File indexing completed on 2025-01-19 03:55:41
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2017-01-24 0007 * Description : Web Service settings container. 0008 * 0009 * SPDX-FileCopyrightText: 2017-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * SPDX-FileCopyrightText: 2018 by Thanh Trung Dinh <dinhthanhtrung1996 at gmail dot com> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 #ifndef DIGIKAM_WS_SETTINGS_H 0017 #define DIGIKAM_WS_SETTINGS_H 0018 0019 // Qt includes 0020 0021 #include <QObject> 0022 #include <QtGlobal> 0023 #include <QList> 0024 #include <QString> 0025 #include <QStringList> 0026 #include <QUrl> 0027 #include <QMap> 0028 #include <QSettings> 0029 0030 // Local includes 0031 0032 #include "digikam_export.h" 0033 #include "o0settingsstore.h" 0034 0035 class KConfigGroup; 0036 0037 namespace Digikam 0038 { 0039 0040 class DIGIKAM_EXPORT WSSettings : public QObject 0041 { 0042 Q_OBJECT 0043 0044 public: 0045 0046 /// Images selection mode 0047 enum Selection 0048 { 0049 EXPORT = 0, 0050 IMPORT 0051 }; 0052 0053 enum WebService 0054 { 0055 FLICKR = 0, 0056 DROPBOX, 0057 IMGUR, 0058 FACEBOOK, 0059 SMUGMUG, 0060 GDRIVE, 0061 GPHOTO 0062 }; 0063 0064 enum ImageFormat 0065 { 0066 JPEG = 0, 0067 PNG 0068 }; 0069 0070 public: 0071 0072 explicit WSSettings(QObject* const parent = nullptr); 0073 ~WSSettings() override; 0074 0075 ///@{ 0076 /// Read and write settings in config file between sessions. 0077 void readSettings(KConfigGroup& group); 0078 void writeSettings(KConfigGroup& group); 0079 ///@} 0080 0081 QString format() const; 0082 0083 ///@{ 0084 /// Helper methods to fill settings from GUI. 0085 static QMap<WebService, QString> webServiceNames(); 0086 static QMap<ImageFormat, QString> imageFormatNames(); 0087 ///@} 0088 0089 /// Helper method to list all user accounts (of all web service) that user logged in before. 0090 QStringList allUserNames(const QString& serviceName); 0091 0092 public: 0093 0094 Selection selMode; ///< Items selection mode 0095 0096 QList<QUrl> inputImages; ///< Selected items to upload. 0097 0098 bool addFileProperties; 0099 bool imagesChangeProp; 0100 0101 bool removeMetadata; 0102 0103 int imageCompression; 0104 0105 qint64 attLimitInMbytes; 0106 0107 WebService webService; 0108 0109 QString userName; 0110 0111 QSettings* oauthSettings; 0112 O0SettingsStore* oauthSettingsStore; 0113 0114 QString currentAlbumId; ///< Selected album to upload to 0115 0116 int imageSize; 0117 0118 ImageFormat imageFormat; 0119 0120 QMap<QUrl, QUrl> itemsList; ///< Map of original item and attached item (can be resized). 0121 }; 0122 0123 } // namespace Digikam 0124 0125 #endif // DIGIKAM_WS_SETTINGS_H