Huggle  build:^490^dce1e5c
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
history.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 HISTORY_H
12 #define HISTORY_H
13 
14 #include <QString>
15 #include <QList>
16 #include <QDockWidget>
17 #include "exception.hpp"
18 
19 namespace Ui
20 {
21  class History;
22 }
23 
24 namespace Huggle
25 {
26  enum HistoryType
27  {
28  HistoryUnknown,
29  HistoryEdit,
30  HistoryRollback,
31  HistoryMessage
32  };
33 
34  //! History consist of these items
36  {
37  public:
38  HistoryItem();
39  HistoryItem(const HistoryItem &item);
40  HistoryItem(HistoryItem * item);
41  //! Unique ID of this item
42  int ID;
43  QString Result;
44  QString Target;
45  //! Type of item
46  HistoryType Type;
47  static QString TypeToString(HistoryType type);
48  private:
49 
50  };
51 
52  //! History of actions done by user
53 
54  /// \todo It should be possible to go back in history to review what you have you done
55  /// currently nothing happens when you click on history items
56  /// \todo Function to revert your own changes
57  class History : public QDockWidget
58  {
59  Q_OBJECT
60 
61  public:
62  explicit History(QWidget *parent = 0);
63  ~History();
64  //! Insert a new item to top of list
65  void Prepend(HistoryItem item);
66  void Refresh();
67  void Remove(HistoryItem item);
68  QList<HistoryItem> Items;
69  static int Last;
70 
71  private:
72  Ui::History *ui;
73  };
74 }
75 
76 #endif // HISTORY_H
int ID
Unique ID of this item.
Definition: history.hpp:42
History of actions done by user.
Definition: history.hpp:57
void Prepend(HistoryItem item)
Insert a new item to top of list.
Definition: history.cpp:37
HistoryType Type
Type of item.
Definition: history.hpp:46
History consist of these items.
Definition: history.hpp:35