1 /* ============================================================
2  *
3  * This file is a part of KDE project
4  *
5  *
6  * Date        : 2011-02-11
7  * Description : a kipi plugin to export images to WikiMedia web service
8  *
9  * Copyright (C) 2011      by Alexandre Mendes <alex dot mendes1988 at gmail dot com>
10  * Copyright (C) 2011-2018 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  * Copyright (C) 2012      by Parthasarathy Gopavarapu <gparthasarathy93 at gmail dot com>
12  * Copyright (C) 2013      by Peter Potrowl <peter dot potrowl at gmail dot com>
13  *
14  * This program is free software; you can redistribute it
15  * and/or modify it under the terms of the GNU General
16  * Public License as published by the Free Software Foundation;
17  * either version 2, or (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef WMWIDGET_H
27 #define WMWIDGET_H
28 
29 // Qt includes
30 
31 #include <QWidget>
32 #include <QStringList>
33 #include <QTreeWidgetItem>
34 #include <QUrl>
35 
36 //KDE includes
37 
38 #include <kconfig.h>
39 
40 namespace KIPIPlugins
41 {
42     class KPImagesList;
43     class KPProgressWidget;
44 }
45 
46 using namespace KIPIPlugins;
47 
48 namespace KIPIWikiMediaPlugin
49 {
50 
51 enum WmDownloadType
52 {
53     WmMyAlbum = 0,
54     WmFriendAlbum,
55     WmPhotosMe,
56     WmPhotosFriend
57 };
58 
59 class WmWidget : public QWidget
60 {
61     Q_OBJECT
62 
63 public:
64 
65     WmWidget(QWidget* const parent);
66     ~WmWidget();
67 
68     void updateLabels(const QString& userName = QString(), const QString& wikiName = QString(), const QString& url = QString());
69     void invertAccountLoginBox();
70 
71     KPImagesList*     imagesList()  const;
72     KPProgressWidget* progressBar() const;
73 
74     int  dimension()        const;
75     int  quality()          const;
76     bool resize()           const;
77     bool removeMeta()       const;
78     bool removeGeo()        const;
79 
80     QString author()        const;
81     QString source()        const;
82     QString genCategories() const;
83     QString genText()       const;
84     QString genComments()   const;
85     QString license()       const;
86     QString categories()    const;
87     QString title()         const;
88     QString description()   const;
89     QString date()          const;
90     QString latitude()      const;
91     QString longitude()     const;
92 
93     QMap <QString, QMap <QString, QString> > allImagesDesc();
94 
95     void clearImagesDesc();
96     void readSettings(KConfigGroup& group);
97     void saveSettings(KConfigGroup& group);
98     void loadImageInfoFirstLoad();
99     void loadImageInfo(const QUrl& url);
100     void clearEditFields();
101 
102 Q_SIGNALS:
103 
104     void signalChangeUserRequest();
105     void signalLoginRequest(const QString& login, const QString& pass, const QString& wikiName, const QUrl& wikiUrl);
106 
107 private Q_SLOTS:
108 
109     void slotResizeChecked();
110     void slotRemoveMetaChecked();
111     void slotChangeUserClicked();
112     void slotLoginClicked();
113     void slotNewWikiClicked();
114     void slotAddWikiClicked();
115     void slotLoadImagesDesc(QTreeWidgetItem* item);
116     void slotRemoveImagesDesc(const QList<QUrl> urls);
117     void slotRestoreExtension();
118     void slotApplyTitle();
119     void slotApplyDate();
120     void slotApplyCategories();
121     void slotApplyDescription();
122     void slotApplyLatitude();
123     void slotApplyLongitude();
124 
125 private:
126 
127     class Private;
128     Private* const d;
129 
130     friend class WmWindow;
131 };
132 
133 } // namespace KIPIWikiMediaPlugin
134 
135 #endif // WMWIDGET_H
136