digiKam
dbtalker.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 : 2013-11-18
7  * Description : a tool to export images to Dropbox web service
8  *
9  * Copyright (C) 2013 by Pankaj Kumar <me at panks dot me>
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_DB_TALKER_H
24 #define DIGIKAM_DB_TALKER_H
25 
26 // Qt includes
27 
28 #include <QList>
29 #include <QPair>
30 #include <QString>
31 #include <QNetworkReply>
32 
34 {
35 
36 class DBTalker : public QObject
37 {
38  Q_OBJECT
39 
40 public:
41 
42  explicit DBTalker(QWidget* const parent);
43  ~DBTalker() override;
44 
45 public:
46 
47  void link();
48  void unLink();
49  bool authenticated();
50  void reauthenticate();
51  void getUserName();
52  void cancel();
53  void listFolders(const QString& cursor = QString());
54  bool addPhoto(const QString& imgPath, const QString& uploadFolder,
55  bool original, bool rescale, int maxDim, int imageQuality);
56  void createFolder(const QString& path);
57 
58 Q_SIGNALS:
59 
60  void signalBusy(bool val);
63  void signalSetUserName(const QString& msg);
64  void signalListAlbumsFailed(const QString& msg);
65  void signalListAlbumsDone(const QList<QPair<QString, QString> >& list);
66  void signalCreateFolderFailed(const QString& msg);
68  void signalAddPhotoFailed(const QString& msg);
70 
71 private Q_SLOTS:
72 
73  void slotLinkingFailed();
74  void slotLinkingSucceeded();
75  void slotOpenBrowser(const QUrl& url);
76  void slotFinished(QNetworkReply* reply);
77 
78 private:
79 
80  void parseResponseUserName(const QByteArray& data);
81  void parseResponseListFolders(const QByteArray& data);
82  void parseResponseCreateFolder(const QByteArray& data);
83  void parseResponseAddPhoto(const QByteArray& data);
84 
85 private:
86 
87  class Private;
88  Private* const d;
89 };
90 
91 } // namespace DigikamGenericDropBoxPlugin
92 
93 #endif // DIGIKAM_DB_TALKER_H
Definition: dbtalker.h:37
bool addPhoto(const QString &imgPath, const QString &uploadFolder, bool original, bool rescale, int maxDim, int imageQuality)
Definition: dbtalker.cpp:281
void signalSetUserName(const QString &msg)
DBTalker(QWidget *const parent)
Definition: dbtalker.cpp:118
void cancel()
Definition: dbtalker.cpp:356
void listFolders(const QString &cursor=QString())
Definition: dbtalker.cpp:255
bool authenticated()
Definition: dbtalker.cpp:212
void createFolder(const QString &path)
Definition: dbtalker.cpp:219
void link()
Definition: dbtalker.cpp:162
void reauthenticate()
Definition: dbtalker.cpp:177
void signalCreateFolderFailed(const QString &msg)
void getUserName()
Definition: dbtalker.cpp:240
void unLink()
Definition: dbtalker.cpp:168
~DBTalker() override
Definition: dbtalker.cpp:150
void signalListAlbumsDone(const QList< QPair< QString, QString > > &list)
void signalListAlbumsFailed(const QString &msg)
void signalAddPhotoFailed(const QString &msg)
Definition: piwigotalker.h:48
Definition: dbitem.h:32