File indexing completed on 2025-01-05 03:53:23
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2018-05-20 0007 * Description : a tool to export images to Box web service 0008 * 0009 * SPDX-FileCopyrightText: 2018 by Tarek Talaat <tarektalaat93 at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #ifndef DIGIKAM_BOX_TALKER_H 0016 #define DIGIKAM_BOX_TALKER_H 0017 0018 // Qt includes 0019 0020 #include <QList> 0021 #include <QPair> 0022 #include <QString> 0023 #include <QNetworkReply> 0024 0025 // Local includes 0026 0027 #include "boxitem.h" 0028 #include "o2.h" 0029 #include "o0globals.h" 0030 #include "dmetadata.h" 0031 0032 using namespace Digikam; 0033 0034 namespace DigikamGenericBoxPlugin 0035 { 0036 0037 class BOXTalker : public QObject 0038 { 0039 Q_OBJECT 0040 0041 public: 0042 0043 explicit BOXTalker(QWidget* const parent); 0044 ~BOXTalker() override; 0045 0046 public: 0047 0048 void link(); 0049 void unLink(); 0050 void getUserName(); 0051 bool authenticated(); 0052 void cancel(); 0053 bool addPhoto(const QString& imgPath, const QString& uploadFolder, bool rescale, int maxDim, int imageQuality); 0054 void listFolders(const QString& path = QString()); 0055 void createFolder(const QString& path); 0056 void setAccessToken(const QString& token); 0057 QMap<QString, QString> ParseUrlParameters(const QString& url); 0058 0059 Q_SIGNALS: 0060 0061 void signalBusy(bool val); 0062 void signalLinkingSucceeded(); 0063 void signalLinkingFailed(); 0064 void signalSetUserName(const QString& msg); 0065 void signalListAlbumsFailed(const QString& msg); 0066 void signalListAlbumsDone(const QList<QPair<QString, QString> >& list); 0067 void signalCreateFolderFailed(const QString& msg); 0068 void signalCreateFolderSucceeded(); 0069 void signalAddPhotoFailed(const QString& msg); 0070 void signalAddPhotoSucceeded(); 0071 void boxLinkingSucceeded(); 0072 void boxLinkingFailed(); 0073 0074 private Q_SLOTS: 0075 0076 void slotLinkingFailed(); 0077 void slotLinkingSucceeded(); 0078 void slotFinished(QNetworkReply* reply); 0079 void slotOpenBrowser(const QUrl& url); 0080 0081 private: 0082 0083 void parseResponseUserName(const QByteArray& data); 0084 void parseResponseListFolders(const QByteArray& data); 0085 /* 0086 QList<QPair<QString, QString> > parseListFoldersRequest(const QByteArray& data); 0087 */ 0088 void parseResponseCreateFolder(const QByteArray& data); 0089 void parseResponseAddPhoto(const QByteArray& data); 0090 0091 private: 0092 0093 class Private; 0094 Private* const d; 0095 }; 0096 0097 } // namespace DigikamGenericBoxPlugin 0098 0099 #endif // DIGIKAM_BOX_TALKER_H