digiKam
odtalker.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 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_TALKER_H
24 #define DIGIKAM_OD_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 "oditem.h"
36 #include "dmetadata.h"
37 
38 using namespace Digikam;
39 
41 {
42 
43 class ODTalker : public QObject
44 {
45  Q_OBJECT
46 
47 public:
48 
49  explicit ODTalker(QWidget* const parent);
50  ~ODTalker() override;
51 
52 public:
53 
54  void link();
55  void unLink();
56  void getUserName();
57  bool authenticated();
58  void cancel();
59  bool addPhoto(const QString& imgPath, const QString& uploadFolder, bool rescale, int maxDim, int imageQuality);
60  void listFolders(const QString& folder = QString());
61  void createFolder(QString& path);
62  void setAccessToken(const QString& token);
63  void readSettings();
64  void writeSettings();
65 
66 Q_SIGNALS:
67 
68  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 slotCatchUrl(const QUrl& url);
87  void slotFinished(QNetworkReply* reply);
88 
89 private:
90 
91  void parseResponseUserName(const QByteArray& data);
92  void parseResponseListFolders(const QByteArray& data);
93  void parseResponseCreateFolder(const QByteArray& data);
94  void parseResponseAddPhoto(const QByteArray& data);
95 
96 private:
97 
98  class Private;
99  Private* const d;
100 };
101 
102 } // namespace DigikamGenericOneDrivePlugin
103 
104 #endif // DIGIKAM_OD_TALKER_H
void signalAddPhotoFailed(const QString &msg)
void setAccessToken(const QString &token)
void signalSetUserName(const QString &msg)
void signalListAlbumsDone(const QList< QPair< QString, QString > > &list)
void signalCreateFolderFailed(const QString &msg)
void signalListAlbumsFailed(const QString &msg)
Definition: piwigotalker.h:48
Definition: oditem.h:31
Definition: datefolderview.cpp:43