digiKam
smugwindow.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 : 2005-17-06
7  * Description : a tool to export images to Smugmug web service
8  *
9  * Copyright (C) 2005-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) 2008-2009 by Luka Renko <lure at kubuntu dot org>
12  * Copyright (C) 2018 by Thanh Trung Dinh <dinhthanhtrung1996 at gmail dot com>
13  *
14  * This program is free software; you can redistribute it
15  * and/or modify it under the terms of the GNU General
16  * Public License as published by the Free Software Foundation;
17  * either version 2, or (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef DIGIKAM_SMUG_WINDOW_H
27 #define DIGIKAM_SMUG_WINDOW_H
28 
29 // Qt includes
30 
31 #include <QList>
32 #include <QUrl>
33 #include <QCloseEvent>
34 
35 // Local includes
36 
37 #include "wstooldialog.h"
38 #include "wslogindialog.h"
39 #include "smugitem.h"
40 #include "dinfointerface.h"
41 
42 using namespace Digikam;
43 
45 {
46 
47 class SmugWindow : public WSToolDialog
48 {
49  Q_OBJECT
50 
51 public:
52 
53  explicit SmugWindow(DInfoInterface* const iface,
54  QWidget* const parent,
55  bool import = false,
56  const QString& nickName = QString());
57  ~SmugWindow() override;
58 
63  void reactivate();
64 
65 Q_SIGNALS:
66 
67  void updateHostApp(const QUrl& url);
68 
69 protected:
70 
71  void closeEvent(QCloseEvent*) override;
72 
73 private Q_SLOTS:
74 
75  void slotBusy(bool val);
76  void slotLoginProgress(int step, int maxStep, const QString& label);
77  void slotLoginDone(int errCode, const QString& errMsg);
78  void slotAddPhotoDone(int errCode, const QString& errMsg);
79 
80  void slotGetPhotoDone(int errCode,
81  const QString& errMsg,
82  const QByteArray& photoData);
83 
84  void slotCreateAlbumDone(int errCode,
85  const QString& errMsg,
86  qint64 newAlbumID,
87  const QString& newAlbumKey);
88 
89  void slotListAlbumsDone(int errCode,
90  const QString& errMsg,
91  const QList <SmugAlbum>& albumsList);
92 
93  void slotListPhotosDone(int errCode,
94  const QString& errMsg,
95  const QList <SmugPhoto>& photosList);
96 
97  void slotListAlbumTmplDone(int errCode,
98  const QString& errMsg,
99  const QList <SmugAlbumTmpl>& albumTList);
100 
101 /* Categories now are deprecated in API v2
102 
103  void slotListCategoriesDone(int errCode,
104  const QString& errMsg,
105  const QList <SmugCategory>& categoriesList);
106 
107  void slotListSubCategoriesDone(int errCode,
108  const QString& errMsg,
109  const QList <SmugCategory>& categoriesList);
110 */
111 
112  void slotUserChangeRequest(bool anonymous);
113  void slotReloadAlbumsRequest();
114  void slotNewAlbumRequest();
115 
116  void slotStartTransfer();
117  void slotCancelClicked();
118  void slotStopAndCloseProgressBar();
119  void slotDialogFinished();
120 
121  void slotImageListChanged();
122 
123  void slotTemplateSelectionChanged(int index);
124 
125 /* Categories now are deprecated in API v2
126 
127  void slotCategorySelectionChanged(int index);
128 */
129 
130 private:
131 
132  bool prepareImageForUpload(const QString& imgPath) const;
133  void uploadNextPhoto();
134  void downloadNextPhoto();
135 
136  void readSettings();
137  void writeSettings();
138 
139  void authenticate();
140 
141  void buttonStateChange(bool state);
142  void setUiInProgressState(bool inProgress);
143 
144 private:
145 
146  class Private;
147  Private* const d;
148 };
149 
150 } // namespace Digikam
151 
152 #endif // DIGIKAM_SMUG_WINDOW_H
Definition: smugwindow.h:48
void updateHostApp(const QUrl &url)
Definition: dinfointerface.h:56
Definition: wstooldialog.h:43
Definition: piwigotalker.h:48
Definition: smugitem.h:33
Definition: datefolderview.cpp:43