File indexing completed on 2025-01-19 03:52:59

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2013-11-18
0007  * Description : a tool to export items to Google web services
0008  *
0009  * SPDX-FileCopyrightText: 2013      by Pankaj Kumar <me at panks dot me>
0010  * SPDX-FileCopyrightText: 2013-2020 by Caulier Gilles <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_GD_TALKER_H
0017 #define DIGIKAM_GD_TALKER_H
0018 
0019 // Qt includes
0020 
0021 #include <QList>
0022 #include <QString>
0023 #include <QObject>
0024 #include <QStringList>
0025 
0026 // Local includes
0027 
0028 #include "gsitem.h"
0029 #include "gstalkerbase.h"
0030 
0031 namespace DigikamGenericGoogleServicesPlugin
0032 {
0033 
0034 class GDTalker : public GSTalkerBase
0035 {
0036     Q_OBJECT
0037 
0038 public:
0039 
0040     explicit GDTalker(QWidget* const parent);
0041     ~GDTalker() override;
0042 
0043 public:
0044 
0045     void getUserName();
0046     void listFolders();
0047     void createFolder(const QString& title, const QString& id);
0048     bool addPhoto(const QString& imgPath,
0049                   const GSPhoto& info,
0050                   const QString& id,
0051                   bool original,
0052                   bool rescale,
0053                   int maxDim,
0054                   int imageQuality);
0055     void cancel();
0056 
0057 Q_SIGNALS:
0058 
0059     void signalListAlbumsDone(int, const QString&, const QList <GSFolder>&);
0060     void signalCreateFolderDone(int,const QString& msg);
0061     void signalSetUserName(const QString& msg);
0062     void signalAddPhotoDone(int,const QString& msg);
0063     void signalReadyToUpload();
0064     void signalUploadPhotoDone(int, const QString&, const QStringList&);
0065 
0066 private Q_SLOTS:
0067 
0068     void slotFinished(QNetworkReply* reply);
0069     void slotUploadPhoto();
0070 
0071 private:
0072 
0073     void parseResponseListFolders(const QByteArray& data);
0074     void parseResponseCreateFolder(const QByteArray& data);
0075     void parseResponseAddPhoto(const QByteArray& data);
0076     void parseResponseUserName(const QByteArray& data);
0077 
0078 private:
0079 
0080     class Private;
0081     Private* const d;
0082 };
0083 
0084 } // namespace DigikamGenericGoogleServicesPlugin
0085 
0086 #endif // DIGIKAM_GD_TALKER_H