Generated on Thu Mar 22 10:39:32 2012 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  *  Last modified:
00010  *     $Date: 2010-08-12 10:29:27 +0200 (Thu, 12 Aug 2010) $ by $Author: tack $
00011  *     $Revision: 11346 $
00012  *
00013  *  This file is part of Gecode, the generic constraint
00014  *  development environment:
00015  *     http://www.gecode.org
00016  *
00017  * Permission is hereby granted, free of charge, to any person obtaining
00018  * a copy of this software and associated documentation files (the
00019  * "Software"), to deal in the Software without restriction, including
00020  * without limitation the rights to use, copy, modify, merge, publish,
00021  * distribute, sublicense, and/or sell copies of the Software, and to
00022  * permit persons to whom the Software is furnished to do so, subject to
00023  * the following conditions:
00024  *
00025  * The above copyright notice and this permission notice shall be
00026  * included in all copies or substantial portions of the Software.
00027  *
00028  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00029  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00030  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00031  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
00032  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
00033  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00034  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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  * Configure linking
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 // Configure auto-linking
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* 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);
00231 
00233     void setRecompDistances(int c_d, int a_d);
00235     int getCd(void);
00237     int getAd(void);
00238 
00240     bool finish(void);
00241 
00243     void resizeEvent(QResizeEvent*);
00244 
00245   Q_SIGNALS:
00247     void statusChanged(const Statistics&, bool);
00248 
00250     void solution(const Space*);
00251 
00253     void searchFinished(void);
00254 
00255   private Q_SLOTS:
00257     void on_canvas_contextMenu(QContextMenuEvent*);
00259     void on_canvas_statusChanged(VisualNode*, const Statistics&, bool);
00261     void selectDoubleClickInspector(QAction*);
00263     void selectSolutionInspector(QAction*);
00265     void selectMoveInspector(QAction*);
00267     void selectComparator(QAction*);
00269     void selectBookmark(QAction*);
00271     void addBookmark(const QString& id);
00273     void removeBookmark(int idx);
00275     void populateInspectors(void);
00277     void populateBookmarksMenu(void);
00279     void showStats(void);
00281     void inspectWithAction(QAction* a);
00283     void inspectBeforeFPWithAction(QAction* a);
00284   protected:
00286     void addInspector(Inspector* i, QAction*& nas, QAction*& nad,
00287                       QAction*& nam);
00288   };
00289 
00290 }}
00291 
00292 #endif
00293 
00294 // STATISTICS: gist-any