Medical Imaging Interaction Toolkit  2025.12.02
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 
27 
28 #include <QList>
29 
30 class QAction;
31 class QMenu;
32 
34 {
35  Q_OBJECT
36 
37 public:
38 
41 
43 
46 
47  QWidget* CreateEmptyWindowContents(QWidget* parent) override;
48 
49  void PostWindowCreate() override;
50 
51  void PreWindowOpen() override;
52 
53  void PostWindowOpen() override;
54 
55  void PostWindowClose() override;
56 
57  void ShowViewToolbar(bool show);
58 
59  void ShowPerspectiveToolbar(bool show);
60 
61  void ShowVersionInfo(bool show);
62 
63  void ShowMitkVersionInfo(bool show);
64 
65  void ShowViewMenuItem(bool show);
66 
67  void ShowNewWindowMenuItem(bool show);
68 
70 
72 
73  void ShowMemoryIndicator(bool show);
74 
76 
77  //TODO should be removed when product support is here
78  void SetProductName(const QString& product);
79  void SetWindowIcon(const QString& wndIcon);
80 
81  void SetPerspectiveExcludeList(const QList<QString> &v);
82  QList<QString> GetPerspectiveExcludeList();
83 
84  void SetViewExcludeList(const QList<QString> &v);
85  QList<QString> GetViewExcludeList();
86 
87 protected slots:
88 
89  virtual void onIntro();
90  virtual void onHelp();
91  virtual void onHelpOpenHelpPerspective();
92  virtual void onAbout();
93 
94 private:
95 
101  void HookTitleUpdateListeners(berry::IWorkbenchWindowConfigurer::Pointer configurer);
102 
103  QString ComputeTitle();
104 
105  void RecomputeTitle();
106 
107  QString GetQSettingsFile() const;
108 
114  void UpdateTitle(bool editorHidden);
115 
116  void PropertyChange(const berry::Object::Pointer& /*source*/, int propId);
117 
118  void OnUndoStackChanged();
119 
120  static QString QT_SETTINGS_FILENAME;
121 
122  QScopedPointer<berry::IPartListener> titlePartListener;
123  QScopedPointer<berry::IPerspectiveListener> titlePerspectiveListener;
124  QScopedPointer<berry::IPerspectiveListener> menuPerspectiveListener;
125  QScopedPointer<berry::IPartListener> imageNavigatorPartListener;
126  QScopedPointer<berry::IPartListener> viewNavigatorPartListener;
127  QScopedPointer<berry::IPropertyChangeListener> editorPropertyListener;
129  friend class PartListenerForTitle;
130  friend class PerspectiveListenerForTitle;
131  friend class PerspectiveListenerForMenu;
132  friend class PartListenerForImageNavigator;
133  friend class PartListenerForViewNavigator;
134 
135  berry::IEditorPart::WeakPtr lastActiveEditor;
137  berry::IWorkbenchPage::WeakPtr lastActivePage;
138  QString lastEditorTitle;
139  berry::IAdaptable* lastInput;
140 
141  berry::WorkbenchAdvisor* wbAdvisor;
142  bool showViewToolbar;
143  bool showPerspectiveToolbar;
144  bool showVersionInfo;
145  bool showMitkVersionInfo;
146  bool showViewMenuItem;
147  bool showNewWindowMenuItem;
148  bool showClosePerspectiveMenuItem;
149  bool viewNavigatorFound;
150  bool showMemoryIndicator;
151  QString productName;
152  QString windowIcon;
153 
154  // enables DnD on the editor area
155  QScopedPointer<berry::IDropTargetListener> dropTargetListener;
156 
157  // stringlist for excluding perspectives from the perspective menu entry (e.g. Welcome Perspective)
158  QList<QString> perspectiveExcludeList;
159 
160  // stringlist for excluding views from the menu entry
161  QList<QString> viewExcludeList;
162 
163  // maps perspective ids to QAction objects
164  QHash<QString, QAction*> mapPerspIdToAction;
165 
166  // actions which will be enabled/disabled depending on the application state
167  QList<QAction*> viewActions;
168  QAction* fileSaveProjectAction;
169  QAction* closeProjectAction;
170  QAction* undoAction;
171  QAction* redoAction;
172  QAction* imageNavigatorAction;
173  QAction* viewNavigatorAction;
174  QAction* resetPerspAction;
175  QAction* closePerspAction;
176  QAction* openDicomEditorAction;
177  QAction* openStdMultiWidgetEditorAction;
178  QAction* openMxNMultiWidgetEditorAction;
179 
180  mitk::ITKEventObserverGuard m_UndoStackObserverGuard;
181 };
182 
183 #endif
void ShowNewWindowMenuItem(bool show)
void ShowMitkVersionInfo(bool show)
void ShowClosePerspectiveMenuItem(bool show)
QList< QString > GetViewExcludeList()
void SetPerspectiveExcludeList(const QList< QString > &v)
berry::SmartPointer< berry::ActionBarAdvisor > CreateActionBarAdvisor(berry::SmartPointer< berry::IActionBarConfigurer > configurer) override
void SetWindowIcon(const QString &wndIcon)
void SetProductName(const QString &product)
void ShowViewMenuItem(bool show)
void ShowMemoryIndicator(bool show)
QWidget * CreateEmptyWindowContents(QWidget *parent) override
QList< QString > GetPerspectiveExcludeList()
virtual void onHelpOpenHelpPerspective()
~QmitkExtWorkbenchWindowAdvisor() override
void ShowPerspectiveToolbar(bool show)
void SetViewExcludeList(const QList< QString > &v)
QmitkExtWorkbenchWindowAdvisor(berry::WorkbenchAdvisor *wbAdvisor, berry::IWorkbenchWindowConfigurer::Pointer configurer)
void PostWindowCreate() override
Implements transparent reference counting.
implements a WeakPointer class to deal with circular reference problems.
Convenience class that helps to manage the lifetime of itk event observers.
#define MITK_QT_COMMON_EXT_EXPORT