FreeDebks  1.0.3
 All Classes Files Functions Variables Friends Pages
FdCommandsResults.hpp
Go to the documentation of this file.
1 // --------------------------------------------------------------------
2 // Copyright © 2011-2013 Mathieu Schopfer
3 //
4 // This file is part of FreeDebks.
5 //
6 // FreeDebks is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // FreeDebks is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with FreeDebks. If not, see <http://www.gnu.org/licenses/>.
18 // --------------------------------------------------------------------
19 
20 #ifndef FDCOMMANDSRESULTS_HPP
21 #define FDCOMMANDSRESULTS_HPP
22 
23 #include <QUndoCommand>
24 
25 #include "dataDefinitions.hpp"
26 
30 struct locationResults {
31  FdItemResults_p item;
32  int row;
33 };
34 
35 class FdResultsAdd;
36 class FdResultsSetData;
37 class FdResultsRemove;
38 
40 class FdResultsAdd : public QUndoCommand
41 {
42 private:
44 
45 public:
46  FdResultsAdd(FdModelResults* results, locationResults location);
47  void redo();
48  void undo();
49 };
50 
54 class FdResultsDragDrop : public QUndoCommand
55 {
56 public:
57  FdResultsDragDrop(FdModelResults* model, QList<int> rows, int row);
58  void redo();
59  void undo();
60 private:
64  int mRow;
66  QList<FdResultsAdd*> mAddActions;
67 };
68 
70 
73 class FdResultsSetData : public QUndoCommand
74 {
75 public:
76  FdResultsSetData(FdModelResults* results, FdItemResults_p calculation, ResultsColumn column, QVariant newValue);
77  void redo();
78  void undo();
79 private:
81  FdItemResults_p mCalculation;
82  ResultsColumn mColumn;
83  QVariant mOldValue;
84  QVariant mNewValue;
85 };
86 
88 
93 class FdResultsRemove : public QUndoCommand
94 {
95 public:
96  FdResultsRemove(FdModelResults* model, QList<int> rows);
97  FdResultsRemove(FdModelResults* model, QList<locationResults> location);
98  void redo();
99  void undo();
100 private:
101  void init();
103  QList<locationResults> mMap;
104 };
105 
106 #endif // FDCOMMANDSRESULTS_HPP