digiKam
gptalker.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2007-16-07
7  * Description : a tool to export items to Google web services
8  *
9  * Copyright (C) 2007-2008 by Vardhman Jain <vardhman at gmail dot com>
10  * Copyright (C) 2008-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  * Copyright (C) 2018 by Thanh Trung Dinh <dinhthanhtrung1996 at gmail dot com>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_GP_TALKER_H
26 #define DIGIKAM_GP_TALKER_H
27 
28 // Qt includes
29 
30 #include <QUrl>
31 #include <QMap>
32 #include <QHash>
33 #include <QObject>
34 #include <QPointer>
35 
36 // Local includes
37 
38 #include "gsitem.h"
39 #include "gstalkerbase.h"
40 
42 {
43 
44 class GPTalker : public GSTalkerBase
45 {
46  Q_OBJECT
47 
48 public:
49 
50  explicit GPTalker(QWidget* const parent);
51  ~GPTalker() override;
52 
53 public:
54 
55  void getLoggedInUser();
56 
57  void listAlbums(const QString& nextPageToken = QString());
58  void listPhotos(const QString& albumId,
59  const QString& nextPageToken = QString());
60 
61  void createAlbum(const GSFolder& newAlbum);
62 
63  bool addPhoto(const QString& photoPath,
64  GSPhoto& info,
65  const QString& albumId,
66  bool original,
67  bool rescale,
68  int maxDim,
69  int imageQuality);
70  bool updatePhoto(const QString& photoPath,
71  GSPhoto& info,
72  bool rescale,
73  int maxDim,
74  int imageQuality);
75 
76  void getPhoto(const QString& imgPath);
77 
78  QStringList getUploadTokenList();
79 
80  void cancel();
81 
82 Q_SIGNALS:
83 
84  void signalSetUserName(const QString& msg);
85  void signalError(const QString& msg);
86  void signalListAlbumsDone(int, const QString&, const QList <GSFolder>&);
87  void signalListPhotosDone(int, const QString&, const QList <GSPhoto>&);
88  void signalCreateAlbumDone(int, const QString&, const QString&);
89  void signalAddPhotoDone(int, const QString&);
90  void signalUploadPhotoDone(int, const QString&, const QStringList&);
91  void signalGetPhotoDone(int errCode, const QString& errMsg,
92  const QByteArray& photoData, const QString& fileName);
94 
95 private:
96 
97  void parseResponseGetLoggedInUser(const QByteArray& data);
98  void parseResponseListAlbums(const QByteArray& data);
99  void parseResponseListPhotos(const QByteArray& data);
100  void parseResponseCreateAlbum(const QByteArray& data);
101  void parseResponseAddPhoto(const QByteArray& data);
102  void parseResponseUploadPhoto(const QByteArray& data);
103 
104 private Q_SLOTS:
105 
106  void slotError(const QString& msg);
107  void slotFinished(QNetworkReply* reply);
108  void slotUploadPhoto();
109 
110 private:
111 
112  class Private;
113  Private* const d;
114 };
115 
116 } // namespace DigikamGenericGoogleServicesPlugin
117 
118 #endif // DIGIKAM_GP_TALKER_H
void getPhoto(const QString &imgPath)
Definition: gptalker.cpp:474
QStringList getUploadTokenList()
Definition: gptalker.cpp:170
void signalUploadPhotoDone(int, const QString &, const QStringList &)
void listPhotos(const QString &albumId, const QString &nextPageToken=QString())
Definition: gptalker.cpp:249
void signalListAlbumsDone(int, const QString &, const QList< GSFolder > &)
void signalSetUserName(const QString &msg)
bool addPhoto(const QString &photoPath, GSPhoto &info, const QString &albumId, bool original, bool rescale, int maxDim, int imageQuality)
Definition: gptalker.cpp:323
void getLoggedInUser()
Definition: gptalker.cpp:224
void signalCreateAlbumDone(int, const QString &, const QString &)
~GPTalker() override
Definition: gptalker.cpp:157
void signalAddPhotoDone(int, const QString &)
void listAlbums(const QString &nextPageToken=QString())
Definition: gptalker.cpp:183
bool updatePhoto(const QString &photoPath, GSPhoto &info, bool rescale, int maxDim, int imageQuality)
Definition: gptalker.cpp:410
void signalListPhotosDone(int, const QString &, const QList< GSPhoto > &)
void createAlbum(const GSFolder &newAlbum)
Definition: gptalker.cpp:291
void signalGetPhotoDone(int errCode, const QString &errMsg, const QByteArray &photoData, const QString &fileName)
void cancel()
Definition: gptalker.cpp:493
GPTalker(QWidget *const parent)
Definition: gptalker.cpp:131
Definition: piwigotalker.h:48
Definition: gdmpform.cpp:46