1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date        : 2018-05-20
7  * Description : a tool to export images to Onedrive web service
8  *
9  * Copyright (C) 2018      by Tarek Talaat <tarektalaat93 at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * ============================================================ */
22 
23 #ifndef DIGIKAM_OD_WINDOW_H
24 #define DIGIKAM_OD_WINDOW_H
25 
26 // Qt includes
27 
28 #include <QList>
29 #include <QUrl>
30 #include <QPair>
31 
32 // Local includes
33 
34 #include "wstooldialog.h"
35 #include "dinfointerface.h"
36 
37 class QCloseEvent;
38 class QUrl;
39 
40 using namespace Digikam;
41 
42 namespace DigikamGenericOneDrivePlugin
43 {
44 
45 class ODWindow : public WSToolDialog
46 {
47     Q_OBJECT
48 
49 public:
50 
51     explicit ODWindow(DInfoInterface* const iface, QWidget* const parent);
52     ~ODWindow() override;
53 
54     void reactivate();
55 
56     void setItemsList(const QList<QUrl>& urls);
57 
58 private:
59 
60     void readSettings();
61     void writeSettings();
62 
63     void uploadNextPhoto();
64 
65     void buttonStateChange(bool state);
66     void closeEvent(QCloseEvent*) override;
67 
68 private Q_SLOTS:
69 
70     void slotImageListChanged();
71     void slotUserChangeRequest();
72     void slotNewAlbumRequest();
73     void slotReloadAlbumsRequest();
74     void slotStartTransfer();
75 
76     void slotBusy(bool);
77     void slotSignalLinkingFailed();
78     void slotSignalLinkingSucceeded();
79     void slotSetUserName(const QString& msg);
80     void slotListAlbumsFailed(const QString& msg);
81     void slotListAlbumsDone(const QList<QPair<QString, QString> >& list);
82     void slotCreateFolderFailed(const QString& msg);
83     void slotCreateFolderSucceeded();
84     void slotAddPhotoFailed(const QString& msg);
85     void slotAddPhotoSucceeded();
86     void slotTransferCancel();
87 
88     void slotFinished();
89 
90 private:
91 
92     class Private;
93     Private* const d;
94 };
95 
96 } // namespace DigikamGenericOneDrivePlugin
97 
98 #endif // DIGIKAM_OD_WINDOW_H
99