Generated on Tue May 22 09:39:53 2018 for Gecode by doxygen 1.6.3

qtgist.hh

Go to the documentation of this file.
00001 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
00002 /*
00003  *  Main authors:
00004  *     Guido Tack <tack@gecode.org>
00005  *
00006  *  Copyright:
00007  *     Guido Tack, 2006
00008  *
00009  *  This file is part of Gecode, the generic constraint
00010  *  development environment:
00011  *     http://www.gecode.org
00012  *
00013  * Permission is hereby granted, free of charge, to any person obtaining
00014  * a copy of this software and associated documentation files (the
00015  * "Software"), to deal in the Software without restriction, including
00016  * without limitation the rights to use, copy, modify, merge, publish,
00017  * distribute, sublicense, and/or sell copies of the Software, and to
00018  * permit persons to whom the Software is furnished to do so, subject to
00019  * the following conditions:
00020  *
00021  * The above copyright notice and this permission notice shall be
00022  * included in all copies or substantial portions of the Software.
00023  *
00024  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00025  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00026  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00027  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00028  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00029  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00030  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00031  *
00032  */
00033 
00034 #ifndef GECODE_GIST_QTGIST_HH
00035 #define GECODE_GIST_QTGIST_HH
00036 
00037 #include <gecode/gist/treecanvas.hh>
00038 #include <gecode/gist/nodestats.hh>
00039 
00040 /*
00041  * Configure linking
00042  *
00043  */
00044 
00045 #if !defined(GIST_STATIC_LIBS) && \
00046     (defined(__CYGWIN__) || defined(__MINGW32__) || defined(_MSC_VER))
00047 
00048 #ifdef GECODE_BUILD_GIST
00049 #define GECODE_GIST_EXPORT __declspec( dllexport )
00050 #else
00051 #define GECODE_GIST_EXPORT __declspec( dllimport )
00052 #endif
00053 
00054 #else
00055 
00056 #ifdef GECODE_GCC_HAS_CLASS_VISIBILITY
00057 #define GECODE_GIST_EXPORT __attribute__ ((visibility("default")))
00058 #else
00059 #define GECODE_GIST_EXPORT
00060 #endif
00061 
00062 #endif
00063 
00064 // Configure auto-linking
00065 #ifndef GECODE_BUILD_GIST
00066 #define GECODE_LIBRARY_NAME "Gist"
00067 #include <gecode/support/auto-link.hpp>
00068 #endif
00069 
00070 namespace Gecode {  namespace Gist {
00071 
00081   class GECODE_GIST_EXPORT Gist : public QWidget {
00082     Q_OBJECT
00083   private:
00085     TreeCanvas* canvas;
00087     QSlider* timeBar;
00089     QMenu* contextMenu;
00091     QAction* nullSolutionInspector;
00093     QMenu* solutionInspectorMenu;
00095     QAction* nullDoubleClickInspector;
00097     QMenu* doubleClickInspectorMenu;
00099     QAction* nullMoveInspector;
00101     QMenu* moveInspectorMenu;
00103     QAction* nullComparator;
00105     QMenu* comparatorMenu;
00107     QAction* nullBookmark;
00109     QMenu* bookmarksMenu;
00111     QMenu* inspectNodeMenu;
00113     QMenu* inspectNodeBeforeFPMenu;
00115     NodeStatInspector* nodeStatInspector;
00116   public:
00118     QAction* inspect;
00120     QAction* inspectBeforeFP;
00122     QAction* stop;
00124     QAction* reset;
00126     QAction* navUp;
00128     QAction* navDown;
00130     QAction* navLeft;
00132     QAction* navRight;
00134     QAction* navRoot;
00136     QAction* navNextSol;
00138     QAction* navPrevSol;
00140     QAction* searchNext;
00142     QAction* searchAll;
00144     QAction* toggleHidden;
00146     QAction* hideFailed;
00148     QAction* unhideAll;
00150     QAction* labelBranches;
00152     QAction* labelPath;
00154     QAction* zoomToFit;
00156     QAction* center;
00158     QAction* exportPDF;
00160     QAction* exportWholeTreePDF;
00162     QAction* print;
00163 
00165     QAction* bookmarkNode;
00167     QAction* compareNode;
00169     QAction* compareNodeBeforeFP;
00171     QAction* setPath;
00173     QAction* inspectPath;
00175     QAction* showNodeStats;
00177     QAction* toggleStop;
00179     QAction* unstopAll;
00180 
00182     QActionGroup* solutionInspectorGroup;
00184     QActionGroup* doubleClickInspectorGroup;
00186     QActionGroup* moveInspectorGroup;
00188     QActionGroup* comparatorGroup;
00190     QActionGroup* bookmarksGroup;
00192     QActionGroup* inspectGroup;
00194     QActionGroup* inspectBeforeFPGroup;
00195   public:
00197     Gist(Space* root, bool bab, QWidget* parent, const Options& opt);
00199     ~Gist(void);
00200 
00202     void addDoubleClickInspector(Inspector* i0);
00204     void addSolutionInspector(Inspector* i0);
00206     void addMoveInspector(Inspector* i0);
00208     void addComparator(Comparator* c0);
00209 
00211     void setAutoHideFailed(bool b);
00213     void setAutoZoom(bool b);
00215     bool getAutoHideFailed(void);
00217     bool getAutoZoom(void);
00219     void setShowCopies(bool b);
00221     bool getShowCopies(void);
00222 
00224     void setRefresh(int i);
00226     void setRefreshPause(int i);
00228     bool getSmoothScrollAndZoom(void);
00230     void setSmoothScrollAndZoom(bool b);
00232     bool getMoveDuringSearch(void);
00234     void setMoveDuringSearch(bool b);
00235 
00237     void setRecompDistances(int c_d, int a_d);
00239     int getCd(void);
00241     int getAd(void);
00242 
00244     bool finish(void);
00245 
00247     void resizeEvent(QResizeEvent*);
00248 
00249   Q_SIGNALS:
00251     void statusChanged(const Statistics&, bool);
00252 
00254     void solution(const Space*);
00255 
00257     void searchFinished(void);
00258 
00259   private Q_SLOTS:
00261     void on_canvas_contextMenu(QContextMenuEvent*);
00263     void on_canvas_statusChanged(VisualNode*, const Statistics&, bool);
00265     void selectDoubleClickInspector(QAction*);
00267     void selectSolutionInspector(QAction*);
00269     void selectMoveInspector(QAction*);
00271     void selectComparator(QAction*);
00273     void selectBookmark(QAction*);
00275     void addBookmark(const QString& id);
00277     void removeBookmark(int idx);
00279     void populateInspectors(void);
00281     void populateBookmarksMenu(void);
00283     void showStats(void);
00285     void inspectWithAction(QAction* a);
00287     void inspectBeforeFPWithAction(QAction* a);
00288   protected:
00290     void addInspector(Inspector* i, QAction*& nas, QAction*& nad,
00291                       QAction*& nam);
00292   };
00293 
00294 }}
00295 
00296 #endif
00297 
00298 // STATISTICS: gist-any