CustusX  22.04-rc5
An IGT application
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) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #ifndef CXMAINWINDOW_H_
13 #define CXMAINWINDOW_H_
14 
15 #include "cxGuiExport.h"
16 
17 #include <QMainWindow>
18 #include <map>
19 #include <set>
20 #include "boost/shared_ptr.hpp"
21 #include "cxGUIExtenderService.h"
22 #include <QPointer>
24 
25 class QAction;
26 class QMenu;
27 class QActionGroup;
28 class QDockWidget;
29 class QScrollArea;
30 
31 namespace cx
32 {
33 class LayoutData;
34 class GUIExtenderService;
35 class ConsoleWidget;
36 class DynamicMainWindowWidgets;
37 class MainWindowActions;
38 
39 typedef boost::shared_ptr<class LayoutInteractor> LayoutInteractorPtr;
40 typedef boost::shared_ptr<class VisServices> VisServicesPtr;
41 typedef boost::shared_ptr<class ProcessWrapper> ProcessWrapperPtr;
42 
43 
55 class cxGui_EXPORT MainWindow: public QMainWindow
56 {
57  Q_OBJECT
58 
59 public:
60  MainWindow();
61  virtual ~MainWindow();
62 
63  virtual QMenu* createPopupMenu();
64 
65 protected slots:
66  void patientChangedSlot();
67  void delayedShow();
68 
69  //application menu
70  void aboutSlot();
71  void preferencesSlot();
72  void toggleFullScreenSlot();
73 
74  void showControlPanelActionSlot();
75  void showSecondaryViewLayoutWindowActionSlot();
76 
77  // application
78  void onApplicationStateChangedSlot();
79 
80  //workflow
81  void onWorkflowStateChangedSlot();
82  void saveDesktopSlot();
83  void resetDesktopSlot();
84 
85  // help
86  void onShowContextSentitiveHelp();
87 
88  void dockWidgetVisibilityChanged(bool val);
89  void focusChanged(QWidget * old, QWidget * now);
90 
91  void onGUIExtenderServiceAdded(GUIExtenderService* service);
92  void onGUIExtenderServiceRemoved(GUIExtenderService* service);
93  void onGUIExtenderServiceModified(GUIExtenderService* service);
94 
95 protected:
96  void changeEvent(QEvent * event);
97 
98 private:
99  void focusInsideDockWidget(QObject* dockWidget);
100  LayoutInteractorPtr mLayoutInteractor;
101  void updateWindowTitle();
102  void createActions();
103  void createMenus();
104  void createToolBars();
105 
106  QToolBar *registerToolBar(QString name, QString groupname="Toolbars");
107  void setupGUIExtenders();
108 
109  void closeEvent(QCloseEvent *event);
110  QDockWidget* addAsDockWidget(QWidget* widget, QString groupname);
111 
112  //menus
113  QMenu* mFileMenu;
114  QMenu* mWorkflowMenu;
115  QMenu* mToolMenu;
116  QMenu* mLayoutMenu;
117  QMenu* mNavigationMenu;
118  QMenu* mHelpMenu;
119  QAction* mHelpMenuAction;
120 
121  //actions and actiongroups
122  QAction* mAboutAction;
123  QAction* mPreferencesAction;
124  QAction* mFullScreenAction;
125  QAction* mQuitAction;
126 
127  QAction* mShowControlPanelAction;
128  QAction* mSecondaryViewLayoutWindowAction;
129 
130  QActionGroup* mStandard3DViewActions;
131 
132  QAction* mShowContextSensitiveHelpAction;
133  QActionGroup* mInteractorStyleActionGroup;
134 
135  //desktop actions
136  QAction* mSaveDesktopAction;
137  QAction* mResetDesktopAction;
138 
139  //toolbars
140  QToolBar* mDataToolBar;
141  QToolBar* mToolToolBar;
142  QToolBar* mNavigationToolBar;
143  QToolBar* mInteractorStyleToolBar;
144  QToolBar* mWorkflowToolBar;
145  QToolBar* mDesktopToolBar;
146  QToolBar* mHelpToolBar;
147  QToolBar* mScreenshotToolBar;
148 
149  boost::shared_ptr<ServiceTrackerListener<GUIExtenderService> > mServiceListener;
150 
151  //widgets
152  QPointer<class SecondaryMainWindow> mControlPanel;
153  QPointer<class SecondaryViewLayoutWindow> mSecondaryViewLayoutWindow;
154  QMap<QString, QPointer<class SecondaryMainWindow> > mSecondaryMainWindows;
155  QMap<QString, QPointer<QAction> > mSecondaryMainWindowsActions;
156 
157  DynamicMainWindowWidgets* mDockWidgets;
158  MainWindowActions* mActions;
159 
160  VisServicesPtr mServices;
161  void createActionForWidgetInSeparateWindow(QWidget *widget);
162 };
163 
164 }//namespace cx
165 
166 #endif /* CXMAINWINDOW_H_ */
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:40
This is the main gui class which controls the workflow.
Definition: cxMainWindow.h:55
boost::shared_ptr< class LayoutInteractor > LayoutInteractorPtr
boost::shared_ptr< class ProcessWrapper > ProcessWrapperPtr
Definition: cxMainWindow.h:41
Namespace for all CustusX production code.