diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspectiveDescriptor.h b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspectiveDescriptor.h index ac8d0eb442..d7c3f78cce 100644 --- a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspectiveDescriptor.h +++ b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspectiveDescriptor.h @@ -1,233 +1,230 @@ /*=================================================================== BlueBerry Platform 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. ===================================================================*/ #ifndef BERRYPERSPECTIVEDESCRIPTOR_H_ #define BERRYPERSPECTIVEDESCRIPTOR_H_ #include #include "berryIPerspectiveDescriptor.h" #include "berryIPerspectiveFactory.h" #include "berryIMemento.h" #include namespace berry { - /** * \ingroup org_blueberry_ui_internal * * PerspectiveDescriptor. *

* A PerspectiveDesciptor has 3 states: *

*
    *
  1. It isPredefined(), in which case it was defined from an * extension point.
  2. *
  3. It isPredefined() and hasCustomFile, in * which case the user has customized a predefined perspective.
  4. *
  5. It hasCustomFile, in which case the user created a new * perspective.
  6. *
* */ class PerspectiveDescriptor : public IPerspectiveDescriptor { - public: berryObjectMacro(PerspectiveDescriptor); private: std::string id; std::string pluginId; std::string originalId; std::string label; std::string className; std::string description; bool singleton; bool fixed; mutable ImageDescriptor::Pointer imageDescriptor; IConfigurationElement::Pointer configElement; /** * Create a new empty descriptor. * * @param id * the id of the new descriptor * @param label * the label of the new descriptor * @param originalDescriptor * the descriptor that this descriptor is based on */ public: PerspectiveDescriptor(const std::string& id, const std::string& label, PerspectiveDescriptor::Pointer originalDescriptor); /** * Create a descriptor from a config element. * * @param id * the id of the element to create * @param configElement * the element to base this perspective on * @throws CoreException * thrown if there are any missing attributes */ public: PerspectiveDescriptor(const std::string& id, IConfigurationElement::Pointer configElement); /** * Creates a factory for a predefined perspective. If the perspective is not * predefined return null. * * @return the IPerspectiveFactory or null * @throws CoreException * if the object could not be instantiated. */ public: IPerspectiveFactory::Pointer CreateFactory(); /** * Deletes the custom definition for a perspective.. */ public: void DeleteCustomDefinition(); /* * (non-Javadoc) * * @see org.blueberry.ui.IPerspectiveDescriptor#getDescription() */ public: std::string GetDescription() const; +public: void SetDescription(std::string desc) {description = desc; } /** * Returns whether or not this perspective is fixed. * * @return whether or not this perspective is fixed */ public: bool GetFixed() const; /* * (non-Javadoc) * * @see org.blueberry.ui.IPerspectiveDescriptor#getId() */ public: std::string GetId() const; public: std::string GetPluginId() const; /* * (non-Javadoc) * * @see org.blueberry.ui.IPerspectiveDescriptor#getImageDescriptor() */ public: ImageDescriptor::Pointer GetImageDescriptor() const; /* * (non-Javadoc) * * @see org.blueberry.ui.IPerspectiveDescriptor#getLabel() */ public: std::string GetLabel() const; /** * Return the original id of this descriptor. * * @return the original id of this descriptor */ public: std::string GetOriginalId() const; /** * Returns true if this perspective has a custom definition. * * @return whether this perspective has a custom definition */ public: bool HasCustomDefinition() const; /** * Returns true if this perspective wants to be default. * * @return whether this perspective wants to be default */ public: bool HasDefaultFlag() const; /** * Returns true if this perspective is predefined by an * extension. * * @return boolean whether this perspective is predefined by an extension */ public: bool IsPredefined() const; /** * Returns true if this perspective is a singleton. * * @return whether this perspective is a singleton */ public: bool IsSingleton() const; /** * Restore the state of a perspective from a memento. * * @param memento * the memento to restore from * @return the IStatus of the operation * @see org.blueberry.ui.IPersistableElement */ public: bool RestoreState(IMemento::Pointer memento); /** * Revert to the predefined extension template. Does nothing if this * descriptor is user defined. */ public: void RevertToPredefined(); /** * Save the state of a perspective to a memento. * * @param memento * the memento to restore from * @return the IStatus of the operation * @see org.blueberry.ui.IPersistableElement */ public: bool SaveState(IMemento::Pointer memento); /** * Return the configuration element used to create this perspective, if one * was used. * * @return the configuration element used to create this perspective * @since 3.0 */ public: IConfigurationElement::Pointer GetConfigElement() const; /** * Returns the factory class name for this descriptor. * * @return the factory class name for this descriptor * @since 3.1 */ public: std::string GetFactoryClassName() const; - }; - } #endif /*BERRYPERSPECTIVEDESCRIPTOR_H_*/ diff --git a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspectiveRegistryReader.cpp b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspectiveRegistryReader.cpp index 6b3b893be9..4eb7ff8487 100755 --- a/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspectiveRegistryReader.cpp +++ b/BlueBerry/Bundles/org.blueberry.ui/src/internal/berryPerspectiveRegistryReader.cpp @@ -1,62 +1,64 @@ /*=================================================================== BlueBerry Platform 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 "berryPerspectiveRegistryReader.h" #include "berryPerspectiveRegistry.h" #include "berryWorkbenchPlugin.h" #include "berryPlatformUI.h" #include "berryWorkbenchRegistryConstants.h" namespace berry { - PerspectiveRegistryReader::PerspectiveRegistryReader() { - } void PerspectiveRegistryReader::ReadPerspectives(PerspectiveRegistry* out) { registry = out; this->ReadRegistry(PlatformUI::PLUGIN_ID, WorkbenchRegistryConstants::PL_PERSPECTIVES); } bool PerspectiveRegistryReader::ReadElement(IConfigurationElement::Pointer element) { if (element->GetName() == WorkbenchRegistryConstants::TAG_PERSPECTIVE) { try { std::string id; element->GetAttribute(WorkbenchRegistryConstants::ATT_ID, id); + std::vector childs = element->GetChildren("description"); PerspectiveDescriptor::Pointer desc( new PerspectiveDescriptor(id, element)); + if (childs.size() > 0) + { + desc->SetDescription(childs[0]->GetValue()); + } registry->AddPerspective(desc); } catch (CoreException e) { // log an error since its not safe to open a dialog here WorkbenchPlugin::Log("Unable to create layout descriptor.", e);//$NON-NLS-1$ } return true; } return false; } - -} +} \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.diffusionimaging/plugin.xml b/Plugins/org.mitk.gui.qt.diffusionimaging/plugin.xml index b435a0fb90..8d9a6664f0 100644 --- a/Plugins/org.mitk.gui.qt.diffusionimaging/plugin.xml +++ b/Plugins/org.mitk.gui.qt.diffusionimaging/plugin.xml @@ -1,204 +1,206 @@ + icon="resources/reconodf.png"> + This is a short information about this perspective + diff --git a/Plugins/org.mitk.gui.qt.ext/src/QmitkViewBrowserWidget.cpp b/Plugins/org.mitk.gui.qt.ext/src/QmitkViewBrowserWidget.cpp index bb7e450481..b3ef210158 100644 --- a/Plugins/org.mitk.gui.qt.ext/src/QmitkViewBrowserWidget.cpp +++ b/Plugins/org.mitk.gui.qt.ext/src/QmitkViewBrowserWidget.cpp @@ -1,535 +1,544 @@ /*=================================================================== 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. ===================================================================*/ //Qmitk headers #include "QmitkViewBrowserWidget.h" // Blueberry #include #include #include #include #include // Qt #include #include #include #include class ClassFilterProxyModel : public QSortFilterProxyModel { private : 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::ClassFilterProxyModel(QObject *parent): QSortFilterProxyModel(parent) { } bool ClassFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const { QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); return hasToBeDisplayed(index); } bool ClassFilterProxyModel::displayElement(const QModelIndex index) const { bool result = false; QString type = sourceModel()->data(index, Qt::DisplayRole).toString(); QStandardItem * item = dynamic_cast(sourceModel())->itemFromIndex(index); if (type.contains(filterRegExp())) { return true; } { mitk::QtViewItem* viewItem = dynamic_cast(item); if (viewItem) { for (int i = 0; i < viewItem->m_Tags.size(); ++i) { if (viewItem->m_Tags[i].contains(filterRegExp())) { return true; } } + if (viewItem->m_Description.contains(filterRegExp())) + { + return true; + } } } { mitk::QtPerspectiveItem* viewItem = dynamic_cast(item); if (viewItem) { for (int i = 0; i < viewItem->m_Tags.size(); ++i) { if (viewItem->m_Tags[i].contains(filterRegExp())) { return true; } } + if (viewItem->m_Description.contains(filterRegExp())) + { + return true; + } } } - - return result; + 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++) { 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; } struct ViewBrowserWindowListener : public berry::IWindowListener { ViewBrowserWindowListener(QmitkViewBrowserWidget* switcher) : switcher(switcher), m_Running(false) {} virtual void WindowOpened(berry::IWorkbenchWindow::Pointer /*window*/) { if (m_Running) return; m_Running = true; switcher->FillTreeList(); m_Running = false; } virtual void WindowActivated(berry::IWorkbenchWindow::Pointer /*window*/) { if (m_Running) return; m_Running = true; switcher->FillTreeList(); m_Running = false; } private: QmitkViewBrowserWidget* switcher; bool m_Running; }; 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; } QmitkViewBrowserWidget::QmitkViewBrowserWidget( QWidget * parent, Qt::WindowFlags ) : QWidget(parent) { this->CreateQtPartControl(this); } QmitkViewBrowserWidget::~QmitkViewBrowserWidget() { - } void QmitkViewBrowserWidget::CreateQtPartControl( QWidget *parent ) { // create GUI widgets from the Qt Designer's .ui file m_WindowListener = ViewBrowserWindowListener::Pointer(new ViewBrowserWindowListener(this)); berry::PlatformUI::GetWorkbench()->AddWindowListener(m_WindowListener); 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.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(); QList additions = m_Registry.GetViewTags(); foreach (const ViewTagsDescriptor::Pointer& var, additions) { std::cout << var->GetID().toStdString() << std::endl; } } void QmitkViewBrowserWidget::FillTreeList() { // active workbench window available? if (berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow().IsNull()) return; // active page available? berry::IWorkbenchPage::Pointer page = berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage(); if (page.IsNull()) return; // everything is fine and we can remove the window listener berry::PlatformUI::GetWorkbench()->RemoveWindowListener(m_WindowListener); // initialize tree model m_TreeModel->clear(); QStandardItem *treeRootItem = m_TreeModel->invisibleRootItem(); // get all available perspectives berry::IPerspectiveRegistry* perspRegistry = berry::PlatformUI::GetWorkbench()->GetPerspectiveRegistry(); std::vector perspectives(perspRegistry->GetPerspectives()); QModelIndex currentIndex; berry::IPerspectiveDescriptor::Pointer currentPersp = page->GetPerspective(); std::vector perspectiveExcludeList = berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetPerspectiveExcludeList(); QStandardItem *perspectiveRootItem = new QStandardItem("Perspectives"); treeRootItem->appendRow(perspectiveRootItem); for (unsigned int i=0; iGetId()) { skipPerspective = true; break; } if (skipPerspective) continue; QIcon* pIcon = static_cast(p->GetImageDescriptor()->CreateImage()); mitk::QtPerspectiveItem* pItem = new mitk::QtPerspectiveItem(*pIcon, QString::fromStdString(p->GetLabel())); pItem->m_Perspective = p; ViewTagsDescriptor::Pointer tags = m_Registry.Find(p->GetId()); + pItem->m_Description = QString::fromStdString(p->GetDescription()); pItem->m_Tags = tags->GetTags(); perspectiveRootItem->appendRow(pItem); if (currentPersp) { if (currentPersp->GetId()==p->GetId()) currentIndex = pItem->index(); } } // get all available views berry::IViewRegistry* viewRegistry = berry::PlatformUI::GetWorkbench()->GetViewRegistry(); std::vector views(viewRegistry->GetViews()); std::sort(views.begin(), views.end(), compareViews); 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) { berry::IViewDescriptor::Pointer v = views[i]; + ViewTagsDescriptor::Pointer tags = m_Registry.Find(views[i]->GetId()); 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; + vItem->m_Description = QString::fromStdString(v->GetDescription()); vItem->m_Tags = tags->GetTags(); 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 QmitkViewBrowserWidget::FilterChanged() { 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 QmitkViewBrowserWidget::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 QmitkViewBrowserWidget::AddPerspective() { QmitkNewPerspectiveDialog* dialog = new QmitkNewPerspectiveDialog( m_Parent ); int dialogReturnValue = dialog->exec(); if ( dialogReturnValue == QDialog::Rejected ) return; berry::IPerspectiveRegistry* perspRegistry = berry::PlatformUI::GetWorkbench()->GetPerspectiveRegistry(); try { berry::IPerspectiveDescriptor::Pointer perspDesc; perspDesc = perspRegistry->CreatePerspective(dialog->GetPerspectiveName().toStdString(), perspRegistry->FindPerspectiveWithId(perspRegistry->GetDefaultPerspective())); berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->SetPerspective(perspDesc); } 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 QmitkViewBrowserWidget::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 { berry::IPerspectiveDescriptor::Pointer perspDesc = perspRegistry->ClonePerspective(dialog->GetPerspectiveName().toStdString(), dialog->GetPerspectiveName().toStdString(), m_RegisteredPerspective); berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->SetPerspective(perspDesc); } 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 QmitkViewBrowserWidget::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 QmitkViewBrowserWidget::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); berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->RemovePerspective(m_RegisteredPerspective); FillTreeList(); if (! berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->GetPerspective()) { berry::IPerspectiveDescriptor::Pointer persp = perspRegistry->FindPerspectiveWithId(perspRegistry->GetDefaultPerspective()); berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->SetPerspective(persp); } } } } void QmitkViewBrowserWidget::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 QmitkViewBrowserWidget::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 QmitkViewBrowserWidget::CustomMenuRequested(QPoint 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* 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.ext/src/mitkQtPerspectiveItem.h b/Plugins/org.mitk.gui.qt.ext/src/mitkQtPerspectiveItem.h index fc09af133d..1ede7418d3 100644 --- a/Plugins/org.mitk.gui.qt.ext/src/mitkQtPerspectiveItem.h +++ b/Plugins/org.mitk.gui.qt.ext/src/mitkQtPerspectiveItem.h @@ -1,47 +1,48 @@ /*=================================================================== 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. ===================================================================*/ #ifndef _PerspectiveItem #define _PerspectiveItem #include #include namespace mitk { class QtPerspectiveItem : public QStandardItem { public: QtPerspectiveItem(QString string) : QStandardItem(string) { } QtPerspectiveItem(const QIcon& icon, QString string) : QStandardItem(icon, string) { } berry::IPerspectiveDescriptor::Pointer m_Perspective; std::vector m_Tags; + QString m_Description; private: }; } #endif diff --git a/Plugins/org.mitk.gui.qt.ext/src/mitkQtViewItem.h b/Plugins/org.mitk.gui.qt.ext/src/mitkQtViewItem.h index 7a363264d9..04c2beeb80 100644 --- a/Plugins/org.mitk.gui.qt.ext/src/mitkQtViewItem.h +++ b/Plugins/org.mitk.gui.qt.ext/src/mitkQtViewItem.h @@ -1,48 +1,49 @@ /*=================================================================== 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. ===================================================================*/ #ifndef _ViewItem #define _ViewItem #include #include #include namespace mitk { class QtViewItem : public QStandardItem { public: QtViewItem(QString string) : QStandardItem(string) { } QtViewItem(const QIcon& icon, QString string) : QStandardItem(icon, string) { } berry::IViewDescriptor::Pointer m_View; std::vector m_Tags; + QString m_Description; private: }; } #endif diff --git a/Plugins/org.mitk.gui.qt.moviemaker/plugin.xml b/Plugins/org.mitk.gui.qt.moviemaker/plugin.xml index ff93f8cec9..8ecb5c523d 100644 --- a/Plugins/org.mitk.gui.qt.moviemaker/plugin.xml +++ b/Plugins/org.mitk.gui.qt.moviemaker/plugin.xml @@ -1,27 +1,29 @@ + icon="resources/screenshot_maker.png" > + This is a short information about this perspective + Moving Images Documentation Visualisation Document Screen capture