2012-11-29 18:19:41 +01:00
|
|
|
#ifndef DROPBOXSERVICE_H
|
|
|
|
#define DROPBOXSERVICE_H
|
|
|
|
|
|
|
|
#include "internet/cloudfileservice.h"
|
|
|
|
|
|
|
|
#include "core/tagreaderclient.h"
|
|
|
|
|
|
|
|
class DropboxAuthenticator;
|
2012-11-29 18:43:56 +01:00
|
|
|
class NetworkAccessManager;
|
|
|
|
class QNetworkReply;
|
2012-11-29 18:19:41 +01:00
|
|
|
|
|
|
|
class DropboxService : public CloudFileService {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
DropboxService(Application* app, InternetModel* parent);
|
|
|
|
|
|
|
|
static const char* kServiceName;
|
|
|
|
static const char* kSettingsGroup;
|
|
|
|
|
|
|
|
virtual bool has_credentials() const;
|
|
|
|
|
2012-11-29 20:18:08 +01:00
|
|
|
QUrl GetStreamingUrlFromSongId(const QUrl& url);
|
|
|
|
|
2012-11-29 18:19:41 +01:00
|
|
|
signals:
|
|
|
|
void Connected();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void Connect();
|
2012-11-29 18:43:56 +01:00
|
|
|
void AuthenticationFinished(DropboxAuthenticator* authenticator);
|
2012-11-29 18:19:41 +01:00
|
|
|
|
|
|
|
private slots:
|
2012-11-29 18:43:56 +01:00
|
|
|
void RequestFileListFinished(QNetworkReply* reply);
|
2012-11-29 20:18:08 +01:00
|
|
|
void FetchContentUrlFinished(QNetworkReply* reply, const QVariantMap& file);
|
2013-12-19 14:56:46 +01:00
|
|
|
void LongPollFinished(QNetworkReply* reply);
|
|
|
|
void LongPollDelta();
|
2012-11-29 18:43:56 +01:00
|
|
|
|
|
|
|
private:
|
2012-11-30 15:33:03 +01:00
|
|
|
void RequestFileList();
|
2012-11-29 18:43:56 +01:00
|
|
|
QByteArray GenerateAuthorisationHeader();
|
2012-11-29 20:18:08 +01:00
|
|
|
QNetworkReply* FetchContentUrl(const QUrl& url);
|
2012-11-29 18:19:41 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
QString access_token_;
|
|
|
|
QString access_token_secret_;
|
2012-11-29 18:43:56 +01:00
|
|
|
|
|
|
|
NetworkAccessManager* network_;
|
2012-11-29 18:19:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // DROPBOXSERVICE_H
|