File indexing completed on 2022-09-27 13:43:09

0001 /* ============================================================
0002  *
0003  * This file is a part of KDE project
0004  *
0005  *
0006  * Date        : 2005-17-06
0007  * Description : a kipi plugin to export images to Flickr web service
0008  *
0009  * Copyright (C) 2005-2008 by Vardhman Jain <vardhman at gmail dot com>
0010  * Copyright (C) 2008-2018 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * This program is free software; you can redistribute it
0013  * and/or modify it under the terms of the GNU General
0014  * Public License as published by the Free Software Foundation;
0015  * either version 2, or (at your option) any later version.
0016  *
0017  * This program is distributed in the hope that it will be useful,
0018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0020  * GNU General Public License for more details.
0021  *
0022  * ============================================================ */
0023 
0024 #ifndef FLICKRWINDOW_H
0025 #define FLICKRWINDOW_H
0026 
0027 // Qt includes
0028 
0029 #include <QHash>
0030 #include <QList>
0031 #include <QPair>
0032 #include <QLabel>
0033 #include <QLinkedList>
0034 #include <QLineEdit>
0035 #include <QUrl>
0036 #include <QComboBox>
0037 
0038 // Libkipi includes
0039 
0040 #include <KIPI/Interface>
0041 
0042 // Local includes
0043 
0044 #include "kptooldialog.h"
0045 #include "comboboxintermediate.h"
0046 
0047 class QProgressDialog;
0048 class QPushButton;
0049 class QSpinBox;
0050 class QCheckBox;
0051 class QUrl;
0052 
0053 namespace KIPI
0054 {
0055     class Interface;
0056 }
0057 
0058 namespace KIPIPlugins
0059 {
0060     class KPAboutData;
0061 }
0062 
0063 using namespace KIPI;
0064 using namespace KIPIPlugins;
0065 
0066 namespace KIPIFlickrPlugin
0067 {
0068 class SelectUserDlg;
0069 class FlickrWidget;
0070 class FlickrTalker;
0071 class FlickrList;
0072 class FPhotoInfo;
0073 class GPhoto;
0074 class GAlbum;
0075 class NewAlbum;
0076 
0077 using namespace KIPI;
0078 using namespace KIPIPlugins;
0079 
0080 class FlickrWindow : public KPToolDialog
0081 {
0082     Q_OBJECT
0083 
0084 public:
0085 
0086     FlickrWindow(QWidget* const parent, const QString& serviceName, SelectUserDlg* const dlg);
0087     ~FlickrWindow();
0088 
0089     /**
0090      * Use this method to (re-)activate the dialog after it has been created
0091      * to display it. This also loads the currently selected images.
0092      */
0093     void reactivate();
0094 
0095 private Q_SLOTS:
0096 
0097     void slotLinkingSucceeded();
0098     void slotBusy(bool val);
0099     void slotError(const QString& msg);
0100     void slotFinished();
0101     void slotUser1();
0102     void slotCancelClicked();
0103 
0104     void slotCreateNewPhotoSet();
0105     void slotUserChangeRequest();
0106     void slotRemoveAccount();
0107     void slotPopulatePhotoSetComboBox();
0108     void slotAddPhotoNext();
0109     void slotAddPhotoSucceeded();
0110     void slotAddPhotoFailed(const QString& msg);
0111     void slotAddPhotoSetSucceeded();
0112     void slotListPhotoSetsFailed(const QString& msg);
0113     void slotAddPhotoCancelAndClose();
0114     void slotAuthCancel();
0115     void slotImageListChanged();
0116     void slotReloadPhotoSetRequest();
0117 
0118 private:
0119 
0120     QString guessSensibleSetName(const QList<QUrl>& urlList);
0121 
0122     void closeEvent(QCloseEvent*)  override;
0123     void readSettings(QString uname);
0124     void writeSettings();
0125 
0126     void setUiInProgressState(bool inProgress);
0127 
0128 private:
0129 
0130     unsigned int                           m_uploadCount;
0131     unsigned int                           m_uploadTotal;
0132 
0133     QString                                m_serviceName;
0134 
0135     QPushButton*                           m_newAlbumBtn;
0136     QPushButton*                           m_changeUserButton;
0137     QPushButton*                           m_removeAccount;
0138 
0139     QComboBox*                             m_albumsListComboBox;
0140     QCheckBox*                             m_publicCheckBox;
0141     QCheckBox*                             m_familyCheckBox;
0142     QCheckBox*                             m_friendsCheckBox;
0143     QCheckBox*                             m_exportHostTagsCheckBox;
0144     QCheckBox*                             m_stripSpaceTagsCheckBox;
0145     QCheckBox*                             m_addExtraTagsCheckBox;
0146     QCheckBox*                             m_originalCheckBox;
0147     QCheckBox*                             m_resizeCheckBox;
0148 
0149     QSpinBox*                              m_dimensionSpinBox;
0150     QSpinBox*                              m_imageQualitySpinBox;
0151 
0152     QPushButton*                           m_extendedPublicationButton;
0153     QPushButton*                           m_extendedTagsButton;
0154     ComboBoxIntermediate*                  m_contentTypeComboBox;
0155     ComboBoxIntermediate*                  m_safetyLevelComboBox;
0156 
0157     QString                                m_username;
0158     QString                                m_userId;
0159     QString                                m_lastSelectedAlbum;
0160 
0161     QLabel*                                m_userNameDisplayLabel;
0162 
0163     QProgressDialog*                       m_authProgressDlg;
0164 
0165     QList< QPair<QUrl, FPhotoInfo> >       m_uploadQueue;
0166 
0167     QLineEdit*                             m_tagsLineEdit;
0168 
0169     FlickrWidget*                          m_widget;
0170     FlickrTalker*                          m_talker;
0171 
0172     FlickrList*                            m_imglst;
0173     SelectUserDlg*                         m_select;
0174     NewAlbum*                              m_albumDlg;
0175 };
0176 
0177 } // namespace KIPIFlickrPlugin
0178 
0179 #endif /* FLICKRWINDOW_H */