~ubuntu-branches/debian/sid/libmediawiki/sid

« back to all changes in this revision

Viewing changes to src/queryimages.h

  • Committer: Package Import Robot
  • Author(s): Steve M. Robbins
  • Date: 2017-11-05 21:15:29 UTC
  • Revision ID: package-import@ubuntu.com-20171105211529-bgfi385yv79030cf
Tags: upstream-5.37.0
ImportĀ upstreamĀ versionĀ 5.37.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** ===========================================================
 
2
 * @file
 
3
 *
 
4
 * This file is a part of KDE project
 
5
 * <a href="https://projects.kde.org/projects/extragear/libs/libmediawiki">libmediawiki</a>
 
6
 *
 
7
 * @date   2011-03-22
 
8
 * @brief  a MediaWiki C++ interface for KDE
 
9
 *
 
10
 * @author Copyright (C) 2011-2013 by Gilles Caulier
 
11
 *         <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
 
12
 * @author Copyright (C) 2010 by Ludovic Delfau
 
13
 *         <a href="mailto:ludovicdelfau at gmail dot com">ludovicdelfau at gmail dot com</a>
 
14
 * @author Copyright (C) 2010 by Paolo de Vathaire
 
15
 *         <a href="mailto:paolo dot devathaire at gmail dot com">paolo dot devathaire at gmail dot com</a>
 
16
 *
 
17
 * This program is free software; you can redistribute it
 
18
 * and/or modify it under the terms of the GNU General
 
19
 * Public License as published by the Free Software Foundation;
 
20
 * either version 2, or (at your option)
 
21
 * any later version.
 
22
 *
 
23
 * This program is distributed in the hope that it will be useful,
 
24
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
25
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
26
 * GNU General Public License for more details.
 
27
 *
 
28
 * ============================================================ */
 
29
 
 
30
#ifndef MEDIAWIKI_QUERYIMAGES_H
 
31
#define MEDIAWIKI_QUERYIMAGES_H
 
32
 
 
33
// KDE includes
 
34
 
 
35
#include <kjob.h>
 
36
 
 
37
// Local includes
 
38
 
 
39
#include "job.h"
 
40
#include "mediawiki_export.h"
 
41
#include "image.h"
 
42
 
 
43
namespace mediawiki
 
44
{
 
45
 
 
46
class MediaWiki;
 
47
class QueryImagesPrivate;
 
48
 
 
49
/**
 
50
 * @brief Query images job.
 
51
 *
 
52
 * Gets a list of all images used on pages.
 
53
 */
 
54
class MEDIAWIKI_EXPORT QueryImages : public Job
 
55
{
 
56
    Q_OBJECT
 
57
    Q_DECLARE_PRIVATE(QueryImages)
 
58
 
 
59
public:
 
60
 
 
61
    /**
 
62
     * @brief Indicates all possible error conditions found during the processing of the job.
 
63
     */
 
64
    enum
 
65
    {
 
66
        /**
 
67
         * @brief A network error has occurred.
 
68
         */
 
69
        NetworkError = KJob::UserDefinedError + 1,
 
70
 
 
71
        /**
 
72
         * @brief A XML error has occurred.
 
73
         */
 
74
        XmlError
 
75
    };
 
76
 
 
77
public:
 
78
 
 
79
    /**
 
80
     * @brief Constructs a query images job.
 
81
     * @param mediawiki the mediawiki concerned by the job
 
82
     * @param parent the QObject parent
 
83
     */
 
84
    explicit QueryImages(MediaWiki& mediawiki, QObject* const parent = 0);
 
85
 
 
86
    /**
 
87
     * @brief Destroys a query images job.
 
88
     */
 
89
    virtual ~QueryImages();
 
90
 
 
91
    /**
 
92
     * @brief Set the title.
 
93
     * @param title the title of the page
 
94
     */
 
95
    void setTitle(const QString& title);
 
96
 
 
97
    /**
 
98
     * @brief Set the limit.
 
99
     * @param limit number of images returned by one signal #pages()
 
100
     */
 
101
    void setLimit(unsigned int limit);
 
102
 
 
103
    /**
 
104
     * @brief Starts the job asynchronously.
 
105
     */
 
106
    virtual void start();
 
107
 
 
108
Q_SIGNALS:
 
109
 
 
110
    /**
 
111
     * @brief Provides a list of all images used on pages
 
112
     *
 
113
     * This signal can be emitted several times.
 
114
     *
 
115
     * @param pages list of all images used on pages
 
116
     */
 
117
    void images(const QList<Image> & images);
 
118
 
 
119
private Q_SLOTS:
 
120
 
 
121
    void doWorkSendRequest();
 
122
    void doWorkProcessReply();
 
123
};
 
124
 
 
125
} // namespace mediawiki
 
126
 
 
127
#endif // MEDIAWIKI_QUERYIMAGES_H