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

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  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_MEDIAWIKI_TALKER_H
0017 #define DIGIKAM_MEDIAWIKI_TALKER_H
0018 
0019 // Qt includes
0020 
0021 #include <QString>
0022 #include <QList>
0023 #include <QMap>
0024 #include <QUrl>
0025 
0026 // KDE includes
0027 
0028 #include <kjob.h>
0029 
0030 // Local includes
0031 
0032 #include "dinfointerface.h"
0033 
0034 using namespace Digikam;
0035 
0036 namespace MediaWiki
0037 {
0038     class Iface;
0039 }
0040 
0041 using namespace MediaWiki;
0042 
0043 namespace DigikamGenericMediaWikiPlugin
0044 {
0045 
0046 class MediaWikiTalker : public KJob
0047 {
0048     Q_OBJECT
0049 
0050 public:
0051 
0052     explicit MediaWikiTalker(DInfoInterface* const iface, Iface* const MediaWiki, QObject* const parent = nullptr);
0053     ~MediaWikiTalker() override;
0054 
0055 public:
0056 
0057     QString buildWikiText(const QMap<QString, QString>& info) const;
0058 
0059     void setImageMap(const QMap <QString, QMap <QString, QString> >& imageDesc);
0060     void start() override;
0061 
0062 Q_SIGNALS:
0063 
0064     void signalUploadProgress(int percent);
0065     void signalEndUpload();
0066 
0067 public Q_SLOTS:
0068 
0069     void slotBegin();
0070     void slotUploadHandle(KJob* j = nullptr);
0071     void slotUploadProgress(KJob* job, unsigned long percent);
0072 
0073 private:
0074 
0075     class Private;
0076     Private* const d;
0077 };
0078 
0079 } // namespace DigikamGenericMediaWikiPlugin
0080 
0081 #endif // DIGIKAM_MEDIAWIKI_TALKER_H