Huggle  build:^490^dce1e5c
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
processlist.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 PROCESSLIST_H
12 #define PROCESSLIST_H
13 
14 #include <QList>
15 #include <QTableWidgetItem>
16 #include <QDateTime>
17 #include <QHeaderView>
18 #include <QDockWidget>
19 #include "query.hpp"
20 #include "exception.hpp"
21 #include "core.hpp"
22 #include "configuration.hpp"
23 
24 namespace Ui
25 {
26  class ProcessList;
27 }
28 
29 namespace Huggle
30 {
31  //! Removed item that was in the process list
32 
33  //! When you remove an item it should stay in list for some time so that user can notice it finished and that's
34  //! why we store it to separate object and for that we have this class ;)
36  {
37  private:
38  QDateTime time;
39  int id;
40  public:
41  ProcessListRemovedItem(int ID);
42  int GetID();
43  bool Expired();
44  };
45 
46  //! List of processes in a main window
47 
48  //! List of active processes, when some process finish it's collected by garbage collector
49  //! this is only a dialog that you see in huggle form, it doesn't contain process list
50  class ProcessList : public QDockWidget
51  {
52  Q_OBJECT
53  public:
54  explicit ProcessList(QWidget *parent = 0);
55  //! Insert a query to process list, the query is automatically removed once it's done
56  void InsertQuery(Query* q);
57  void Clear();
58  //! Return true if there is already this in a list
59  bool ContainsQuery(Query *q);
60  //! Remove a query from list no matter if it finished or not
61  void RemoveQuery(Query *q);
62  //! Update information about query in list
63  void UpdateQuery(Query *q);
64  void RemoveExpired();
65  ~ProcessList();
66 
67 
68  private:
69  QList<ProcessListRemovedItem*> *Removed;
70  Ui::ProcessList *ui;
71  int GetItem(Query *q);
72  int GetItem(int Id);
73  bool IsExpired(Query *q);
74  };
75 }
76 
77 #endif // PROCESSLIST_H
void InsertQuery(Query *q)
Insert a query to process list, the query is automatically removed once it&#39;s done.
Definition: processlist.cpp:38
Removed item that was in the process list.
Definition: processlist.hpp:35
List of processes in a main window.
Definition: processlist.hpp:50
void RemoveQuery(Query *q)
Remove a query from list no matter if it finished or not.
Definition: processlist.cpp:68
bool ContainsQuery(Query *q)
Return true if there is already this in a list.
Definition: processlist.cpp:60
void UpdateQuery(Query *q)
Update information about query in list.
Definition: processlist.cpp:78
Query base class for all http queries executed by huggle.
Definition: query.hpp:64