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

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2012-02-12
0007  * Description : a tool to export images to Imgur web service
0008  *
0009  * SPDX-FileCopyrightText: 2010-2012 by Marius Orcsik <marius at habarnam dot ro>
0010  * SPDX-FileCopyrightText: 2013-2020 by Caulier Gilles <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_IMGUR_WINDOW_H
0017 #define DIGIKAM_IMGUR_WINDOW_H
0018 
0019 // Qt includes
0020 
0021 #include <QObject>
0022 #include <QLabel>
0023 #include <QList>
0024 #include <QUrl>
0025 
0026 // Local includes
0027 
0028 #include "imgurimageslist.h"
0029 #include "wstooldialog.h"
0030 #include "imgurtalker.h"
0031 #include "dinfointerface.h"
0032 
0033 using namespace Digikam;
0034 
0035 namespace DigikamGenericImgUrPlugin
0036 {
0037 
0038 class ImgurWindow : public WSToolDialog
0039 {
0040     Q_OBJECT
0041 
0042 public:
0043 
0044     explicit ImgurWindow(DInfoInterface* const iface, QWidget* const parent = nullptr);
0045     ~ImgurWindow()                      override;
0046 
0047 public:
0048 
0049     void reactivate();
0050 
0051     void setItemsList(const QList<QUrl>& urls);
0052 
0053 public Q_SLOTS:
0054 
0055     // UI callbacks
0056 
0057     void slotForgetButtonClicked();
0058     void slotUpload();
0059     void slotAnonUpload();
0060     void slotFinished();
0061     void slotCancel();
0062 
0063     // ImgurTalker callbacks
0064 
0065     void slotApiAuthorized(bool success, const QString& username);
0066     void slotApiAuthError(const QString& msg);
0067     void slotApiProgress(unsigned int percent, const ImgurTalkerAction& action);
0068     void slotApiRequestPin(const QUrl& url);
0069     void slotApiSuccess(const ImgurTalkerResult& result);
0070     void slotApiError(const QString& msg, const ImgurTalkerAction& action);
0071     void slotApiBusy(bool busy);
0072 
0073 private:
0074 
0075     void closeEvent(QCloseEvent* e)     override;
0076     void setContinueUpload(bool state);
0077     void readSettings();
0078     void saveSettings();
0079 
0080 private:
0081 
0082     class Private;
0083     Private* const d;
0084 };
0085 
0086 } // namespace DigikamGenericImgUrPlugin
0087 
0088 #endif // DIGIKAM_IMGUR_WINDOW_H