1 /* ============================================================ 2 * 3 * This file is a part of digiKam project 4 * https://www.digikam.org 5 * 6 * Date : 2017-01-24 7 * Description : Web Service settings container. 8 * 9 * Copyright (C) 2017-2021 by Gilles Caulier <caulier dot gilles at gmail dot com> 10 * Copyright (C) 2018 by Thanh Trung Dinh <dinhthanhtrung1996 at gmail dot com> 11 * 12 * This program is free software; you can redistribute it 13 * and/or modify it under the terms of the GNU General 14 * Public License as published by the Free Software Foundation; 15 * either version 2, or (at your option) any later version. 16 * 17 * This program is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details. 21 * 22 * ============================================================ */ 23 24 #ifndef DIGIKAM_WS_SETTINGS_H 25 #define DIGIKAM_WS_SETTINGS_H 26 27 // Qt includes 28 29 #include <QObject> 30 #include <QtGlobal> 31 #include <QList> 32 #include <QString> 33 #include <QStringList> 34 #include <QUrl> 35 #include <QMap> 36 #include <QSettings> 37 38 // Local includes 39 40 #include "digikam_export.h" 41 #include "o0settingsstore.h" 42 43 class KConfigGroup; 44 45 namespace Digikam 46 { 47 48 class DIGIKAM_EXPORT WSSettings : public QObject 49 { 50 Q_OBJECT 51 52 public: 53 54 /// Images selection mode 55 enum Selection 56 { 57 EXPORT = 0, 58 IMPORT 59 }; 60 61 enum WebService 62 { 63 FLICKR = 0, 64 DROPBOX, 65 IMGUR, 66 FACEBOOK, 67 SMUGMUG, 68 GDRIVE, 69 GPHOTO 70 }; 71 72 enum ImageFormat 73 { 74 JPEG = 0, 75 PNG 76 }; 77 78 public: 79 80 explicit WSSettings(QObject* const parent = nullptr); 81 ~WSSettings() override; 82 83 ///@{ 84 /// Read and write settings in config file between sessions. 85 void readSettings(KConfigGroup& group); 86 void writeSettings(KConfigGroup& group); 87 ///@} 88 89 QString format() const; 90 91 ///@{ 92 /// Helper methods to fill settings from GUI. 93 static QMap<WebService, QString> webServiceNames(); 94 static QMap<ImageFormat, QString> imageFormatNames(); 95 ///@} 96 97 /// Helper method to list all user accounts (of all web service) that user logged in before. 98 QStringList allUserNames(const QString& serviceName); 99 100 public: 101 102 Selection selMode; ///< Items selection mode 103 104 QList<QUrl> inputImages; ///< Selected items to upload. 105 106 bool addFileProperties; 107 bool imagesChangeProp; 108 109 bool removeMetadata; 110 111 int imageCompression; 112 113 qint64 attLimitInMbytes; 114 115 WebService webService; 116 117 QString userName; 118 119 QSettings* oauthSettings; 120 O0SettingsStore* oauthSettingsStore; 121 122 QString currentAlbumId; ///< Selected album to upload to 123 124 int imageSize; 125 126 ImageFormat imageFormat; 127 128 QMap<QUrl, QUrl> itemsList; ///< Map of original item and attached item (can be resized). 129 }; 130 131 } // namespace Digikam 132 133 #endif // DIGIKAM_WS_SETTINGS_H 134