aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/General/scrobbler/lastfmscrobbler.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/General/scrobbler/lastfmscrobbler.h')
-rw-r--r--src/plugins/General/scrobbler/lastfmscrobbler.h40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/plugins/General/scrobbler/lastfmscrobbler.h b/src/plugins/General/scrobbler/lastfmscrobbler.h
index 313661e8b..d6e97c8c0 100644
--- a/src/plugins/General/scrobbler/lastfmscrobbler.h
+++ b/src/plugins/General/scrobbler/lastfmscrobbler.h
@@ -27,14 +27,17 @@
class QNetworkAccessManager;
class QNetworkReply;
+class QIODevice;
class QTime;
class SoundCore;
+
/**
@author Ilya Kotov <forkotov02@hotmail.ru>
*/
-struct LastfmResponse
+class LastfmResponse
{
+public:
QString status;
QString token;
QString code;
@@ -42,6 +45,8 @@ struct LastfmResponse
QString key;
QString name;
QString subscriber;
+
+ void parse(QIODevice *device);
};
/**
@@ -82,4 +87,37 @@ private:
ScrobblerCache *m_cache;
};
+/**
+ @author Ilya Kotov <forkotov02@hotmail.ru>
+*/
+class LastfmAuth : public QObject
+{
+ Q_OBJECT
+public:
+ explicit LastfmAuth(QObject *parent = 0);
+ void getToken();
+ void getSession();
+ QString session() const;
+
+ enum ErrorType
+ {
+ NO_ERROR = 0,
+ NETWORK_ERROR,
+ LASTFM_ERROR
+ };
+
+signals:
+ void tokenRequestFinished(int error);
+ void sessionRequestFinished(int error);
+
+private slots:
+ void processResponse(QNetworkReply *reply);
+
+private:
+ QString m_token, m_session;
+ QByteArray m_ua;
+ QNetworkAccessManager *m_http;
+ QNetworkReply *m_getTokenReply, *m_getSessionReply;
+};
+
#endif