Generated on Fri Aug 24 2012 04:52:13 for Gecode by doxygen 1.8.1.1
qtgist.hh
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Guido Tack <tack@gecode.org>
5  *
6  * Copyright:
7  * Guido Tack, 2006
8  *
9  * Last modified:
10  * $Date: 2010-08-12 18:29:27 +1000 (Thu, 12 Aug 2010) $ by $Author: tack $
11  * $Revision: 11346 $
12  *
13  * This file is part of Gecode, the generic constraint
14  * development environment:
15  * http://www.gecode.org
16  *
17  * Permission is hereby granted, free of charge, to any person obtaining
18  * a copy of this software and associated documentation files (the
19  * "Software"), to deal in the Software without restriction, including
20  * without limitation the rights to use, copy, modify, merge, publish,
21  * distribute, sublicense, and/or sell copies of the Software, and to
22  * permit persons to whom the Software is furnished to do so, subject to
23  * the following conditions:
24  *
25  * The above copyright notice and this permission notice shall be
26  * included in all copies or substantial portions of the Software.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35  *
36  */
37 
38 #ifndef GECODE_GIST_QTGIST_HH
39 #define GECODE_GIST_QTGIST_HH
40 
42 #include <gecode/gist/nodestats.hh>
43 
44 /*
45  * Configure linking
46  *
47  */
48 
49 #if !defined(GIST_STATIC_LIBS) && \
50  (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
51 
52 #ifdef GECODE_BUILD_GIST
53 #define GECODE_GIST_EXPORT __declspec( dllexport )
54 #else
55 #define GECODE_GIST_EXPORT __declspec( dllimport )
56 #endif
57 
58 #else
59 
60 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
61 #define GECODE_GIST_EXPORT __attribute__ ((visibility("default")))
62 #else
63 #define GECODE_GIST_EXPORT
64 #endif
65 
66 #endif
67 
68 // Configure auto-linking
69 #ifndef GECODE_BUILD_GIST
70 #define GECODE_LIBRARY_NAME "Gist"
72 #endif
73 
74 namespace Gecode { namespace Gist {
75 
85  class GECODE_GIST_EXPORT Gist : public QWidget {
86  Q_OBJECT
87  private:
89  TreeCanvas* canvas;
91  QSlider* timeBar;
93  QMenu* contextMenu;
95  QAction* nullSolutionInspector;
97  QMenu* solutionInspectorMenu;
99  QAction* nullDoubleClickInspector;
101  QMenu* doubleClickInspectorMenu;
103  QAction* nullMoveInspector;
105  QMenu* moveInspectorMenu;
107  QAction* nullComparator;
109  QMenu* comparatorMenu;
111  QAction* nullBookmark;
113  QMenu* bookmarksMenu;
115  QMenu* inspectNodeMenu;
117  QMenu* inspectNodeBeforeFPMenu;
119  NodeStatInspector* nodeStatInspector;
120  public:
122  QAction* inspect;
124  QAction* inspectBeforeFP;
126  QAction* stop;
128  QAction* reset;
130  QAction* navUp;
132  QAction* navDown;
134  QAction* navLeft;
136  QAction* navRight;
138  QAction* navRoot;
140  QAction* navNextSol;
142  QAction* navPrevSol;
144  QAction* searchNext;
146  QAction* searchAll;
148  QAction* toggleHidden;
150  QAction* hideFailed;
152  QAction* unhideAll;
154  QAction* zoomToFit;
156  QAction* center;
158  QAction* exportPDF;
162  QAction* print;
163 
165  QAction* bookmarkNode;
167  QAction* compareNode;
171  QAction* setPath;
173  QAction* inspectPath;
175  QAction* showNodeStats;
177  QAction* toggleStop;
179  QAction* unstopAll;
180 
182  QActionGroup* solutionInspectorGroup;
186  QActionGroup* moveInspectorGroup;
188  QActionGroup* comparatorGroup;
190  QActionGroup* bookmarksGroup;
192  QActionGroup* inspectGroup;
194  QActionGroup* inspectBeforeFPGroup;
195  public:
197  Gist(Space* root, bool bab, QWidget* parent, const Options& opt);
199  ~Gist(void);
200 
202  void addDoubleClickInspector(Inspector* i0);
204  void addSolutionInspector(Inspector* i0);
206  void addMoveInspector(Inspector* i0);
208  void addComparator(Comparator* c0);
209 
211  void setAutoHideFailed(bool b);
213  void setAutoZoom(bool b);
215  bool getAutoHideFailed(void);
217  bool getAutoZoom(void);
219  void setShowCopies(bool b);
221  bool getShowCopies(void);
222 
224  void setRefresh(int i);
226  void setRefreshPause(int i);
228  bool getSmoothScrollAndZoom(void);
230  void setSmoothScrollAndZoom(bool b);
231 
233  void setRecompDistances(int c_d, int a_d);
235  int getCd(void);
237  int getAd(void);
238 
240  bool finish(void);
241 
243  void resizeEvent(QResizeEvent*);
244 
245  Q_SIGNALS:
247  void statusChanged(const Statistics&, bool);
248 
250  void solution(const Space*);
251 
253  void searchFinished(void);
254 
255  private Q_SLOTS:
257  void on_canvas_contextMenu(QContextMenuEvent*);
259  void on_canvas_statusChanged(VisualNode*, const Statistics&, bool);
261  void selectDoubleClickInspector(QAction*);
263  void selectSolutionInspector(QAction*);
265  void selectMoveInspector(QAction*);
267  void selectComparator(QAction*);
269  void selectBookmark(QAction*);
271  void addBookmark(const QString& id);
273  void removeBookmark(int idx);
275  void populateInspectors(void);
277  void populateBookmarksMenu(void);
279  void showStats(void);
281  void inspectWithAction(QAction* a);
283  void inspectBeforeFPWithAction(QAction* a);
284  protected:
286  void addInspector(Inspector* i, QAction*& nas, QAction*& nad,
287  QAction*& nam);
288  };
289 
290 }}
291 
292 #endif
293 
294 // STATISTICS: gist-any