Fraxinus  16.5.0-fx-rc6
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxMainWindow.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 #ifndef CXMAINWINDOW_H_
34 #define CXMAINWINDOW_H_
35 
36 #include "cxGuiExport.h"
37 
38 #include <QMainWindow>
39 #include <map>
40 #include <set>
41 #include "boost/shared_ptr.hpp"
42 #include "cxGUIExtenderService.h"
43 #include <QPointer>
45 
46 class QAction;
47 class QMenu;
48 class QActionGroup;
49 class QDockWidget;
50 class QScrollArea;
51 
52 namespace cx
53 {
54 class LayoutData;
55 class GUIExtenderService;
56 class ConsoleWidget;
57 class DynamicMainWindowWidgets;
59 
60 typedef boost::shared_ptr<class CameraControl> CameraControlPtr;
61 typedef boost::shared_ptr<class LayoutInteractor> LayoutInteractorPtr;
62 typedef boost::shared_ptr<class VisServices> VisServicesPtr;
63 typedef boost::shared_ptr<class ProcessWrapper> ProcessWrapperPtr;
64 
65 
77 class cxGui_EXPORT MainWindow: public QMainWindow
78 {
79  Q_OBJECT
80 
81 public:
82  MainWindow();
83  virtual ~MainWindow();
84 
85  virtual QMenu* createPopupMenu();
86 
87 protected slots:
88  void patientChangedSlot();
89 
90  //application menu
91  void aboutSlot();
92  void preferencesSlot();
93  void toggleFullScreenSlot();
94 
95  void showControlPanelActionSlot();
96  void showSecondaryViewLayoutWindowActionSlot();
97 
98  // application
99  void onApplicationStateChangedSlot();
100 
101  //workflow
102  void onWorkflowStateChangedSlot();
103  void saveDesktopSlot();
104  void resetDesktopSlot();
105 
106  // help
107  void onShowContextSentitiveHelp();
108 
109  void dockWidgetVisibilityChanged(bool val);
110  void focusChanged(QWidget * old, QWidget * now);
111 
112  void onGUIExtenderServiceAdded(GUIExtenderService* service);
113  void onGUIExtenderServiceRemoved(GUIExtenderService* service);
114  void onGUIExtenderServiceModified(GUIExtenderService* service);
115 
116 protected:
117  void changeEvent(QEvent * event);
118 
119 private:
120  void focusInsideDockWidget(QObject* dockWidget);
121  LayoutInteractorPtr mLayoutInteractor;
122  void updateWindowTitle();
123  void createActions();
124  void createMenus();
125  void createToolBars();
126 
127  QToolBar *registerToolBar(QString name, QString groupname="Toolbars");
128  void setupGUIExtenders();
129 
130  void closeEvent(QCloseEvent *event);
131  QDockWidget* addAsDockWidget(QWidget* widget, QString groupname);
132 
133  //menus
134  QMenu* mFileMenu;
135  QMenu* mWorkflowMenu;
136  QMenu* mToolMenu;
137  QMenu* mLayoutMenu;
138  QMenu* mNavigationMenu;
139  QMenu* mHelpMenu;
140  QAction* mHelpMenuAction;
141 
142  //actions and actiongroups
143  QAction* mAboutAction;
144  QAction* mPreferencesAction;
145  QAction* mFullScreenAction;
146  QAction* mQuitAction;
147 
148  QAction* mShowControlPanelAction;
149  QAction* mSecondaryViewLayoutWindowAction;
150 
151  QActionGroup* mStandard3DViewActions;
152 
153  QAction* mShowContextSensitiveHelpAction;
154  QActionGroup* mInteractorStyleActionGroup;
155 
156  //desktop actions
157  QAction* mSaveDesktopAction;
158  QAction* mResetDesktopAction;
159 
160  //toolbars
161  QToolBar* mDataToolBar;
162  QToolBar* mToolToolBar;
163  QToolBar* mNavigationToolBar;
164  QToolBar* mInteractorStyleToolBar;
165  QToolBar* mWorkflowToolBar;
166  QToolBar* mDesktopToolBar;
167  QToolBar* mHelpToolBar;
168  QToolBar* mScreenshotToolBar;
169 
170  boost::shared_ptr<ServiceTrackerListener<GUIExtenderService> > mServiceListener;
171 
172  //widgets
173  QPointer<class SecondaryMainWindow> mControlPanel;
174  QPointer<class SecondaryViewLayoutWindow> mSecondaryViewLayoutWindow;
175 
176  DynamicMainWindowWidgets* mDockWidgets;
177  MainWindowActions* mActions;
178 
179  VisServicesPtr mServices;
180 };
181 
182 }//namespace cx
183 
184 #endif /* CXMAINWINDOW_H_ */
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:62
This is the main gui class which controls the workflow.
Definition: cxMainWindow.h:77
boost::shared_ptr< class LayoutInteractor > LayoutInteractorPtr
boost::shared_ptr< class ProcessWrapper > ProcessWrapperPtr
Definition: cxMainWindow.h:63
boost::shared_ptr< class CameraControl > CameraControlPtr
Definition: cxMainWindow.h:58