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  *  This file is part of Gecode, the generic constraint
10  *  development environment:
11  *     http://www.gecode.org
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining
14  * a copy of this software and associated documentation files (the
15  * "Software"), to deal in the Software without restriction, including
16  * without limitation the rights to use, copy, modify, merge, publish,
17  * distribute, sublicense, and/or sell copies of the Software, and to
18  * permit persons to whom the Software is furnished to do so, subject to
19  * the following conditions:
20  *
21  * The above copyright notice and this permission notice shall be
22  * included in all copies or substantial portions of the Software.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31  *
32  */
33 
34 #ifndef GECODE_GIST_MAINWINDOW_HH
35 #define GECODE_GIST_MAINWINDOW_HH
36 
37 #include <gecode/gist.hh>
38 #include <gecode/gist/qtgist.hh>
39 
40 namespace Gecode { namespace Gist {
41 
42   /// Display information about %Gist
43   class AboutGist : public QDialog {
44   public:
45     /// Constructor
46     AboutGist(QWidget* parent = 0);
47   };
48 
49   /**
50    * \brief Main window for stand-alone %Gist
51    *
52    * \ingroup TaskGist
53    */
54   class GECODE_GIST_EXPORT GistMainWindow : public QMainWindow {
55     Q_OBJECT
56   private:
57     /// Options
58     Options opt;
59     /// Whether search is currently running
60     bool isSearching;
61     /// Measure search time
62     Support::Timer searchTimer;
63     /// Status bar label for maximum depth indicator
64     QLabel* depthLabel;
65     /// Status bar label for number of solutions
66     QLabel* solvedLabel;
67     /// Status bar label for number of failures
68     QLabel* failedLabel;
69     /// Status bar label for number of choices
70     QLabel* choicesLabel;
71     /// Status bar label for number of open nodes
72     QLabel* openLabel;
73     /// Menu for solution inspectors
74     QMenu* solutionInspectorsMenu;
75     /// Menu for double click inspectors
76     QMenu* doubleClickInspectorsMenu;
77     /// Menu for move inspectors
78     QMenu* moveInspectorsMenu;
79     /// Menu for comparators
80     QMenu* comparatorsMenu;
81     /// Menu for bookmarks
82     QMenu* bookmarksMenu;
83     /// Menu for direct node inspection
84     QMenu* inspectNodeMenu;
85     /// Menu for direct node inspection before fixpoint
86     QMenu* inspectNodeBeforeFPMenu;
87     /// Action for activating the preferences menu
88     QAction* prefAction;
89   protected:
90     /// The contained %Gist object
91     Gist* c;
92     /// A menu bar
93     QMenuBar* menuBar;
94     /// About dialog
95     AboutGist aboutGist;
96 
97   protected Q_SLOTS:
98     /// The status has changed (e.g., new solutions have been found)
99     void statusChanged(const Statistics& stats, bool finished);
100     /// Open the about dialog
101     void about(void);
102     /// Open the preferences dialog
103     void preferences(bool setup=false);
104     /// Populate the inspector menus from the actions found in Gist
105     void populateInspectorSelection(void);
106     /// Populate the inspector menus from the actions found in Gist
107     void populateInspectors(void);
108     /// Populate the bookmarks menus from the actions found in Gist
109     void populateBookmarks(void);
110   public:
111     /// Constructor
112     GistMainWindow(Space* root, bool bab, const Options& opt);
113   protected:
114     /// Close Gist
115     void closeEvent(QCloseEvent* event);
116   };
117 
118 }}
119 
120 #endif
121 
122 
123 // STATISTICS: gist-any
124