-
Notifications
You must be signed in to change notification settings - Fork 1
/
servercomm.h
51 lines (45 loc) · 1.27 KB
/
servercomm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef SERVERCOMM_H
#define SERVERCOMM_H
#include <QObject>
#include <QString>
#include <QMediaPlayer>
class QNetworkAccessManager;
class QNetworkReply;
class QMediaPlaylist;
class QTimer;
#define SONGS_POLL_TIME 10000
#define CHANNEL_REFRESH_URL "http://somafm.com/refresh.xml"
class ServerComm : public QObject
{
Q_OBJECT
public:
explicit ServerComm(QObject *parent = 0);
private:
QNetworkAccessManager *playlistNetworkReader;
QNetworkAccessManager *channelInfoReader;
QMediaPlayer *player;
QMediaPlaylist *mediaplaylist;
QTimer *nowPlayingSongTimer;
signals:
void channelLoading();
void channelLoaded();
void positionUpdate(QString minutes, QString seconds);
void updateSong();
void channelSongUpdate(QString song);
void songPlaying();
void songPaused();
public slots:
void play();
void pause();
void loadChannel(QString channelUrl);
void updateChannelInfo(QString channelName);
private slots:
void updateProgress(qint64 time);
protected slots:
void finishLoadingChannel(QNetworkReply *reply);
void finishReadingChannelInfo(QNetworkReply *reply);
void setMediaStatus(QMediaPlayer::MediaStatus state);
void checkSongUpdates();
void playerState(QMediaPlayer::State state);
};
#endif // SERVERCOMM_H