aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/General/scrobbler/lastfmscrobbler.h
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2013-01-28 16:56:11 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2013-01-28 16:56:11 +0000
commitfe0e51d9b3e6f750b7f0a83900323a654598e6c0 (patch)
treecab605868adec196ccf8868b3f6a081f252f2f27 /src/plugins/General/scrobbler/lastfmscrobbler.h
parent7164404b2e0d428b4f0083255d0ed140740b7146 (diff)
downloadqmmp-fe0e51d9b3e6f750b7f0a83900323a654598e6c0.tar.gz
qmmp-fe0e51d9b3e6f750b7f0a83900323a654598e6c0.tar.bz2
qmmp-fe0e51d9b3e6f750b7f0a83900323a654598e6c0.zip
improved last.fm registration
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@3188 90c681e8-e032-0410-971d-27865f9a5e38
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