NorMIT-nav  16.5
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  void delayedShow();
90 
91  //application menu
92  void aboutSlot();
93  void preferencesSlot();
94  void toggleFullScreenSlot();
95 
96  void showControlPanelActionSlot();
97  void showSecondaryViewLayoutWindowActionSlot();
98 
99  // application
100  void onApplicationStateChangedSlot();
101 
102  //workflow
103  void onWorkflowStateChangedSlot();
104  void saveDesktopSlot();
105  void resetDesktopSlot();
106 
107  // help
108  void onShowContextSentitiveHelp();
109 
110  void dockWidgetVisibilityChanged(bool val);
111  void focusChanged(QWidget * old, QWidget * now);
112 
113  void onGUIExtenderServiceAdded(GUIExtenderService* service);
114  void onGUIExtenderServiceRemoved(GUIExtenderService* service);
115  void onGUIExtenderServiceModified(GUIExtenderService* service);
116 
117 protected:
118  void changeEvent(QEvent * event);
119 
120 private:
121  void focusInsideDockWidget(QObject* dockWidget);
122  LayoutInteractorPtr mLayoutInteractor;
123  void updateWindowTitle();
124  void createActions();
125  void createMenus();
126  void createToolBars();
127 
128  QToolBar *registerToolBar(QString name, QString groupname="Toolbars");
129  void setupGUIExtenders();
130 
131  void closeEvent(QCloseEvent *event);
132  QDockWidget* addAsDockWidget(QWidget* widget, QString groupname);
133 
134  //menus
135  QMenu* mFileMenu;
136  QMenu* mWorkflowMenu;
137  QMenu* mToolMenu;
138  QMenu* mLayoutMenu;
139  QMenu* mNavigationMenu;
140  QMenu* mHelpMenu;
141  QAction* mHelpMenuAction;
142 
143  //actions and actiongroups
144  QAction* mAboutAction;
145  QAction* mPreferencesAction;
146  QAction* mFullScreenAction;
147  QAction* mQuitAction;
148 
149  QAction* mShowControlPanelAction;
150  QAction* mSecondaryViewLayoutWindowAction;
151 
152  QActionGroup* mStandard3DViewActions;
153 
154  QAction* mShowContextSensitiveHelpAction;
155  QActionGroup* mInteractorStyleActionGroup;
156 
157  //desktop actions
158  QAction* mSaveDesktopAction;
159  QAction* mResetDesktopAction;
160 
161  //toolbars
162  QToolBar* mDataToolBar;
163  QToolBar* mToolToolBar;
164  QToolBar* mNavigationToolBar;
165  QToolBar* mInteractorStyleToolBar;
166  QToolBar* mWorkflowToolBar;
167  QToolBar* mDesktopToolBar;
168  QToolBar* mHelpToolBar;
169  QToolBar* mScreenshotToolBar;
170 
171  boost::shared_ptr<ServiceTrackerListener<GUIExtenderService> > mServiceListener;
172 
173  //widgets
174  QPointer<class SecondaryMainWindow> mControlPanel;
175  QPointer<class SecondaryViewLayoutWindow> mSecondaryViewLayoutWindow;
176 
177  DynamicMainWindowWidgets* mDockWidgets;
178  MainWindowActions* mActions;
179 
180  VisServicesPtr mServices;
181 };
182 
183 }//namespace cx
184 
185 #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