Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef QMITKEXTWORKBENCHWINDOWADVISOR_H_
18 #define QMITKEXTWORKBENCHWINDOWADVISOR_H_
19 
21 
22 #include <berryIPartListener.h>
23 #include <berryIEditorPart.h>
24 #include <berryIWorkbenchPage.h>
25 #include <berryWorkbenchAdvisor.h>
27 
29 
30 #include <QList>
31 
32 class QAction;
33 class QMenu;
34 
36 {
37  Q_OBJECT
38 
39 public:
40 
43 
45 
48 
49  QWidget* CreateEmptyWindowContents(QWidget* parent) override;
50 
51  void PostWindowCreate() override;
52 
53  void PreWindowOpen() override;
54 
55  void PostWindowOpen() override;
56 
57  void PostWindowClose() override;
58 
59  void ShowViewToolbar(bool show);
60 
61  void ShowPerspectiveToolbar(bool show);
62 
63  void ShowVersionInfo(bool show);
64 
65  void ShowMitkVersionInfo(bool show);
66 
67  void ShowViewMenuItem(bool show);
68 
69  void ShowNewWindowMenuItem(bool show);
70 
71  void ShowClosePerspectiveMenuItem(bool show);
72 
73  bool GetShowClosePerspectiveMenuItem();
74 
75  void ShowMemoryIndicator(bool show);
76 
77  bool GetShowMemoryIndicator();
78 
79  //TODO should be removed when product support is here
80  void SetProductName(const QString& product);
81  void SetWindowIcon(const QString& wndIcon);
82 
83  void SetPerspectiveExcludeList(const QList<QString> &v);
84  QList<QString> GetPerspectiveExcludeList();
85 
86  void SetViewExcludeList(const QList<QString> &v);
87  QList<QString> GetViewExcludeList();
88 
89 protected slots:
90 
91  virtual void onIntro();
92  virtual void onHelp();
93  virtual void onHelpOpenHelpPerspective();
94  virtual void onAbout();
95 
96 private:
97 
103  void HookTitleUpdateListeners(berry::IWorkbenchWindowConfigurer::Pointer configurer);
104 
105  QString ComputeTitle();
106 
107  void RecomputeTitle();
108 
109  QString GetQSettingsFile() const;
110 
116  void UpdateTitle(bool editorHidden);
117 
118  void PropertyChange(const berry::Object::Pointer& /*source*/, int propId);
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 };
178 
179 #endif /*QMITKEXTWORKBENCHWINDOWADVISOR_H_*/
virtual SmartPointer< ActionBarAdvisor > CreateActionBarAdvisor(SmartPointer< IActionBarConfigurer > configurer)
#define MITK_QT_COMMON_EXT_EXPORT
virtual QWidget * CreateEmptyWindowContents(QWidget *parent)