22 #include <QMainWindow>
27 #include <QTextStream>
30 #include <ctkPluginException.h>
31 #include <service/event/ctkEventAdmin.h>
45 #include <internal/berryQtShowViewAction.h>
46 #include <internal/berryQtOpenPerspectiveAction.h>
62 #include <itkConfigure.h>
63 #include <vtkConfigure.h>
69 #include <vtkVersionMacros.h>
72 #include "internal/QmitkExtWorkbenchWindowAdvisorHack.h"
73 #include "internal/QmitkCommonExtPlugin.h"
77 #include <QMessageBox>
81 QmitkExtWorkbenchWindowAdvisorHack
82 * QmitkExtWorkbenchWindowAdvisorHack::undohack =
83 new QmitkExtWorkbenchWindowAdvisorHack();
85 QString QmitkExtWorkbenchWindowAdvisor::QT_SETTINGS_FILENAME =
"QtSettings.ini";
108 windowAdvisor->UpdateTitle(
false);
116 windowAdvisor->UpdateTitle(
false);
122 windowAdvisor->UpdateTitle(
false);
127 if (!windowAdvisor->lastActiveEditor.Expired() &&
128 ref->GetPart(
false) == windowAdvisor->lastActiveEditor.Lock())
130 windowAdvisor->UpdateTitle(
true);
136 if (!windowAdvisor->lastActiveEditor.Expired() &&
137 ref->GetPart(
false) == windowAdvisor->lastActiveEditor.Lock())
139 windowAdvisor->UpdateTitle(
false);
151 PartListenerForViewNavigator(QAction* act) :
152 viewNavigatorAction(act)
164 if (ref->GetId()==
"org.mitk.views.viewnavigatorview")
166 viewNavigatorAction->setChecked(
true);
172 if (ref->GetId()==
"org.mitk.views.viewnavigatorview")
174 viewNavigatorAction->setChecked(
false);
180 if (ref->GetId()==
"org.mitk.views.viewnavigatorview")
182 viewNavigatorAction->setChecked(
true);
188 if (ref->GetId()==
"org.mitk.views.viewnavigatorview")
190 viewNavigatorAction->setChecked(
false);
195 QAction* viewNavigatorAction;
202 PartListenerForImageNavigator(QAction* act) :
203 imageNavigatorAction(act)
215 if (ref->GetId()==
"org.mitk.views.imagenavigator")
217 imageNavigatorAction->setChecked(
true);
223 if (ref->GetId()==
"org.mitk.views.imagenavigator")
225 imageNavigatorAction->setChecked(
false);
231 if (ref->GetId()==
"org.mitk.views.imagenavigator")
233 imageNavigatorAction->setChecked(
true);
239 if (ref->GetId()==
"org.mitk.views.imagenavigator")
241 imageNavigatorAction->setChecked(
false);
246 QAction* imageNavigatorAction;
254 windowAdvisor(wa), perspectivesClosed(false)
274 windowAdvisor->UpdateTitle(
false);
281 windowAdvisor->UpdateTitle(
false);
287 windowAdvisor->UpdateTitle(
false);
293 if (perspectivesClosed)
295 QListIterator<QAction*> i(windowAdvisor->viewActions);
298 i.next()->setEnabled(
true);
302 if(windowAdvisor->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor(
"org.mitk.editors.dicomeditor"))
304 windowAdvisor->openDicomEditorAction->setEnabled(
true);
306 windowAdvisor->fileSaveProjectAction->setEnabled(
true);
307 windowAdvisor->closeProjectAction->setEnabled(
true);
308 windowAdvisor->undoAction->setEnabled(
true);
309 windowAdvisor->redoAction->setEnabled(
true);
310 windowAdvisor->imageNavigatorAction->setEnabled(
true);
311 windowAdvisor->viewNavigatorAction->setEnabled(
true);
312 windowAdvisor->resetPerspAction->setEnabled(
true);
313 if( windowAdvisor->GetShowClosePerspectiveMenuItem() )
315 windowAdvisor->closePerspAction->setEnabled(
true);
319 perspectivesClosed =
false;
326 bool allClosed =
true;
327 if (wnd->GetActivePage())
329 QList<berry::IPerspectiveDescriptor::Pointer>
perspectives(wnd->GetActivePage()->GetOpenPerspectives());
335 perspectivesClosed =
true;
337 QListIterator<QAction*> i(windowAdvisor->viewActions);
340 i.next()->setEnabled(
false);
343 if(windowAdvisor->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor(
"org.mitk.editors.dicomeditor"))
345 windowAdvisor->openDicomEditorAction->setEnabled(
false);
347 windowAdvisor->fileSaveProjectAction->setEnabled(
false);
348 windowAdvisor->closeProjectAction->setEnabled(
false);
349 windowAdvisor->undoAction->setEnabled(
false);
350 windowAdvisor->redoAction->setEnabled(
false);
351 windowAdvisor->imageNavigatorAction->setEnabled(
false);
352 windowAdvisor->viewNavigatorAction->setEnabled(
false);
353 windowAdvisor->resetPerspAction->setEnabled(
false);
354 if( windowAdvisor->GetShowClosePerspectiveMenuItem() )
356 windowAdvisor->closePerspAction->setEnabled(
false);
363 bool perspectivesClosed;
383 QAction* action = windowAdvisor->mapPerspIdToAction[perspective->GetId()];
386 action->setChecked(
true);
393 QAction* action = windowAdvisor->mapPerspIdToAction[perspective->GetId()];
396 action->setChecked(
false);
406 berry::WorkbenchWindowAdvisor(configurer),
408 wbAdvisor(wbAdvisor),
409 showViewToolbar(true),
410 showPerspectiveToolbar(false),
411 showVersionInfo(true),
412 showMitkVersionInfo(true),
413 showViewMenuItem(true),
414 showNewWindowMenuItem(false),
415 showClosePerspectiveMenuItem(true),
416 viewNavigatorFound(false),
417 showMemoryIndicator(true),
420 productName = QCoreApplication::applicationName();
421 viewExcludeList.push_back(
"org.mitk.views.viewnavigatorview");
435 return actionBarAdvisor;
445 QWidget* parentWidget =
static_cast<QWidget*
>(parent);
446 auto label =
new QLabel(parentWidget);
447 label->setText(
"<b>No perspectives are open. Open a perspective in the <i>Window->Open Perspective</i> menu.</b>");
448 label->setContentsMargins(10,10,10,10);
449 label->setAlignment(Qt::AlignTop);
450 label->setEnabled(
false);
451 parentWidget->layout()->addWidget(label);
457 showClosePerspectiveMenuItem = show;
462 return showClosePerspectiveMenuItem;
467 showMemoryIndicator = show;
472 return showMemoryIndicator;
477 showNewWindowMenuItem = show;
482 showViewToolbar = show;
487 showViewMenuItem = show;
492 showPerspectiveToolbar = show;
497 showVersionInfo = show;
502 showMitkVersionInfo = show;
507 productName = product;
512 windowIcon = wndIcon;
520 QMainWindow* mainWindow =
521 qobject_cast<QMainWindow*> (window->GetShell()->GetControl());
523 if (!windowIcon.isEmpty())
525 mainWindow->setWindowIcon(QIcon(windowIcon));
527 mainWindow->setContextMenuPolicy(Qt::PreventContextMenu);
538 QStringList searchPaths = QIcon::themeSearchPaths();
539 searchPaths.push_front( QString(
":/org_mitk_icons/icons/") );
540 QIcon::setThemeSearchPaths( searchPaths );
545 if( iconTheme == QString(
"<<default>>" ) )
547 iconTheme = QString(
"tango" );
549 QIcon::setThemeName( iconTheme );
553 QMenuBar* menuBar = mainWindow->menuBar();
554 menuBar->setContextMenuPolicy(Qt::PreventContextMenu);
557 menuBar->setNativeMenuBar(
true);
559 menuBar->setNativeMenuBar(
false);
562 QAction* fileOpenAction =
new QmitkFileOpenAction(QIcon::fromTheme(
"document-open",QIcon(
":/org_mitk_icons/icons/tango/scalable/actions/document-open.svg")), window);
563 fileOpenAction->setShortcut(QKeySequence::Open);
564 QAction* fileSaveAction =
new QmitkFileSaveAction(QIcon(
":/org.mitk.gui.qt.ext/Save_48.png"), window);
565 fileSaveAction->setShortcut(QKeySequence::Save);
567 fileSaveProjectAction->setIcon(QIcon::fromTheme(
"document-save",QIcon(
":/org_mitk_icons/icons/tango/scalable/actions/document-save.svg")));
569 closeProjectAction->setIcon(QIcon::fromTheme(
"edit-delete",QIcon(
":/org_mitk_icons/icons/tango/scalable/actions/edit-delete.svg")));
571 auto perspGroup =
new QActionGroup(menuBar);
572 std::map<QString, berry::IViewDescriptor::Pointer> VDMap;
575 QList<berry::IViewDescriptor::Pointer>::const_iterator iter;
579 const QList<berry::IViewDescriptor::Pointer> viewDescriptors = viewRegistry->
GetViews();
582 for (iter = viewDescriptors.begin(); iter != viewDescriptors.end(); ++iter)
586 if (viewExcludeList.size() > 0)
588 for (
int i=0; i<viewExcludeList.size(); i++)
590 if (viewExcludeList.at(i) == (*iter)->GetId())
603 if ((*iter)->GetId() ==
"org.blueberry.ui.internal.introview")
605 if ((*iter)->GetId() ==
"org.mitk.views.imagenavigator")
607 if ((*iter)->GetId() ==
"org.mitk.views.viewnavigatorview")
610 std::pair<QString, berry::IViewDescriptor::Pointer> p(
611 (*iter)->GetLabel(), (*iter));
615 std::map<QString, berry::IViewDescriptor::Pointer>::const_iterator
617 for (MapIter = VDMap.begin(); MapIter != VDMap.end(); ++MapIter)
619 berry::QtShowViewAction* viewAction =
new berry::QtShowViewAction(window,
621 viewActions.push_back(viewAction);
626 QMenu* fileMenu = menuBar->addMenu(
"&File");
627 fileMenu->setObjectName(
"FileMenu");
628 fileMenu->addAction(fileOpenAction);
629 fileMenu->addAction(fileSaveAction);
630 fileMenu->addAction(fileSaveProjectAction);
631 fileMenu->addAction(closeProjectAction);
632 fileMenu->addSeparator();
635 fileExitAction->setIcon(QIcon::fromTheme(
"system-log-out",QIcon(
":/org_mitk_icons/icons/tango/scalable/actions/system-log-out.svg")));
636 fileExitAction->setShortcut(QKeySequence::Quit);
637 fileExitAction->setObjectName(
"QmitkFileExitAction");
638 fileMenu->addAction(fileExitAction);
641 QMenu* editMenu = menuBar->addMenu(
"&Edit");
642 undoAction = editMenu->addAction(QIcon::fromTheme(
"edit-undo",QIcon(
":/org_mitk_icons/icons/tango/scalable/actions/edit-undo.svg")),
644 QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onUndo()),
645 QKeySequence(
"CTRL+Z"));
646 undoAction->setToolTip(
"Undo the last action (not supported by all modules)");
647 redoAction = editMenu->addAction(QIcon::fromTheme(
"edit-redo",QIcon(
":/org_mitk_icons/icons/tango/scalable/actions/edit-redo.svg"))
649 QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onRedo()),
650 QKeySequence(
"CTRL+Y"));
651 redoAction->setToolTip(
"execute the last action that was undone again (not supported by all modules)");
654 QMenu* windowMenu = menuBar->addMenu(
"Window");
655 if (showNewWindowMenuItem)
657 windowMenu->addAction(
"&New Window", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onNewWindow()));
658 windowMenu->addSeparator();
661 QMenu* perspMenu = windowMenu->addMenu(
"&Open Perspective");
664 if (showViewMenuItem)
666 viewMenu = windowMenu->addMenu(
"Show &View");
667 viewMenu->setObjectName(
"Show View");
669 windowMenu->addSeparator();
670 resetPerspAction = windowMenu->addAction(
"&Reset Perspective",
671 QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onResetPerspective()));
673 if(showClosePerspectiveMenuItem)
674 closePerspAction = windowMenu->addAction(
"&Close Perspective", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onClosePerspective()));
676 windowMenu->addSeparator();
677 windowMenu->addAction(
"&Preferences...",
678 QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onEditPreferences()),
679 QKeySequence(
"CTRL+P"));
683 window->GetWorkbench()->GetPerspectiveRegistry();
685 QList<berry::IPerspectiveDescriptor::Pointer>
perspectives(
689 for (QList<berry::IPerspectiveDescriptor::Pointer>::iterator perspIt =
694 if (perspectiveExcludeList.size() > 0)
696 for (
int i=0; i<perspectiveExcludeList.size(); i++)
698 if (perspectiveExcludeList.at(i) == (*perspIt)->GetId())
711 QAction* perspAction =
new berry::QtOpenPerspectiveAction(window,
712 *perspIt, perspGroup);
713 mapPerspIdToAction.insert((*perspIt)->GetId(), perspAction);
715 perspMenu->addActions(perspGroup->actions());
717 if (showViewMenuItem)
719 for (
auto viewAction : viewActions)
721 viewMenu->addAction(viewAction);
726 QMenu* helpMenu = menuBar->addMenu(
"&Help");
727 helpMenu->addAction(
"&Welcome",
this, SLOT(
onIntro()));
729 helpMenu->addAction(
"&Context Help",
this, SLOT(
onHelp()), QKeySequence(
"F1"));
730 helpMenu->addAction(
"&About",
this, SLOT(
onAbout()));
737 undoAction =
new QmitkUndoAction(QIcon::fromTheme(
"edit-undo",QIcon(
":/org_mitk_icons/icons/tango/scalable/actions/edit-undo.svg")),
nullptr);
738 undoAction->setShortcut(QKeySequence::Undo);
739 redoAction =
new QmitkRedoAction(QIcon::fromTheme(
"edit-redo",QIcon(
":/org_mitk_icons/icons/tango/scalable/actions/edit-redo.svg")),
nullptr);
740 redoAction->setShortcut(QKeySequence::Redo);
744 auto mainActionsToolBar =
new QToolBar;
745 mainActionsToolBar->setObjectName(
"mainActionsToolBar");
746 mainActionsToolBar->setContextMenuPolicy(Qt::PreventContextMenu);
748 mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextUnderIcon );
750 mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextBesideIcon );
753 imageNavigatorAction =
new QAction(QIcon(
":/org.mitk.gui.qt.ext/Slider.png"),
"&Image Navigator",
nullptr);
754 bool imageNavigatorViewFound = window->GetWorkbench()->GetViewRegistry()->Find(
"org.mitk.views.imagenavigator");
756 if(this->
GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor(
"org.mitk.editors.dicomeditor"))
761 if (imageNavigatorViewFound)
763 QObject::connect(imageNavigatorAction, SIGNAL(triggered(
bool)), QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onImageNavigator()));
764 imageNavigatorAction->setCheckable(
true);
768 window->GetPartService()->AddPartListener(imageNavigatorPartListener.data());
770 window->GetActivePage()->FindView(
"org.mitk.views.imagenavigator");
771 imageNavigatorAction->setChecked(
false);
772 if (imageNavigatorView)
774 bool isImageNavigatorVisible = window->GetActivePage()->IsPartVisible(imageNavigatorView);
775 if (isImageNavigatorVisible)
776 imageNavigatorAction->setChecked(
true);
778 imageNavigatorAction->setToolTip(
"Toggle image navigator for navigating through image");
781 viewNavigatorAction =
new QAction(QIcon(
":/org.mitk.gui.qt.ext/view-manager_48.png"),
"&View Navigator",
nullptr);
782 viewNavigatorFound = window->GetWorkbench()->GetViewRegistry()->Find(
"org.mitk.views.viewnavigatorview");
783 if (viewNavigatorFound)
785 QObject::connect(viewNavigatorAction, SIGNAL(triggered(
bool)), QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onViewNavigator()));
786 viewNavigatorAction->setCheckable(
true);
790 window->GetPartService()->AddPartListener(viewNavigatorPartListener.data());
792 window->GetActivePage()->FindView(
"org.mitk.views.viewnavigatorview");
793 viewNavigatorAction->setChecked(
false);
794 if (viewnavigatorview)
796 bool isViewNavigatorVisible = window->GetActivePage()->IsPartVisible(viewnavigatorview);
797 if (isViewNavigatorVisible)
798 viewNavigatorAction->setChecked(
true);
800 viewNavigatorAction->setToolTip(
"Toggle View Navigator");
803 mainActionsToolBar->addAction(fileOpenAction);
804 mainActionsToolBar->addAction(fileSaveProjectAction);
805 mainActionsToolBar->addAction(closeProjectAction);
806 mainActionsToolBar->addAction(undoAction);
807 mainActionsToolBar->addAction(redoAction);
808 if(this->
GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor(
"org.mitk.editors.dicomeditor"))
810 mainActionsToolBar->addAction(openDicomEditorAction);
812 if (imageNavigatorViewFound)
814 mainActionsToolBar->addAction(imageNavigatorAction);
816 if (viewNavigatorFound)
818 mainActionsToolBar->addAction(viewNavigatorAction);
820 mainWindow->addToolBar(mainActionsToolBar);
823 auto qPerspectiveToolbar =
new QToolBar;
824 qPerspectiveToolbar->setObjectName(
"perspectiveToolBar");
826 if (showPerspectiveToolbar)
828 qPerspectiveToolbar->addActions(perspGroup->actions());
829 mainWindow->addToolBar(qPerspectiveToolbar);
832 delete qPerspectiveToolbar;
835 auto qToolbar =
new QToolBar;
836 qToolbar->setObjectName(
"viewToolBar");
840 mainWindow->addToolBar(qToolbar);
842 for (
auto viewAction : viewActions)
844 qToolbar->addAction(viewAction);
850 QSettings settings(GetQSettingsFile(), QSettings::IniFormat);
851 mainWindow->restoreState(settings.value(
"ToolbarPosition").toByteArray());
853 auto qStatusBar =
new QStatusBar();
858 statusBar->SetSizeGripEnabled(
false);
862 qStatusBar->addPermanentWidget(progBar, 0);
867 mainWindow->setStatusBar(qStatusBar);
869 if (showMemoryIndicator)
872 qStatusBar->addPermanentWidget(memoryIndicator, 0);
894 this->HookTitleUpdateListeners(configurer);
897 configurer->GetWindow()->AddPerspectiveListener(menuPerspectiveListener.data());
899 configurer->AddEditorAreaTransfer(QStringList(
"text/uri-list"));
900 configurer->ConfigureEditorAreaDropListener(dropTargetListener.data());
909 ctkPluginContext* context = QmitkCommonExtPlugin::getContext();
925 QmitkExtWorkbenchWindowAdvisorHack::undohack->onIntro();
930 QmitkExtWorkbenchWindowAdvisorHack::undohack->onHelp();
935 QmitkExtWorkbenchWindowAdvisorHack::undohack->onHelpOpenHelpPerspective();
940 QmitkExtWorkbenchWindowAdvisorHack::undohack->onAbout();
948 QmitkExtWorkbenchWindowAdvisorHack::QmitkExtWorkbenchWindowAdvisorHack() : QObject()
952 QmitkExtWorkbenchWindowAdvisorHack::~QmitkExtWorkbenchWindowAdvisorHack()
956 void QmitkExtWorkbenchWindowAdvisorHack::onUndo()
964 verboseundo->GetUndoDescriptions();
965 if (descriptions.size() >= 1)
967 MITK_INFO <<
"Undo " << descriptions.front().second;
978 void QmitkExtWorkbenchWindowAdvisorHack::onRedo()
986 verboseundo->GetRedoDescriptions();
987 if (descriptions.size() >= 1)
989 MITK_INFO <<
"Redo " << descriptions.front().second;
1006 if( wbench ==
nullptr )
1010 if( wbench_window.
IsNull() )
1014 if( wbench_page.
IsNull() )
1017 auto wbench_view = wbench_page->FindView( view_query_name );
1019 if( wbench_view.IsNotNull() )
1021 bool isViewVisible = wbench_page->IsPartVisible( wbench_view );
1024 wbench_page->HideView( wbench_view );
1030 wbench_page->ShowView( view_query_name );
1033 void QmitkExtWorkbenchWindowAdvisorHack::onImageNavigator()
1039 void QmitkExtWorkbenchWindowAdvisorHack::onViewNavigator()
1045 void QmitkExtWorkbenchWindowAdvisorHack::onEditPreferences()
1048 _PreferencesDialog.exec();
1051 void QmitkExtWorkbenchWindowAdvisorHack::onQuit()
1056 void QmitkExtWorkbenchWindowAdvisorHack::onResetPerspective()
1061 void QmitkExtWorkbenchWindowAdvisorHack::onClosePerspective()
1066 page->ClosePerspective(page->GetPerspective(),
true,
true);
1069 void QmitkExtWorkbenchWindowAdvisorHack::onNewWindow()
1074 void QmitkExtWorkbenchWindowAdvisorHack::onIntro()
1080 QRegExp reg(
"(.*)<title>(\\n)*");
1081 QRegExp reg2(
"(\\n)*</title>(.*)");
1082 QFile file(
":/org.mitk.gui.qt.ext/index.html");
1083 file.open(QIODevice::ReadOnly | QIODevice::Text);
1085 QString text = QString(file.readAll());
1089 QString title = text;
1090 title.replace(reg,
"");
1091 title.replace(reg2,
"");
1093 std::cout << title.toStdString() << std::endl;
1095 QMessageBox::information(
nullptr, title,
1105 void QmitkExtWorkbenchWindowAdvisorHack::onHelp()
1107 ctkPluginContext* context = QmitkCommonExtPlugin::getContext();
1108 if (context ==
nullptr)
1110 MITK_WARN <<
"Plugin context not set, unable to open context help";
1115 QList<QSharedPointer<ctkPlugin> > plugins = context->getPlugins();
1118 if (p->getSymbolicName() ==
"org.blueberry.ui.qt.help")
1120 if (p->getState() != ctkPlugin::ACTIVE)
1125 p->start(ctkPlugin::START_TRANSIENT);
1127 catch (
const ctkPluginException& pe)
1129 MITK_ERROR <<
"Activating org.blueberry.ui.qt.help failed: " << pe.what();
1136 ctkServiceReference eventAdminRef = context->getServiceReference<ctkEventAdmin>();
1137 ctkEventAdmin* eventAdmin =
nullptr;
1140 eventAdmin = context->getService<ctkEventAdmin>(eventAdminRef);
1142 if (eventAdmin ==
nullptr)
1144 MITK_WARN <<
"ctkEventAdmin service not found. Unable to open context help";
1148 ctkEvent ev(
"org/blueberry/ui/help/CONTEXTHELP_REQUESTED");
1149 eventAdmin->postEvent(ev);
1153 void QmitkExtWorkbenchWindowAdvisorHack::onHelpOpenHelpPerspective()
1159 void QmitkExtWorkbenchWindowAdvisorHack::onAbout()
1161 auto aboutDialog =
new QmitkAboutDialog(QApplication::activeWindow(),
nullptr);
1162 aboutDialog->open();
1165 void QmitkExtWorkbenchWindowAdvisor::HookTitleUpdateListeners(
1173 &QmitkExtWorkbenchWindowAdvisor::PropertyChange));
1189 configurer->GetWindow()->AddPerspectiveListener(titlePerspectiveListener.data());
1190 configurer->GetWindow()->GetPartService()->AddPartListener(titlePartListener.data());
1193 QString QmitkExtWorkbenchWindowAdvisor::ComputeTitle()
1198 configurer->GetWindow()->GetActivePage();
1202 activeEditor = lastActiveEditor.
Lock();
1209 title = product->GetName();
1211 if (title.isEmpty())
1214 title = productName;
1217 if(showMitkVersionInfo)
1222 if (showVersionInfo)
1225 QString versions = QString(
" (ITK %1.%2.%3 VTK %4.%5.%6 Qt %7 MITK %8)")
1226 .arg(ITK_VERSION_MAJOR).arg(ITK_VERSION_MINOR).arg(ITK_VERSION_PATCH)
1227 .arg(VTK_MAJOR_VERSION).arg(VTK_MINOR_VERSION).arg(VTK_BUILD_VERSION)
1228 .arg(QT_VERSION_STR)
1238 lastEditorTitle = activeEditor->GetTitleToolTip();
1239 if (!lastEditorTitle.isEmpty())
1240 title = lastEditorTitle +
" - " + title;
1243 currentPage->GetPerspective();
1247 label = persp->GetLabel();
1252 label = currentPage->GetLabel();
1254 if (!label.isEmpty())
1256 title = label +
" - " + title;
1260 title +=
" (Not for use in diagnosis or treatment of patients)";
1265 void QmitkExtWorkbenchWindowAdvisor::RecomputeTitle()
1269 QString oldTitle = configurer->GetTitle();
1270 QString newTitle = ComputeTitle();
1271 if (newTitle != oldTitle)
1273 configurer->SetTitle(newTitle);
1277 void QmitkExtWorkbenchWindowAdvisor::UpdateTitle(
bool editorHidden)
1289 activeEditor = currentPage->GetActiveEditor();
1290 persp = currentPage->GetPerspective();
1291 input = currentPage->GetInput();
1296 activeEditor =
nullptr;
1300 if (activeEditor == lastActiveEditor.
Lock() && currentPage == lastActivePage.
Lock()
1301 && persp == lastPerspective.
Lock() && input == lastInput)
1306 if (!lastActiveEditor.
Expired())
1308 lastActiveEditor.
Lock()->RemovePropertyListener(editorPropertyListener.data());
1311 lastActiveEditor = activeEditor;
1312 lastActivePage = currentPage;
1313 lastPerspective = persp;
1318 activeEditor->AddPropertyListener(editorPropertyListener.data());
1328 if (!lastActiveEditor.
Expired())
1330 QString newTitle = lastActiveEditor.
Lock()->GetPartName();
1331 if (lastEditorTitle != newTitle)
1341 this->perspectiveExcludeList = v;
1346 return this->perspectiveExcludeList;
1351 this->viewExcludeList = v;
1356 return this->viewExcludeList;
1362 QMainWindow* mainWindow =
static_cast<QMainWindow*
> (window->GetShell()->GetControl());
1364 QSettings settings(GetQSettingsFile(), QSettings::IniFormat);
1365 settings.setValue(
"ToolbarPosition", mainWindow->saveState());
1368 QString QmitkExtWorkbenchWindowAdvisor::GetQSettingsFile()
const
1370 QFileInfo settingsInfo = QmitkCommonExtPlugin::getContext()->getDataFile(QT_SETTINGS_FILENAME);
1371 return settingsInfo.canonicalFilePath();
QWidget * CreateEmptyWindowContents(QWidget *parent) override
void ShowVersionInfo(bool show)
virtual void PartHidden(const IWorkbenchPartReference::Pointer &)
#define MITK_VERSION_STRING
void ShowPerspectiveToolbar(bool show)
void ShowViewMenuItem(bool show)
virtual void onHelpOpenHelpPerspective()
void PostWindowClose() override
virtual void PerspectiveActivated(const SmartPointer< IWorkbenchPage > &page, const IPerspectiveDescriptor::Pointer &perspective)
virtual void PerspectiveOpened(const SmartPointer< IWorkbenchPage > &page, const IPerspectiveDescriptor::Pointer &perspective)
berry::SmartPointer< berry::ActionBarAdvisor > CreateActionBarAdvisor(berry::SmartPointer< berry::IActionBarConfigurer > configurer) override
void ShowViewToolbar(bool show)
~QmitkExtWorkbenchWindowAdvisor()
QmitkExtWorkbenchWindowAdvisor(berry::WorkbenchAdvisor *wbAdvisor, berry::IWorkbenchWindowConfigurer::Pointer configurer)
static const QString QT_ICON_THEME
virtual IDataStorageReference::Pointer GetDataStorage() const =0
virtual SmartPointer< ActionBarAdvisor > CreateActionBarAdvisor(SmartPointer< IActionBarConfigurer > configurer)
virtual SmartPointer< IPreferences > GetSystemPreferences()=0
virtual void PartOpened(const IWorkbenchPartReference::Pointer &)
virtual IIntroManager * GetIntroManager() const =0
virtual QList< IPerspectiveDescriptor::Pointer > GetPerspectives()=0
static bool USE_EXPERIMENTAL_COMMAND_CONTRIBUTIONS
QT-Toolkit/GUI dependent class that provides the QT's ProgressBar.
virtual void PostWindowOpen()
void PreWindowOpen() override
bool GetShowClosePerspectiveMenuItem()
virtual void PartActivated(const IWorkbenchPartReference::Pointer &)
friend class PerspectiveListenerForTitle
virtual IIntroPart::Pointer ShowIntro(IWorkbenchWindow::Pointer preferredWindow, bool standby)=0
SmartPointer< IWorkbenchWindowConfigurer > GetWindowConfigurer()
void SetPerspectiveExcludeList(const QList< QString > &v)
virtual void PerspectiveClosed(const SmartPointer< IWorkbenchPage > &page, const IPerspectiveDescriptor::Pointer &perspective)
virtual bool HasIntro() const =0
virtual Events::Types GetPerspectiveEventTypes() const =0
void ShowMitkVersionInfo(bool show)
virtual QList< IViewDescriptor::Pointer > GetViews() const =0
static const int PROP_TITLE
QT-Toolkit/GUI dependent class that provides to send a Message to the QT's StatusBar.
virtual IWorkbenchWindow::Pointer OpenWorkbenchWindow(const QString &perspectiveId, IAdaptable *input)=0
void ShowClosePerspectiveMenuItem(bool show)
bool GetShowMemoryIndicator()
static const QString QT_STYLES_NODE
QList< QString > GetPerspectiveExcludeList()
friend class PartListenerForViewNavigator
virtual IWorkbenchWindow::Pointer GetActiveWorkbenchWindow() const =0
void ShowMemoryIndicator(bool show)
void SetProductName(const QString &product)
virtual IAdaptable * GetDefaultPageInput()
friend class PartListenerForTitle
The custom viewer plugin implements simple viewer functionality presented in a customized look and feel It was developed to demonstrate extensibility and customizability of the blueberry application framework As an example for the GUI customization capabilities provided by the BlueBerry application the custom viewer plugin was developed It features simple viewer functionality presented in a customized look and feel The custom viewer consists of two i e a viewer perspective and a DICOM perspective As part of the viewer perspective
superclass for all UndoModels
A limited linear undo model providing GUI elements with stack status information. ...
virtual void PartClosed(const IWorkbenchPartReference::Pointer &)
friend class PerspectiveListenerForMenu
friend class PartListenerForImageNavigator
virtual void PartVisible(const IWorkbenchPartReference::Pointer &)
The custom viewer plugin implements simple viewer functionality presented in a customized look and feel It was developed to demonstrate extensibility and customizability of the blueberry application framework As an example for the GUI customization capabilities provided by the BlueBerry application the custom viewer plugin was developed It features simple viewer functionality presented in a customized look and feel The custom viewer consists of two perspectives
virtual void PartBroughtToTop(const IWorkbenchPartReference::Pointer &)
static UndoModel * GetCurrentUndoModel()
gives access to the currently used UndoModel Introduced to access special functions of more specific ...
virtual IViewRegistry * GetViewRegistry() const =0
void SetWindowIcon(const QString &wndIcon)
SmartPointer< Other > Cast() const
virtual void PerspectiveSavedAs(const SmartPointer< IWorkbenchPage > &page, const IPerspectiveDescriptor::Pointer &oldPerspective, const IPerspectiveDescriptor::Pointer &newPerspective)
static berry::IEditorPart::Pointer OpenEditor(berry::IWorkbenchPage::Pointer page, berry::IEditorInput::Pointer input, const QString &editorId, bool activate=false)
void ShowNewWindowMenuItem(bool show)
SmartPointer< ObjectType > Lock() const
void PostWindowOpen() override
virtual Events::Types GetPartEventTypes() const =0
std::vector< StackDescriptionItem > StackDescription
void PostWindowCreate() override
virtual SmartPointer< IWorkbenchPage > ShowPerspective(const QString &perspectiveId, IWorkbenchWindow::Pointer window)=0
void SetViewExcludeList(const QList< QString > &v)
QList< QString > GetViewExcludeList()
static void SafeHandleNavigatorView(QString view_query_name)
virtual void PerspectiveDeactivated(const SmartPointer< IWorkbenchPage > &page, const IPerspectiveDescriptor::Pointer &perspective)