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: 2009-05-14 10:44:50 +0200 (Thu, 14 May 2009) $ by $Author: tack $ 00011 * $Revision: 9107 $ 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 namespace Gecode { namespace Gist { 00045 00055 class Gist : public QWidget { 00056 Q_OBJECT 00057 private: 00059 TreeCanvas* canvas; 00061 QSlider* timeBar; 00063 QMenu* contextMenu; 00065 QAction* nullSolutionInspector; 00067 QMenu* solutionInspectorMenu; 00069 QAction* nullDoubleClickInspector; 00071 QMenu* doubleClickInspectorMenu; 00073 NodeStatInspector* nodeStatInspector; 00074 public: 00076 QAction* inspect; 00078 QAction* stop; 00080 QAction* reset; 00082 QAction* navUp; 00084 QAction* navDown; 00086 QAction* navLeft; 00088 QAction* navRight; 00090 QAction* navRoot; 00092 QAction* navNextSol; 00094 QAction* navPrevSol; 00096 QAction* searchNext; 00098 QAction* searchAll; 00100 QAction* toggleHidden; 00102 QAction* hideFailed; 00104 QAction* unhideAll; 00106 QAction* zoomToFit; 00108 QAction* center; 00110 QAction* exportPDF; 00112 QAction* exportWholeTreePDF; 00114 QAction* print; 00115 00117 QAction* setPath; 00119 QAction* inspectPath; 00121 QAction* showNodeStats; 00122 00124 QActionGroup* solutionInspectorGroup; 00126 QActionGroup* doubleClickInspectorGroup; 00127 public: 00129 Gist(Space* root, bool bab, QWidget* parent, const Options& opt); 00131 ~Gist(void); 00132 00134 void addDoubleClickInspector(Inspector* i0); 00136 void addSolutionInspector(Inspector* i0); 00137 00139 void setAutoHideFailed(bool b); 00141 void setAutoZoom(bool b); 00143 bool getAutoHideFailed(void); 00145 bool getAutoZoom(void); 00147 void setShowCopies(bool b); 00149 bool getShowCopies(void); 00150 00152 void setRefresh(int i); 00154 bool getSmoothScrollAndZoom(void); 00156 void setSmoothScrollAndZoom(bool b); 00157 00159 void setRecompDistances(int c_d, int a_d); 00161 int getCd(void); 00163 int getAd(void); 00164 00166 bool finish(void); 00167 00169 void resizeEvent(QResizeEvent*); 00170 00171 Q_SIGNALS: 00173 void statusChanged(const Statistics&, bool); 00174 00176 void solution(const Space*); 00177 00179 void finished(void); 00180 00181 private Q_SLOTS: 00183 void on_canvas_contextMenu(QContextMenuEvent*); 00185 void on_canvas_statusChanged(VisualNode*, const Statistics&, bool); 00187 void selectDoubleClickInspector(QAction*); 00189 void selectSolutionInspector(QAction*); 00191 void showStats(void); 00192 protected: 00194 void addInspector(Inspector* i, bool solutionInspector); 00195 }; 00196 00197 }} 00198 00199 #endif 00200 00201 // STATISTICS: gist-any