Changeset View
Changeset View
Standalone View
Standalone View
runners/mediawiki/mediawiki.h
Show All 15 Lines | |||||
16 | * License along with this program; if not, write to the | 16 | * License along with this program; if not, write to the | ||
17 | * Free Software Foundation, Inc., | 17 | * Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #ifndef MEDIAWIKI_H | 21 | #ifndef MEDIAWIKI_H | ||
22 | #define MEDIAWIKI_H | 22 | #define MEDIAWIKI_H | ||
23 | 23 | | |||
24 | // Qt | ||||
24 | #include <QObject> | 25 | #include <QObject> | ||
25 | #include <QList> | 26 | #include <QList> | ||
26 | #include <QUrl> | 27 | #include <QUrl> | ||
27 | 28 | | |||
28 | class QNetworkReply; | 29 | class QNetworkReply; | ||
30 | class QIODevice; | ||||
29 | 31 | | |||
30 | /** | 32 | /** | ||
31 | * Searches MediaWiki based wikis like wikipedia and techbase. | 33 | * Searches MediaWiki based wikis like wikipedia and techbase. | ||
32 | * | 34 | * | ||
33 | * @author Richard Moore, rich@kde.org | 35 | * @author Richard Moore, rich@kde.org | ||
34 | */ | 36 | */ | ||
35 | class MediaWiki : public QObject | 37 | class MediaWiki : public QObject | ||
36 | { | 38 | { | ||
Show All 27 Lines | 41 | public: | |||
64 | }; | 66 | }; | ||
65 | 67 | | |||
66 | /** | 68 | /** | ||
67 | * Create a media wiki querying object with the specified parent. The querying | 69 | * Create a media wiki querying object with the specified parent. The querying | ||
68 | * object can be used for multple queries, though only one can be performed at | 70 | * object can be used for multple queries, though only one can be performed at | ||
69 | * a time. | 71 | * a time. | ||
70 | * @param parent The parent object | 72 | * @param parent The parent object | ||
71 | */ | 73 | */ | ||
72 | MediaWiki( QObject *parent=0 ); | 74 | explicit MediaWiki(QObject *parent = nullptr); | ||
73 | virtual ~MediaWiki(); | 75 | ~MediaWiki() override; | ||
broulik: Asterisk goes to variable name, `QObject *parent` (pedantic) | |||||
kossebau: Ah, too much kdevelop code done (where asterisk goes to type) :) | |||||
74 | 76 | | |||
75 | /** | 77 | /** | ||
76 | * @returns a list of matches. | 78 | * @returns a list of matches. | ||
77 | */ | 79 | */ | ||
78 | QList<MediaWiki::Result> results() const; | 80 | QList<MediaWiki::Result> results() const; | ||
79 | 81 | | |||
80 | /** @returns the currently specified maximum number of results to return. */ | 82 | /** @returns the currently specified maximum number of results to return. */ | ||
81 | int maxItems() const; | 83 | int maxItems() const; | ||
Show All 21 Lines | |||||
103 | /** | 105 | /** | ||
104 | * Sets timeout in milliseconds. Once the specified time has elapsed, the current | 106 | * Sets timeout in milliseconds. Once the specified time has elapsed, the current | ||
105 | * query is aborted. | 107 | * query is aborted. | ||
106 | * | 108 | * | ||
107 | * @param millis Query timeout in milliseconds | 109 | * @param millis Query timeout in milliseconds | ||
108 | */ | 110 | */ | ||
109 | void setTimeout( int millis ); | 111 | void setTimeout( int millis ); | ||
110 | 112 | | |||
111 | signals: | 113 | Q_SIGNALS: | ||
112 | /** | 114 | /** | ||
113 | * Emitted when a search has been completed. | 115 | * Emitted when a search has been completed. | ||
114 | * @param success true if the search was completed successfully. | 116 | * @param success true if the search was completed successfully. | ||
115 | */ | 117 | */ | ||
116 | void finished( bool success ); | 118 | void finished( bool success ); | ||
117 | 119 | | |||
118 | public slots: | 120 | public Q_SLOTS: | ||
119 | /** | 121 | /** | ||
120 | * Search the wiki for the specified search term. | 122 | * Search the wiki for the specified search term. | ||
121 | */ | 123 | */ | ||
122 | void search( const QString &searchTerm ); | 124 | void search( const QString &searchTerm ); | ||
123 | 125 | | |||
124 | /** | 126 | /** | ||
125 | * Aborts the currently running request. | 127 | * Aborts the currently running request. | ||
126 | */ | 128 | */ | ||
127 | void abort(); | 129 | void abort(); | ||
128 | 130 | | |||
129 | private slots: | 131 | private Q_SLOTS: | ||
130 | void finished( QNetworkReply *reply ); | 132 | void onNetworkRequestFinished(QNetworkReply *reply); | ||
131 | 133 | | |||
132 | private: | 134 | private: | ||
133 | void findBase(); | 135 | void findBase(); | ||
134 | bool processBaseResult( QIODevice *source ); | 136 | bool processBaseResult( QIODevice *source ); | ||
135 | bool processSearchResult( QIODevice *source ); | 137 | bool processSearchResult( QIODevice *source ); | ||
136 | 138 | | |||
137 | struct MediaWikiPrivate * const d; | 139 | struct MediaWikiPrivate * const d; | ||
138 | }; | 140 | }; | ||
139 | 141 | | |||
140 | #endif // MEDIAWIKI_H | 142 | #endif // MEDIAWIKI_H |
Asterisk goes to variable name, QObject *parent (pedantic)