diff --git a/BlueBerry/Bundles/org.blueberry.ui.qt.help/plugin.xml b/BlueBerry/Bundles/org.blueberry.ui.qt.help/plugin.xml index 7d7ec224db..c7bd593c26 100644 --- a/BlueBerry/Bundles/org.blueberry.ui.qt.help/plugin.xml +++ b/BlueBerry/Bundles/org.blueberry.ui.qt.help/plugin.xml @@ -1,43 +1,43 @@ diff --git a/BlueBerry/Bundles/org.blueberry.ui.qt.log/plugin.xml b/BlueBerry/Bundles/org.blueberry.ui.qt.log/plugin.xml index a23c512adb..5d2989f5c5 100644 --- a/BlueBerry/Bundles/org.blueberry.ui.qt.log/plugin.xml +++ b/BlueBerry/Bundles/org.blueberry.ui.qt.log/plugin.xml @@ -1,15 +1,14 @@ - diff --git a/Plugins/org.mitk.gui.qt.datamanager/plugin.xml b/Plugins/org.mitk.gui.qt.datamanager/plugin.xml index d238dfdf6f..6c3dc5c4fe 100644 --- a/Plugins/org.mitk.gui.qt.datamanager/plugin.xml +++ b/Plugins/org.mitk.gui.qt.datamanager/plugin.xml @@ -1,32 +1,32 @@ + name="MITK General" + id="org.mitk.views.general"/> diff --git a/Plugins/org.mitk.gui.qt.datamanagerlight/plugin.xml b/Plugins/org.mitk.gui.qt.datamanagerlight/plugin.xml index 0e7ca74a82..083781134e 100644 --- a/Plugins/org.mitk.gui.qt.datamanagerlight/plugin.xml +++ b/Plugins/org.mitk.gui.qt.datamanagerlight/plugin.xml @@ -1,16 +1,16 @@ diff --git a/Plugins/org.mitk.gui.qt.diffusionimaging/plugin.xml b/Plugins/org.mitk.gui.qt.diffusionimaging/plugin.xml index db8942459c..b435a0fb90 100644 --- a/Plugins/org.mitk.gui.qt.diffusionimaging/plugin.xml +++ b/Plugins/org.mitk.gui.qt.diffusionimaging/plugin.xml @@ -1,188 +1,204 @@ - - diff --git a/Plugins/org.mitk.gui.qt.diffusionimagingapp/src/QmitkDiffusionImagingAppWorkbenchAdvisor.cpp b/Plugins/org.mitk.gui.qt.diffusionimagingapp/src/QmitkDiffusionImagingAppWorkbenchAdvisor.cpp index d6fb014c02..c03ca35b0a 100644 --- a/Plugins/org.mitk.gui.qt.diffusionimagingapp/src/QmitkDiffusionImagingAppWorkbenchAdvisor.cpp +++ b/Plugins/org.mitk.gui.qt.diffusionimagingapp/src/QmitkDiffusionImagingAppWorkbenchAdvisor.cpp @@ -1,79 +1,84 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "QmitkDiffusionImagingAppWorkbenchAdvisor.h" #include "internal/QmitkDiffusionApplicationPlugin.h" #include #include #include #include #include #include const std::string QmitkDiffusionImagingAppWorkbenchAdvisor::WELCOME_PERSPECTIVE_ID = "org.mitk.diffusionimagingapp.perspectives.welcome"; void QmitkDiffusionImagingAppWorkbenchAdvisor::Initialize(berry::IWorkbenchConfigurer::Pointer configurer) { berry::QtWorkbenchAdvisor::Initialize(configurer); configurer->SetSaveAndRestore(true); } berry::WorkbenchWindowAdvisor* QmitkDiffusionImagingAppWorkbenchAdvisor::CreateWorkbenchWindowAdvisor( berry::IWorkbenchWindowConfigurer::Pointer configurer) { std::vector perspExcludeList; perspExcludeList.push_back( std::string("org.blueberry.uitest.util.EmptyPerspective") ); perspExcludeList.push_back( std::string("org.blueberry.uitest.util.EmptyPerspective2") ); perspExcludeList.push_back( std::string("org.mitk.coreapp.defaultperspective") ); perspExcludeList.push_back( std::string("org.mitk.extapp.defaultperspective") ); perspExcludeList.push_back( std::string("org.mitk.perspectives.publicdiffusionimaging") ); perspExcludeList.push_back( std::string("org.mitk.perspectives.diffusionimaginginternal") ); // Exclude the help perspective from org.blueberry.ui.qt.help from // the normal perspective list. // The perspective gets a dedicated menu entry in the help menu perspExcludeList.push_back("org.blueberry.perspectives.help"); std::vector viewExcludeList; + viewExcludeList.push_back( std::string("org.mitk.views.controlvisualizationpropertiesview") ); + viewExcludeList.push_back( std::string("org.mitk.views.imagenavigator") ); + viewExcludeList.push_back( std::string("org.mitk.views.datamanager") ); + viewExcludeList.push_back( std::string("org.mitk.views.modules") ); + viewExcludeList.push_back( std::string("org.blueberry.ui.internal.introview") ); configurer->SetInitialSize(berry::Point(1000,770)); QmitkExtWorkbenchWindowAdvisor* advisor = new QmitkExtWorkbenchWindowAdvisor(this, configurer); advisor->ShowViewMenuItem(false); advisor->ShowNewWindowMenuItem(false); advisor->ShowClosePerspectiveMenuItem(false); advisor->SetPerspectiveExcludeList(perspExcludeList); advisor->SetViewExcludeList(viewExcludeList); advisor->ShowViewToolbar(false); advisor->ShowPerspectiveToolbar(true); advisor->ShowVersionInfo(false); advisor->ShowMitkVersionInfo(false); advisor->SetProductName("MITK Diffusion"); advisor->SetWindowIcon(":/org.mitk.gui.qt.diffusionimagingapp/app-icon.png"); return advisor; } std::string QmitkDiffusionImagingAppWorkbenchAdvisor::GetInitialWindowPerspectiveId() { return WELCOME_PERSPECTIVE_ID; } diff --git a/Plugins/org.mitk.gui.qt.imagecropper/plugin.xml b/Plugins/org.mitk.gui.qt.imagecropper/plugin.xml index 38c0158df5..14f1a652bd 100644 --- a/Plugins/org.mitk.gui.qt.imagecropper/plugin.xml +++ b/Plugins/org.mitk.gui.qt.imagecropper/plugin.xml @@ -1,18 +1,18 @@ - - + - + diff --git a/Plugins/org.mitk.gui.qt.measurementtoolbox/plugin.xml b/Plugins/org.mitk.gui.qt.measurementtoolbox/plugin.xml index c2b4d0ec08..a45570603b 100644 --- a/Plugins/org.mitk.gui.qt.measurementtoolbox/plugin.xml +++ b/Plugins/org.mitk.gui.qt.measurementtoolbox/plugin.xml @@ -1,24 +1,25 @@ - - + - + - + diff --git a/Plugins/org.mitk.gui.qt.python/plugin.xml b/Plugins/org.mitk.gui.qt.python/plugin.xml index c69d1a6080..fccd0509cf 100644 --- a/Plugins/org.mitk.gui.qt.python/plugin.xml +++ b/Plugins/org.mitk.gui.qt.python/plugin.xml @@ -1,16 +1,16 @@ diff --git a/Plugins/org.mitk.gui.qt.registration/plugin.xml b/Plugins/org.mitk.gui.qt.registration/plugin.xml index 9f550dad2b..094f1eab40 100644 --- a/Plugins/org.mitk.gui.qt.registration/plugin.xml +++ b/Plugins/org.mitk.gui.qt.registration/plugin.xml @@ -1,25 +1,28 @@ - + - + - + diff --git a/Plugins/org.mitk.gui.qt.segmentation/plugin.xml b/Plugins/org.mitk.gui.qt.segmentation/plugin.xml index d00fd0cf2d..75c8681509 100644 --- a/Plugins/org.mitk.gui.qt.segmentation/plugin.xml +++ b/Plugins/org.mitk.gui.qt.segmentation/plugin.xml @@ -1,40 +1,43 @@ - - + - + - + diff --git a/Plugins/org.mitk.gui.qt.viewbrowser/src/internal/ViewBrowserView.cpp b/Plugins/org.mitk.gui.qt.viewbrowser/src/internal/ViewBrowserView.cpp index c0eb1cf2ae..5740e73c75 100644 --- a/Plugins/org.mitk.gui.qt.viewbrowser/src/internal/ViewBrowserView.cpp +++ b/Plugins/org.mitk.gui.qt.viewbrowser/src/internal/ViewBrowserView.cpp @@ -1,430 +1,478 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ // Blueberry #include #include #include #include #include // Qmitk #include "ViewBrowserView.h" #include #include #include // Qt #include #include #include -#include +#include class ClassFilterProxyModel : public QSortFilterProxyModel { private : - bool hasToBeDisplayed(const QModelIndex index) const; - bool displayElement(const QModelIndex index) const; + bool hasToBeDisplayed(const QModelIndex index) const; + bool displayElement(const QModelIndex index) const; public: - ClassFilterProxyModel(QObject *parent = NULL); - bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; + ClassFilterProxyModel(QObject *parent = NULL); + bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; }; ClassFilterProxyModel::ClassFilterProxyModel(QObject *parent): - QSortFilterProxyModel(parent) + QSortFilterProxyModel(parent) { } bool ClassFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const { - QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); + QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); - return hasToBeDisplayed(index); + return hasToBeDisplayed(index); } bool ClassFilterProxyModel::displayElement(const QModelIndex index) const { - bool result; - QString type = sourceModel()->data(index, Qt::DisplayRole).toString(); - if ( ! type.contains(filterRegExp())) - { - result = false; - } - else - { - result = true; - } - return result; + bool result; + QString type = sourceModel()->data(index, Qt::DisplayRole).toString(); + if ( ! type.contains(filterRegExp())) + { + result = false; + } + else + { + result = true; + } + return result; } bool ClassFilterProxyModel::hasToBeDisplayed(const QModelIndex index) const { - bool result = false; - // How many child this element have - if ( sourceModel()->rowCount(index) > 0 ) - { - for( int ii = 0; ii < sourceModel()->rowCount(index); ii++) + bool result = false; + // How many child this element have + if ( sourceModel()->rowCount(index) > 0 ) { - QModelIndex childIndex = sourceModel()->index(ii,0,index); - if ( ! childIndex.isValid() ) - break; - result = hasToBeDisplayed(childIndex); - result |= displayElement(index); - if (result) - { - // there is atless one element to display - break; - } + for( int ii = 0; ii < sourceModel()->rowCount(index); ii++) + { + QModelIndex childIndex = sourceModel()->index(ii,0,index); + if ( ! childIndex.isValid() ) + break; + result = hasToBeDisplayed(childIndex); + result |= displayElement(index); + if (result) + { + // there is atless one element to display + break; + } + } } - } - else - { - result = displayElement(index); - } - return result; + else + { + result = displayElement(index); + } + return result; } const std::string ViewBrowserView::VIEW_ID = "org.mitk.views.viewbrowser"; bool compareViews(berry::IViewDescriptor::Pointer a, berry::IViewDescriptor::Pointer b) { if (a.IsNull() || b.IsNull()) return false; return a->GetLabel().compare(b->GetLabel()) < 0; } +bool compareQStandardItems(QStandardItem* a, QStandardItem* b) +{ + if (a==NULL || b==NULL) + return false; + return a->text().compare(b->text()) < 0; +} + void ViewBrowserView::SetFocus() { } void ViewBrowserView::CreateQtPartControl( QWidget *parent ) { // create GUI widgets from the Qt Designer's .ui file m_Parent = parent; m_Controls.setupUi( parent ); connect( m_Controls.m_PluginTreeView, SIGNAL(customContextMenuRequested(QPoint)), SLOT(CustomMenuRequested(QPoint))); connect( m_Controls.m_PluginTreeView, SIGNAL(doubleClicked(const QModelIndex&)), SLOT(ItemClicked(const QModelIndex&))); connect( m_Controls.pushButton, SIGNAL(clicked()), SLOT(ButtonClicked()) ); connect( m_Controls.lineEdit, SIGNAL(textChanged(QString)), SLOT(FilterChanged())); m_ContextMenu = new QMenu(m_Controls.m_PluginTreeView); m_Controls.m_PluginTreeView->setContextMenuPolicy(Qt::CustomContextMenu); // Create a new TreeModel for the data m_TreeModel = new QStandardItemModel(); m_FilterProxyModel = new ClassFilterProxyModel(this); m_FilterProxyModel->setSourceModel(m_TreeModel); //proxyModel->setFilterFixedString("Diff"); m_Controls.m_PluginTreeView->setModel(m_FilterProxyModel); FillTreeList(); } void ViewBrowserView::ButtonClicked() { FillTreeList(); } void ViewBrowserView::FillTreeList() { m_TreeModel->clear(); QStandardItem *treeRootItem = m_TreeModel->invisibleRootItem(); // Get all available views and create a map of all views std::map viewMap; berry::IViewRegistry* viewRegistry = berry::PlatformUI::GetWorkbench()->GetViewRegistry(); std::vector views(viewRegistry->GetViews()); for (unsigned int i=0; iGetId()] = views[i]; } std::sort(views.begin(), views.end(), compareViews); // Get all available perspectives berry::IPerspectiveRegistry* perspRegistry = berry::PlatformUI::GetWorkbench()->GetPerspectiveRegistry(); std::vector perspectives(perspRegistry->GetPerspectives()); // workbench window available? if (berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow().IsNull()) return; // Fill the TreeModel berry::IWorkbenchPage::Pointer page = berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage(); if (page.IsNull()) { return; } QModelIndex currentIndex; berry::IPerspectiveDescriptor::Pointer currentPersp = page->GetPerspective(); std::vector perspectiveExcludeList = berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetPerspectiveExcludeList(); - std::vector viewExcludeList = berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetViewExcludeList(); QStandardItem *perspectiveRootItem = new QStandardItem("Perspectives"); treeRootItem->appendRow(perspectiveRootItem); for (unsigned int i=0; iGetId()) { skipPerspective = true; break; } if (skipPerspective) continue; QList< QStandardItem*> preparedRow; QIcon* pIcon = static_cast(p->GetImageDescriptor()->CreateImage()); mitk::QtPerspectiveItem* pItem = new mitk::QtPerspectiveItem(*pIcon, QString::fromStdString(p->GetLabel())); pItem->m_Perspective = p; preparedRow << pItem; perspectiveRootItem->appendRow(preparedRow); if (currentPersp->GetId()==p->GetId()) currentIndex = pItem->index(); } // Add a list with all available views - QList< QStandardItem*> preparedRow; - QStandardItem* pItem = new QStandardItem(QIcon(),"Views"); - preparedRow << pItem; - treeRootItem->appendRow(preparedRow); + std::vector viewExcludeList = berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetViewExcludeList(); + QStandardItem* viewRootItem = new QStandardItem(QIcon(),"View categories"); + treeRootItem->appendRow(viewRootItem); + + std::vector< QStandardItem* > categoryItems; + QStandardItem* noCategoryItem = new QStandardItem(QIcon(),"Miscellaneous"); + + for (unsigned int i = 0; i < views.size(); ++i) { - QList secondRow; - QIcon* icon = static_cast(views[i]->GetImageDescriptor()->CreateImage()); - mitk::QtViewItem* vItem = new mitk::QtViewItem(*icon, QString::fromStdString(views[i]->GetLabel())); - vItem->m_View = views[i]; - secondRow << vItem; - preparedRow.first()->appendRow(secondRow); + berry::IViewDescriptor::Pointer v = views[i]; + bool skipView = false; + for(unsigned int e=0; eGetId()) + { + skipView = true; + break; + } + if (skipView) + continue; + + std::vector catPath = v->GetCategoryPath(); + + QIcon* icon = static_cast(v->GetImageDescriptor()->CreateImage()); + mitk::QtViewItem* vItem = new mitk::QtViewItem(*icon, QString::fromStdString(v->GetLabel())); + vItem->m_View = v; + + if (catPath.empty()) + noCategoryItem->appendRow(vItem); + else + { + QStandardItem* categoryItem = NULL; + + for (unsigned int c=0; ctext().toStdString() == catPath.front()) + { + categoryItem = categoryItems.at(c); + break; + } + + if (categoryItem==NULL) + { + categoryItem = new QStandardItem(QIcon(),catPath.front().c_str()); + categoryItems.push_back(categoryItem); + } + + categoryItem->appendRow(vItem); + } } + std::sort(categoryItems.begin(), categoryItems.end(), compareQStandardItems); + + for (unsigned int i=0; iappendRow(categoryItems.at(i)); + if (noCategoryItem->hasChildren()) + viewRootItem->appendRow(noCategoryItem); QModelIndex correctedIndex = m_FilterProxyModel->mapFromSource(currentIndex); m_Controls.m_PluginTreeView->setCurrentIndex(correctedIndex); } void ViewBrowserView::OnSelectionChanged( berry::IWorkbenchPart::Pointer /*source*/, const QList& nodes ) { } void ViewBrowserView::FilterChanged() { - QString filterString = m_Controls.lineEdit->text(); - if (filterString.size() > 0 ) - { - m_Controls.m_PluginTreeView->expandAll(); - } - QRegExp::PatternSyntax syntax = QRegExp::RegExp; - - Qt::CaseSensitivity caseSensitivity = Qt::CaseInsensitive; - QString strPattern = "^*" + filterString; - QRegExp regExp(strPattern, caseSensitivity); - - m_FilterProxyModel->setFilterRegExp(regExp); + QString filterString = m_Controls.lineEdit->text(); + if (filterString.size() > 0 ) + m_Controls.m_PluginTreeView->expandAll(); + else + m_Controls.m_PluginTreeView->collapseAll(); + QRegExp::PatternSyntax syntax = QRegExp::RegExp; + + Qt::CaseSensitivity caseSensitivity = Qt::CaseInsensitive; + QString strPattern = "^*" + filterString; + QRegExp regExp(strPattern, caseSensitivity); + + m_FilterProxyModel->setFilterRegExp(regExp); } void ViewBrowserView::ItemClicked(const QModelIndex &index) { QStandardItem* item = m_TreeModel->itemFromIndex(m_FilterProxyModel->mapToSource(index)); if ( dynamic_cast< mitk::QtPerspectiveItem* >(item) ) { try { mitk::QtPerspectiveItem* pItem = dynamic_cast< mitk::QtPerspectiveItem* >(item); berry::PlatformUI::GetWorkbench()->ShowPerspective( pItem->m_Perspective->GetId(), berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow() ); } catch (...) { QMessageBox::critical(0, "Opening Perspective Failed", QString("The requested perspective could not be opened.\nSee the log for details.")); } } else if ( dynamic_cast< mitk::QtViewItem* >(item) ) { berry::IWorkbenchPage::Pointer page = berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage(); if (page.IsNotNull()) { try { mitk::QtViewItem* vItem = dynamic_cast< mitk::QtViewItem* >(item); page->ShowView(vItem->m_View->GetId()); } catch (berry::PartInitException e) { BERRY_ERROR << "Error: " << e.displayText() << std::endl; } } } } void ViewBrowserView::AddPerspective() { QmitkNewPerspectiveDialog* dialog = new QmitkNewPerspectiveDialog( m_Parent ); int dialogReturnValue = dialog->exec(); if ( dialogReturnValue == QDialog::Rejected ) return; berry::IPerspectiveRegistry* perspRegistry = berry::PlatformUI::GetWorkbench()->GetPerspectiveRegistry(); try { perspRegistry->CreatePerspective(dialog->GetPerspectiveName().toStdString(), perspRegistry->FindPerspectiveWithId(perspRegistry->GetDefaultPerspective())); } catch(...) { QMessageBox::warning(m_Parent, "Error", "Duplication of selected perspective failed. Please make sure the specified perspective name is not already in use!"); } FillTreeList(); } void ViewBrowserView::ClonePerspective() { if (m_RegisteredPerspective.IsNotNull()) { QmitkNewPerspectiveDialog* dialog = new QmitkNewPerspectiveDialog( m_Parent ); QString defaultName(m_RegisteredPerspective->GetLabel().c_str()); defaultName.append(" Copy"); dialog->SetPerspectiveName(defaultName); int dialogReturnValue = dialog->exec(); if ( dialogReturnValue == QDialog::Rejected ) return; berry::IPerspectiveRegistry* perspRegistry = berry::PlatformUI::GetWorkbench()->GetPerspectiveRegistry(); try { perspRegistry->ClonePerspective(dialog->GetPerspectiveName().toStdString(), dialog->GetPerspectiveName().toStdString(), m_RegisteredPerspective); } catch(...) { QMessageBox::warning(m_Parent, "Error", "Duplication of selected perspective failed. Please make sure the specified perspective name is not already in use!"); } FillTreeList(); } } void ViewBrowserView::ResetPerspective() { if (QMessageBox::Yes == QMessageBox(QMessageBox::Question, "Please confirm", "Do you really want to reset the curent perspective?", QMessageBox::Yes|QMessageBox::No).exec()) berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->ResetPerspective(); } void ViewBrowserView::DeletePerspective() { if (m_RegisteredPerspective.IsNotNull()) { QString question = "Do you really want to remove the perspective '"; question.append(m_RegisteredPerspective->GetLabel().c_str()); question.append("'?"); if (QMessageBox::Yes == QMessageBox(QMessageBox::Question, "Please confirm", question, QMessageBox::Yes|QMessageBox::No).exec()) { berry::IPerspectiveRegistry* perspRegistry = berry::PlatformUI::GetWorkbench()->GetPerspectiveRegistry(); perspRegistry->DeletePerspective(m_RegisteredPerspective); FillTreeList(); } } } void ViewBrowserView::ClosePerspective() { if (QMessageBox::Yes == QMessageBox(QMessageBox::Question, "Please confirm", "Do you really want to close the curent perspective?", QMessageBox::Yes|QMessageBox::No).exec()) { berry::IWorkbenchPage::Pointer page = berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage(); page->CloseCurrentPerspective(true, true); if ( page->GetPerspective().IsNull() ) { berry::IPerspectiveRegistry* perspRegistry = berry::PlatformUI::GetWorkbench()->GetPerspectiveRegistry(); berry::PlatformUI::GetWorkbench()->ShowPerspective( perspRegistry->GetDefaultPerspective(), berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow() ); } } } void ViewBrowserView::ClosePerspectives() { if (QMessageBox::Yes == QMessageBox(QMessageBox::Question, "Please confirm", "Do you really want to close all perspectives?", QMessageBox::Yes|QMessageBox::No).exec()) { berry::IWorkbenchPage::Pointer page = berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage(); page->CloseAllPerspectives(true, true); berry::IPerspectiveRegistry* perspRegistry = berry::PlatformUI::GetWorkbench()->GetPerspectiveRegistry(); berry::PlatformUI::GetWorkbench()->ShowPerspective( perspRegistry->GetDefaultPerspective(), berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow() ); } } void ViewBrowserView::CustomMenuRequested(QPoint pos) { - QModelIndex index = m_Controls.m_PluginTreeView->indexAt(pos); + QModelIndex index = m_Controls.m_PluginTreeView->indexAt(pos); QStandardItem* item = m_TreeModel->itemFromIndex(m_FilterProxyModel->mapToSource(index)); if (m_ContextMenu==NULL || item==NULL) return; m_ContextMenu->clear(); m_RegisteredPerspective = NULL; bool showMenu = false; if (item->text()=="Perspectives") { QAction* addAction = new QAction("Create new perspective", this); m_ContextMenu->addAction(addAction); connect(addAction, SIGNAL(triggered()), SLOT(AddPerspective())); m_ContextMenu->addSeparator(); QAction* resetAction = new QAction("Reset current perspective", this); m_ContextMenu->addAction(resetAction); connect(resetAction, SIGNAL(triggered()), SLOT(ResetPerspective())); QAction* closeAction = new QAction("Close current perspective", this); m_ContextMenu->addAction(closeAction); connect(closeAction, SIGNAL(triggered()), SLOT(ClosePerspective())); m_ContextMenu->addSeparator(); QAction* closeAllAction = new QAction("Close all perspectives", this); m_ContextMenu->addAction(closeAllAction); connect(closeAllAction, SIGNAL(triggered()), SLOT(ClosePerspectives())); showMenu = true; } if (dynamic_cast< mitk::QtPerspectiveItem* >(item) ) { m_RegisteredPerspective = dynamic_cast< mitk::QtPerspectiveItem* >(item)->m_Perspective; //m_ContextMenu->addSeparator(); QAction* cloneAction = new QAction("Duplicate perspective", this); m_ContextMenu->addAction(cloneAction); connect(cloneAction, SIGNAL(triggered()), SLOT(ClonePerspective())); if (!m_RegisteredPerspective->IsPredefined()) { QAction* deleteAction = new QAction("Remove perspective", this); m_ContextMenu->addAction(deleteAction); connect(deleteAction, SIGNAL(triggered()), SLOT(DeletePerspective())); } showMenu = true; } if (showMenu) m_ContextMenu->popup(m_Controls.m_PluginTreeView->viewport()->mapToGlobal(pos)); -} \ No newline at end of file +} diff --git a/Plugins/org.mitk.gui.qt.volumevisualization/plugin.xml b/Plugins/org.mitk.gui.qt.volumevisualization/plugin.xml index 33ed061d6a..5ae4185899 100755 --- a/Plugins/org.mitk.gui.qt.volumevisualization/plugin.xml +++ b/Plugins/org.mitk.gui.qt.volumevisualization/plugin.xml @@ -1,15 +1,14 @@ - - + - \ No newline at end of file +