File indexing completed on 2025-01-05 03:53:38

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2011-02-11
0007  * Description : a tool to export images to WikiMedia web service
0008  *
0009  * SPDX-FileCopyrightText: 2011      by Alexandre Mendes <alex dot mendes1988 at gmail dot com>
0010  * SPDX-FileCopyrightText: 2011-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  * SPDX-FileCopyrightText: 2012      by Parthasarathy Gopavarapu <gparthasarathy93 at gmail dot com>
0012  * SPDX-FileCopyrightText: 2013      by Peter Potrowl <peter dot potrowl at gmail dot com>
0013  *
0014  * SPDX-License-Identifier: GPL-2.0-or-later
0015  *
0016  * ============================================================ */
0017 
0018 #ifndef DIGIKAM_MEDIAWIKI_WIDGET_H
0019 #define DIGIKAM_MEDIAWIKI_WIDGET_H
0020 
0021 // Qt includes
0022 
0023 #include <QWidget>
0024 #include <QStringList>
0025 #include <QTreeWidgetItem>
0026 #include <QUrl>
0027 
0028 // Local includes
0029 
0030 #include "dinfointerface.h"
0031 #include "dprogresswdg.h"
0032 #include "ditemslist.h"
0033 
0034 class KConfigGroup;
0035 
0036 using namespace Digikam;
0037 
0038 namespace DigikamGenericMediaWikiPlugin
0039 {
0040 
0041 enum MediaWikiDownloadType
0042 {
0043     MediaWikiMyAlbum = 0,
0044     MediaWikiFriendAlbum,
0045     MediaWikiPhotosMe,
0046     MediaWikiPhotosFriend
0047 };
0048 
0049 class MediaWikiWidget : public QWidget
0050 {
0051     Q_OBJECT
0052 
0053 public:
0054 
0055     explicit MediaWikiWidget(DInfoInterface* const iface, QWidget* const parent);
0056     ~MediaWikiWidget() override;
0057 
0058 public:
0059 
0060     void updateLabels(const QString& userName = QString(),
0061                       const QString& wikiName = QString(),
0062                       const QString& url = QString());
0063     void invertAccountLoginBox();
0064 
0065     DItemsList*  imagesList()  const;
0066     DProgressWdg* progressBar() const;
0067 
0068     int  dimension()            const;
0069     int  quality()              const;
0070     bool resize()               const;
0071     bool removeMeta()           const;
0072     bool removeGeo()            const;
0073 
0074     QString author()            const;
0075     QString source()            const;
0076     QString genCategories()     const;
0077     QString genText()           const;
0078     QString genComments()       const;
0079     QString license()           const;
0080     QString categories()        const;
0081     QString title()             const;
0082     QString description()       const;
0083     QString date()              const;
0084     QString latitude()          const;
0085     QString longitude()         const;
0086 
0087     QMap <QString, QMap <QString, QString> > allImagesDesc();
0088 
0089     void clearImagesDesc();
0090     void readSettings(KConfigGroup& group);
0091     void saveSettings(KConfigGroup& group);
0092     void loadItemInfoFirstLoad();
0093     void loadItemInfo(const QUrl& url);
0094     void clearEditFields();
0095 
0096 Q_SIGNALS:
0097 
0098     void signalChangeUserRequest();
0099     void signalLoginRequest(const QString& login,
0100                             const QString& pass,
0101                             const QString& wikiName,
0102                             const QUrl& wikiUrl);
0103 
0104 private Q_SLOTS:
0105 
0106     void slotResizeChecked();
0107     void slotRemoveMetaChecked();
0108     void slotChangeUserClicked();
0109     void slotLoginClicked();
0110     void slotNewWikiClicked();
0111     void slotAddWikiClicked();
0112     void slotLoadImagesDesc(QTreeWidgetItem* item);
0113     void slotRemoveImagesDesc();
0114     void slotRestoreExtension();
0115     void slotApplyTitle();
0116     void slotApplyDate();
0117     void slotApplyCategories();
0118     void slotApplyDescription();
0119     void slotApplyLatitude();
0120     void slotApplyLongitude();
0121 
0122 private:
0123 
0124     class Private;
0125     Private* const d;
0126 
0127     friend class WmWindow;
0128 };
0129 
0130 } // namespace DigikamGenericMediaWikiPlugin
0131 
0132 #endif // DIGIKAM_MEDIAWIKI_WIDGET_H