digiKam
boxtalker.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 : 2018-05-20
7  * Description : a tool to export images to Box 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_BOX_TALKER_H
24 #define DIGIKAM_BOX_TALKER_H
25 
26 // Qt includes
27 
28 #include <QList>
29 #include <QPair>
30 #include <QString>
31 #include <QNetworkReply>
32 
33 // Local includes
34 
35 #include "boxitem.h"
36 #include "o2.h"
37 #include "o0globals.h"
38 #include "dmetadata.h"
39 
40 using namespace Digikam;
41 
43 {
44 
45 class BOXTalker : public QObject
46 {
47  Q_OBJECT
48 
49 public:
50 
51  explicit BOXTalker(QWidget* const parent);
52  ~BOXTalker() override;
53 
54 public:
55 
56  void link();
57  void unLink();
58  void getUserName();
59  bool authenticated();
60  void cancel();
61  bool addPhoto(const QString& imgPath, const QString& uploadFolder, bool rescale, int maxDim, int imageQuality);
62  void listFolders(const QString& path = QString());
63  void createFolder(QString& path);
64  void setAccessToken(const QString& token);
65  QMap<QString, QString> ParseUrlParameters(const QString& url);
66 
67 Q_SIGNALS:
68 
69  void signalBusy(bool val);
72  void signalSetUserName(const QString& msg);
73  void signalListAlbumsFailed(const QString& msg);
74  void signalListAlbumsDone(const QList<QPair<QString, QString> >& list);
75  void signalCreateFolderFailed(const QString& msg);
77  void signalAddPhotoFailed(const QString& msg);
81 
82 private Q_SLOTS:
83 
84  void slotLinkingFailed();
85  void slotLinkingSucceeded();
86  void slotFinished(QNetworkReply* reply);
87  void slotOpenBrowser(const QUrl& url);
88 
89 private:
90 
91  void parseResponseUserName(const QByteArray& data);
92  void parseResponseListFolders(const QByteArray& data);
93 /*
94  QList<QPair<QString, QString> > parseListFoldersRequest(const QByteArray& data);
95 */
96  void parseResponseCreateFolder(const QByteArray& data);
97  void parseResponseAddPhoto(const QByteArray& data);
98 
99 private:
100 
101  class Private;
102  Private* const d;
103 };
104 
105 } // namespace DigikamGenericBoxPlugin
106 
107 #endif // DIGIKAM_BOX_TALKER_H
Definition: boxtalker.h:46
QMap< QString, QString > ParseUrlParameters(const QString &url)
void signalAddPhotoFailed(const QString &msg)
void signalListAlbumsDone(const QList< QPair< QString, QString > > &list)
void setAccessToken(const QString &token)
void signalListAlbumsFailed(const QString &msg)
void signalCreateFolderFailed(const QString &msg)
void signalSetUserName(const QString &msg)
Definition: piwigotalker.h:48
Definition: boxitem.h:31
Definition: datefolderview.cpp:43