File indexing completed on 2025-01-05 03:53:36
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2011-03-22 0007 * Description : a Iface C++ interface 0008 * 0009 * SPDX-FileCopyrightText: 2011-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * SPDX-FileCopyrightText: 2011 by Ludovic Delfau <ludovicdelfau at gmail dot com> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 #ifndef DIGIKAM_MEDIAWIKI_QUERYIMAGES_H 0017 #define DIGIKAM_MEDIAWIKI_QUERYIMAGES_H 0018 0019 // KDE includes 0020 0021 #include <kjob.h> 0022 0023 // Local includes 0024 0025 #include "mediawiki_job.h" 0026 #include "mediawiki_image.h" 0027 0028 namespace MediaWiki 0029 { 0030 0031 class Iface; 0032 class QueryImagesPrivate; 0033 0034 /** 0035 * @brief Query images job. 0036 * 0037 * Gets a list of all images used on pages. 0038 */ 0039 class QueryImages : public Job 0040 { 0041 Q_OBJECT 0042 Q_DECLARE_PRIVATE(QueryImages) 0043 0044 public: 0045 0046 /** 0047 * @brief Indicates all possible error conditions found during the processing of the job. 0048 */ 0049 enum 0050 { 0051 /** 0052 * @brief A network error has occurred. 0053 */ 0054 NetworkError = KJob::UserDefinedError + 1, 0055 0056 /** 0057 * @brief A XML error has occurred. 0058 */ 0059 XmlError 0060 }; 0061 0062 public: 0063 0064 /** 0065 * @brief Constructs a query images job. 0066 * @param MediaWiki the MediaWiki concerned by the job 0067 * @param parent the QObject parent 0068 */ 0069 explicit QueryImages(Iface& MediaWiki, QObject* const parent = nullptr); 0070 0071 /** 0072 * @brief Destroys a query images job. 0073 */ 0074 ~QueryImages() override; 0075 0076 /** 0077 * @brief Set the title. 0078 * @param title the title of the page 0079 */ 0080 void setTitle(const QString& title); 0081 0082 /** 0083 * @brief Set the limit. 0084 * @param limit number of images returned by one signal #pages() 0085 */ 0086 void setLimit(unsigned int limit); 0087 0088 /** 0089 * @brief Starts the job asynchronously. 0090 */ 0091 void start() override; 0092 0093 Q_SIGNALS: 0094 0095 /** 0096 * @brief Provides a list of all images used on pages 0097 * 0098 * This signal can be emitted several times. 0099 * 0100 * @param pages list of all images used on pages 0101 */ 0102 void images(const QList<Image>& images); 0103 0104 private Q_SLOTS: 0105 0106 void doWorkSendRequest(); 0107 void doWorkProcessReply(); 0108 }; 0109 0110 } // namespace MediaWiki 0111 0112 #endif // DIGIKAM_MEDIAWIKI_QUERYIMAGES_H