Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
QmitkExtWorkbenchWindowAdvisor.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef QmitkExtWorkbenchWindowAdvisor_h
14 #define QmitkExtWorkbenchWindowAdvisor_h
15 
17 
18 #include <berryIPartListener.h>
19 #include <berryIEditorPart.h>
20 #include <berryIWorkbenchPage.h>
21 #include <berryWorkbenchAdvisor.h>
23 
25 
26 #include <QList>
27 
28 class QAction;
29 class QMenu;
30 
32 {
33  Q_OBJECT
34 
35 public:
36 
39 
41 
44 
45  QWidget* CreateEmptyWindowContents(QWidget* parent) override;
46 
47  void PostWindowCreate() override;
48 
49  void PreWindowOpen() override;
50 
51  void PostWindowOpen() override;
52 
53  void PostWindowClose() override;
54 
55  void ShowViewToolbar(bool show);
56 
57  void ShowPerspectiveToolbar(bool show);
58 
59  void ShowVersionInfo(bool show);
60 
61  void ShowMitkVersionInfo(bool show);
62 
63  void ShowViewMenuItem(bool show);
64 
65  void ShowNewWindowMenuItem(bool show);
66 
67  void ShowClosePerspectiveMenuItem(bool show);
68 
69  bool GetShowClosePerspectiveMenuItem();
70 
71  void ShowMemoryIndicator(bool show);
72 
73  bool GetShowMemoryIndicator();
74 
75  //TODO should be removed when product support is here
76  void SetProductName(const QString& product);
77  void SetWindowIcon(const QString& wndIcon);
78 
79  void SetPerspectiveExcludeList(const QList<QString> &v);
80  QList<QString> GetPerspectiveExcludeList();
81 
82  void SetViewExcludeList(const QList<QString> &v);
83  QList<QString> GetViewExcludeList();
84 
85 protected slots:
86 
87  virtual void onIntro();
88  virtual void onHelp();
89  virtual void onHelpOpenHelpPerspective();
90  virtual void onAbout();
91 
92 private:
93 
99  void HookTitleUpdateListeners(berry::IWorkbenchWindowConfigurer::Pointer configurer);
100 
101  QString ComputeTitle();
102 
103  void RecomputeTitle();
104 
105  QString GetQSettingsFile() const;
106 
112  void UpdateTitle(bool editorHidden);
113 
114  void PropertyChange(const berry::Object::Pointer& /*source*/, int propId);
115 
116  static QString QT_SETTINGS_FILENAME;
117 
118  QScopedPointer<berry::IPartListener> titlePartListener;
119  QScopedPointer<berry::IPerspectiveListener> titlePerspectiveListener;
120  QScopedPointer<berry::IPerspectiveListener> menuPerspectiveListener;
121  QScopedPointer<berry::IPartListener> imageNavigatorPartListener;
122  QScopedPointer<berry::IPartListener> viewNavigatorPartListener;
123  QScopedPointer<berry::IPropertyChangeListener> editorPropertyListener;
125  friend class PartListenerForTitle;
126  friend class PerspectiveListenerForTitle;
127  friend class PerspectiveListenerForMenu;
128  friend class PartListenerForImageNavigator;
129  friend class PartListenerForViewNavigator;
130 
131  berry::IEditorPart::WeakPtr lastActiveEditor;
133  berry::IWorkbenchPage::WeakPtr lastActivePage;
134  QString lastEditorTitle;
135  berry::IAdaptable* lastInput;
136 
137  berry::WorkbenchAdvisor* wbAdvisor;
138  bool showViewToolbar;
139  bool showPerspectiveToolbar;
140  bool showVersionInfo;
141  bool showMitkVersionInfo;
142  bool showViewMenuItem;
143  bool showNewWindowMenuItem;
144  bool showClosePerspectiveMenuItem;
145  bool viewNavigatorFound;
146  bool showMemoryIndicator;
147  QString productName;
148  QString windowIcon;
149 
150  // enables DnD on the editor area
151  QScopedPointer<berry::IDropTargetListener> dropTargetListener;
152 
153  // stringlist for excluding perspectives from the perspective menu entry (e.g. Welcome Perspective)
154  QList<QString> perspectiveExcludeList;
155 
156  // stringlist for excluding views from the menu entry
157  QList<QString> viewExcludeList;
158 
159  // maps perspective ids to QAction objects
160  QHash<QString, QAction*> mapPerspIdToAction;
161 
162  // actions which will be enabled/disabled depending on the application state
163  QList<QAction*> viewActions;
164  QAction* fileSaveProjectAction;
165  QAction* closeProjectAction;
166  QAction* undoAction;
167  QAction* redoAction;
168  QAction* imageNavigatorAction;
169  QAction* viewNavigatorAction;
170  QAction* resetPerspAction;
171  QAction* closePerspAction;
172  QAction* openDicomEditorAction;
173  QAction* openStdMultiWidgetEditorAction;
174  QAction* openMxNMultiWidgetEditorAction;
175 };
176 
177 #endif
berryIPartListener.h
berryWorkbenchWindowAdvisor.h
berry::SmartPointer< Self >
berry::WorkbenchWindowAdvisor::PostWindowOpen
virtual void PostWindowOpen()
berry::WorkbenchWindowAdvisor
Definition: berryWorkbenchWindowAdvisor.h:65
berry::WorkbenchWindowAdvisor::CreateEmptyWindowContents
virtual QWidget * CreateEmptyWindowContents(QWidget *parent)
MITK_QT_COMMON_EXT_EXPORT
#define MITK_QT_COMMON_EXT_EXPORT
Definition: org_mitk_gui_qt_ext_Export.h:26
berry::WorkbenchWindowAdvisor::CreateActionBarAdvisor
virtual SmartPointer< ActionBarAdvisor > CreateActionBarAdvisor(SmartPointer< IActionBarConfigurer > configurer)
berry::WorkbenchAdvisor
Definition: berryWorkbenchAdvisor.h:92
berryIEditorPart.h
berry::PropertyChangeIntAdapter
Definition: berryIPropertyChangeListener.h:105
berry::IAdaptable
Definition: berryIAdaptable.h:50
berry::WorkbenchWindowAdvisor::PostWindowCreate
virtual void PostWindowCreate()
berry::WorkbenchWindowAdvisor::PostWindowClose
virtual void PostWindowClose()
berryIWorkbenchPage.h
berryWorkbenchAdvisor.h
berry::Object::WeakPtr
berry::WeakPointer< Self > WeakPtr
Definition: berryObject.h:84
berry::WorkbenchWindowAdvisor::PreWindowOpen
virtual void PreWindowOpen()
QmitkExtWorkbenchWindowAdvisor
Definition: QmitkExtWorkbenchWindowAdvisor.h:31
berry::WeakPointer
implements a WeakPointer class to deal with circular reference problems.
Definition: berrySmartPointer.h:32
org_mitk_gui_qt_ext_Export.h