-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgistmainwindow.h
271 lines (215 loc) · 7.01 KB
/
gistmainwindow.h
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
262
263
264
265
266
267
268
269
270
271
/* 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 GISTMAINWINDOW_H
#define GISTMAINWINDOW_H
#include <QMainWindow>
#include <QVariant>
#include <QMutex>
#include <memory>
class QLabel;
class QAction;
class NodeStatInspector;
class TreeCanvas;
class QGridLayout;
class Execution;
class QAction;
class QActionGroup;
class VisualNode;
class Statistics;
class ProfilerConductor;
class NodeStatsBar;
class GistMainWindow : public QMainWindow {
Q_OBJECT
private:
QGridLayout* layout;
std::unique_ptr<TreeCanvas> m_Canvas;
ProfilerConductor& conductor;
Execution& execution;
std::unique_ptr<NodeStatsBar> m_NodeStatsBar;
/// Menu for bookmarks
QMenu* bookmarksMenu;
/// Action for activating the preferences menu
QAction* prefAction;
/// A menu bar
QMenuBar* menuBar;
QString statsFilename;
QMutex gistMutex {QMutex::Recursive};
/// Context menu
QMenu* contextMenu;
QAction* reset;
/// Group of all actions for bookmarks
QActionGroup* bookmarksGroup;
/// Action used when no bookmark exists
QAction* nullBookmark;
/// 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;
/// Remove immediately unseccessful assignments
QAction* deleteTrials;
/// Remove Unexplored Nodes
QAction* deleteSkippedNodes;
/// Compare domains of two roots of highlighted subtrees
QAction* compareDomains;
/// Follow path
QAction* followPath;
/// Compare labels of bookmarked subtrees
QAction* compareSubtreeLabels;
/// Show on a pixel tree
QAction* showNodeOnPixelTree;
/// Show webscript view
QAction* showWebscript;
/// Extract subtree into a fake execution
QAction* extractSubtree;
/// Highlight subtrees similar to the one selected
QAction* findSelectedShape;
/// Backjump analysis
QAction* analyseBackjumps;
/// Find Node
QAction* findNode;
#ifdef MAXIM_DEBUG
QAction* dirtyUpNode;
/// For debugging and other fun
QAction* createRandomTree;
#endif
/// Information about individual nodes
NodeStatInspector* nodeStatInspector;
/// *************************
void addActions();
Q_SIGNALS:
/// stops the receiver thread
void stopReceiver(void);
/// Notify MainWindow about fzn file name
void changeMainTitle(QString file_name);
private Q_SLOTS:
/// update node count display (status bar)
void updateStatsBar();
/// update "searching" to "done"
void finishStatsBar();
/// Displays the context menu for a node
void onContextMenu(QContextMenuEvent*);
/// 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);
protected Q_SLOTS:
/// Open the preferences dialog
void preferences(bool setup=false);
/// Populate the bookmarks menus from the actions found in Gist
void populateBookmarks(void);
/// Change MainWindow's title to fzn file name
public Q_SLOTS:
void updateActions(VisualNode* n);
void changeTitle(QString file_name);
void gatherStatistics(void);
void selectNode(int gid);
void selectManyNodes(QVariantList gids);
public:
GistMainWindow(Execution& execution, ProfilerConductor* parent);
~GistMainWindow();
void setStatsFilename(QString filename) {
statsFilename = filename;
}
/// 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 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);
TreeCanvas* getCanvas();
};
#endif // MAINWINDOW_H