Slicer  4.10
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qSlicerMainWindow.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright (c) Kitware Inc.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16  This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
17  and was partially funded by NIH grant 3P41RR013218-12S1
18 
19 ==============================================================================*/
20 
21 #ifndef __qSlicerMainWindow_h
22 #define __qSlicerMainWindow_h
23 
24 // Qt includes
25 #include <QMainWindow>
26 #include <QVariantMap>
27 
28 // CTK includes
29 #include <ctkErrorLogModel.h>
30 class ctkErrorLogWidget;
31 class ctkPythonConsole;
32 
33 // Slicer includes
34 #include "qSlicerBaseQTAppExport.h"
35 #include "qSlicerIO.h"
36 #include "vtkSlicerConfigure.h" // For Slicer_BUILD_DICOM_SUPPORT, Slicer_USE_PYTHONQT, Slicer_USE_QtTesting
37 
39 class qSlicerMainWindowPrivate;
40 
41 // VTK includes
42 class vtkObject;
43 
44 class Q_SLICER_BASE_QTAPP_EXPORT qSlicerMainWindow : public QMainWindow
45 {
46  Q_OBJECT
47 public:
48  typedef QMainWindow Superclass;
49 
50  qSlicerMainWindow(QWidget *parent=0);
51  virtual ~qSlicerMainWindow();
52 
56  Q_INVOKABLE qSlicerModuleSelectorToolBar* moduleSelector()const;
57 
58 #ifdef Slicer_USE_PYTHONQT
59  Q_INVOKABLE ctkPythonConsole* pythonConsole()const;
62 #endif
63  Q_INVOKABLE ctkErrorLogWidget* errorLogWidget()const;
66 
67 public slots:
68  virtual void setHomeModuleCurrent();
69  virtual void restoreToolbars();
70 
71  virtual void on_FileAddDataAction_triggered();
72  virtual void on_FileLoadDataAction_triggered();
73  virtual void on_FileImportSceneAction_triggered();
74  virtual void on_FileLoadSceneAction_triggered();
75  virtual void on_FileAddVolumeAction_triggered();
76  virtual void on_FileAddTransformAction_triggered();
77  virtual void on_FileSaveSceneAction_triggered();
78  virtual void on_FileExitAction_triggered();
79  virtual void onFileRecentLoadedActionTriggered();
80  virtual void on_SDBSaveToDirectoryAction_triggered();
81  virtual void on_SDBSaveToMRBAction_triggered();
82  virtual void on_SDBSaveToDCMAction_triggered();
83  virtual void on_FileCloseSceneAction_triggered();
84  virtual void on_LoadDICOMAction_triggered();
85 
86  virtual void on_EditRecordMacroAction_triggered();
87  virtual void on_EditPlayMacroAction_triggered();
88  virtual void on_EditUndoAction_triggered();
89  virtual void on_EditRedoAction_triggered();
90 
91  virtual void on_ModuleHomeAction_triggered();
92 
93  virtual void onLayoutActionTriggered(QAction* action);
94  virtual void onLayoutCompareActionTriggered(QAction* action);
95  virtual void onLayoutCompareWidescreenActionTriggered(QAction* action);
96  virtual void onLayoutCompareGridActionTriggered(QAction* action);
97 
98  virtual void setLayout(int);
99  virtual void setLayoutNumberOfCompareViewRows(int);
100  virtual void setLayoutNumberOfCompareViewColumns(int);
101 
102  virtual void onPythonConsoleToggled(bool);
103 
104  virtual void on_WindowErrorLogAction_triggered();
105  virtual void on_WindowToolbarsResetToDefaultAction_triggered();
106 
107  virtual void on_EditApplicationSettingsAction_triggered();
108  virtual void on_CutAction_triggered();
109  virtual void on_CopyAction_triggered();
110  virtual void on_PasteAction_triggered();
111  virtual void on_ViewExtensionsManagerAction_triggered();
112 
113 signals:
116  void initialWindowShown();
117 
118 protected slots:
119  virtual void onModuleLoaded(const QString& moduleName);
120  virtual void onModuleAboutToBeUnloaded(const QString& moduleName);
121  virtual void onNewFileLoaded(const qSlicerIO::IOProperties &fileProperties);
122 
123  virtual void onMRMLSceneModified(vtkObject*);
124  virtual void onLayoutChanged(int);
125  virtual void onWarningsOrErrorsOccurred(ctkErrorLogLevel::LogLevel logLevel);
126 
127 #ifdef Slicer_USE_PYTHONQT
128  virtual void onPythonConsoleUserInput(const QString&);
129 #endif
130 
131 protected:
133  virtual void setupMenuActions();
134 
136  virtual void pythonConsoleInitialDisplay();
137 
139  virtual void disclaimer();
140 
144  virtual void dragEnterEvent(QDragEnterEvent *event);
145 
148  virtual void dropEvent(QDropEvent *event);
149 
156  virtual bool eventFilter(QObject* object, QEvent* event);
157 
158  virtual void closeEvent(QCloseEvent *event);
159  virtual void showEvent(QShowEvent *event);
160 
161 protected:
162  QScopedPointer<qSlicerMainWindowPrivate> d_ptr;
163 
164  qSlicerMainWindow(qSlicerMainWindowPrivate* pimpl, QWidget* parent);
165 
166 private:
167  Q_DECLARE_PRIVATE(qSlicerMainWindow);
168  Q_DISABLE_COPY(qSlicerMainWindow);
169 };
170 
171 #endif
QMainWindow Superclass
QScopedPointer< qSlicerMainWindowPrivate > d_ptr