servercomm.h 1.25 KB
Newer Older
1 2 3 4 5
#ifndef SERVERCOMM_H
#define SERVERCOMM_H

#include <QObject>
#include <QString>
6
#include <QSettings>
7
#include <QtXml/QDomDocument>
8
#include <QtNetwork/QNetworkAccessManager>
9
#include <QList>
10
#include <phonon/MediaObject>
11
#include "track.h"
12 13 14 15 16 17 18 19 20 21 22 23 24 25

class ServerComm : public QObject
{
    Q_OBJECT
public:
    explicit ServerComm(QObject *parent = 0);

private:
    QString ws_sk;
    QString scrobble_sk;
    QString np_url;
    QString scr_url;
    QString hs_url;
    QString ws_url;
26
    int currentSong;
27
    QSettings *settings;
28
    QList<Track> *playlist;
29
    Phonon::MediaObject *media;
30
    void parseTrack(QDomNode trackNode);
31 32 33 34

signals:
    void loginFailed();
    void loginSuccessful();
35
    void tuned(QString stationName);
36
    void playing(QString artist, QString album, QString title, QString imageurl);
37

38
private slots:
39 40
    void wsLoginReply(QNetworkReply *reply);
    void scrobbleLoginReply(QNetworkReply *reply);
41
    void tuneReply(QNetworkReply *reply);
42 43 44 45 46 47
    void playlistReply(QNetworkReply *reply);

public slots:
    void login(const QString &username, const QString &password);
    void tuneStation(const QString &station);
    void getPlaylist();
48 49 50
    void loadSong(int song);
    void play();
    void pause();
51 52
    void next();
    void prev();
53

54 55 56
};

#endif // SERVERCOMM_H