SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SCIRunMainWindow.h
Go to the documentation of this file.
1 /*
2  For more information, please see: http://software.sci.utah.edu
3 
4  The MIT License
5 
6  Copyright (c) 2012 Scientific Computing and Imaging Institute,
7  University of Utah.
8 
9  License for the specific language governing rights and limitations under
10  Permission is hereby granted, free of charge, to any person obtaining a
11  copy of this software and associated documentation files (the "Software"),
12  to deal in the Software without restriction, including without limitation
13  the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  and/or sell copies of the Software, and to permit persons to whom the
15  Software is furnished to do so, subject to the following conditions:
16 
17  The above copyright notice and this permission notice shall be included
18  in all copies or substantial portions of the Software.
19 
20  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  DEALINGS IN THE SOFTWARE.
27 */
28 
29 #ifndef INTERFACE_APPLICATION_SCIRUN_MAIN_WINDOW_H
30 #define INTERFACE_APPLICATION_SCIRUN_MAIN_WINDOW_H
31 
32 #include <QDialog>
33 #include <QDir>
34 #include <boost/shared_ptr.hpp>
35 #include <boost/variant.hpp>
37 #include "ui_SCIRunMainWindow.h"
38 
39 namespace SCIRun {
40  namespace Dataflow {
41  namespace Engine {
42  class NetworkEditorController;
43  }}}
44 
45 namespace SCIRun {
46 namespace Gui {
47 
48 class NetworkEditor;
49 class ProvenanceWindow;
50 class DeveloperConsole;
51 class PreferencesWindow;
53 
54 typedef boost::variant<QAction*, QWidget*> InputWidget;
55 
56 class SCIRunMainWindow : public QMainWindow, public Ui::SCIRunMainWindow
57 {
58  Q_OBJECT
59 public:
60  static SCIRunMainWindow* Instance();
61  void setController(boost::shared_ptr<SCIRun::Dataflow::Engine::NetworkEditorController> controller);
62  void initialize();
63 
64  //command access: extract an interface
65  void saveNetworkFile(const QString& fileName);
66  void loadNetworkFile(const QString& filename);
67  void setupQuitAfterExecute();
68  void quit();
69  void runPythonScript(const QString& scriptFileName);
70 
71 public Q_SLOTS:
72  void executeAll();
73 protected:
74  virtual void closeEvent(QCloseEvent* event);
75 private:
76  static SCIRunMainWindow* instance_;
78  NetworkEditor* networkEditor_;
79  ProvenanceWindow* provenanceWindow_;
80  DeveloperConsole* devConsole_;
81  PreferencesWindow* prefs_;
82  PythonConsoleWidget* pythonConsole_;
83  QActionGroup* filterActionGroup_;
84  QAction* actionEnterWhatsThisMode_;
85  QStringList favoriteModuleNames_;
86 
87 private:
88  void postConstructionSignalHookup();
89  void executeCommandLineRequests();
90  bool okToContinue();
91  void setCurrentFile(const QString& fileName);
92  void updateRecentFileActions();
93  QString strippedName(const QString& fullFileName);
94  void setActionIcons();
95  void makeFilterButtonMenu();
96  void writeSettings();
97  void readSettings();
98  void setupNetworkEditor();
99  void setupProvenanceWindow();
100  void setupDevConsole();
101  void setupPreferencesWindow();
102  void setupPythonConsole();
103  void fillModuleSelector();
104  void setupInputWidgets();
105  enum { MaxRecentFiles = 5 }; //TODO: could be a user setting
106  std::vector<QAction*> recentFileActions_;
107  QStringList recentFiles_;
108  QString currentFile_;
109  QDir latestNetworkDirectory_;
110  bool firstTimePythonShown_;
111  boost::shared_ptr<class DialogErrorControl> dialogErrorControl_;
112  boost::shared_ptr<class NetworkExecutionProgressBar> networkProgressBar_;
113  boost::shared_ptr<class GuiActionProvenanceConverter> commandConverter_;
114  boost::shared_ptr<class DefaultNotePositionGetter> defaultNotePositionGetter_;
115  std::vector<InputWidget> inputWidgets_;
116 Q_SIGNALS:
119 private Q_SLOTS:
120  void saveNetworkAs();
121  void saveNetwork();
122  void loadNetwork();
123  void loadRecentNetwork();
124  bool newNetwork();
125  void runScript();
126  void networkModified();
127  void filterModuleNamesInTreeView(const QString& start);
128  void makePipesEuclidean();
129  void makePipesCubicBezier();
130  void makePipesManhattan();
131  void disableInputWidgets();
132  void enableInputWidgets();
133  void chooseBackgroundColor();
134  void resetBackgroundColor();
135  void filterDoubleClickedModuleSelectorItem(QTreeWidgetItem* item);
136  void handleCheckedModuleEntry(QTreeWidgetItem* item, int column);
137  void setExecutor(int type);
138  void readDefaultNotePosition(int index);
139  void updateMiniView();
140  void showPythonWarning(bool visible);
141  void makeModulesLargeSize();
142  void makeModulesSmallSize();
143  void displayAcknowledgement();
144  void exitApplication(int code);
145 };
146 
147 }
148 }
149 #endif
void defaultNotePositionChanged(NotePosition position)
boost::variant< QAction *, QWidget * > InputWidget
Definition: SCIRunMainWindow.h:52
void setupQuitAfterExecute()
Definition: SCIRunMainWindow.cc:316
Definition: PreferencesWindow.h:39
void loadNetworkFile(const QString &filename)
Definition: SCIRunMainWindow.cc:373
void initialize()
Definition: SCIRunMainWindow.cc:215
void runPythonScript(const QString &scriptFileName)
Definition: SCIRunMainWindow.cc:793
NotePosition
Definition: Note.h:47
Definition: DeveloperConsole.h:39
void setController(boost::shared_ptr< SCIRun::Dataflow::Engine::NetworkEditorController > controller)
Definition: SCIRunMainWindow.cc:278
Definition: NetworkEditor.h:104
static SCIRunMainWindow * Instance()
Definition: SCIRunMainWindow.cc:269
void executeAll()
Definition: SCIRunMainWindow.cc:306
void saveNetworkFile(const QString &fileName)
Definition: SCIRunMainWindow.cc:348
virtual void closeEvent(QCloseEvent *event)
Definition: SCIRunMainWindow.cc:467
Definition: SCIRunMainWindow.h:56
Definition: PythonConsoleWidget.h:62
void quit()
Definition: SCIRunMainWindow.cc:328
Definition: ProvenanceWindow.h:44