NorMIT-nav  2023.01.05-dev+develop.0da12
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(int currentTabIndex = 0);
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* mPreferencesToolConfigAction;
125  QAction* mFullScreenAction;
126  QAction* mQuitAction;
127 
128  QAction* mShowControlPanelAction;
129  QAction* mSecondaryViewLayoutWindowAction;
130 
131  QActionGroup* mStandard3DViewActions;
132 
133  QAction* mShowContextSensitiveHelpAction;
134  QActionGroup* mInteractorStyleActionGroup;
135 
136  //desktop actions
137  QAction* mSaveDesktopAction;
138  QAction* mResetDesktopAction;
139 
140  //toolbars
141  QToolBar* mDataToolBar;
142  QToolBar* mToolToolBar;
143  QToolBar* mNavigationToolBar;
144  QToolBar* mInteractorStyleToolBar;
145  QToolBar* mWorkflowToolBar;
146  QToolBar* mDesktopToolBar;
147  QToolBar* mHelpToolBar;
148  QToolBar* mScreenshotToolBar;
149 
150  boost::shared_ptr<ServiceTrackerListener<GUIExtenderService> > mServiceListener;
151 
152  //widgets
153  QPointer<class SecondaryMainWindow> mControlPanel;
154  QPointer<class SecondaryViewLayoutWindow> mSecondaryViewLayoutWindow;
155  QMap<QString, QPointer<class SecondaryMainWindow> > mSecondaryMainWindows;
156  QMap<QString, QPointer<QAction> > mSecondaryMainWindowsActions;
157 
158  DynamicMainWindowWidgets* mDockWidgets;
159  MainWindowActions* mActions;
160 
161  VisServicesPtr mServices;
162  void createActionForWidgetInSeparateWindow(QWidget *widget);
163 };
164 
165 }//namespace cx
166 
167 #endif /* CXMAINWINDOW_H_ */
cxServiceTrackerListener.h
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::MainWindow
This is the main gui class which controls the workflow.
Definition: cxMainWindow.h:55
cx::VisServicesPtr
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:40
cx::LayoutInteractorPtr
boost::shared_ptr< class LayoutInteractor > LayoutInteractorPtr
Definition: cxLayoutInteractor.h:69
cx::MainWindowActions
Definition: cxMainWindowActions.h:29
cx::GUIExtenderService
Definition: cxGUIExtenderService.h:40
cx::ProcessWrapperPtr
boost::shared_ptr< class ProcessWrapper > ProcessWrapperPtr
Definition: cxMainWindow.h:41
cx::DynamicMainWindowWidgets
Definition: cxDynamicMainWindowWidgets.h:30
cxGUIExtenderService.h