Clementine-audio-player-Mac.../src/internet/googledriveservice.h

65 lines
1.5 KiB
C
Raw Normal View History

#ifndef GOOGLEDRIVESERVICE_H
#define GOOGLEDRIVESERVICE_H
#include "cloudfileservice.h"
#include "core/tagreaderclient.h"
namespace google_drive {
class Client;
class ConnectResponse;
class File;
class ListFilesResponse;
}
class GoogleDriveService : public CloudFileService {
Q_OBJECT
public:
GoogleDriveService(Application* app, InternetModel* parent);
static const char* kServiceName;
static const char* kSettingsGroup;
virtual bool has_credentials() const;
virtual void ShowContextMenu(const QPoint& global_pos);
google_drive::Client* client() const { return client_; }
QString refresh_token() const;
QUrl GetStreamingUrlFromSongId(const QString& file_id);
public slots:
void Connect();
void ForgetCredentials();
signals:
void Connected();
private slots:
void ConnectFinished(google_drive::ConnectResponse* response);
void FilesFound(const QList<google_drive::File>& files);
void ListFilesFinished(google_drive::ListFilesResponse* response);
void ReadTagsFinished(TagReaderClient::ReplyType* reply,
const google_drive::File& metadata,
const QString& url,
const int task_id);
void OpenWithDrive();
private:
void EnsureConnected();
void RefreshAuthorisation(const QString& refresh_token);
void MaybeAddFileToDatabase(const google_drive::File& file);
void ListFilesForMimeType(const QString& mime_type);
google_drive::Client* client_;
TaskManager* task_manager_;
int indexing_task_id_;
QAction* open_in_drive_action_;
};
#endif