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 Alexandre Mendes <alex dot mendes1988 at gmail dot com>
0011  * SPDX-FileCopyrightText: 2011      by Vincent Garcia <xavier dot vincent dot garcia at gmail dot com>
0012  *
0013  * SPDX-License-Identifier: GPL-2.0-or-later
0014  *
0015  * ============================================================ */
0016 
0017 #ifndef DIGIKAM_MEDIAWIKI_PARSE_H
0018 #define DIGIKAM_MEDIAWIKI_PARSE_H
0019 
0020 // Qt includes
0021 
0022 #include <QString>
0023 #include <QLocale>
0024 
0025 // Local includes
0026 
0027 #include "mediawiki_job.h"
0028 
0029 
0030 namespace MediaWiki
0031 {
0032 
0033 class Iface;
0034 class ParsePrivate;
0035 
0036 class Parse : public Job
0037 {
0038     Q_OBJECT
0039     Q_DECLARE_PRIVATE(Parse)
0040 
0041 public:
0042 
0043     /**
0044      * @brief Indicates all possible error conditions found during the processing of the job.
0045      */
0046     enum
0047     {
0048          /**
0049          * @brief An internal error occurred.
0050          */
0051         InternalError= Job::UserDefinedError+1,
0052 
0053         /**
0054          * @brief The page parameter cannot be used together with the text and title parameters
0055          */
0056         TooManyParams,
0057 
0058         /**
0059          * @brief The page you specified doesn't exist
0060          */
0061         MissingPage
0062     };
0063 
0064     explicit Parse(Iface& MediaWiki, QObject* const parent = nullptr);
0065     ~Parse() override;
0066 
0067     void setText(const QString& param);
0068 
0069     void setTitle(const QString& param);
0070 
0071     void setPageName(const QString& param);
0072 
0073     void setUseLang(const QString& param);
0074 
0075     void start() override;
0076 
0077     Q_SIGNALS:
0078 
0079     void result(const QString& text);
0080 
0081 private Q_SLOTS:
0082 
0083     void doWorkSendRequest();
0084     void doWorkProcessReply();
0085 };
0086 
0087 } // namespace MediaWiki
0088 
0089 #endif // DIGIKAM_MEDIAWIKI_PARSE_H