Huggle  build:^490^dce1e5c
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
mainwindow.hpp
1 //This program is free software: you can redistribute it and/or modify
2 //it under the terms of the GNU General Public License as published by
3 //the Free Software Foundation, either version 3 of the License, or
4 //(at your option) any later version.
5 
6 //This program is distributed in the hope that it will be useful,
7 //but WITHOUT ANY WARRANTY; without even the implied warranty of
8 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 //GNU General Public License for more details.
10 
11 #ifndef MAINWINDOW_H
12 #define MAINWINDOW_H
13 
14 #include <QMainWindow>
15 #include <QTimer>
16 #include <QLabel>
17 #include <QDesktopServices>
18 #include <QMutex>
19 #include <QThread>
20 #include <QSplitter>
21 #include <QDockWidget>
22 #include "configuration.hpp"
23 #include "core.hpp"
24 #include "aboutform.hpp"
25 #include "preferences.hpp"
26 #include "hugglelog.hpp"
27 #include "hugglequeue.hpp"
28 #include "huggletool.hpp"
29 #include "huggleweb.hpp"
30 #include "wikipage.hpp"
31 #include "editquery.hpp"
32 #include "processlist.hpp"
33 #include "wikiuser.hpp"
34 #include "ignorelist.hpp"
35 #include "speedyform.hpp"
36 #include "exception.hpp"
37 #include "hooks.hpp"
38 #include "history.hpp"
39 #include "blockuser.hpp"
40 #include "hugglefeedproviderwiki.hpp"
41 #include "hugglefeedproviderirc.hpp"
42 #include "userinfoform.hpp"
43 #include "vandalnw.hpp"
44 #include "revertquery.hpp"
45 #include "collectable.hpp"
46 #include "gc.hpp"
47 #include "reportuser.hpp"
48 #include "waitingform.hpp"
49 #include "wlquery.hpp"
50 #include "sessionform.h"
51 #include "historyform.hpp"
52 #include "scorewordsdbform.hpp"
53 #include "deleteform.hpp"
54 #include "protectpage.hpp"
55 #include "uaareport.hpp"
56 
57 namespace Ui
58 {
59  class MainWindow;
60 }
61 
62 namespace Huggle
63 {
64  class HistoryForm;
65  class UserinfoForm;
66  class HuggleQueue;
67  class HuggleTool;
68  class AboutForm;
69  class HuggleWeb;
70  class SpeedyForm;
71  class WikiEdit;
72  class RevertQuery;
73  class WlQuery;
74  class WikiPage;
75  class EditQuery;
76  class ProcessList;
77  class Preferences;
78  class SessionForm;
79  class IgnoreList;
80  class WaitingForm;
81  class VandalNw;
82  class WikiUser;
83  class ReportUser;
84 #if !PRODUCTION_BUILD
85  class DeleteForm;
86  class BlockUser;
87 #endif
88  class ProtectPage;
89  class UAAReport;
90  class ScoreWordsDbForm;
91 
92  /*!
93  * \brief The ShutdownOp enum contains a various parts of shutdown so that we can keep the track of what is going on
94  */
96  {
97  //! Huggle is not shutting down
99  //! Huggle is downloading a whitelist in order to update it
101  //! Huggle is updating the whitelist
103  //! Huggle is updating a config of user
105  };
106 
107  /// \todo We should display reason why revert wasn't done to log
108 
109  //! Primary huggle window
110  class MainWindow : public QMainWindow
111  {
112  Q_OBJECT
113 
114  public:
115  //! List of edits that are being saved
116  QList<WikiEdit*> PendingEdits;
117  //! Pointer to syslog
119  //! Pointer to queue
121  //! Pointer to browser
123  HistoryForm *wHistory;
124  UserinfoForm *wUserInfo;
125  //! Pointer to toolbar
127  //! Pointer to options
129  //! Pointer to ignore list (see ignorelist.h)
131  //! Pointer to about dialog (see aboutform.h)
133  //! Pointer to current edit, if it's NULL there is no edit being displayed
135  SpeedyForm* fRemove;
136  //! Pointer to processes
138  //! This is a list of logs that needs to be written, it exist so that logs can be written from
139  //! other threads as well, writing to syslog from other thread would crash huggle
140  QStringList UnwrittenLogs;
141  //! Pointer to history
143  //! Mutex we lock unwritten logs with so that only 1 thread can write to it
145  //! Pointer to menu of revert warn button
146  QMenu *RevertWarn;
147  //! Pointer to vandal network
149  SessionForm *fSessionData;
150  //! Pointer to query that is used to store user config on exit of huggle
152  //! This query is used to refresh white list
154  //! Warning menu
155  QMenu *WarnMenu;
156  //! Revert menu
158  ScoreWordsDbForm *fScoreWord;
159  Ui::MainWindow *ui;
160  bool ShuttingDown;
161  //! If system is shutting down this is displaying which part of shutdown is currently being executed
163  ReportUser *fReportForm;
164 #if !PRODUCTION_BUILD
165  //! Pointer to a form to block user
167  //! Pointer to a form to delete a page
169 #endif
170  //! Pointer to a form to protect a page
172  //! Pointer to UAA dialog
174  explicit MainWindow(QWidget *parent = 0);
175  ~MainWindow();
176  void _ReportUser();
177  //! Recreate interface, should be called everytime you do anything with main form
178  void ProcessEdit(WikiEdit *e, bool IgnoreHistory = false);
179  RevertQuery *Revert(QString summary = "", bool nd = false, bool next = true);
180  bool Warn(QString WarningType, RevertQuery *dependency);
181  QString GetSummaryKey(QString item);
182  QString GetSummaryText(QString text);
183  //! Send a template to user no matter if they can be messaged or not
184  void ForceWarn(int level);
185  void Exit();
186  void ReconnectIRC();
187  //! Returns true if current page can be edited
188  bool BrowserPageIsEditable();
189  /*!
190  * \brief CheckEditableBrowserPage will check if current page is editable and if it's not it display a message box
191  * \return true on success or false in case it's not
192  */
194  void SuspiciousEdit();
195 
196 
197  private slots:
198  void on_actionExit_triggered();
199  void on_actionPreferences_triggered();
200  void on_actionContents_triggered();
201  void on_actionAbout_triggered();
202  void on_MainWindow_destroyed();
203  void on_Tick();
204  void on_Tick2();
205  void on_actionNext_triggered();
206  void on_actionNext_2_triggered();
207  void on_actionWarn_triggered();
208  void on_actionRevert_currently_displayed_edit_triggered();
209  void on_actionWarn_the_user_triggered();
210  void on_actionRevert_currently_displayed_edit_and_warn_the_user_triggered();
211  void on_actionRevert_and_warn_triggered();
212  void on_actionRevert_triggered();
213  void on_actionShow_ignore_list_of_current_wiki_triggered();
214  void on_actionForward_triggered();
215  void on_actionBack_triggered();
216  void CustomRevert();
217  void CustomRevertWarn();
218  void CustomWarn();
219  void on_actionWelcome_user_triggered();
220  void on_actionOpen_in_a_browser_triggered();
221  void on_actionIncrease_badness_score_by_20_triggered();
222  void on_actionDecrease_badness_score_by_20_triggered();
223  void on_actionGood_edit_triggered();
224  void on_actionTalk_page_triggered();
225  void on_actionFlag_as_a_good_edit_triggered();
226  void on_actionDisplay_this_page_in_browser_triggered();
227  void on_actionEdit_page_in_browser_triggered();
228  void on_actionDisplay_history_in_browser_triggered();
229  void on_actionStop_feed_triggered();
230  void on_actionRemove_old_edits_triggered();
232  void on_actionList_all_QGC_items_triggered();
233  void on_actionRevert_currently_displayed_edit_warn_user_and_stay_on_page_triggered();
234  void on_actionRevert_currently_displayed_edit_and_stay_on_page_triggered();
235  void on_actionWelcome_user_2_triggered();
238  void on_actionWarning_1_triggered();
239  void on_actionWarning_2_triggered();
240  void on_actionWarning_3_triggered();
241  void on_actionWarning_4_triggered();
242  void on_actionEdit_user_talk_triggered();
243  void on_actionReconnect_IRC_triggered();
244  void on_actionRequest_speedy_deletion_triggered();
247  void on_actionIRC_triggered();
250  void on_actionShow_talk_triggered();
252  void on_actionFlag_as_suspicious_edit_triggered();
253  void on_actionDisconnect_triggered();
255  void on_actionShow_list_of_score_words_triggered();
256  void on_actionRevert_AGF_triggered();
257  void on_actionDisplay_a_session_data_triggered();
258 
259  private:
260  QTimer *timer1;
261  // Whitelist
262  QTimer *wlt;
263  //! Status bar
264  QLabel *Status;
265  bool EditablePage;
266  WaitingForm *fWaiting;
267  //! List of all edits that are kept in history, so that we can track them and delete them
268  QList <WikiEdit*> Historical;
269  //! Check if huggle is shutting down or not, in case it is, message box is shown as well
270  //! this function should be called before every action user can trigger
271  bool CheckExit();
272  void DisplayWelcomeMessage();
273  //! Welcome user
274  void Welcome();
275  void Render();
276  //! Request a page deletion csd or afd and so on
277  void RequestPD();
278  void closeEvent(QCloseEvent *event);
279  };
280 }
281 #endif // MAINWINDOW_H
Web browser.
Definition: huggleweb.hpp:31
Huggle is updating a config of user.
Definition: mainwindow.hpp:104
Primary huggle window.
Definition: mainwindow.hpp:110
void on_actionProtect_triggered()
bool BrowserPageIsEditable()
Returns true if current page can be edited.
Form that can be displayed from help menu, should list all developers.
Definition: aboutform.hpp:25
QMenu * RevertSummaries
Revert menu.
Definition: mainwindow.hpp:157
bool Warn(QString WarningType, RevertQuery *dependency)
Definition: mainwindow.cpp:423
History * _History
Pointer to history.
Definition: mainwindow.hpp:142
void on_actionReport_user_2_triggered()
QMenu * WarnMenu
Warning menu.
Definition: mainwindow.hpp:155
void on_actionDelete_triggered()
List of processes in a main window.
Definition: processlist.hpp:50
Report user.
Definition: reportuser.hpp:39
QList< WikiEdit * > PendingEdits
List of edits that are being saved.
Definition: mainwindow.hpp:116
The window that is used to report a page for deletion.
Definition: speedyform.hpp:34
void on_actionReport_user_triggered()
HuggleWeb * Browser
Pointer to browser.
Definition: mainwindow.hpp:122
QList< WikiEdit * > Historical
List of all edits that are kept in history, so that we can track them and delete them.
Definition: mainwindow.hpp:268
EditQuery * eq
Pointer to query that is used to store user config on exit of huggle.
Definition: mainwindow.hpp:151
Whitelist query :o.
Definition: wlquery.hpp:23
void on_actionWiki_triggered()
BlockUser * fBlockForm
Pointer to a form to block user.
Definition: mainwindow.hpp:166
This form can be used to block users from editing, which requires the block permission.
Definition: blockuser.hpp:37
Preferences * preferencesForm
Pointer to options.
Definition: mainwindow.hpp:128
RevertQuery * Revert(QString summary="", bool nd=false, bool next=true)
Definition: mainwindow.cpp:384
VandalNw * VandalDock
Pointer to vandal network.
Definition: mainwindow.hpp:148
void ProcessEdit(WikiEdit *e, bool IgnoreHistory=false)
Recreate interface, should be called everytime you do anything with main form.
Definition: mainwindow.cpp:258
QLabel * Status
Status bar.
Definition: mainwindow.hpp:264
The RevertQuery class can be used to rollback any edit.
Definition: revertquery.hpp:32
This window contains all the messages that are stored in ring log.
Definition: hugglelog.hpp:28
AboutForm * aboutForm
Pointer to about dialog (see aboutform.h)
Definition: mainwindow.hpp:132
The UserinfoForm class is a widget that displays the information about user including their history a...
History of actions done by user.
Definition: history.hpp:57
Huggle is downloading a whitelist in order to update it.
Definition: mainwindow.hpp:100
Huggle is updating the whitelist.
Definition: mainwindow.hpp:102
WLQuery * wq
This query is used to refresh white list.
Definition: mainwindow.hpp:153
void on_actionBlock_user_triggered()
void on_actionReport_username_triggered()
ShutdownOp
The ShutdownOp enum contains a various parts of shutdown so that we can keep the track of what is goi...
Definition: mainwindow.hpp:95
Huggle is not shutting down.
Definition: mainwindow.hpp:98
QStringList UnwrittenLogs
Definition: mainwindow.hpp:140
Toolbar on top of window.
Definition: huggletool.hpp:35
HuggleQueue * Queue1
Pointer to queue.
Definition: mainwindow.hpp:120
ProcessList * Queries
Pointer to processes.
Definition: mainwindow.hpp:137
Queue of edits.
Definition: hugglequeue.hpp:36
IgnoreList * Ignore
Pointer to ignore list (see ignorelist.h)
Definition: mainwindow.hpp:130
UAAReport * fUaaReportForm
Pointer to UAA dialog.
Definition: mainwindow.hpp:173
ShutdownOp Shutdown
If system is shutting down this is displaying which part of shutdown is currently being executed...
Definition: mainwindow.hpp:162
HuggleLog * SystemLog
Pointer to syslog.
Definition: mainwindow.hpp:118
The ProtectPage class display a window where user can protect a page given they have the permissions ...
Definition: protectpage.hpp:36
QMutex lUnwrittenLogs
Mutex we lock unwritten logs with so that only 1 thread can write to it.
Definition: mainwindow.hpp:144
Modifications of mediawiki pages can be done using this query.
Definition: editquery.hpp:25
void on_actionEdit_info_triggered()
Preferences window.
Definition: preferences.hpp:29
WikiEdit * CurrentEdit
Pointer to current edit, if it&#39;s NULL there is no edit being displayed.
Definition: mainwindow.hpp:134
A window that contains ignore list.
Definition: ignorelist.hpp:26
QMenu * RevertWarn
Pointer to menu of revert warn button.
Definition: mainwindow.hpp:146
void ForceWarn(int level)
Send a template to user no matter if they can be messaged or not.
Definition: mainwindow.cpp:973
MainWindow(QWidget *parent=0)
Definition: mainwindow.cpp:16
Session info.
Definition: sessionform.h:27
HuggleTool * tb
Pointer to toolbar.
Definition: mainwindow.hpp:126
DeleteForm * fDeleteForm
Pointer to a form to delete a page.
Definition: mainwindow.hpp:168
Wiki edit.
Definition: wikiedit.hpp:67
void Welcome()
Welcome user.
void RequestPD()
Request a page deletion csd or afd and so on.
Definition: mainwindow.cpp:347
Form to report users to UAA.
Definition: uaareport.hpp:36
void on_actionClear_talk_page_of_user_triggered()
This is a delete form.
Definition: deleteform.hpp:38
bool CheckEditableBrowserPage()
CheckEditableBrowserPage will check if current page is editable and if it&#39;s not it display a message ...
Vandalism network.
Definition: vandalnw.hpp:32
This is universal form that is just displaying the progress bar and reason why we need to wait...
Definition: waitingform.hpp:25
It can be used to retrieve a history of currently displayed page.
Definition: historyform.hpp:29
ProtectPage * fProtectForm
Pointer to a form to protect a page.
Definition: mainwindow.hpp:171