2012-07-12 14:09:20 +02:00
|
|
|
#ifndef GOOGLEDRIVESERVICE_H
|
|
|
|
#define GOOGLEDRIVESERVICE_H
|
|
|
|
|
|
|
|
#include "internetservice.h"
|
|
|
|
|
|
|
|
#include "core/network.h"
|
|
|
|
|
|
|
|
class QStandardItem;
|
|
|
|
|
2012-07-27 16:04:12 +02:00
|
|
|
class LibraryBackend;
|
|
|
|
class LibraryModel;
|
2012-07-12 14:09:20 +02:00
|
|
|
class OAuthenticator;
|
2012-07-27 16:04:12 +02:00
|
|
|
class QSortFilterProxyModel;
|
2012-07-12 14:09:20 +02:00
|
|
|
|
|
|
|
class GoogleDriveService : public InternetService {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
GoogleDriveService(Application* app, InternetModel* parent);
|
|
|
|
|
|
|
|
QStandardItem* CreateRootItem();
|
|
|
|
void LazyPopulate(QStandardItem* item);
|
|
|
|
|
2012-07-26 16:35:57 +02:00
|
|
|
QUrl GetStreamingUrlFromSongId(const QString& file_id);
|
|
|
|
|
2012-07-12 14:09:20 +02:00
|
|
|
private slots:
|
|
|
|
void AccessTokenAvailable(const QString& token);
|
2012-07-26 16:55:59 +02:00
|
|
|
void RefreshTokenAvailable(const QString& token);
|
2012-07-12 14:09:20 +02:00
|
|
|
void ListFilesFinished(QNetworkReply* reply);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void Connect();
|
2012-07-26 16:55:59 +02:00
|
|
|
void RefreshAuthorisation(const QString& refresh_token);
|
2012-07-27 16:04:12 +02:00
|
|
|
void MaybeAddFileToDatabase(const QVariantMap& file);
|
2012-07-12 14:09:20 +02:00
|
|
|
|
|
|
|
QStandardItem* root_;
|
|
|
|
OAuthenticator* oauth_;
|
|
|
|
|
|
|
|
QString access_token_;
|
|
|
|
|
|
|
|
NetworkAccessManager network_;
|
2012-07-27 16:04:12 +02:00
|
|
|
|
|
|
|
LibraryBackend* library_backend_;
|
|
|
|
LibraryModel* library_model_;
|
|
|
|
QSortFilterProxyModel* library_sort_model_;
|
|
|
|
|
|
|
|
int indexing_task_id_;
|
2012-07-12 14:09:20 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|