| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#pragma once |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#include <QUrl> |
| 22 |
#include <QMap> |
| 23 |
#include <QHash> |
| 24 |
#include <QObject> |
| 25 |
#include <QPointer> |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
#include "gsitem.h" |
| 30 |
#include "gstalkerbase.h" |
| 31 |
|
| 32 |
namespace DigikamGenericGoogleServicesPlugin |
| 33 |
{ |
| 34 |
|
| 35 |
class GPTalker : public GSTalkerBase |
| 36 |
{ |
| 37 |
Q_OBJECT |
| 38 |
|
| 39 |
public: |
| 40 |
|
| 41 |
explicit GPTalker(QWidget* const parent); |
| 42 |
~GPTalker() override; |
| 43 |
|
| 44 |
public: |
| 45 |
|
| 46 |
void getLoggedInUser(); |
| 47 |
|
| 48 |
void listAlbums(const QString& nextPageToken = QString()); |
| 49 |
void listPhotos(const QString& albumId, |
| 50 |
const QString& nextPageToken = QString()); |
| 51 |
|
| 52 |
void createAlbum(const GSFolder& newAlbum); |
| 53 |
|
| 54 |
bool addPhoto(const QString& photoPath, |
| 55 |
const GSPhoto& info, |
| 56 |
const QString& albumId, |
| 57 |
bool original, |
| 58 |
bool rescale, |
| 59 |
int maxDim, |
| 60 |
int imageQuality); |
| 61 |
bool updatePhoto(const QString& photoPath, |
| 62 |
GSPhoto& info, |
| 63 |
bool rescale, |
| 64 |
int maxDim, |
| 65 |
int imageQuality); |
| 66 |
|
| 67 |
void getPhoto(const QString& imgPath); |
| 68 |
|
| 69 |
QStringList getUploadTokenList(); |
| 70 |
|
| 71 |
void cancel(); |
| 72 |
|
| 73 |
Q_SIGNALS: |
| 74 |
|
| 75 |
void signalSetUserName(const QString& msg); |
| 76 |
void signalError(const QString& msg); |
| 77 |
void signalListAlbumsDone(int, const QString&, const QList <GSFolder>&); |
| 78 |
void signalListPhotosDone(int, const QString&, const QList <GSPhoto>&); |
| 79 |
void signalCreateAlbumDone(int, const QString&, const QString&); |
| 80 |
void signalAddPhotoDone(int, const QString&); |
| 81 |
void signalUploadPhotoDone(int, const QString&, const QStringList&); |
| 82 |
void signalGetPhotoDone(int errCode, const QString& errMsg, |
| 83 |
const QByteArray& photoData, const QString& fileName); |
| 84 |
void signalReadyToUpload(); |
| 85 |
|
| 86 |
private: |
| 87 |
|
| 88 |
void parseResponseGetLoggedInUser(const QByteArray& data); |
| 89 |
void parseResponseListAlbums(const QByteArray& data); |
| 90 |
void parseResponseListPhotos(const QByteArray& data); |
| 91 |
void parseResponseCreateAlbum(const QByteArray& data); |
| 92 |
void parseResponseAddPhoto(const QByteArray& data); |
| 93 |
void parseResponseUploadPhoto(const QByteArray& data); |
| 94 |
|
| 95 |
private Q_SLOTS: |
| 96 |
|
| 97 |
void slotError(const QString& msg); |
| 98 |
void slotFinished(QNetworkReply* reply); |
| 99 |
void slotUploadPhoto(); |
| 100 |
|
| 101 |
private: |
| 102 |
|
| 103 |
class Private; |
| 104 |
Private* const d = nullptr; |
| 105 |
}; |
| 106 |
|
| 107 |
} |