qtgist.hh
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef GECODE_GIST_QTGIST_HH
00039 #define GECODE_GIST_QTGIST_HH
00040
00041 #include <gecode/gist/treecanvas.hh>
00042 #include <gecode/gist/nodestats.hh>
00043
00044
00045
00046
00047
00048
00049 #if !defined(GIST_STATIC_LIBS) && \
00050 (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
00051
00052 #ifdef GECODE_BUILD_GIST
00053 #define GECODE_GIST_EXPORT __declspec( dllexport )
00054 #else
00055 #define GECODE_GIST_EXPORT __declspec( dllimport )
00056 #endif
00057
00058 #else
00059
00060 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
00061 #define GECODE_GIST_EXPORT __attribute__ ((visibility("default")))
00062 #else
00063 #define GECODE_GIST_EXPORT
00064 #endif
00065
00066 #endif
00067
00068
00069 #ifndef GECODE_BUILD_GIST
00070 #define GECODE_LIBRARY_NAME "Gist"
00071 #include <gecode/support/auto-link.hpp>
00072 #endif
00073
00074 namespace Gecode { namespace Gist {
00075
00085 class GECODE_GIST_EXPORT Gist : public QWidget {
00086 Q_OBJECT
00087 private:
00089 TreeCanvas* canvas;
00091 QSlider* timeBar;
00093 QMenu* contextMenu;
00095 QAction* nullSolutionInspector;
00097 QMenu* solutionInspectorMenu;
00099 QAction* nullDoubleClickInspector;
00101 QMenu* doubleClickInspectorMenu;
00103 QAction* nullMoveInspector;
00105 QMenu* moveInspectorMenu;
00107 QAction* nullComparator;
00109 QMenu* comparatorMenu;
00111 QAction* nullBookmark;
00113 QMenu* bookmarksMenu;
00115 QMenu* inspectNodeMenu;
00117 QMenu* inspectNodeBeforeFPMenu;
00119 NodeStatInspector* nodeStatInspector;
00120 public:
00122 QAction* inspect;
00124 QAction* inspectBeforeFP;
00126 QAction* stop;
00128 QAction* reset;
00130 QAction* navUp;
00132 QAction* navDown;
00134 QAction* navLeft;
00136 QAction* navRight;
00138 QAction* navRoot;
00140 QAction* navNextSol;
00142 QAction* navPrevSol;
00144 QAction* searchNext;
00146 QAction* searchAll;
00148 QAction* toggleHidden;
00150 QAction* hideFailed;
00152 QAction* unhideAll;
00154 QAction* labelBranches;
00156 QAction* labelPath;
00158 QAction* zoomToFit;
00160 QAction* center;
00162 QAction* exportPDF;
00164 QAction* exportWholeTreePDF;
00166 QAction* print;
00167
00169 QAction* bookmarkNode;
00171 QAction* compareNode;
00173 QAction* compareNodeBeforeFP;
00175 QAction* setPath;
00177 QAction* inspectPath;
00179 QAction* showNodeStats;
00181 QAction* toggleStop;
00183 QAction* unstopAll;
00184
00186 QActionGroup* solutionInspectorGroup;
00188 QActionGroup* doubleClickInspectorGroup;
00190 QActionGroup* moveInspectorGroup;
00192 QActionGroup* comparatorGroup;
00194 QActionGroup* bookmarksGroup;
00196 QActionGroup* inspectGroup;
00198 QActionGroup* inspectBeforeFPGroup;
00199 public:
00201 Gist(Space* root, bool bab, QWidget* parent, const Options& opt);
00203 ~Gist(void);
00204
00206 void addDoubleClickInspector(Inspector* i0);
00208 void addSolutionInspector(Inspector* i0);
00210 void addMoveInspector(Inspector* i0);
00212 void addComparator(Comparator* c0);
00213
00215 void setAutoHideFailed(bool b);
00217 void setAutoZoom(bool b);
00219 bool getAutoHideFailed(void);
00221 bool getAutoZoom(void);
00223 void setShowCopies(bool b);
00225 bool getShowCopies(void);
00226
00228 void setRefresh(int i);
00230 void setRefreshPause(int i);
00232 bool getSmoothScrollAndZoom(void);
00234 void setSmoothScrollAndZoom(bool b);
00236 bool getMoveDuringSearch(void);
00238 void setMoveDuringSearch(bool b);
00239
00241 void setRecompDistances(int c_d, int a_d);
00243 int getCd(void);
00245 int getAd(void);
00246
00248 bool finish(void);
00249
00251 void resizeEvent(QResizeEvent*);
00252
00253 Q_SIGNALS:
00255 void statusChanged(const Statistics&, bool);
00256
00258 void solution(const Space*);
00259
00261 void searchFinished(void);
00262
00263 private Q_SLOTS:
00265 void on_canvas_contextMenu(QContextMenuEvent*);
00267 void on_canvas_statusChanged(VisualNode*, const Statistics&, bool);
00269 void selectDoubleClickInspector(QAction*);
00271 void selectSolutionInspector(QAction*);
00273 void selectMoveInspector(QAction*);
00275 void selectComparator(QAction*);
00277 void selectBookmark(QAction*);
00279 void addBookmark(const QString& id);
00281 void removeBookmark(int idx);
00283 void populateInspectors(void);
00285 void populateBookmarksMenu(void);
00287 void showStats(void);
00289 void inspectWithAction(QAction* a);
00291 void inspectBeforeFPWithAction(QAction* a);
00292 protected:
00294 void addInspector(Inspector* i, QAction*& nas, QAction*& nad,
00295 QAction*& nam);
00296 };
00297
00298 }}
00299
00300 #endif
00301
00302