1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date        : 2013-11-18
7  * Description : a tool to export items to Google web services
8  *
9  * Copyright (C) 2013      by Pankaj Kumar <me at panks dot me>
10  * Copyright (C) 2015      by Shourya Singh Gupta <shouryasgupta at gmail dot com>
11  * Copyright (C) 2013-2020 by Caulier Gilles <caulier dot gilles 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_GS_WINDOW_H
26 #define DIGIKAM_GS_WINDOW_H
27 
28 // Qt includes
29 
30 #include <QList>
31 #include <QPair>
32 #include <QUrl>
33 #include <QPointer>
34 
35 // Local includes
36 
37 #include "wstooldialog.h"
38 #include "gsitem.h"
39 #include "dinfointerface.h"
40 #include "dmetadata.h"
41 
42 class QCloseEvent;
43 
44 using namespace Digikam;
45 
46 namespace DigikamGenericGoogleServicesPlugin
47 {
48 class GDTalker;
49 class GPTalker;
50 class GSWidget;
51 class GSPhoto;
52 class GSFolder;
53 class GSNewAlbumDlg;
54 
55 class GSWindow : public WSToolDialog
56 {
57     Q_OBJECT
58 
59 public:
60 
61     explicit GSWindow(DInfoInterface* const iface,
62                       QWidget* const parent,
63                       const QString& serviceName);
64     ~GSWindow() override;
65 
66     void reactivate();
67 
68 Q_SIGNALS:
69 
70     void updateHostApp(const QUrl& url);
71 
72 private:
73 
74     void readSettings();
75     void writeSettings();
76 
77     void uploadNextPhoto();
78     void downloadNextPhoto();
79 
80     void buttonStateChange(bool state);
81     void closeEvent(QCloseEvent*) override;
82 
83 private Q_SLOTS:
84 
85     void slotImageListChanged();
86     void slotUserChangeRequest();
87     void slotNewAlbumRequest();
88     void slotReloadAlbumsRequest();
89     void slotStartTransfer();
90     void slotFinished();
91 
92     void slotBusy(bool);
93     void slotAccessTokenObtained();
94     void slotAuthenticationRefused();
95     void slotSetUserName(const QString& msg);
96     void slotListAlbumsDone(int, const QString&,
97                             const QList <GSFolder>&);
98     void slotListPhotosDoneForDownload(int errCode,
99                                        const QString& errMsg,
100                                        const QList <GSPhoto>& photosList);
101     void slotCreateFolderDone(int,
102                               const QString& msg,
103                               const QString& = QLatin1String("-1"));
104     void slotAddPhotoDone(int,
105                           const QString& msg);
106     void slotUploadPhotoDone(int,
107                              const QString& msg,
108                              const QStringList&);
109     void slotGetPhotoDone(int errCode,
110                           const QString& errMsg,
111                           const QByteArray& photoData,
112                           const QString& fileName);
113     void slotTransferCancel();
114 
115 private:
116 
117     class Private;
118     Private* const d;
119 };
120 
121 } // namespace DigikamGenericGoogleServicesPlugin
122 
123 #endif // DIGIKAM_GS_WINDOW_H
124