2012-07-12 14:09:20 +02:00
|
|
|
#ifndef GOOGLEDRIVESERVICE_H
|
|
|
|
#define GOOGLEDRIVESERVICE_H
|
|
|
|
|
2012-11-28 16:21:14 +01:00
|
|
|
#include "cloudfileservice.h"
|
2012-07-12 14:09:20 +02:00
|
|
|
|
2012-07-28 18:18:03 +02:00
|
|
|
namespace google_drive {
|
2014-02-07 16:34:20 +01:00
|
|
|
class Client;
|
|
|
|
class ConnectResponse;
|
|
|
|
class File;
|
|
|
|
class ListFilesResponse;
|
|
|
|
class ListChangesResponse;
|
2012-07-28 18:18:03 +02:00
|
|
|
}
|
|
|
|
|
2012-11-28 16:21:14 +01:00
|
|
|
class GoogleDriveService : public CloudFileService {
|
2012-07-12 14:09:20 +02:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
GoogleDriveService(Application* app, InternetModel* parent);
|
|
|
|
|
2012-07-29 16:06:23 +02:00
|
|
|
static const char* kServiceName;
|
|
|
|
static const char* kSettingsGroup;
|
|
|
|
|
2012-11-28 16:21:14 +01:00
|
|
|
virtual bool has_credentials() const;
|
|
|
|
virtual void ShowContextMenu(const QPoint& global_pos);
|
|
|
|
|
2012-07-29 16:06:23 +02:00
|
|
|
google_drive::Client* client() const { return client_; }
|
2012-08-24 22:26:10 +02:00
|
|
|
QString refresh_token() const;
|
2012-07-29 16:06:23 +02:00
|
|
|
|
2012-07-26 16:35:57 +02:00
|
|
|
QUrl GetStreamingUrlFromSongId(const QString& file_id);
|
|
|
|
|
2012-08-17 22:48:45 +02:00
|
|
|
public slots:
|
|
|
|
void Connect();
|
|
|
|
void ForgetCredentials();
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
signals:
|
2012-08-17 22:48:45 +02:00
|
|
|
void Connected();
|
|
|
|
|
2012-07-12 14:09:20 +02:00
|
|
|
private slots:
|
2012-07-28 18:18:03 +02:00
|
|
|
void ConnectFinished(google_drive::ConnectResponse* response);
|
|
|
|
void FilesFound(const QList<google_drive::File>& files);
|
2012-12-05 12:57:10 +01:00
|
|
|
void FilesDeleted(const QList<QUrl>& files);
|
|
|
|
void ListChangesFinished(google_drive::ListChangesResponse* response);
|
2014-03-30 07:01:58 +02:00
|
|
|
void SaveCursor(const QString& cursor);
|
2012-07-12 14:09:20 +02:00
|
|
|
|
2012-08-24 20:33:05 +02:00
|
|
|
void OpenWithDrive();
|
2014-06-05 12:16:16 +02:00
|
|
|
void ConfirmFullRescan();
|
|
|
|
void DoFullRescan();
|
|
|
|
void CheckForUpdates();
|
2012-08-24 20:33:05 +02:00
|
|
|
|
2012-07-12 14:09:20 +02:00
|
|
|
private:
|
2012-08-10 20:46:26 +02:00
|
|
|
void EnsureConnected();
|
2012-07-26 16:55:59 +02:00
|
|
|
void RefreshAuthorisation(const QString& refresh_token);
|
2012-12-05 12:57:10 +01:00
|
|
|
void ListChanges(const QString& cursor);
|
2012-07-12 14:09:20 +02:00
|
|
|
|
2012-07-28 18:18:03 +02:00
|
|
|
google_drive::Client* client_;
|
2012-07-12 14:09:20 +02:00
|
|
|
|
2012-08-24 20:33:05 +02:00
|
|
|
QAction* open_in_drive_action_;
|
2014-06-05 12:16:16 +02:00
|
|
|
QAction* update_action_;
|
|
|
|
QAction* full_rescan_action_;
|
2012-07-12 14:09:20 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|