File indexing completed on 2025-01-05 03:53:30

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: 2015      by Shourya Singh Gupta <shouryasgupta at gmail dot com>
0011  * SPDX-FileCopyrightText: 2013-2020 by Caulier Gilles <caulier dot gilles at gmail dot com>
0012  *
0013  * SPDX-License-Identifier: GPL-2.0-or-later
0014  *
0015  * ============================================================ */
0016 
0017 #ifndef DIGIKAM_GS_WINDOW_H
0018 #define DIGIKAM_GS_WINDOW_H
0019 
0020 // Qt includes
0021 
0022 #include <QList>
0023 #include <QPair>
0024 #include <QUrl>
0025 #include <QPointer>
0026 
0027 // Local includes
0028 
0029 #include "wstooldialog.h"
0030 #include "gsitem.h"
0031 #include "dinfointerface.h"
0032 #include "dmetadata.h"
0033 
0034 class QCloseEvent;
0035 
0036 using namespace Digikam;
0037 
0038 namespace DigikamGenericGoogleServicesPlugin
0039 {
0040 class GDTalker;
0041 class GPTalker;
0042 class GSWidget;
0043 class GSPhoto;
0044 class GSFolder;
0045 class GSNewAlbumDlg;
0046 
0047 class GSWindow : public WSToolDialog
0048 {
0049     Q_OBJECT
0050 
0051 public:
0052 
0053     explicit GSWindow(DInfoInterface* const iface,
0054                       QWidget* const parent,
0055                       const QString& serviceName);
0056     ~GSWindow() override;
0057 
0058     void reactivate();
0059 
0060 Q_SIGNALS:
0061 
0062     void updateHostApp(const QUrl& url);
0063 
0064 private:
0065 
0066     void readSettings();
0067     void writeSettings();
0068 
0069     void uploadNextPhoto();
0070     void downloadNextPhoto();
0071 
0072     void buttonStateChange(bool state);
0073     void closeEvent(QCloseEvent*) override;
0074 
0075 private Q_SLOTS:
0076 
0077     void slotImageListChanged();
0078     void slotUserChangeRequest();
0079     void slotNewAlbumRequest();
0080     void slotReloadAlbumsRequest();
0081     void slotStartTransfer();
0082     void slotFinished();
0083 
0084     void slotBusy(bool);
0085     void slotAccessTokenObtained();
0086     void slotAuthenticationRefused();
0087     void slotSetUserName(const QString& msg);
0088     void slotListAlbumsDone(int, const QString&,
0089                             const QList <GSFolder>&);
0090     void slotListPhotosDoneForDownload(int errCode,
0091                                        const QString& errMsg,
0092                                        const QList <GSPhoto>& photosList);
0093     void slotCreateFolderDone(int,
0094                               const QString& msg,
0095                               const QString& = QLatin1String("-1"));
0096     void slotAddPhotoDone(int,
0097                           const QString& msg);
0098     void slotUploadPhotoDone(int,
0099                              const QString& msg,
0100                              const QStringList&);
0101     void slotGetPhotoDone(int errCode,
0102                           const QString& errMsg,
0103                           const QByteArray& photoData,
0104                           const QString& fileName);
0105     void slotTransferCancel();
0106 
0107 private:
0108 
0109     class Private;
0110     Private* const d;
0111 };
0112 
0113 } // namespace DigikamGenericGoogleServicesPlugin
0114 
0115 #endif // DIGIKAM_GS_WINDOW_H