forked from cp-profiler/cp-profiler-deprecated-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qtgist.hh
261 lines (209 loc) · 6.87 KB
/
qtgist.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
/* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifndef GIST_HH
#define GIST_HH
#include "nodestats.hh"
#include <vector>
/**
* \brief %Gecode Interactive %Search Tool
*
* This class provides an interactive search tree viewer and explorer as
* a Qt widget. You can embedd or inherit from this widget to use %Gist
* in your own project.
*
* \ingroup TaskGist
*/
class CmpTreeDialog;
class TreeCanvas;
class Execution;
using std::vector;
class Gist : public QWidget {
Q_OBJECT
QPalette* myPalette;
QGridLayout* layout;
/// The canvas implementation
TreeCanvas* m_Canvas;
void addActions();
Execution* execution;
private:
/// The time slider
QSlider* timeBar;
/// Context menu
QMenu* contextMenu;
/// Action used when no comparator is registered
QAction* nullComparator;
/// Menu of comparators
QMenu* comparatorMenu;
/// Action used when no bookmark exists
QAction* nullBookmark;
/// Bookmark menu
QMenu* bookmarksMenu;
/// Information about individual nodes
NodeStatInspector* nodeStatInspector;
/// Search next solution in current subtree
QAction* searchNext;
/// Search all solutions in current subtree
QAction* searchAll;
/// Show on a pixel tree
QAction* showNodeOnPixelTree;
/// Bookmark current node
QAction* toggleStop;
/// Bookmark current node
QAction* unstopAll;
/// Show webscript view
QAction* showWebscript;
/// Group of all actions for comparators
QActionGroup* comparatorGroup;
public:
/// ------------ accessed from mainwindow --------------
/// Reset %Gist
QAction* reset;
/// Group of all actions for bookmarks
QActionGroup* bookmarksGroup;
/// Print tree
QAction* print;
/// Print search tree log
QAction* printSearchLog;
/// Export PDF of whole tree
QAction* exportWholeTreePDF;
/// Bookmark current node
QAction* bookmarkNode;
/// Open node statistics inspector
QAction* showNodeStats;
/// Navigate to parent node
QAction* navUp;
/// Navigate to leftmost child node
QAction* navDown;
/// Navigate to left sibling
QAction* navLeft;
/// Navigate to right sibling
QAction* navRight;
/// Navigate to root node
QAction* navRoot;
/// Navigate to next solution (to the right)
QAction* navNextSol;
/// Navigate to previous solution (to the left)
QAction* navPrevSol;
/// Navigate to next leaf (to the right)
QAction* navNextLeaf;
/// Navigate to previous leaf (to the left)
QAction* navPrevLeaf;
/// Toggle whether current node is hidden
QAction* toggleHidden;
/// Hide failed subtrees under current node
QAction* hideFailed;
/// Unhide all hidden subtrees under current node
QAction* unhideAll;
/// Label branches under current node
QAction* labelBranches;
/// Label branches on path to root
QAction* labelPath;
/// Show no-goods
QAction* showNogoods;
/// Show node info
QAction* showNodeInfo;
/// Zoom tree to fit window
QAction* zoomToFit;
/// Center on current node
QAction* center;
/// Export PDF of current subtree
QAction* exportPDF;
/// Highlight nodes
QAction* highlightNodesMenu;
/// Analyze similar subtrees
QAction* analyzeSimilarSubtrees;
/// Show Indented Pixel Tree View
QAction* showPixelTree;
/// Show Icicle Search Tree
QAction* showIcicleTree;
/// Remove Unexplored Nodes
QAction* deleteWhiteNodes;
/// Hide subtrees by their size
QAction* hideSize;
/// Follow path
QAction* followPath;
#ifdef MAXIM_DEBUG
/// Delete a node from the tree
QAction* deleteNode;
QAction* dirtyUpNode;
#endif
public:
explicit Gist(Execution* execution, QWidget* parent);
/// Destructor
~Gist(void);
/// Set preference whether to automatically hide failed subtrees
void setAutoHideFailed(bool b);
/// Set preference whether to automatically zoom to fit
void setAutoZoom(bool b);
/// Return preference whether to automatically hide failed subtrees
bool getAutoHideFailed(void);
/// Return preference whether to automatically zoom to fit
bool getAutoZoom(void);
/// Set preference whether to show copies in the tree
void setShowCopies(bool b);
/// Return preference whether to show copies in the tree
bool getShowCopies(void);
/// Set refresh rate
void setRefresh(int i);
/// Set refresh pause in msec
void setRefreshPause(int i);
/// Return preference whether to use smooth scrolling and zooming
bool getSmoothScrollAndZoom(void);
/// Set preference whether to use smooth scrolling and zooming
void setSmoothScrollAndZoom(bool b);
/// Return preference whether to move cursor during search
bool getMoveDuringSearch(void);
/// Set preference whether to move cursor during search
void setMoveDuringSearch(bool b);
/// Handle resize event
void resizeEvent(QResizeEvent*);
/// Receiver calles this when name is obtained
void emitChangeMainTitle(QString file_name);
/// ***** GETTERS *****
TreeCanvas* getCanvas() { return m_Canvas; }
Execution* getExecution() { return execution; }
Q_SIGNALS:
/// Signals that the tree has changed
void statusChanged(const Statistics&, bool);
/// Signals that a solution has been found
void solution(int);
/// Notify MainWindow about fzn file name
void changeMainTitle(QString file_name);
void doneReceiving(void);
private Q_SLOTS:
/// Displays the context menu for a node
void on_canvas_contextMenu(QContextMenuEvent*);
/// Reacts on status changes
void on_canvas_statusChanged(VisualNode*, const Statistics&, bool);
/// TODO: this should only react on selecting node?
void updateActions(VisualNode*, bool);
/// Reacts on bookmark selection
void selectBookmark(QAction*);
/// Reacts on adding a bookmark
void addBookmark(const QString& id);
/// Reacts on removing a bookmark
void removeBookmark(int idx);
/// Populate the bookmarks menu
void populateBookmarksMenu(void);
/// Shows node status information
void showStats(void);
};
#endif // GIST_HH