diff --git a/Modules/QtWidgets/files.cmake b/Modules/QtWidgets/files.cmake index ad9a92ab7b..9e5579fb4e 100644 --- a/Modules/QtWidgets/files.cmake +++ b/Modules/QtWidgets/files.cmake @@ -1,118 +1,118 @@ file(GLOB_RECURSE H_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include/*") set(CPP_FILES QmitkAbstractDataStorageModel.cpp QmitkApplicationCursor.cpp QmitkDataStorageComboBox.cpp QmitkDataStorageDefaultListModel.cpp QmitkDataStorageListModel.cpp QmitkDataStorageTableModel.cpp QmitkDataStorageSimpleTreeModel.cpp QmitkDataStorageTreeModel.cpp QmitkDataStorageTreeModelInternalItem.cpp QmitkFileReaderOptionsDialog.cpp QmitkFileReaderWriterOptionsWidget.cpp QmitkFileWriterOptionsDialog.cpp QmitkInteractionSchemeToolBar.cpp QmitkIOUtil.cpp QmitkLevelWindowPresetDefinitionDialog.cpp QmitkLevelWindowRangeChangeDialog.cpp QmitkLevelWindowWidgetContextMenu.cpp QmitkLevelWindowWidget.cpp QmitkLineEditLevelWindowWidget.cpp QmitkMemoryUsageIndicatorView.cpp QmitkMouseModeSwitcher.cpp QmitkMimeTypes.cpp QmitkMultiWidgetConfigurationToolBar.cpp QmitkMultiWidgetLayoutSelectionWidget.cpp QmitkNodeDescriptor.cpp QmitkColoredNodeDescriptor.cpp QmitkNodeDescriptorManager.cpp QmitkProgressBar.cpp QmitkPropertiesTableEditor.cpp QmitkPropertiesTableModel.cpp QmitkPropertyDelegate.cpp QmitkRegisterClasses.cpp QmitkRenderingManager.cpp QmitkRenderingManagerFactory.cpp QmitkRenderWindow.cpp QmitkRenderWindowMenu.cpp QmitkRenderWindowWidget.cpp QmitkServiceListWidget.cpp QmitkSliderLevelWindowWidget.cpp QmitkStdMultiWidget.cpp - QmitkCustomMultiWidget.cpp + QmitkMxNMultiWidget.cpp QmitkDataStorageComboBoxWithSelectNone.cpp QmitkDataStorageFilterProxyModel.cpp QmitkPropertyItem.cpp QmitkPropertyItemDelegate.cpp QmitkPropertyItemModel.cpp QmitkStyleManager.cpp QmitkAbstractDataStorageInspector.cpp QmitkDataStorageListInspector.cpp QmitkDataStorageTreeInspector.cpp QmitkModelViewSelectionConnector.cpp mitkIDataStorageInspectorProvider.cpp mitkQtWidgetsActivator.cpp mitkDataStorageInspectorGenerator.cpp ) set(MOC_H_FILES include/QmitkAbstractDataStorageModel.h include/QmitkDataStorageComboBox.h include/QmitkDataStorageTableModel.h include/QmitkDataStorageTreeModel.h include/QmitkDataStorageSimpleTreeModel.h include/QmitkDataStorageDefaultListModel.h include/QmitkFileReaderOptionsDialog.h include/QmitkFileReaderWriterOptionsWidget.h include/QmitkFileWriterOptionsDialog.h include/QmitkInteractionSchemeToolBar.h include/QmitkLevelWindowPresetDefinitionDialog.h include/QmitkLevelWindowRangeChangeDialog.h include/QmitkLevelWindowWidgetContextMenu.h include/QmitkLevelWindowWidget.h include/QmitkLineEditLevelWindowWidget.h include/QmitkMemoryUsageIndicatorView.h include/QmitkMouseModeSwitcher.h include/QmitkMultiWidgetConfigurationToolBar.h include/QmitkMultiWidgetLayoutSelectionWidget.h include/QmitkNodeDescriptor.h include/QmitkColoredNodeDescriptor.h include/QmitkNodeDescriptorManager.h include/QmitkProgressBar.h include/QmitkPropertiesTableEditor.h include/QmitkPropertyDelegate.h include/QmitkRenderingManager.h include/QmitkRenderWindow.h include/QmitkRenderWindowMenu.h include/QmitkRenderWindowWidget.h include/QmitkServiceListWidget.h include/QmitkSliderLevelWindowWidget.h include/QmitkStdMultiWidget.h - include/QmitkCustomMultiWidget.h + include/QmitkMxNMultiWidget.h include/QmitkDataStorageComboBoxWithSelectNone.h include/QmitkPropertyItemDelegate.h include/QmitkPropertyItemModel.h include/QmitkDataStorageListInspector.h include/QmitkAbstractDataStorageInspector.h include/QmitkDataStorageTreeInspector.h include/QmitkModelViewSelectionConnector.h ) set(UI_FILES src/QmitkFileReaderOptionsDialog.ui src/QmitkFileWriterOptionsDialog.ui src/QmitkLevelWindowPresetDefinition.ui src/QmitkLevelWindowWidget.ui src/QmitkLevelWindowRangeChange.ui src/QmitkMemoryUsageIndicator.ui src/QmitkMultiWidgetLayoutSelectionWidget.ui src/QmitkServiceListWidgetControls.ui src/QmitkDataStorageListInspector.ui src/QmitkDataStorageTreeInspector.ui ) set(QRC_FILES resource/Qmitk.qrc ) diff --git a/Modules/QtWidgets/include/QmitkMultiWidgetConfigurationToolBar.h b/Modules/QtWidgets/include/QmitkMultiWidgetConfigurationToolBar.h index 72b149a46f..89ca170d5b 100644 --- a/Modules/QtWidgets/include/QmitkMultiWidgetConfigurationToolBar.h +++ b/Modules/QtWidgets/include/QmitkMultiWidgetConfigurationToolBar.h @@ -1,65 +1,62 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. 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 QMITKMULTIWIDGETCONFIGURATIONTOOLBAR_H #define QMITKMULTIWIDGETCONFIGURATIONTOOLBAR_H #include "MitkQtWidgetsExports.h" #include // mitk qtwidgets -#include "QmitkCustomMultiWidget.h" #include "QmitkMultiWidgetLayoutSelectionWidget.h" /** * @brief * * */ class MITKQTWIDGETS_EXPORT QmitkMultiWidgetConfigurationToolBar : public QToolBar { Q_OBJECT public: - QmitkMultiWidgetConfigurationToolBar(QmitkCustomMultiWidget* customMultiWidget); + QmitkMultiWidgetConfigurationToolBar(); ~QmitkMultiWidgetConfigurationToolBar() override; Q_SIGNALS: void LayoutSet(int row, int column); void Synchronized(bool synchronized); protected Q_SLOTS: void OnSetLayout(); void OnSynchronize(); private: void InitializeToolBar();; void AddButtons(); - QmitkCustomMultiWidget* m_CustomMultiWidget; - QAction* m_SynchronizeAction; QmitkMultiWidgetLayoutSelectionWidget* m_LayoutSelectionPopup; }; #endif // QMITKMULTIWIDGETCONFIGURATIONTOOLBAR_H diff --git a/Modules/QtWidgets/include/QmitkCustomMultiWidget.h b/Modules/QtWidgets/include/QmitkMxNMultiWidget.h similarity index 89% rename from Modules/QtWidgets/include/QmitkCustomMultiWidget.h rename to Modules/QtWidgets/include/QmitkMxNMultiWidget.h index c3608be5b8..12c7e2fb39 100644 --- a/Modules/QtWidgets/include/QmitkCustomMultiWidget.h +++ b/Modules/QtWidgets/include/QmitkMxNMultiWidget.h @@ -1,158 +1,158 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. 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 QMITKCUSTOMMULTIWIDGET_H -#define QMITKCUSTOMMULTIWIDGET_H +#ifndef QMITKMXNMULTIWIDGET_H +#define QMITKMXNMULTIWIDGET_H // qt widgets module #include "MitkQtWidgetsExports.h" #include "QmitkRenderWindowWidget.h" // mitk core #include #include #include #include // qt #include class QHBoxLayout; class QVBoxLayout; class QGridLayout; class QSpacerItem; class QmitkRenderWindow; namespace mitk { class RenderingManager; } /** -* @brief The 'QmitkCustomMultiWidget' is a 'QWidget' that is used to display multiple render windows at once. +* @brief The 'QmitkMxNMultiWidget' is a QWidget that is used to display multiple render windows at once. * * Render windows can dynamically be added and removed to change the layout of the multi widget. */ -class MITKQTWIDGETS_EXPORT QmitkCustomMultiWidget : public QWidget +class MITKQTWIDGETS_EXPORT QmitkMxNMultiWidget : public QWidget { Q_OBJECT public: using RenderWindowWidgetPointer = std::shared_ptr; using RenderWindowWidgetMap = std::map>; using RenderWindowHash = QHash; - QmitkCustomMultiWidget(QWidget* parent = 0, + QmitkMxNMultiWidget(QWidget* parent = 0, Qt::WindowFlags f = 0, mitk::RenderingManager* renderingManager = nullptr, mitk::BaseRenderer::RenderingMode::Type renderingMode = mitk::BaseRenderer::RenderingMode::Standard, - const QString& multiWidgetName = "custommulti"); + const QString& multiWidgetName = "mxnmulti"); - virtual ~QmitkCustomMultiWidget(); + virtual ~QmitkMxNMultiWidget(); void SetDataStorage(mitk::DataStorage* dataStorage); void InitializeRenderWindowWidgets(); mitk::InteractionEventHandler::Pointer GetInteractionEventHandler() { return m_DisplayActionEventBroadcast.GetPointer(); }; void ResetLayout(int row, int column); void Synchronize(bool synchronized); RenderWindowWidgetMap GetRenderWindowWidgets() const; RenderWindowWidgetPointer GetRenderWindowWidget(int row, int column) const; RenderWindowWidgetPointer GetRenderWindowWidget(const QString& widgetName) const; RenderWindowHash GetRenderWindows() const; QmitkRenderWindow* GetRenderWindow(int row, int column) const; QmitkRenderWindow* GetRenderWindow(const QString& widgetName) const; void SetActiveRenderWindowWidget(RenderWindowWidgetPointer activeRenderWindowWidget); RenderWindowWidgetPointer GetActiveRenderWindowWidget() const; RenderWindowWidgetPointer GetFirstRenderWindowWidget() const; RenderWindowWidgetPointer GetLastRenderWindowWidget() const; unsigned int GetNumberOfRenderWindowWidgets() const; void RequestUpdate(const QString& widgetName); void RequestUpdateAll(); void ForceImmediateUpdate(const QString& widgetName); void ForceImmediateUpdateAll(); void ActivateAllCrosshairs(bool activate); const mitk::Point3D GetSelectedPosition(const QString& widgetName) const; public Q_SLOTS: void SetSelectedPosition(const QString& widgetName, const mitk::Point3D& newPosition); // mouse events void wheelEvent(QWheelEvent* e) override; void mousePressEvent(QMouseEvent* e) override; void moveEvent(QMoveEvent* e) override; Q_SIGNALS: void WheelMoved(QWheelEvent *); void Moved(); public: enum { AXIAL, SAGITTAL, CORONAL, THREE_D }; private: void InitializeGUI(); void InitializeDisplayActionEventHandling(); void CreateRenderWindowWidget(const std::string& cornerAnnotation = ""); void DestroyRenderWindowWidget(); void FillMultiWidgetLayout(); QString GetNameFromIndex(int row, int column) const; QString GetNameFromIndex(size_t index) const; // #TODO: see T24173 mitk::DataNode::Pointer GetTopLayerNode(mitk::DataStorage::SetOfObjects::ConstPointer nodes); - QGridLayout* m_CustomMultiWidgetLayout; + QGridLayout* m_MxNMultiWidgetLayout; RenderWindowWidgetMap m_RenderWindowWidgets; RenderWindowWidgetPointer m_ActiveRenderWindowWidget; int m_MultiWidgetRows; int m_MultiWidgetColumns; int m_PlaneMode; mitk::RenderingManager* m_RenderingManager; mitk::BaseRenderer::RenderingMode::Type m_RenderingMode; QString m_MultiWidgetName; mitk::DisplayActionEventBroadcast::Pointer m_DisplayActionEventBroadcast; std::unique_ptr m_DisplayActionEventHandler; mitk::DataStorage::Pointer m_DataStorage; }; -#endif // QMITKCUSTOMMULTIWIDGET_H +#endif // QMITKMXNMULTIWIDGET_H diff --git a/Modules/QtWidgets/resource/Qmitk.qrc b/Modules/QtWidgets/resource/Qmitk.qrc index 69e5b5704d..bc4fa4a99e 100644 --- a/Modules/QtWidgets/resource/Qmitk.qrc +++ b/Modules/QtWidgets/resource/Qmitk.qrc @@ -1,18 +1,18 @@ Binaerbilder_48.png Images_48.png PointSet_48.png Segmentation_48.png Surface_48.png mm_pointer.png mm_scroll.png mm_zoom.png mm_contrast.png mm_pan.png LabelSetImage_48.png - cmwLayout.png - cmwSynchronized.png - cmwDesynchronized.png + mwLayout.png + mwSynchronized.png + mwDesynchronized.png diff --git a/Modules/QtWidgets/resource/cmwDesynchronized.png b/Modules/QtWidgets/resource/mwDesynchronized.png similarity index 100% rename from Modules/QtWidgets/resource/cmwDesynchronized.png rename to Modules/QtWidgets/resource/mwDesynchronized.png diff --git a/Modules/QtWidgets/resource/cmwLayout.png b/Modules/QtWidgets/resource/mwLayout.png similarity index 100% rename from Modules/QtWidgets/resource/cmwLayout.png rename to Modules/QtWidgets/resource/mwLayout.png diff --git a/Modules/QtWidgets/resource/cmwSynchronized.png b/Modules/QtWidgets/resource/mwSynchronized.png similarity index 100% rename from Modules/QtWidgets/resource/cmwSynchronized.png rename to Modules/QtWidgets/resource/mwSynchronized.png diff --git a/Modules/QtWidgets/resource/cmwViewDirection.png b/Modules/QtWidgets/resource/mwViewDirection.png similarity index 100% rename from Modules/QtWidgets/resource/cmwViewDirection.png rename to Modules/QtWidgets/resource/mwViewDirection.png diff --git a/Modules/QtWidgets/src/QmitkMultiWidgetConfigurationToolBar.cpp b/Modules/QtWidgets/src/QmitkMultiWidgetConfigurationToolBar.cpp index 969dab9d22..a078239b81 100644 --- a/Modules/QtWidgets/src/QmitkMultiWidgetConfigurationToolBar.cpp +++ b/Modules/QtWidgets/src/QmitkMultiWidgetConfigurationToolBar.cpp @@ -1,87 +1,82 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. 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 "QmitkMultiWidgetConfigurationToolBar.h" -QmitkMultiWidgetConfigurationToolBar::QmitkMultiWidgetConfigurationToolBar(QmitkCustomMultiWidget* customMultiWidget) - : QToolBar(customMultiWidget) - , m_CustomMultiWidget(customMultiWidget) +QmitkMultiWidgetConfigurationToolBar::QmitkMultiWidgetConfigurationToolBar() + : QToolBar() { QToolBar::setOrientation(Qt::Vertical); QToolBar::setIconSize(QSize(17, 17)); InitializeToolBar(); } QmitkMultiWidgetConfigurationToolBar::~QmitkMultiWidgetConfigurationToolBar() { // nothing here } void QmitkMultiWidgetConfigurationToolBar::InitializeToolBar() { // create popup to show a widget to modify the multi widget layout m_LayoutSelectionPopup = new QmitkMultiWidgetLayoutSelectionWidget(this); m_LayoutSelectionPopup->hide(); AddButtons(); connect(m_LayoutSelectionPopup, &QmitkMultiWidgetLayoutSelectionWidget::LayoutSet, this, &QmitkMultiWidgetConfigurationToolBar::LayoutSet); } void QmitkMultiWidgetConfigurationToolBar::AddButtons() { - QAction* setLayoutAction = new QAction(QIcon(":/Qmitk/cmwLayout.png"), tr("Set multi widget layout"), this); + QAction* setLayoutAction = new QAction(QIcon(":/Qmitk/mwLayout.png"), tr("Set multi widget layout"), this); connect(setLayoutAction, &QAction::triggered, this, &QmitkMultiWidgetConfigurationToolBar::OnSetLayout); QToolBar::addAction(setLayoutAction); - m_SynchronizeAction = new QAction(QIcon(":/Qmitk/cmwSynchronized.png"), tr("Desynchronize render windows"), this); + m_SynchronizeAction = new QAction(QIcon(":/Qmitk/mwSynchronized.png"), tr("Desynchronize render windows"), this); m_SynchronizeAction->setCheckable(true); m_SynchronizeAction->setChecked(true); connect(m_SynchronizeAction, &QAction::triggered, this, &QmitkMultiWidgetConfigurationToolBar::OnSynchronize); QToolBar::addAction(m_SynchronizeAction); } void QmitkMultiWidgetConfigurationToolBar::OnSetLayout() { - if (nullptr != m_CustomMultiWidget) - { - m_LayoutSelectionPopup->setWindowFlags(Qt::Popup); - m_LayoutSelectionPopup->move(this->cursor().pos()); - m_LayoutSelectionPopup->show(); - } + m_LayoutSelectionPopup->setWindowFlags(Qt::Popup); + m_LayoutSelectionPopup->move(this->cursor().pos()); + m_LayoutSelectionPopup->show(); } void QmitkMultiWidgetConfigurationToolBar::OnSynchronize() { bool synchronized = m_SynchronizeAction->isChecked(); if (synchronized) { - m_SynchronizeAction->setIcon(QIcon(":/Qmitk/cmwSynchronized.png")); + m_SynchronizeAction->setIcon(QIcon(":/Qmitk/mwSynchronized.png")); m_SynchronizeAction->setText(tr("Desynchronize render windows")); - } else { - m_SynchronizeAction->setIcon(QIcon(":/Qmitk/cmwDesynchronized.png")); + m_SynchronizeAction->setIcon(QIcon(":/Qmitk/mwDesynchronized.png")); m_SynchronizeAction->setText(tr("Synchronize render windows")); } m_SynchronizeAction->setChecked(synchronized); emit Synchronized(synchronized); } diff --git a/Modules/QtWidgets/src/QmitkCustomMultiWidget.cpp b/Modules/QtWidgets/src/QmitkMxNMultiWidget.cpp similarity index 78% rename from Modules/QtWidgets/src/QmitkCustomMultiWidget.cpp rename to Modules/QtWidgets/src/QmitkMxNMultiWidget.cpp index e650d7f4cd..c5c541e62b 100644 --- a/Modules/QtWidgets/src/QmitkCustomMultiWidget.cpp +++ b/Modules/QtWidgets/src/QmitkMxNMultiWidget.cpp @@ -1,463 +1,463 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. 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 "QmitkCustomMultiWidget.h" +#include "QmitkMxNMultiWidget.h" #include #include #include #include // mitk core #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // qt #include -QmitkCustomMultiWidget::QmitkCustomMultiWidget(QWidget* parent, +QmitkMxNMultiWidget::QmitkMxNMultiWidget(QWidget* parent, Qt::WindowFlags f/* = 0*/, mitk::RenderingManager* renderingManager/* = nullptr*/, mitk::BaseRenderer::RenderingMode::Type renderingMode/* = mitk::BaseRenderer::RenderingMode::Standard*/, - const QString& multiWidgetName/* = "custommulti"*/) + const QString& multiWidgetName/* = "mxnmulti"*/) : QWidget(parent, f) - , m_CustomMultiWidgetLayout(nullptr) + , m_MxNMultiWidgetLayout(nullptr) , m_MultiWidgetRows(0) , m_MultiWidgetColumns(0) , m_PlaneMode(0) , m_RenderingManager(renderingManager) , m_RenderingMode(renderingMode) , m_MultiWidgetName(multiWidgetName) , m_DisplayActionEventBroadcast(nullptr) , m_DisplayActionEventHandler(nullptr) , m_DataStorage(nullptr) { // create widget manually // create and set layout InitializeGUI(); InitializeDisplayActionEventHandling(); resize(QSize(364, 477).expandedTo(minimumSizeHint())); } -QmitkCustomMultiWidget::~QmitkCustomMultiWidget() +QmitkMxNMultiWidget::~QmitkMxNMultiWidget() { // nothing here } -void QmitkCustomMultiWidget::SetDataStorage(mitk::DataStorage* dataStorage) +void QmitkMxNMultiWidget::SetDataStorage(mitk::DataStorage* dataStorage) { if (dataStorage == m_DataStorage) { return; } m_DataStorage = dataStorage; // set new data storage for the render window widgets for (const auto& renderWindowWidget : m_RenderWindowWidgets) { renderWindowWidget.second->SetDataStorage(m_DataStorage); } } -void QmitkCustomMultiWidget::InitializeRenderWindowWidgets() +void QmitkMxNMultiWidget::InitializeRenderWindowWidgets() { // create render window widget initially m_MultiWidgetRows = 1; m_MultiWidgetColumns = 1; CreateRenderWindowWidget("2015-01-14 - CT"); InitializeGUI(); } -void QmitkCustomMultiWidget::ResetLayout(int row, int column) +void QmitkMxNMultiWidget::ResetLayout(int row, int column) { m_MultiWidgetRows = row; m_MultiWidgetColumns = column; int requiredRenderWindowWidgets = m_MultiWidgetRows * m_MultiWidgetColumns; int existingRenderWindowWidgets = m_RenderWindowWidgets.size(); int difference = requiredRenderWindowWidgets - existingRenderWindowWidgets; while(0 < difference) { // more render window widgets needed CreateRenderWindowWidget(); --difference; } while(0 > difference) { // less render window widgets needed DestroyRenderWindowWidget(); ++difference; } InitializeGUI(); } -void QmitkCustomMultiWidget::Synchronize(bool synchronized) +void QmitkMxNMultiWidget::Synchronize(bool synchronized) { auto allObserverTags = m_DisplayActionEventHandler->GetAllObserverTags(); for (auto observerTag : allObserverTags) { m_DisplayActionEventHandler->DisconnectObserver(observerTag); } if (synchronized) { mitk::StdFunctionCommand::ActionFunction actionFunction = mitk::DisplayActionEventFunctions::MoveCameraSynchronizedAction(); m_DisplayActionEventHandler->ConnectDisplayActionEvent(mitk::DisplayMoveEvent(nullptr, mitk::Vector2D()), actionFunction); actionFunction = mitk::DisplayActionEventFunctions::SetCrosshairSynchronizedAction(); m_DisplayActionEventHandler->ConnectDisplayActionEvent(mitk::DisplaySetCrosshairEvent(nullptr, mitk::Point3D()), actionFunction); actionFunction = mitk::DisplayActionEventFunctions::ZoomCameraSynchronizedAction(); m_DisplayActionEventHandler->ConnectDisplayActionEvent(mitk::DisplayZoomEvent(nullptr, 0.0, mitk::Point2D()), actionFunction); actionFunction = mitk::DisplayActionEventFunctions::ScrollSliceStepperSynchronizedAction(); m_DisplayActionEventHandler->ConnectDisplayActionEvent(mitk::DisplayScrollEvent(nullptr, 0), actionFunction); } else { mitk::StdFunctionCommand::ActionFunction actionFunction = mitk::DisplayActionEventFunctions::MoveSenderCameraAction(); m_DisplayActionEventHandler->ConnectDisplayActionEvent(mitk::DisplayMoveEvent(nullptr, mitk::Vector2D()), actionFunction); actionFunction = mitk::DisplayActionEventFunctions::SetCrosshairAction(); m_DisplayActionEventHandler->ConnectDisplayActionEvent(mitk::DisplaySetCrosshairEvent(nullptr, mitk::Point3D()), actionFunction); actionFunction = mitk::DisplayActionEventFunctions::ZoomSenderCameraAction(); m_DisplayActionEventHandler->ConnectDisplayActionEvent(mitk::DisplayZoomEvent(nullptr, 0.0, mitk::Point2D()), actionFunction); actionFunction = mitk::DisplayActionEventFunctions::ScrollSliceStepperAction(); m_DisplayActionEventHandler->ConnectDisplayActionEvent(mitk::DisplayScrollEvent(nullptr, 0), actionFunction); } // use the standard 'set level window' action for both modes mitk::StdFunctionCommand::ActionFunction actionFunction = mitk::DisplayActionEventFunctions::SetLevelWindowAction(); m_DisplayActionEventHandler->ConnectDisplayActionEvent(mitk::DisplaySetLevelWindowEvent(nullptr, mitk::ScalarType(), mitk::ScalarType()), actionFunction); } -QmitkCustomMultiWidget::RenderWindowWidgetMap QmitkCustomMultiWidget::GetRenderWindowWidgets() const +QmitkMxNMultiWidget::RenderWindowWidgetMap QmitkMxNMultiWidget::GetRenderWindowWidgets() const { return m_RenderWindowWidgets; } -QmitkCustomMultiWidget::RenderWindowWidgetPointer QmitkCustomMultiWidget::GetRenderWindowWidget(int row, int column) const +QmitkMxNMultiWidget::RenderWindowWidgetPointer QmitkMxNMultiWidget::GetRenderWindowWidget(int row, int column) const { return GetRenderWindowWidget(GetNameFromIndex(row, column)); } -QmitkCustomMultiWidget::RenderWindowWidgetPointer QmitkCustomMultiWidget::GetRenderWindowWidget(const QString& widgetName) const +QmitkMxNMultiWidget::RenderWindowWidgetPointer QmitkMxNMultiWidget::GetRenderWindowWidget(const QString& widgetName) const { RenderWindowWidgetMap::const_iterator it = m_RenderWindowWidgets.find(widgetName); if (it != m_RenderWindowWidgets.end()) { return it->second; } return nullptr; } -QmitkCustomMultiWidget::RenderWindowHash QmitkCustomMultiWidget::GetRenderWindows() const +QmitkMxNMultiWidget::RenderWindowHash QmitkMxNMultiWidget::GetRenderWindows() const { RenderWindowHash result; // create QHash on demand auto renderWindowWidgets = GetRenderWindowWidgets(); for (const auto& renderWindowWidget : renderWindowWidgets) { result.insert(renderWindowWidget.first, renderWindowWidget.second->GetRenderWindow()); } return result; } -QmitkRenderWindow* QmitkCustomMultiWidget::GetRenderWindow(int row, int column) const +QmitkRenderWindow* QmitkMxNMultiWidget::GetRenderWindow(int row, int column) const { return GetRenderWindow(GetNameFromIndex(row, column)); } -QmitkRenderWindow* QmitkCustomMultiWidget::GetRenderWindow(const QString& widgetName) const +QmitkRenderWindow* QmitkMxNMultiWidget::GetRenderWindow(const QString& widgetName) const { RenderWindowWidgetPointer renderWindowWidget = GetRenderWindowWidget(widgetName); if (nullptr != renderWindowWidget) { return renderWindowWidget->GetRenderWindow(); } return nullptr; } -void QmitkCustomMultiWidget::SetActiveRenderWindowWidget(RenderWindowWidgetPointer activeRenderWindowWidget) +void QmitkMxNMultiWidget::SetActiveRenderWindowWidget(RenderWindowWidgetPointer activeRenderWindowWidget) { m_ActiveRenderWindowWidget = activeRenderWindowWidget; } -QmitkCustomMultiWidget::RenderWindowWidgetPointer QmitkCustomMultiWidget::GetActiveRenderWindowWidget() const +QmitkMxNMultiWidget::RenderWindowWidgetPointer QmitkMxNMultiWidget::GetActiveRenderWindowWidget() const { return m_ActiveRenderWindowWidget; } -QmitkCustomMultiWidget::RenderWindowWidgetPointer QmitkCustomMultiWidget::GetFirstRenderWindowWidget() const +QmitkMxNMultiWidget::RenderWindowWidgetPointer QmitkMxNMultiWidget::GetFirstRenderWindowWidget() const { if (!m_RenderWindowWidgets.empty()) { return m_RenderWindowWidgets.begin()->second; } else { return nullptr; } } -QmitkCustomMultiWidget::RenderWindowWidgetPointer QmitkCustomMultiWidget::GetLastRenderWindowWidget() const +QmitkMxNMultiWidget::RenderWindowWidgetPointer QmitkMxNMultiWidget::GetLastRenderWindowWidget() const { if (!m_RenderWindowWidgets.empty()) { return m_RenderWindowWidgets.rbegin()->second; } else { return nullptr; } } -unsigned int QmitkCustomMultiWidget::GetNumberOfRenderWindowWidgets() const +unsigned int QmitkMxNMultiWidget::GetNumberOfRenderWindowWidgets() const { return m_RenderWindowWidgets.size(); } -void QmitkCustomMultiWidget::RequestUpdate(const QString& widgetName) +void QmitkMxNMultiWidget::RequestUpdate(const QString& widgetName) { RenderWindowWidgetPointer renderWindowWidget = GetRenderWindowWidget(widgetName); if (nullptr != renderWindowWidget) { return renderWindowWidget->RequestUpdate(); } } -void QmitkCustomMultiWidget::RequestUpdateAll() +void QmitkMxNMultiWidget::RequestUpdateAll() { for (const auto& renderWindowWidget : m_RenderWindowWidgets) { renderWindowWidget.second->RequestUpdate(); } } -void QmitkCustomMultiWidget::ForceImmediateUpdate(const QString& widgetName) +void QmitkMxNMultiWidget::ForceImmediateUpdate(const QString& widgetName) { RenderWindowWidgetPointer renderWindowWidget = GetRenderWindowWidget(widgetName); if (nullptr != renderWindowWidget) { renderWindowWidget->ForceImmediateUpdate(); } } -void QmitkCustomMultiWidget::ForceImmediateUpdateAll() +void QmitkMxNMultiWidget::ForceImmediateUpdateAll() { for (const auto& renderWindowWidget : m_RenderWindowWidgets) { renderWindowWidget.second->ForceImmediateUpdate(); } } -void QmitkCustomMultiWidget::ActivateAllCrosshairs(bool activate) +void QmitkMxNMultiWidget::ActivateAllCrosshairs(bool activate) { for (const auto& renderWindowWidget : m_RenderWindowWidgets) { renderWindowWidget.second->ActivateCrosshair(activate); } } -const mitk::Point3D QmitkCustomMultiWidget::GetSelectedPosition(const QString& /*widgetName*/) const +const mitk::Point3D QmitkMxNMultiWidget::GetSelectedPosition(const QString& /*widgetName*/) const { /* const mitk::PlaneGeometry *plane1 = mitkWidget1->GetSliceNavigationController()->GetCurrentPlaneGeometry(); const mitk::PlaneGeometry *plane2 = mitkWidget2->GetSliceNavigationController()->GetCurrentPlaneGeometry(); const mitk::PlaneGeometry *plane3 = mitkWidget3->GetSliceNavigationController()->GetCurrentPlaneGeometry(); mitk::Line3D line; if ((plane1 != NULL) && (plane2 != NULL) && (plane1->IntersectionLine(plane2, line))) { mitk::Point3D point; if ((plane3 != NULL) && (plane3->IntersectionPoint(line, point))) { return point; } } // TODO BUG POSITIONTRACKER; mitk::Point3D p; return p; // return m_LastLeftClickPositionSupplier->GetCurrentPoint(); */ return mitk::Point3D(); } ////////////////////////////////////////////////////////////////////////// // PUBLIC SLOTS ////////////////////////////////////////////////////////////////////////// -void QmitkCustomMultiWidget::SetSelectedPosition(const QString& widgetName, const mitk::Point3D& newPosition) +void QmitkMxNMultiWidget::SetSelectedPosition(const QString& widgetName, const mitk::Point3D& newPosition) { RenderWindowWidgetPointer renderWindowWidget; if (widgetName.isNull()) { renderWindowWidget = GetActiveRenderWindowWidget(); } else { renderWindowWidget = GetRenderWindowWidget(widgetName); } if (nullptr != renderWindowWidget) { renderWindowWidget->GetSliceNavigationController()->SelectSliceByPoint(newPosition); renderWindowWidget->RequestUpdate(); return; } MITK_ERROR << "Position can not be set for an unknown render window widget."; } ////////////////////////////////////////////////////////////////////////// // MOUSE EVENTS ////////////////////////////////////////////////////////////////////////// -void QmitkCustomMultiWidget::wheelEvent(QWheelEvent* e) +void QmitkMxNMultiWidget::wheelEvent(QWheelEvent* e) { emit WheelMoved(e); } -void QmitkCustomMultiWidget::mousePressEvent(QMouseEvent* /*e*/) +void QmitkMxNMultiWidget::mousePressEvent(QMouseEvent* /*e*/) { } -void QmitkCustomMultiWidget::moveEvent(QMoveEvent* e) +void QmitkMxNMultiWidget::moveEvent(QMoveEvent* e) { QWidget::moveEvent(e); // it is necessary to readjust the position of the overlays as the MultiWidget has moved // unfortunately it's not done by QmitkRenderWindow::moveEvent -> must be done here emit Moved(); } ////////////////////////////////////////////////////////////////////////// // PRIVATE ////////////////////////////////////////////////////////////////////////// -void QmitkCustomMultiWidget::InitializeGUI() +void QmitkMxNMultiWidget::InitializeGUI() { - delete m_CustomMultiWidgetLayout; - m_CustomMultiWidgetLayout = new QGridLayout(this); - m_CustomMultiWidgetLayout->setContentsMargins(0, 0, 0, 0); - setLayout(m_CustomMultiWidgetLayout); + delete m_MxNMultiWidgetLayout; + m_MxNMultiWidgetLayout = new QGridLayout(this); + m_MxNMultiWidgetLayout->setContentsMargins(0, 0, 0, 0); + setLayout(m_MxNMultiWidgetLayout); FillMultiWidgetLayout(); } -void QmitkCustomMultiWidget::InitializeDisplayActionEventHandling() +void QmitkMxNMultiWidget::InitializeDisplayActionEventHandling() { m_DisplayActionEventBroadcast = mitk::DisplayActionEventBroadcast::New(); m_DisplayActionEventBroadcast->LoadStateMachine("DisplayInteraction.xml"); m_DisplayActionEventBroadcast->SetEventConfig("DisplayConfigPACS.xml"); m_DisplayActionEventHandler = std::make_unique(); m_DisplayActionEventHandler->SetObservableBroadcast(m_DisplayActionEventBroadcast); Synchronize(true); } -void QmitkCustomMultiWidget::CreateRenderWindowWidget(const std::string& /*cornerAnnotation = ""*/) +void QmitkMxNMultiWidget::CreateRenderWindowWidget(const std::string& /*cornerAnnotation = ""*/) { // create the render window widget and connect signals / slots QString renderWindowWidgetName = GetNameFromIndex(m_RenderWindowWidgets.size()); RenderWindowWidgetPointer renderWindowWidget = std::make_shared(this, renderWindowWidgetName, m_DataStorage); renderWindowWidget->SetCornerAnnotationText(renderWindowWidgetName.toStdString()/*cornerAnnotation*/); // store the newly created render window widget with the UID m_RenderWindowWidgets.insert(std::make_pair(renderWindowWidgetName, renderWindowWidget)); } -void QmitkCustomMultiWidget::DestroyRenderWindowWidget() +void QmitkMxNMultiWidget::DestroyRenderWindowWidget() { auto iterator = m_RenderWindowWidgets.find(GetNameFromIndex(m_RenderWindowWidgets.size() - 1)); if (iterator == m_RenderWindowWidgets.end()) { return; } // disconnect each signal of this render window widget RenderWindowWidgetPointer renderWindowWidgetToRemove = iterator->second; disconnect(renderWindowWidgetToRemove.get(), 0, 0, 0); // erase the render window from the map m_RenderWindowWidgets.erase(iterator); } -void QmitkCustomMultiWidget::FillMultiWidgetLayout() +void QmitkMxNMultiWidget::FillMultiWidgetLayout() { for (int row = 0; row < m_MultiWidgetRows; ++row) { for (int column = 0; column < m_MultiWidgetColumns; ++column) { RenderWindowWidgetPointer renderWindowWidget = GetRenderWindowWidget(row, column); if (nullptr != renderWindowWidget) { - m_CustomMultiWidgetLayout->addWidget(renderWindowWidget.get(), row, column); + m_MxNMultiWidgetLayout->addWidget(renderWindowWidget.get(), row, column); SetActiveRenderWindowWidget(renderWindowWidget); } } } } -QString QmitkCustomMultiWidget::GetNameFromIndex(int row, int column) const +QString QmitkMxNMultiWidget::GetNameFromIndex(int row, int column) const { if (0 <= row && m_MultiWidgetRows > row && 0 <= column && m_MultiWidgetColumns > column) { return GetNameFromIndex(row * m_MultiWidgetColumns + column); } return QString(); } -QString QmitkCustomMultiWidget::GetNameFromIndex(size_t index) const +QString QmitkMxNMultiWidget::GetNameFromIndex(size_t index) const { if (index <= m_RenderWindowWidgets.size()) { return m_MultiWidgetName + ".widget" + QString::number(index); } return QString(); } -mitk::DataNode::Pointer QmitkCustomMultiWidget::GetTopLayerNode(mitk::DataStorage::SetOfObjects::ConstPointer nodes) +mitk::DataNode::Pointer QmitkMxNMultiWidget::GetTopLayerNode(mitk::DataStorage::SetOfObjects::ConstPointer nodes) { // #TODO: see T24173 return nodes->front(); } diff --git a/Modules/QtWidgets/src/QmitkRenderWindowWidget.cpp b/Modules/QtWidgets/src/QmitkRenderWindowWidget.cpp index eada7e0855..d47be7d992 100644 --- a/Modules/QtWidgets/src/QmitkRenderWindowWidget.cpp +++ b/Modules/QtWidgets/src/QmitkRenderWindowWidget.cpp @@ -1,250 +1,250 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. 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 "QmitkRenderWindowWidget.h" // mitk qt widgets -#include +#include // vtk #include QmitkRenderWindowWidget::QmitkRenderWindowWidget(QWidget* parent/* = nullptr*/, const QString& widgetName/* = ""*/, mitk::DataStorage* dataStorage/* = nullptr*/, mitk::BaseRenderer::RenderingMode::Type renderingMode/* = mitk::BaseRenderer::RenderingMode::Standard*/) : QWidget(parent) , m_WidgetName(widgetName) , m_DataStorage(dataStorage) , m_RenderWindow(nullptr) , m_RenderingMode(renderingMode) , m_PointSetNode(nullptr) , m_PointSet(nullptr) { InitializeGUI(); } QmitkRenderWindowWidget::~QmitkRenderWindowWidget() { auto sliceNavigationController = m_RenderWindow->GetSliceNavigationController(); if (nullptr != sliceNavigationController) { sliceNavigationController->SetCrosshairEvent.RemoveListener(mitk::MessageDelegate1(this, &QmitkRenderWindowWidget::SetCrosshair)); } if (nullptr != m_DataStorage) { m_DataStorage->Remove(m_PointSetNode); } } void QmitkRenderWindowWidget::SetDataStorage(mitk::DataStorage* dataStorage) { if (dataStorage == m_DataStorage) { return; } m_DataStorage = dataStorage; if (nullptr != m_RenderWindow) { mitk::BaseRenderer::GetInstance(m_RenderWindow->GetRenderWindow())->SetDataStorage(dataStorage); } } mitk::SliceNavigationController* QmitkRenderWindowWidget::GetSliceNavigationController() const { return m_RenderWindow->GetSliceNavigationController(); } void QmitkRenderWindowWidget::RequestUpdate() { m_RenderingManager->RequestUpdate(m_RenderWindow->GetRenderWindow()); } void QmitkRenderWindowWidget::ForceImmediateUpdate() { m_RenderingManager->ForceImmediateUpdate(m_RenderWindow->GetRenderWindow()); } void QmitkRenderWindowWidget::SetGradientBackgroundColors(const mitk::Color& upper, const mitk::Color& lower) { vtkRenderer* vtkRenderer = m_RenderWindow->GetRenderer()->GetVtkRenderer(); if (nullptr == vtkRenderer) { return; } m_GradientBackgroundColors.first = upper; m_GradientBackgroundColors.second = lower; vtkRenderer->SetBackground(lower[0], lower[1], lower[2]); vtkRenderer->SetBackground2(upper[0], upper[1], upper[2]); ShowGradientBackground(true); } void QmitkRenderWindowWidget::ShowGradientBackground(bool show) { m_RenderWindow->GetRenderer()->GetVtkRenderer()->SetGradientBackground(show); } bool QmitkRenderWindowWidget::IsGradientBackgroundOn() const { return m_RenderWindow->GetRenderer()->GetVtkRenderer()->GetGradientBackground(); } void QmitkRenderWindowWidget::SetDecorationColor(const mitk::Color& color) { m_DecorationColor = color; m_RectangleProp->SetColor(m_DecorationColor[0], m_DecorationColor[1], m_DecorationColor[2]); m_CornerAnnotation->GetTextProperty()->SetColor(color[0], color[1], color[2]); } void QmitkRenderWindowWidget::ShowColoredRectangle(bool show) { m_RectangleProp->SetVisibility(show); } bool QmitkRenderWindowWidget::IsColoredRectangleVisible() const { return m_RectangleProp->GetVisibility() > 0; } void QmitkRenderWindowWidget::ShowCornerAnnotation(bool show) { m_CornerAnnotation->SetVisibility(show); } bool QmitkRenderWindowWidget::IsCornerAnnotationVisible() const { return m_CornerAnnotation->GetVisibility() > 0; } void QmitkRenderWindowWidget::SetCornerAnnotationText(const std::string& cornerAnnotation) { m_CornerAnnotation->SetText(0, cornerAnnotation.c_str()); } std::string QmitkRenderWindowWidget::GetCornerAnnotationText() const { return std::string(m_CornerAnnotation->GetText(0)); } bool QmitkRenderWindowWidget::IsRenderWindowMenuActivated() const { return m_RenderWindow->GetActivateMenuWidgetFlag(); } void QmitkRenderWindowWidget::ActivateCrosshair(bool activate) { if (nullptr == m_DataStorage) { return; } if (activate) { try { m_DataStorage->Add(m_PointSetNode); } catch(std::invalid_argument& /*e*/) { // crosshair already existing return; } } else { m_DataStorage->Remove(m_PointSetNode); } } void QmitkRenderWindowWidget::InitializeGUI() { m_Layout = new QHBoxLayout(this); m_Layout->setMargin(0); setLayout(m_Layout); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); // create render window for this render window widget m_RenderingManager = mitk::RenderingManager::GetInstance(); //m_RenderingManager = mitk::RenderingManager::New(); m_RenderingManager->SetDataStorage(m_DataStorage); m_RenderWindow = new QmitkRenderWindow(this, m_WidgetName, nullptr, m_RenderingManager, m_RenderingMode); - m_RenderWindow->SetLayoutIndex(QmitkCustomMultiWidget::SAGITTAL); // TODO: allow to change layout type later + m_RenderWindow->SetLayoutIndex(QmitkMxNMultiWidget::SAGITTAL); // TODO: allow to change layout type later m_RenderWindow->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Sagittal); m_RenderWindow->GetSliceNavigationController()->SetRenderingManager(m_RenderingManager); m_RenderWindow->GetSliceNavigationController()->SetCrosshairEvent.AddListener(mitk::MessageDelegate1(this, &QmitkRenderWindowWidget::SetCrosshair)); mitk::TimeGeometry::ConstPointer timeGeometry = m_DataStorage->ComputeBoundingGeometry3D(m_DataStorage->GetAll()); m_RenderingManager->InitializeViews(timeGeometry); m_Layout->addWidget(m_RenderWindow); // add point set as a crosshair m_PointSetNode = mitk::DataNode::New(); m_PointSetNode->SetProperty("name", mitk::StringProperty::New("Crosshair of render window " + m_WidgetName.toStdString())); m_PointSetNode->SetProperty("helper object", mitk::BoolProperty::New(true)); // crosshair-node should typically be invisible // set the crosshair only visible for this specific renderer m_PointSetNode->SetBoolProperty("fixedLayer", true, m_RenderWindow->GetRenderer()); m_PointSetNode->SetVisibility(true, m_RenderWindow->GetRenderer()); m_PointSetNode->SetVisibility(false); m_PointSet = mitk::PointSet::New(); m_PointSetNode->SetData(m_PointSet); // set colors and corner annotation InitializeDecorations(); } void QmitkRenderWindowWidget::InitializeDecorations() { vtkRenderer* vtkRenderer = m_RenderWindow->GetRenderer()->GetVtkRenderer(); if (nullptr == vtkRenderer) { return; } // initialize background color gradients float black[3] = { 0.0f, 0.0f, 0.0f }; SetGradientBackgroundColors(black, black); // initialize decoration color, rectangle and annotation text float white[3] = { 1.0f, 1.0f, 1.0f }; m_DecorationColor = white; m_RectangleProp = vtkSmartPointer::New(); m_RectangleProp->SetColor(m_DecorationColor[0], m_DecorationColor[1], m_DecorationColor[2]); if (0 == vtkRenderer->HasViewProp(m_RectangleProp)) { vtkRenderer->AddViewProp(m_RectangleProp); } m_CornerAnnotation = vtkSmartPointer::New(); m_CornerAnnotation->SetText(0, "Sagittal"); m_CornerAnnotation->SetMaximumFontSize(12); m_CornerAnnotation->GetTextProperty()->SetColor(m_DecorationColor[0], m_DecorationColor[1], m_DecorationColor[2]); if (0 == vtkRenderer->HasViewProp(m_CornerAnnotation)) { vtkRenderer->AddViewProp(m_CornerAnnotation); } } void QmitkRenderWindowWidget::SetCrosshair(mitk::Point3D selectedPoint) { m_PointSet->SetPoint(1, selectedPoint, 0); mitk::RenderingManager::GetInstance()->RequestUpdate(m_RenderWindow->GetRenderWindow()); } diff --git a/Plugins/PluginList.cmake b/Plugins/PluginList.cmake index 42e36efbf9..4a1c3ef0d7 100644 --- a/Plugins/PluginList.cmake +++ b/Plugins/PluginList.cmake @@ -1,104 +1,104 @@ # Plug-ins must be ordered according to their dependencies set(MITK_PLUGINS org.blueberry.core.runtime:ON org.blueberry.core.expressions:OFF org.blueberry.core.commands:OFF org.blueberry.core.jobs:OFF org.blueberry.ui.qt:OFF org.blueberry.ui.qt.help:ON org.blueberry.ui.qt.log:ON org.blueberry.ui.qt.objectinspector:OFF #org.blueberry.test:ON #org.blueberry.uitest:ON #Testing/org.blueberry.core.runtime.tests:ON #Testing/org.blueberry.osgi.tests:ON org.mitk.core.services:ON org.mitk.gui.common:ON org.mitk.planarfigure:ON org.mitk.core.ext:OFF org.mitk.core.jobs:OFF org.mitk.gui.qt.application:ON org.mitk.gui.qt.coreapplication:OFF org.mitk.gui.qt.ext:OFF org.mitk.gui.qt.extapplication:OFF org.mitk.gui.qt.common:ON org.mitk.gui.qt.stdmultiwidgeteditor:ON - org.mitk.gui.qt.custommultiwidgeteditor:OFF + org.mitk.gui.qt.mxnmultiwidgeteditor:OFF org.mitk.gui.qt.common.legacy:OFF org.mitk.gui.qt.cmdlinemodules:OFF org.mitk.gui.qt.diffusionimagingapp:OFF org.mitk.gui.qt.datamanager:ON org.mitk.gui.qt.datamanagerlight:OFF org.mitk.gui.qt.datastorageviewertest:OFF org.mitk.gui.qt.properties:ON org.mitk.gui.qt.basicimageprocessing:OFF org.mitk.gui.qt.dicom:OFF org.mitk.gui.qt.dicominspector:OFF org.mitk.gui.qt.diffusionimaging:OFF org.mitk.gui.qt.diffusionimaging.connectomics:OFF org.mitk.gui.qt.diffusionimaging.denoising:OFF org.mitk.gui.qt.diffusionimaging.fiberfox:OFF org.mitk.gui.qt.diffusionimaging.fiberprocessing:OFF org.mitk.gui.qt.diffusionimaging.ivim:OFF org.mitk.gui.qt.diffusionimaging.odfpeaks:OFF org.mitk.gui.qt.diffusionimaging.partialvolume:OFF org.mitk.gui.qt.diffusionimaging.preprocessing:OFF org.mitk.gui.qt.diffusionimaging.reconstruction:OFF org.mitk.gui.qt.diffusionimaging.registration:OFF org.mitk.gui.qt.diffusionimaging.tbss:OFF org.mitk.gui.qt.diffusionimaging.tractography:OFF org.mitk.gui.qt.diffusionimaging.python:OFF org.mitk.gui.qt.dosevisualization:OFF org.mitk.gui.qt.geometrytools:OFF org.mitk.gui.qt.igtexamples:OFF org.mitk.gui.qt.igttracking:OFF org.mitk.gui.qt.lasercontrol:OFF org.mitk.gui.qt.openigtlink:OFF org.mitk.gui.qt.imagecropper:OFF org.mitk.gui.qt.imagenavigator:ON org.mitk.gui.qt.viewnavigator:OFF org.mitk.gui.qt.materialeditor:OFF org.mitk.gui.qt.measurementtoolbox:OFF org.mitk.gui.qt.moviemaker:OFF org.mitk.gui.qt.pointsetinteraction:OFF org.mitk.gui.qt.pointsetinteractionmultispectrum:OFF org.mitk.gui.qt.python:OFF org.mitk.gui.qt.remeshing:OFF org.mitk.gui.qt.segmentation:OFF org.mitk.gui.qt.aicpregistration:OFF org.mitk.gui.qt.renderwindowmanager:OFF org.mitk.gui.qt.toftutorial:OFF org.mitk.gui.qt.tofutil:OFF org.mitk.gui.qt.tubegraph:OFF org.mitk.gui.qt.ugvisualization:OFF org.mitk.gui.qt.photoacoustics.pausviewer:OFF org.mitk.gui.qt.photoacoustics.imageprocessing:OFF org.mitk.gui.qt.photoacoustics.simulation:OFF org.mitk.gui.qt.ultrasound:OFF org.mitk.gui.qt.volumevisualization:OFF org.mitk.gui.qt.eventrecorder:OFF org.mitk.gui.qt.xnat:OFF org.mitk.gui.qt.igt.app.echotrack:OFF org.mitk.gui.qt.spectrocamrecorder:OFF org.mitk.gui.qt.classificationsegmentation:OFF org.mitk.gui.qt.overlaymanager:OFF org.mitk.gui.qt.igt.app.hummelprotocolmeasurements:OFF org.mitk.gui.qt.multilabelsegmentation:OFF org.mitk.matchpoint.core.helper:OFF org.mitk.gui.qt.matchpoint.algorithm.browser:OFF org.mitk.gui.qt.matchpoint.algorithm.control:OFF org.mitk.gui.qt.matchpoint.algorithm.batch:OFF org.mitk.gui.qt.matchpoint.mapper:OFF org.mitk.gui.qt.matchpoint.framereg:OFF org.mitk.gui.qt.matchpoint.visualizer:OFF org.mitk.gui.qt.matchpoint.evaluator:OFF org.mitk.gui.qt.matchpoint.manipulator:OFF org.mitk.gui.qt.preprocessing.resampling:OFF org.mitk.gui.qt.cest:OFF ) diff --git a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/plugin.xml b/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/plugin.xml deleted file mode 100644 index 606705c432..0000000000 --- a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/plugin.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/Plugins/org.mitk.gui.qt.ext/files.cmake b/Plugins/org.mitk.gui.qt.ext/files.cmake index faea93108a..562bc5d984 100644 --- a/Plugins/org.mitk.gui.qt.ext/files.cmake +++ b/Plugins/org.mitk.gui.qt.ext/files.cmake @@ -1,63 +1,63 @@ set(SRC_CPP_FILES QmitkExtActionBarAdvisor.cpp QmitkExtWorkbenchWindowAdvisor.cpp QmitkExtFileSaveProjectAction.cpp QmitkOpenDicomEditorAction.cpp - QmitkOpenCustomMultiWidgetEditorAction.cpp + QmitkOpenMxNMultiWidgetEditorAction.cpp QmitkOpenStdMultiWidgetEditorAction.cpp ) set(INTERNAL_CPP_FILES QmitkAboutHandler.cpp QmitkAppInstancesPreferencePage.cpp QmitkExternalProgramsPreferencePage.cpp QmitkCommonExtPlugin.cpp QmitkInputDevicesPrefPage.cpp QmitkModuleView.cpp ) set(UI_FILES src/internal/QmitkAppInstancesPreferencePage.ui src/internal/QmitkExternalProgramsPreferencePage.ui ) set(MOC_H_FILES src/QmitkExtFileSaveProjectAction.h src/QmitkExtWorkbenchWindowAdvisor.h src/internal/QmitkAboutHandler.h src/internal/QmitkAppInstancesPreferencePage.h src/internal/QmitkExternalProgramsPreferencePage.h src/internal/QmitkCommonExtPlugin.h src/internal/QmitkExtWorkbenchWindowAdvisorHack.h src/internal/QmitkInputDevicesPrefPage.h src/internal/QmitkModuleView.h src/QmitkOpenDicomEditorAction.h - src/QmitkOpenCustomMultiWidgetEditorAction.h + src/QmitkOpenMxNMultiWidgetEditorAction.h src/QmitkOpenStdMultiWidgetEditorAction.h ) set(CACHED_RESOURCE_FILES # list of resource files which can be used by the plug-in # system without loading the plug-ins shared library, # for example the icon used in the menu and tabs for the # plug-in views in the workbench plugin.xml resources/ModuleView.png ) set(QRC_FILES # uncomment the following line if you want to use Qt resources resources/org_mitk_gui_qt_ext.qrc resources/org_mitk_icons.qrc ) set(CPP_FILES ) foreach(file ${SRC_CPP_FILES}) set(CPP_FILES ${CPP_FILES} src/${file}) endforeach(file ${SRC_CPP_FILES}) foreach(file ${INTERNAL_CPP_FILES}) set(CPP_FILES ${CPP_FILES} src/internal/${file}) endforeach(file ${INTERNAL_CPP_FILES}) diff --git a/Plugins/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.cpp b/Plugins/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.cpp index 206a6e9874..3d6817f970 100644 --- a/Plugins/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.cpp +++ b/Plugins/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.cpp @@ -1,1426 +1,1426 @@ /*=================================================================== 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 "QmitkExtWorkbenchWindowAdvisor.h" #include "QmitkExtActionBarAdvisor.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include -#include +#include #include #include #include #include #include #include #include #include #include // UGLYYY #include "internal/QmitkExtWorkbenchWindowAdvisorHack.h" #include "internal/QmitkCommonExtPlugin.h" #include "mitkUndoController.h" #include "mitkVerboseLimitedLinearUndo.h" #include #include #include #include #include #include QmitkExtWorkbenchWindowAdvisorHack* QmitkExtWorkbenchWindowAdvisorHack::undohack = new QmitkExtWorkbenchWindowAdvisorHack(); QString QmitkExtWorkbenchWindowAdvisor::QT_SETTINGS_FILENAME = "QtSettings.ini"; static bool USE_EXPERIMENTAL_COMMAND_CONTRIBUTIONS = false; class PartListenerForTitle: public berry::IPartListener { public: PartListenerForTitle(QmitkExtWorkbenchWindowAdvisor* wa) : windowAdvisor(wa) { } Events::Types GetPartEventTypes() const override { return Events::ACTIVATED | Events::BROUGHT_TO_TOP | Events::CLOSED | Events::HIDDEN | Events::VISIBLE; } void PartActivated(const berry::IWorkbenchPartReference::Pointer& ref) override { if (ref.Cast ()) { windowAdvisor->UpdateTitle(false); } } void PartBroughtToTop(const berry::IWorkbenchPartReference::Pointer& ref) override { if (ref.Cast ()) { windowAdvisor->UpdateTitle(false); } } void PartClosed(const berry::IWorkbenchPartReference::Pointer& /*ref*/) override { windowAdvisor->UpdateTitle(false); } void PartHidden(const berry::IWorkbenchPartReference::Pointer& ref) override { if (!windowAdvisor->lastActiveEditor.Expired() && ref->GetPart(false) == windowAdvisor->lastActiveEditor.Lock()) { windowAdvisor->UpdateTitle(true); } } void PartVisible(const berry::IWorkbenchPartReference::Pointer& ref) override { if (!windowAdvisor->lastActiveEditor.Expired() && ref->GetPart(false) == windowAdvisor->lastActiveEditor.Lock()) { windowAdvisor->UpdateTitle(false); } } private: QmitkExtWorkbenchWindowAdvisor* windowAdvisor; }; class PartListenerForViewNavigator: public berry::IPartListener { public: PartListenerForViewNavigator(QAction* act) : viewNavigatorAction(act) { } Events::Types GetPartEventTypes() const override { return Events::OPENED | Events::CLOSED | Events::HIDDEN | Events::VISIBLE; } void PartOpened(const berry::IWorkbenchPartReference::Pointer& ref) override { if (ref->GetId()=="org.mitk.views.viewnavigatorview") { viewNavigatorAction->setChecked(true); } } void PartClosed(const berry::IWorkbenchPartReference::Pointer& ref) override { if (ref->GetId()=="org.mitk.views.viewnavigatorview") { viewNavigatorAction->setChecked(false); } } void PartVisible(const berry::IWorkbenchPartReference::Pointer& ref) override { if (ref->GetId()=="org.mitk.views.viewnavigatorview") { viewNavigatorAction->setChecked(true); } } void PartHidden(const berry::IWorkbenchPartReference::Pointer& ref) override { if (ref->GetId()=="org.mitk.views.viewnavigatorview") { viewNavigatorAction->setChecked(false); } } private: QAction* viewNavigatorAction; }; class PartListenerForImageNavigator: public berry::IPartListener { public: PartListenerForImageNavigator(QAction* act) : imageNavigatorAction(act) { } Events::Types GetPartEventTypes() const override { return Events::OPENED | Events::CLOSED | Events::HIDDEN | Events::VISIBLE; } void PartOpened(const berry::IWorkbenchPartReference::Pointer& ref) override { if (ref->GetId()=="org.mitk.views.imagenavigator") { imageNavigatorAction->setChecked(true); } } void PartClosed(const berry::IWorkbenchPartReference::Pointer& ref) override { if (ref->GetId()=="org.mitk.views.imagenavigator") { imageNavigatorAction->setChecked(false); } } void PartVisible(const berry::IWorkbenchPartReference::Pointer& ref) override { if (ref->GetId()=="org.mitk.views.imagenavigator") { imageNavigatorAction->setChecked(true); } } void PartHidden(const berry::IWorkbenchPartReference::Pointer& ref) override { if (ref->GetId()=="org.mitk.views.imagenavigator") { imageNavigatorAction->setChecked(false); } } private: QAction* imageNavigatorAction; }; class PerspectiveListenerForTitle: public berry::IPerspectiveListener { public: PerspectiveListenerForTitle(QmitkExtWorkbenchWindowAdvisor* wa) : windowAdvisor(wa) , perspectivesClosed(false) { } Events::Types GetPerspectiveEventTypes() const override { if (USE_EXPERIMENTAL_COMMAND_CONTRIBUTIONS) { return Events::ACTIVATED | Events::SAVED_AS | Events::DEACTIVATED; } else { return Events::ACTIVATED | Events::SAVED_AS | Events::DEACTIVATED | Events::CLOSED | Events::OPENED; } } void PerspectiveActivated(const berry::IWorkbenchPage::Pointer& /*page*/, const berry::IPerspectiveDescriptor::Pointer& /*perspective*/) override { windowAdvisor->UpdateTitle(false); } void PerspectiveSavedAs(const berry::IWorkbenchPage::Pointer& /*page*/, const berry::IPerspectiveDescriptor::Pointer& /*oldPerspective*/, const berry::IPerspectiveDescriptor::Pointer& /*newPerspective*/) override { windowAdvisor->UpdateTitle(false); } void PerspectiveDeactivated(const berry::IWorkbenchPage::Pointer& /*page*/, const berry::IPerspectiveDescriptor::Pointer& /*perspective*/) override { windowAdvisor->UpdateTitle(false); } void PerspectiveOpened(const berry::IWorkbenchPage::Pointer& /*page*/, const berry::IPerspectiveDescriptor::Pointer& /*perspective*/) override { if (perspectivesClosed) { QListIterator i(windowAdvisor->viewActions); while (i.hasNext()) { i.next()->setEnabled(true); } //GetViewRegistry()->Find("org.mitk.views.imagenavigator"); if(windowAdvisor->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.dicomeditor")) { windowAdvisor->openDicomEditorAction->setEnabled(true); } if (windowAdvisor->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.stdmultiwidget")) { windowAdvisor->openStdMultiWidgetEditorAction->setEnabled(true); } - if (windowAdvisor->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.custommultiwidget")) + if (windowAdvisor->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.mxnmultiwidget")) { - windowAdvisor->openCustomMultiWidgetEditorAction->setEnabled(true); + windowAdvisor->openMxNMultiWidgetEditorAction->setEnabled(true); } windowAdvisor->fileSaveProjectAction->setEnabled(true); windowAdvisor->closeProjectAction->setEnabled(true); windowAdvisor->undoAction->setEnabled(true); windowAdvisor->redoAction->setEnabled(true); windowAdvisor->imageNavigatorAction->setEnabled(true); windowAdvisor->viewNavigatorAction->setEnabled(true); windowAdvisor->resetPerspAction->setEnabled(true); if( windowAdvisor->GetShowClosePerspectiveMenuItem() ) { windowAdvisor->closePerspAction->setEnabled(true); } } perspectivesClosed = false; } void PerspectiveClosed(const berry::IWorkbenchPage::Pointer& /*page*/, const berry::IPerspectiveDescriptor::Pointer& /*perspective*/) override { berry::IWorkbenchWindow::Pointer wnd = windowAdvisor->GetWindowConfigurer()->GetWindow(); bool allClosed = true; if (wnd->GetActivePage()) { QList perspectives(wnd->GetActivePage()->GetOpenPerspectives()); allClosed = perspectives.empty(); } if (allClosed) { perspectivesClosed = true; QListIterator i(windowAdvisor->viewActions); while (i.hasNext()) { i.next()->setEnabled(false); } if(windowAdvisor->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.dicomeditor")) { windowAdvisor->openDicomEditorAction->setEnabled(false); } if (windowAdvisor->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.stdmultiwidget")) { windowAdvisor->openStdMultiWidgetEditorAction->setEnabled(false); } - if (windowAdvisor->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.custommultiwidget")) + if (windowAdvisor->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.mxnmultiwidget")) { - windowAdvisor->openCustomMultiWidgetEditorAction->setEnabled(false); + windowAdvisor->openMxNMultiWidgetEditorAction->setEnabled(false); } windowAdvisor->fileSaveProjectAction->setEnabled(false); windowAdvisor->closeProjectAction->setEnabled(false); windowAdvisor->undoAction->setEnabled(false); windowAdvisor->redoAction->setEnabled(false); windowAdvisor->imageNavigatorAction->setEnabled(false); windowAdvisor->viewNavigatorAction->setEnabled(false); windowAdvisor->resetPerspAction->setEnabled(false); if( windowAdvisor->GetShowClosePerspectiveMenuItem() ) { windowAdvisor->closePerspAction->setEnabled(false); } } } private: QmitkExtWorkbenchWindowAdvisor* windowAdvisor; bool perspectivesClosed; }; class PerspectiveListenerForMenu: public berry::IPerspectiveListener { public: PerspectiveListenerForMenu(QmitkExtWorkbenchWindowAdvisor* wa) : windowAdvisor(wa) { } Events::Types GetPerspectiveEventTypes() const override { return Events::ACTIVATED | Events::DEACTIVATED; } void PerspectiveActivated(const berry::IWorkbenchPage::Pointer& /*page*/, const berry::IPerspectiveDescriptor::Pointer& perspective) override { QAction* action = windowAdvisor->mapPerspIdToAction[perspective->GetId()]; if (action) { action->setChecked(true); } } void PerspectiveDeactivated(const berry::IWorkbenchPage::Pointer& /*page*/, const berry::IPerspectiveDescriptor::Pointer& perspective) override { QAction* action = windowAdvisor->mapPerspIdToAction[perspective->GetId()]; if (action) { action->setChecked(false); } } private: QmitkExtWorkbenchWindowAdvisor* windowAdvisor; }; QmitkExtWorkbenchWindowAdvisor::QmitkExtWorkbenchWindowAdvisor(berry::WorkbenchAdvisor* wbAdvisor, berry::IWorkbenchWindowConfigurer::Pointer configurer) : berry::WorkbenchWindowAdvisor(configurer) , lastInput(nullptr) , wbAdvisor(wbAdvisor) , showViewToolbar(true) , showPerspectiveToolbar(false) , showVersionInfo(true) , showMitkVersionInfo(true) , showViewMenuItem(true) , showNewWindowMenuItem(false) , showClosePerspectiveMenuItem(true) , viewNavigatorFound(false) , showMemoryIndicator(true) , dropTargetListener(new QmitkDefaultDropTargetListener) { productName = QCoreApplication::applicationName(); viewExcludeList.push_back("org.mitk.views.viewnavigatorview"); } QmitkExtWorkbenchWindowAdvisor::~QmitkExtWorkbenchWindowAdvisor() { } berry::ActionBarAdvisor::Pointer QmitkExtWorkbenchWindowAdvisor::CreateActionBarAdvisor(berry::IActionBarConfigurer::Pointer configurer) { if (USE_EXPERIMENTAL_COMMAND_CONTRIBUTIONS) { berry::ActionBarAdvisor::Pointer actionBarAdvisor(new QmitkExtActionBarAdvisor(configurer)); return actionBarAdvisor; } else { return berry::WorkbenchWindowAdvisor::CreateActionBarAdvisor(configurer); } } QWidget* QmitkExtWorkbenchWindowAdvisor::CreateEmptyWindowContents(QWidget* parent) { QWidget* parentWidget = static_cast(parent); auto label = new QLabel(parentWidget); label->setText("No perspectives are open. Open a perspective in the Window->Open Perspective menu."); label->setContentsMargins(10,10,10,10); label->setAlignment(Qt::AlignTop); label->setEnabled(false); parentWidget->layout()->addWidget(label); return label; } void QmitkExtWorkbenchWindowAdvisor::ShowClosePerspectiveMenuItem(bool show) { showClosePerspectiveMenuItem = show; } bool QmitkExtWorkbenchWindowAdvisor::GetShowClosePerspectiveMenuItem() { return showClosePerspectiveMenuItem; } void QmitkExtWorkbenchWindowAdvisor::ShowMemoryIndicator(bool show) { showMemoryIndicator = show; } bool QmitkExtWorkbenchWindowAdvisor::GetShowMemoryIndicator() { return showMemoryIndicator; } void QmitkExtWorkbenchWindowAdvisor::ShowNewWindowMenuItem(bool show) { showNewWindowMenuItem = show; } void QmitkExtWorkbenchWindowAdvisor::ShowViewToolbar(bool show) { showViewToolbar = show; } void QmitkExtWorkbenchWindowAdvisor::ShowViewMenuItem(bool show) { showViewMenuItem = show; } void QmitkExtWorkbenchWindowAdvisor::ShowPerspectiveToolbar(bool show) { showPerspectiveToolbar = show; } void QmitkExtWorkbenchWindowAdvisor::ShowVersionInfo(bool show) { showVersionInfo = show; } void QmitkExtWorkbenchWindowAdvisor::ShowMitkVersionInfo(bool show) { showMitkVersionInfo = show; } void QmitkExtWorkbenchWindowAdvisor::SetProductName(const QString& product) { productName = product; } void QmitkExtWorkbenchWindowAdvisor::SetWindowIcon(const QString& wndIcon) { windowIcon = wndIcon; } void QmitkExtWorkbenchWindowAdvisor::PostWindowCreate() { // very bad hack... berry::IWorkbenchWindow::Pointer window = this->GetWindowConfigurer()->GetWindow(); QMainWindow* mainWindow = qobject_cast (window->GetShell()->GetControl()); if (!windowIcon.isEmpty()) { mainWindow->setWindowIcon(QIcon(windowIcon)); } mainWindow->setContextMenuPolicy(Qt::PreventContextMenu); // Load icon theme QIcon::setThemeSearchPaths(QStringList() << QStringLiteral(":/org_mitk_icons/icons/")); QIcon::setThemeName(QStringLiteral("awesome")); // ==== Application menu ============================ QMenuBar* menuBar = mainWindow->menuBar(); menuBar->setContextMenuPolicy(Qt::PreventContextMenu); #ifdef __APPLE__ menuBar->setNativeMenuBar(true); #else menuBar->setNativeMenuBar(false); #endif auto basePath = QStringLiteral(":/org_mitk_icons/icons/awesome/scalable/actions/"); auto fileOpenAction = new QmitkFileOpenAction(berry::QtStyleManager::ThemeIcon(basePath + "document-open.svg"), window); fileOpenAction->setShortcut(QKeySequence::Open); auto fileSaveAction = new QmitkFileSaveAction(berry::QtStyleManager::ThemeIcon(basePath + "document-save.svg"), window); fileSaveAction->setShortcut(QKeySequence::Save); fileSaveProjectAction = new QmitkExtFileSaveProjectAction(window); fileSaveProjectAction->setIcon(berry::QtStyleManager::ThemeIcon(basePath + "document-save.svg")); closeProjectAction = new QmitkCloseProjectAction(window); closeProjectAction->setIcon(berry::QtStyleManager::ThemeIcon(basePath + "edit-delete.svg")); auto perspGroup = new QActionGroup(menuBar); std::map VDMap; // sort elements (converting vector to map...) QList::const_iterator iter; berry::IViewRegistry* viewRegistry = berry::PlatformUI::GetWorkbench()->GetViewRegistry(); const QList viewDescriptors = viewRegistry->GetViews(); bool skip = false; for (iter = viewDescriptors.begin(); iter != viewDescriptors.end(); ++iter) { // if viewExcludeList is set, it contains the id-strings of view, which // should not appear as an menu-entry in the menu if (viewExcludeList.size() > 0) { for (int i=0; iGetId()) { skip = true; break; } } if (skip) { skip = false; continue; } } if ((*iter)->GetId() == "org.blueberry.ui.internal.introview") continue; if ((*iter)->GetId() == "org.mitk.views.imagenavigator") continue; if ((*iter)->GetId() == "org.mitk.views.viewnavigatorview") continue; std::pair p((*iter)->GetLabel(), (*iter)); VDMap.insert(p); } std::map::const_iterator MapIter; for (MapIter = VDMap.begin(); MapIter != VDMap.end(); ++MapIter) { berry::QtShowViewAction* viewAction = new berry::QtShowViewAction(window, (*MapIter).second); viewActions.push_back(viewAction); } if (!USE_EXPERIMENTAL_COMMAND_CONTRIBUTIONS) { QMenu* fileMenu = menuBar->addMenu("&File"); fileMenu->setObjectName("FileMenu"); fileMenu->addAction(fileOpenAction); fileMenu->addAction(fileSaveAction); fileMenu->addAction(fileSaveProjectAction); fileMenu->addAction(closeProjectAction); fileMenu->addSeparator(); QAction* fileExitAction = new QmitkFileExitAction(window); fileExitAction->setIcon(berry::QtStyleManager::ThemeIcon(basePath + "system-log-out.svg")); fileExitAction->setShortcut(QKeySequence::Quit); fileExitAction->setObjectName("QmitkFileExitAction"); fileMenu->addAction(fileExitAction); // another bad hack to get an edit/undo menu... QMenu* editMenu = menuBar->addMenu("&Edit"); undoAction = editMenu->addAction(berry::QtStyleManager::ThemeIcon(basePath + "edit-undo.svg"), "&Undo", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onUndo()), QKeySequence("CTRL+Z")); undoAction->setToolTip("Undo the last action (not supported by all modules)"); redoAction = editMenu->addAction(berry::QtStyleManager::ThemeIcon(basePath + "edit-redo.svg"), "&Redo", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onRedo()), QKeySequence("CTRL+Y")); redoAction->setToolTip("execute the last action that was undone again (not supported by all modules)"); // ==== Window Menu ========================== QMenu* windowMenu = menuBar->addMenu("Window"); if (showNewWindowMenuItem) { windowMenu->addAction("&New Window", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onNewWindow())); windowMenu->addSeparator(); } QMenu* perspMenu = windowMenu->addMenu("&Open Perspective"); QMenu* viewMenu = nullptr; if (showViewMenuItem) { viewMenu = windowMenu->addMenu("Show &View"); viewMenu->setObjectName("Show View"); } windowMenu->addSeparator(); resetPerspAction = windowMenu->addAction("&Reset Perspective", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onResetPerspective())); if(showClosePerspectiveMenuItem) closePerspAction = windowMenu->addAction("&Close Perspective", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onClosePerspective())); windowMenu->addSeparator(); windowMenu->addAction("&Preferences...", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onEditPreferences()), QKeySequence("CTRL+P")); // fill perspective menu berry::IPerspectiveRegistry* perspRegistry = window->GetWorkbench()->GetPerspectiveRegistry(); QList perspectives( perspRegistry->GetPerspectives()); skip = false; for (QList::iterator perspIt = perspectives.begin(); perspIt != perspectives.end(); ++perspIt) { // if perspectiveExcludeList is set, it contains the id-strings of perspectives, which // should not appear as an menu-entry in the perspective menu if (perspectiveExcludeList.size() > 0) { for (int i=0; iGetId()) { skip = true; break; } } if (skip) { skip = false; continue; } } QAction* perspAction = new berry::QtOpenPerspectiveAction(window, *perspIt, perspGroup); mapPerspIdToAction.insert((*perspIt)->GetId(), perspAction); } perspMenu->addActions(perspGroup->actions()); if (showViewMenuItem) { for (auto viewAction : viewActions) { viewMenu->addAction(viewAction); } } // ===== Help menu ==================================== QMenu* helpMenu = menuBar->addMenu("&Help"); helpMenu->addAction("&Welcome",this, SLOT(onIntro())); helpMenu->addAction("&Open Help Perspective", this, SLOT(onHelpOpenHelpPerspective())); helpMenu->addAction("&Context Help",this, SLOT(onHelp()), QKeySequence("F1")); helpMenu->addAction("&About",this, SLOT(onAbout())); // ===================================================== } else { undoAction = new QmitkUndoAction(berry::QtStyleManager::ThemeIcon(basePath + "edit-undo.svg"), nullptr); undoAction->setShortcut(QKeySequence::Undo); redoAction = new QmitkRedoAction(berry::QtStyleManager::ThemeIcon(basePath + "edit-redo.svg"), nullptr); redoAction->setShortcut(QKeySequence::Redo); } // toolbar for showing file open, undo, redo and other main actions auto mainActionsToolBar = new QToolBar; mainActionsToolBar->setObjectName("mainActionsToolBar"); mainActionsToolBar->setContextMenuPolicy(Qt::PreventContextMenu); #ifdef __APPLE__ mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextUnderIcon ); #else mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextBesideIcon ); #endif basePath = QStringLiteral(":/org.mitk.gui.qt.ext/"); imageNavigatorAction = new QAction(berry::QtStyleManager::ThemeIcon(basePath + "image_navigator.svg"), "&Image Navigator", nullptr); bool imageNavigatorViewFound = window->GetWorkbench()->GetViewRegistry()->Find("org.mitk.views.imagenavigator"); if (this->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.dicomeditor")) { openDicomEditorAction = new QmitkOpenDicomEditorAction(berry::QtStyleManager::ThemeIcon(basePath + "dicom.svg"), window); } if (this->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.stdmultiwidget")) { openStdMultiWidgetEditorAction = new QmitkOpenStdMultiWidgetEditorAction(QIcon(":/org.mitk.gui.qt.ext/Editor.png"), window); } - if (this->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.custommultiwidget")) + if (this->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.mxnmultiwidget")) { - openCustomMultiWidgetEditorAction = new QmitkOpenCustomMultiWidgetEditorAction(QIcon(":/org.mitk.gui.qt.ext/Editor.png"), window); + openMxNMultiWidgetEditorAction = new QmitkOpenMxNMultiWidgetEditorAction(QIcon(":/org.mitk.gui.qt.ext/Editor.png"), window); } if (imageNavigatorViewFound) { QObject::connect(imageNavigatorAction, SIGNAL(triggered(bool)), QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onImageNavigator())); imageNavigatorAction->setCheckable(true); // add part listener for image navigator imageNavigatorPartListener.reset(new PartListenerForImageNavigator(imageNavigatorAction)); window->GetPartService()->AddPartListener(imageNavigatorPartListener.data()); berry::IViewPart::Pointer imageNavigatorView = window->GetActivePage()->FindView("org.mitk.views.imagenavigator"); imageNavigatorAction->setChecked(false); if (imageNavigatorView) { bool isImageNavigatorVisible = window->GetActivePage()->IsPartVisible(imageNavigatorView); if (isImageNavigatorVisible) imageNavigatorAction->setChecked(true); } imageNavigatorAction->setToolTip("Toggle image navigator for navigating through image"); } viewNavigatorAction = new QAction(berry::QtStyleManager::ThemeIcon(QStringLiteral(":/org.mitk.gui.qt.ext/view-manager.svg")),"&View Navigator", nullptr); viewNavigatorFound = window->GetWorkbench()->GetViewRegistry()->Find("org.mitk.views.viewnavigatorview"); if (viewNavigatorFound) { QObject::connect(viewNavigatorAction, SIGNAL(triggered(bool)), QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onViewNavigator())); viewNavigatorAction->setCheckable(true); // add part listener for view navigator viewNavigatorPartListener.reset(new PartListenerForViewNavigator(viewNavigatorAction)); window->GetPartService()->AddPartListener(viewNavigatorPartListener.data()); berry::IViewPart::Pointer viewnavigatorview = window->GetActivePage()->FindView("org.mitk.views.viewnavigatorview"); viewNavigatorAction->setChecked(false); if (viewnavigatorview) { bool isViewNavigatorVisible = window->GetActivePage()->IsPartVisible(viewnavigatorview); if (isViewNavigatorVisible) viewNavigatorAction->setChecked(true); } viewNavigatorAction->setToolTip("Toggle View Navigator"); } mainActionsToolBar->addAction(fileOpenAction); mainActionsToolBar->addAction(fileSaveProjectAction); mainActionsToolBar->addAction(closeProjectAction); mainActionsToolBar->addAction(undoAction); mainActionsToolBar->addAction(redoAction); if(this->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.dicomeditor")) { mainActionsToolBar->addAction(openDicomEditorAction); } if (this->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.stdmultiwidget")) { mainActionsToolBar->addAction(openStdMultiWidgetEditorAction); } - if (this->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.custommultiwidget")) + if (this->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.mxnmultiwidget")) { - mainActionsToolBar->addAction(openCustomMultiWidgetEditorAction); + mainActionsToolBar->addAction(openMxNMultiWidgetEditorAction); } if (imageNavigatorViewFound) { mainActionsToolBar->addAction(imageNavigatorAction); } if (viewNavigatorFound) { mainActionsToolBar->addAction(viewNavigatorAction); } mainWindow->addToolBar(mainActionsToolBar); // ==== Perspective Toolbar ================================== auto qPerspectiveToolbar = new QToolBar; qPerspectiveToolbar->setObjectName("perspectiveToolBar"); if (showPerspectiveToolbar) { qPerspectiveToolbar->addActions(perspGroup->actions()); mainWindow->addToolBar(qPerspectiveToolbar); } else delete qPerspectiveToolbar; if (showViewToolbar) { auto prefService = berry::WorkbenchPlugin::GetDefault()->GetPreferencesService(); berry::IPreferences::Pointer stylePrefs = prefService->GetSystemPreferences()->Node(berry::QtPreferences::QT_STYLES_NODE); bool showCategoryNames = stylePrefs->GetBool(berry::QtPreferences::QT_SHOW_TOOLBAR_CATEGORY_NAMES, true); // Order view descriptors by category QMultiMap categoryViewDescriptorMap; for (auto labelViewDescriptorPair : VDMap) { auto viewDescriptor = labelViewDescriptorPair.second; auto category = !viewDescriptor->GetCategoryPath().isEmpty() ? viewDescriptor->GetCategoryPath().back() : QString(); categoryViewDescriptorMap.insert(category, viewDescriptor); } // Create a separate toolbar for each category for (auto category : categoryViewDescriptorMap.uniqueKeys()) { auto viewDescriptorsInCurrentCategory = categoryViewDescriptorMap.values(category); if (!viewDescriptorsInCurrentCategory.isEmpty()) { auto toolbar = new QToolBar; toolbar->setObjectName(category + " View Toolbar"); mainWindow->addToolBar(toolbar); if (showCategoryNames && !category.isEmpty()) { auto categoryButton = new QToolButton; categoryButton->setToolButtonStyle(Qt::ToolButtonTextOnly); categoryButton->setText(category); categoryButton->setStyleSheet("background: transparent; margin: 0; padding: 0;"); toolbar->addWidget(categoryButton); connect(categoryButton, &QToolButton::clicked, [toolbar]() { for (QWidget* widget : toolbar->findChildren()) { if (QStringLiteral("qt_toolbar_ext_button") == widget->objectName() && widget->isVisible()) { QMouseEvent pressEvent(QEvent::MouseButtonPress, QPointF(0.0f, 0.0f), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPointF(0.0f, 0.0f), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); QApplication::sendEvent(widget, &pressEvent); QApplication::sendEvent(widget, &releaseEvent); } } }); } for (auto viewDescriptor : viewDescriptorsInCurrentCategory) { auto viewAction = new berry::QtShowViewAction(window, viewDescriptor); toolbar->addAction(viewAction); } } } } QSettings settings(GetQSettingsFile(), QSettings::IniFormat); mainWindow->restoreState(settings.value("ToolbarPosition").toByteArray()); auto qStatusBar = new QStatusBar(); //creating a QmitkStatusBar for Output on the QStatusBar and connecting it with the MainStatusBar auto statusBar = new QmitkStatusBar(qStatusBar); //disabling the SizeGrip in the lower right corner statusBar->SetSizeGripEnabled(false); auto progBar = new QmitkProgressBar(); qStatusBar->addPermanentWidget(progBar, 0); progBar->hide(); // progBar->AddStepsToDo(2); // progBar->Progress(1); mainWindow->setStatusBar(qStatusBar); if (showMemoryIndicator) { auto memoryIndicator = new QmitkMemoryUsageIndicatorView(); qStatusBar->addPermanentWidget(memoryIndicator, 0); } } void QmitkExtWorkbenchWindowAdvisor::PreWindowOpen() { berry::IWorkbenchWindowConfigurer::Pointer configurer = GetWindowConfigurer(); // show the shortcut bar and progress indicator, which are hidden by // default //configurer->SetShowPerspectiveBar(true); //configurer->SetShowFastViewBars(true); //configurer->SetShowProgressIndicator(true); // // add the drag and drop support for the editor area // configurer.addEditorAreaTransfer(EditorInputTransfer.getInstance()); // configurer.addEditorAreaTransfer(ResourceTransfer.getInstance()); // configurer.addEditorAreaTransfer(FileTransfer.getInstance()); // configurer.addEditorAreaTransfer(MarkerTransfer.getInstance()); // configurer.configureEditorAreaDropListener(new EditorAreaDropAdapter( // configurer.getWindow())); this->HookTitleUpdateListeners(configurer); menuPerspectiveListener.reset(new PerspectiveListenerForMenu(this)); configurer->GetWindow()->AddPerspectiveListener(menuPerspectiveListener.data()); configurer->AddEditorAreaTransfer(QStringList("text/uri-list")); configurer->ConfigureEditorAreaDropListener(dropTargetListener.data()); } void QmitkExtWorkbenchWindowAdvisor::PostWindowOpen() { berry::WorkbenchWindowAdvisor::PostWindowOpen(); // Force Rendering Window Creation on startup. berry::IWorkbenchWindowConfigurer::Pointer configurer = GetWindowConfigurer(); ctkPluginContext* context = QmitkCommonExtPlugin::getContext(); ctkServiceReference serviceRef = context->getServiceReference(); if (serviceRef) { mitk::IDataStorageService *dsService = context->getService(serviceRef); if (dsService) { mitk::IDataStorageReference::Pointer dsRef = dsService->GetDataStorage(); mitk::DataStorageEditorInput::Pointer dsInput(new mitk::DataStorageEditorInput(dsRef)); mitk::WorkbenchUtil::OpenEditor(configurer->GetWindow()->GetActivePage(),dsInput); } } } void QmitkExtWorkbenchWindowAdvisor::onIntro() { QmitkExtWorkbenchWindowAdvisorHack::undohack->onIntro(); } void QmitkExtWorkbenchWindowAdvisor::onHelp() { QmitkExtWorkbenchWindowAdvisorHack::undohack->onHelp(); } void QmitkExtWorkbenchWindowAdvisor::onHelpOpenHelpPerspective() { QmitkExtWorkbenchWindowAdvisorHack::undohack->onHelpOpenHelpPerspective(); } void QmitkExtWorkbenchWindowAdvisor::onAbout() { QmitkExtWorkbenchWindowAdvisorHack::undohack->onAbout(); } //-------------------------------------------------------------------------------- // Ugly hack from here on. Feel free to delete when command framework // and undo buttons are done. //-------------------------------------------------------------------------------- QmitkExtWorkbenchWindowAdvisorHack::QmitkExtWorkbenchWindowAdvisorHack() : QObject() { } QmitkExtWorkbenchWindowAdvisorHack::~QmitkExtWorkbenchWindowAdvisorHack() { } void QmitkExtWorkbenchWindowAdvisorHack::onUndo() { mitk::UndoModel* model = mitk::UndoController::GetCurrentUndoModel(); if (model) { if (mitk::VerboseLimitedLinearUndo* verboseundo = dynamic_cast( model )) { mitk::VerboseLimitedLinearUndo::StackDescription descriptions = verboseundo->GetUndoDescriptions(); if (descriptions.size() >= 1) { MITK_INFO << "Undo " << descriptions.front().second; } } model->Undo(); } else { MITK_ERROR << "No undo model instantiated"; } } void QmitkExtWorkbenchWindowAdvisorHack::onRedo() { mitk::UndoModel* model = mitk::UndoController::GetCurrentUndoModel(); if (model) { if (mitk::VerboseLimitedLinearUndo* verboseundo = dynamic_cast( model )) { mitk::VerboseLimitedLinearUndo::StackDescription descriptions = verboseundo->GetRedoDescriptions(); if (descriptions.size() >= 1) { MITK_INFO << "Redo " << descriptions.front().second; } } model->Redo(); } else { MITK_ERROR << "No undo model instantiated"; } } // safe calls to the complete chain // berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->FindView("org.mitk.views.imagenavigator"); // to cover for all possible cases of closed pages etc. static void SafeHandleNavigatorView(QString view_query_name) { berry::IWorkbench* wbench = berry::PlatformUI::GetWorkbench(); if( wbench == nullptr ) return; berry::IWorkbenchWindow::Pointer wbench_window = wbench->GetActiveWorkbenchWindow(); if( wbench_window.IsNull() ) return; berry::IWorkbenchPage::Pointer wbench_page = wbench_window->GetActivePage(); if( wbench_page.IsNull() ) return; auto wbench_view = wbench_page->FindView( view_query_name ); if( wbench_view.IsNotNull() ) { bool isViewVisible = wbench_page->IsPartVisible( wbench_view ); if( isViewVisible ) { wbench_page->HideView( wbench_view ); return; } } wbench_page->ShowView( view_query_name ); } void QmitkExtWorkbenchWindowAdvisorHack::onImageNavigator() { // show/hide ImageNavigatorView SafeHandleNavigatorView("org.mitk.views.imagenavigator"); } void QmitkExtWorkbenchWindowAdvisorHack::onViewNavigator() { // show/hide viewnavigatorView SafeHandleNavigatorView("org.mitk.views.viewnavigatorview"); } void QmitkExtWorkbenchWindowAdvisorHack::onEditPreferences() { QmitkPreferencesDialog _PreferencesDialog(QApplication::activeWindow()); _PreferencesDialog.exec(); } void QmitkExtWorkbenchWindowAdvisorHack::onQuit() { berry::PlatformUI::GetWorkbench()->Close(); } void QmitkExtWorkbenchWindowAdvisorHack::onResetPerspective() { berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->ResetPerspective(); } void QmitkExtWorkbenchWindowAdvisorHack::onClosePerspective() { berry::IWorkbenchPage::Pointer page = berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage(); page->ClosePerspective(page->GetPerspective(), true, true); } void QmitkExtWorkbenchWindowAdvisorHack::onNewWindow() { berry::PlatformUI::GetWorkbench()->OpenWorkbenchWindow(nullptr); } void QmitkExtWorkbenchWindowAdvisorHack::onIntro() { bool hasIntro = berry::PlatformUI::GetWorkbench()->GetIntroManager()->HasIntro(); if (!hasIntro) { QRegExp reg("(.*)(\\n)*"); QRegExp reg2("(\\n)*(.*)"); QFile file(":/org.mitk.gui.qt.ext/index.html"); file.open(QIODevice::ReadOnly | QIODevice::Text); //text file only for reading QString text = QString(file.readAll()); file.close(); QString title = text; title.replace(reg, ""); title.replace(reg2, ""); std::cout << title.toStdString() << std::endl; QMessageBox::information(nullptr, title, text, "Close"); } else { berry::PlatformUI::GetWorkbench()->GetIntroManager()->ShowIntro( berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow(), false); } } void QmitkExtWorkbenchWindowAdvisorHack::onHelp() { ctkPluginContext* context = QmitkCommonExtPlugin::getContext(); if (context == nullptr) { MITK_WARN << "Plugin context not set, unable to open context help"; return; } // Check if the org.blueberry.ui.qt.help plug-in is installed and started QList > plugins = context->getPlugins(); foreach(QSharedPointer p, plugins) { if (p->getSymbolicName() == "org.blueberry.ui.qt.help") { if (p->getState() != ctkPlugin::ACTIVE) { // try to activate the plug-in explicitly try { p->start(ctkPlugin::START_TRANSIENT); } catch (const ctkPluginException& pe) { MITK_ERROR << "Activating org.blueberry.ui.qt.help failed: " << pe.what(); return; } } } } ctkServiceReference eventAdminRef = context->getServiceReference(); ctkEventAdmin* eventAdmin = nullptr; if (eventAdminRef) { eventAdmin = context->getService(eventAdminRef); } if (eventAdmin == nullptr) { MITK_WARN << "ctkEventAdmin service not found. Unable to open context help"; } else { ctkEvent ev("org/blueberry/ui/help/CONTEXTHELP_REQUESTED"); eventAdmin->postEvent(ev); } } void QmitkExtWorkbenchWindowAdvisorHack::onHelpOpenHelpPerspective() { berry::PlatformUI::GetWorkbench()->ShowPerspective("org.blueberry.perspectives.help", berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()); } void QmitkExtWorkbenchWindowAdvisorHack::onAbout() { auto aboutDialog = new QmitkAboutDialog(QApplication::activeWindow(),nullptr); aboutDialog->open(); } void QmitkExtWorkbenchWindowAdvisor::HookTitleUpdateListeners(berry::IWorkbenchWindowConfigurer::Pointer configurer) { // hook up the listeners to update the window title titlePartListener.reset(new PartListenerForTitle(this)); titlePerspectiveListener.reset(new PerspectiveListenerForTitle(this)); editorPropertyListener.reset(new berry::PropertyChangeIntAdapter< QmitkExtWorkbenchWindowAdvisor>(this, &QmitkExtWorkbenchWindowAdvisor::PropertyChange)); // configurer.getWindow().addPageListener(new IPageListener() { // public void pageActivated(IWorkbenchPage page) { // updateTitle(false); // } // // public void pageClosed(IWorkbenchPage page) { // updateTitle(false); // } // // public void pageOpened(IWorkbenchPage page) { // // do nothing // } // }); configurer->GetWindow()->AddPerspectiveListener(titlePerspectiveListener.data()); configurer->GetWindow()->GetPartService()->AddPartListener(titlePartListener.data()); } QString QmitkExtWorkbenchWindowAdvisor::ComputeTitle() { berry::IWorkbenchWindowConfigurer::Pointer configurer = GetWindowConfigurer(); berry::IWorkbenchPage::Pointer currentPage = configurer->GetWindow()->GetActivePage(); berry::IEditorPart::Pointer activeEditor; if (currentPage) { activeEditor = lastActiveEditor.Lock(); } QString title; berry::IProduct::Pointer product = berry::Platform::GetProduct(); if (product.IsNotNull()) { title = product->GetName(); } if (title.isEmpty()) { // instead of the product name, we use a custom variable for now title = productName; } if(showMitkVersionInfo) { title += QString(" ") + MITK_VERSION_STRING; } if (showVersionInfo) { // add version informatioin QString versions = QString(" (ITK %1.%2.%3 VTK %4.%5.%6 Qt %7 MITK %8)") .arg(ITK_VERSION_MAJOR).arg(ITK_VERSION_MINOR).arg(ITK_VERSION_PATCH) .arg(VTK_MAJOR_VERSION).arg(VTK_MINOR_VERSION).arg(VTK_BUILD_VERSION) .arg(QT_VERSION_STR) .arg(MITK_VERSION_STRING); title += versions; } if (currentPage) { if (activeEditor) { lastEditorTitle = activeEditor->GetTitleToolTip(); if (!lastEditorTitle.isEmpty()) title = lastEditorTitle + " - " + title; } berry::IPerspectiveDescriptor::Pointer persp = currentPage->GetPerspective(); QString label = ""; if (persp) { label = persp->GetLabel(); } berry::IAdaptable* input = currentPage->GetInput(); if (input && input != wbAdvisor->GetDefaultPageInput()) { label = currentPage->GetLabel(); } if (!label.isEmpty()) { title = label + " - " + title; } } title += " (Not for use in diagnosis or treatment of patients)"; return title; } void QmitkExtWorkbenchWindowAdvisor::RecomputeTitle() { berry::IWorkbenchWindowConfigurer::Pointer configurer = GetWindowConfigurer(); QString oldTitle = configurer->GetTitle(); QString newTitle = ComputeTitle(); if (newTitle != oldTitle) { configurer->SetTitle(newTitle); } } void QmitkExtWorkbenchWindowAdvisor::UpdateTitle(bool editorHidden) { berry::IWorkbenchWindowConfigurer::Pointer configurer = GetWindowConfigurer(); berry::IWorkbenchWindow::Pointer window = configurer->GetWindow(); berry::IEditorPart::Pointer activeEditor; berry::IWorkbenchPage::Pointer currentPage = window->GetActivePage(); berry::IPerspectiveDescriptor::Pointer persp; berry::IAdaptable* input = nullptr; if (currentPage) { activeEditor = currentPage->GetActiveEditor(); persp = currentPage->GetPerspective(); input = currentPage->GetInput(); } if (editorHidden) { activeEditor = nullptr; } // Nothing to do if the editor hasn't changed if (activeEditor == lastActiveEditor.Lock() && currentPage == lastActivePage.Lock() && persp == lastPerspective.Lock() && input == lastInput) { return; } if (!lastActiveEditor.Expired()) { lastActiveEditor.Lock()->RemovePropertyListener(editorPropertyListener.data()); } lastActiveEditor = activeEditor; lastActivePage = currentPage; lastPerspective = persp; lastInput = input; if (activeEditor) { activeEditor->AddPropertyListener(editorPropertyListener.data()); } RecomputeTitle(); } void QmitkExtWorkbenchWindowAdvisor::PropertyChange(const berry::Object::Pointer& /*source*/, int propId) { if (propId == berry::IWorkbenchPartConstants::PROP_TITLE) { if (!lastActiveEditor.Expired()) { QString newTitle = lastActiveEditor.Lock()->GetPartName(); if (lastEditorTitle != newTitle) { RecomputeTitle(); } } } } void QmitkExtWorkbenchWindowAdvisor::SetPerspectiveExcludeList(const QList& v) { this->perspectiveExcludeList = v; } QList QmitkExtWorkbenchWindowAdvisor::GetPerspectiveExcludeList() { return this->perspectiveExcludeList; } void QmitkExtWorkbenchWindowAdvisor::SetViewExcludeList(const QList& v) { this->viewExcludeList = v; } QList QmitkExtWorkbenchWindowAdvisor::GetViewExcludeList() { return this->viewExcludeList; } void QmitkExtWorkbenchWindowAdvisor::PostWindowClose() { berry::IWorkbenchWindow::Pointer window = this->GetWindowConfigurer()->GetWindow(); QMainWindow* mainWindow = static_cast (window->GetShell()->GetControl()); QSettings settings(GetQSettingsFile(), QSettings::IniFormat); settings.setValue("ToolbarPosition", mainWindow->saveState()); } QString QmitkExtWorkbenchWindowAdvisor::GetQSettingsFile() const { QFileInfo settingsInfo = QmitkCommonExtPlugin::getContext()->getDataFile(QT_SETTINGS_FILENAME); return settingsInfo.canonicalFilePath(); } diff --git a/Plugins/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.h b/Plugins/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.h index 2004508251..76ed29e22b 100644 --- a/Plugins/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.h +++ b/Plugins/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.h @@ -1,181 +1,181 @@ /*=================================================================== 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 QMITKEXTWORKBENCHWINDOWADVISOR_H_ #define QMITKEXTWORKBENCHWINDOWADVISOR_H_ #include #include #include #include #include #include #include #include class QAction; class QMenu; class MITK_QT_COMMON_EXT_EXPORT QmitkExtWorkbenchWindowAdvisor : public QObject, public berry::WorkbenchWindowAdvisor { Q_OBJECT public: QmitkExtWorkbenchWindowAdvisor(berry::WorkbenchAdvisor* wbAdvisor, berry::IWorkbenchWindowConfigurer::Pointer configurer); ~QmitkExtWorkbenchWindowAdvisor() override; berry::SmartPointer CreateActionBarAdvisor( berry::SmartPointer configurer) override; QWidget* CreateEmptyWindowContents(QWidget* parent) override; void PostWindowCreate() override; void PreWindowOpen() override; void PostWindowOpen() override; void PostWindowClose() override; void ShowViewToolbar(bool show); void ShowPerspectiveToolbar(bool show); void ShowVersionInfo(bool show); void ShowMitkVersionInfo(bool show); void ShowViewMenuItem(bool show); void ShowNewWindowMenuItem(bool show); void ShowClosePerspectiveMenuItem(bool show); bool GetShowClosePerspectiveMenuItem(); void ShowMemoryIndicator(bool show); bool GetShowMemoryIndicator(); //TODO should be removed when product support is here void SetProductName(const QString& product); void SetWindowIcon(const QString& wndIcon); void SetPerspectiveExcludeList(const QList &v); QList GetPerspectiveExcludeList(); void SetViewExcludeList(const QList &v); QList GetViewExcludeList(); protected slots: virtual void onIntro(); virtual void onHelp(); virtual void onHelpOpenHelpPerspective(); virtual void onAbout(); private: /** * Hooks the listeners needed on the window * * @param configurer */ void HookTitleUpdateListeners(berry::IWorkbenchWindowConfigurer::Pointer configurer); QString ComputeTitle(); void RecomputeTitle(); QString GetQSettingsFile() const; /** * Updates the window title. Format will be: [pageInput -] * [currentPerspective -] [editorInput -] [workspaceLocation -] productName * @param editorHidden TODO */ void UpdateTitle(bool editorHidden); void PropertyChange(const berry::Object::Pointer& /*source*/, int propId); static QString QT_SETTINGS_FILENAME; QScopedPointer titlePartListener; QScopedPointer titlePerspectiveListener; QScopedPointer menuPerspectiveListener; QScopedPointer imageNavigatorPartListener; QScopedPointer viewNavigatorPartListener; QScopedPointer editorPropertyListener; friend struct berry::PropertyChangeIntAdapter; friend class PartListenerForTitle; friend class PerspectiveListenerForTitle; friend class PerspectiveListenerForMenu; friend class PartListenerForImageNavigator; friend class PartListenerForViewNavigator; berry::IEditorPart::WeakPtr lastActiveEditor; berry::IPerspectiveDescriptor::WeakPtr lastPerspective; berry::IWorkbenchPage::WeakPtr lastActivePage; QString lastEditorTitle; berry::IAdaptable* lastInput; berry::WorkbenchAdvisor* wbAdvisor; bool showViewToolbar; bool showPerspectiveToolbar; bool showVersionInfo; bool showMitkVersionInfo; bool showViewMenuItem; bool showNewWindowMenuItem; bool showClosePerspectiveMenuItem; bool viewNavigatorFound; bool showMemoryIndicator; QString productName; QString windowIcon; // enables DnD on the editor area QScopedPointer dropTargetListener; // stringlist for excluding perspectives from the perspective menu entry (e.g. Welcome Perspective) QList perspectiveExcludeList; // stringlist for excluding views from the menu entry QList viewExcludeList; // maps perspective ids to QAction objects QHash mapPerspIdToAction; // actions which will be enabled/disabled depending on the application state QList viewActions; QAction* fileSaveProjectAction; QAction* closeProjectAction; QAction* undoAction; QAction* redoAction; QAction* imageNavigatorAction; QAction* viewNavigatorAction; QAction* resetPerspAction; QAction* closePerspAction; QAction* openDicomEditorAction; QAction* openStdMultiWidgetEditorAction; - QAction* openCustomMultiWidgetEditorAction; + QAction* openMxNMultiWidgetEditorAction; }; #endif /*QMITKEXTWORKBENCHWINDOWADVISOR_H_*/ diff --git a/Plugins/org.mitk.gui.qt.ext/src/QmitkOpenCustomMultiWidgetEditorAction.cpp b/Plugins/org.mitk.gui.qt.ext/src/QmitkOpenMxNMultiWidgetEditorAction.cpp similarity index 77% rename from Plugins/org.mitk.gui.qt.ext/src/QmitkOpenCustomMultiWidgetEditorAction.cpp rename to Plugins/org.mitk.gui.qt.ext/src/QmitkOpenMxNMultiWidgetEditorAction.cpp index eb1dc022d5..293f5e1fad 100644 --- a/Plugins/org.mitk.gui.qt.ext/src/QmitkOpenCustomMultiWidgetEditorAction.cpp +++ b/Plugins/org.mitk.gui.qt.ext/src/QmitkOpenMxNMultiWidgetEditorAction.cpp @@ -1,82 +1,82 @@ /*=================================================================== 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 "QmitkOpenCustomMultiWidgetEditorAction.h" +#include "QmitkOpenMxNMultiWidgetEditorAction.h" #include "mitkCoreObjectFactory.h" #include #include #include #include #include #include #include "internal/QmitkCommonExtPlugin.h" #include class ctkPluginContext; -QmitkOpenCustomMultiWidgetEditorAction::QmitkOpenCustomMultiWidgetEditorAction(berry::IWorkbenchWindow::Pointer window) +QmitkOpenMxNMultiWidgetEditorAction::QmitkOpenMxNMultiWidgetEditorAction(berry::IWorkbenchWindow::Pointer window) : QAction(nullptr) { this->init(window); } -QmitkOpenCustomMultiWidgetEditorAction::QmitkOpenCustomMultiWidgetEditorAction(const QIcon& icon, berry::IWorkbenchWindow::Pointer window) +QmitkOpenMxNMultiWidgetEditorAction::QmitkOpenMxNMultiWidgetEditorAction(const QIcon& icon, berry::IWorkbenchWindow::Pointer window) : QAction(nullptr) { this->setIcon(icon); this->init(window); } -void QmitkOpenCustomMultiWidgetEditorAction::init(berry::IWorkbenchWindow::Pointer window) +void QmitkOpenMxNMultiWidgetEditorAction::init(berry::IWorkbenchWindow::Pointer window) { m_Window = window; this->setParent(static_cast(m_Window->GetShell()->GetControl())); - this->setText("Custom Display"); - this->setToolTip("Open the custom multi widget editor"); + this->setText("MxN Display"); + this->setToolTip("Open the mxn multi widget editor"); berry::IPreferencesService* prefService = berry::Platform::GetPreferencesService(); m_GeneralPreferencesNode = prefService->GetSystemPreferences()->Node("/General"); this->connect(this, SIGNAL(triggered(bool)), this, SLOT(Run())); } -void QmitkOpenCustomMultiWidgetEditorAction::Run() +void QmitkOpenMxNMultiWidgetEditorAction::Run() { // check if there is an open perspective, if not open the default perspective if (m_Window->GetActivePage().IsNull()) { QString defaultPerspId = m_Window->GetWorkbench()->GetPerspectiveRegistry()->GetDefaultPerspective(); m_Window->GetWorkbench()->ShowPerspective(defaultPerspId, m_Window); } ctkPluginContext* context = QmitkCommonExtPlugin::getContext(); ctkServiceReference serviceRef = context->getServiceReference(); if (serviceRef) { mitk::IDataStorageService* dsService = context->getService(serviceRef); if (dsService) { mitk::IDataStorageReference::Pointer dsRef = dsService->GetDataStorage(); berry::IEditorInput::Pointer editorInput(new mitk::DataStorageEditorInput(dsRef)); - m_Window->GetActivePage()->OpenEditor(editorInput, "org.mitk.editors.custommultiwidget", true, berry::IWorkbenchPage::MATCH_ID); + m_Window->GetActivePage()->OpenEditor(editorInput, "org.mitk.editors.mxnmultiwidget", true, berry::IWorkbenchPage::MATCH_ID); } } } diff --git a/Plugins/org.mitk.gui.qt.ext/src/QmitkOpenCustomMultiWidgetEditorAction.h b/Plugins/org.mitk.gui.qt.ext/src/QmitkOpenMxNMultiWidgetEditorAction.h similarity index 64% rename from Plugins/org.mitk.gui.qt.ext/src/QmitkOpenCustomMultiWidgetEditorAction.h rename to Plugins/org.mitk.gui.qt.ext/src/QmitkOpenMxNMultiWidgetEditorAction.h index 8da39ccda9..2c159d761c 100644 --- a/Plugins/org.mitk.gui.qt.ext/src/QmitkOpenCustomMultiWidgetEditorAction.h +++ b/Plugins/org.mitk.gui.qt.ext/src/QmitkOpenMxNMultiWidgetEditorAction.h @@ -1,56 +1,56 @@ /*=================================================================== 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 QMITKOPENCUSTOMMULTIWIDGETEDITORACTION_H -#define QMITKOPENCUSTOMMULTIWIDGETEDITORACTION_H +#ifndef QMITKOPENMXNMULTIWIDGETEDITORACTION_H +#define QMITKOPENMXNMULTIWIDGETEDITORACTION_H #ifdef __MINGW32__ -// We need to inlclude winbase.h here in order to declare +// We need to include winbase.h here in order to declare // atomic intrinsics like InterlockedIncrement correctly. -// Otherwhise, they would be declared wrong within qatomic_windows.h . +// Otherwise they would be declared wrong within qatomic_windows.h . #include #endif #include #include #include #include #include -class MITK_QT_COMMON_EXT_EXPORT QmitkOpenCustomMultiWidgetEditorAction : public QAction +class MITK_QT_COMMON_EXT_EXPORT QmitkOpenMxNMultiWidgetEditorAction : public QAction { Q_OBJECT public: - QmitkOpenCustomMultiWidgetEditorAction(berry::IWorkbenchWindow::Pointer window); - QmitkOpenCustomMultiWidgetEditorAction(const QIcon& icon, berry::IWorkbenchWindow::Pointer window); + QmitkOpenMxNMultiWidgetEditorAction(berry::IWorkbenchWindow::Pointer window); + QmitkOpenMxNMultiWidgetEditorAction(const QIcon& icon, berry::IWorkbenchWindow::Pointer window); protected slots: void Run(); private: void init(berry::IWorkbenchWindow::Pointer window); berry::IWorkbenchWindow::Pointer m_Window; berry::IPreferences::WeakPtr m_GeneralPreferencesNode; }; -#endif // QMITKOPENCUSTOMMULTIWIDGETEDITORACTION_H +#endif // QMITKOPENMXNMULTIWIDGETEDITORACTION_H diff --git a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/CMakeLists.txt b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/CMakeLists.txt similarity index 52% rename from Plugins/org.mitk.gui.qt.custommultiwidgeteditor/CMakeLists.txt rename to Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/CMakeLists.txt index 308d5992c8..311da29037 100644 --- a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/CMakeLists.txt @@ -1,7 +1,7 @@ -project(org_mitk_gui_qt_custommultiwidgeteditor) +project(org_mitk_gui_qt_mxnmultiwidgeteditor) mitk_create_plugin( - EXPORT_DIRECTIVE CUSTOMMULTIWIDGETEDITOR_EXPORT + EXPORT_DIRECTIVE MXNMULTIWIDGETEDITOR_EXPORT EXPORTED_INCLUDE_SUFFIXES src MODULE_DEPENDS MitkQtWidgets MitkRenderWindowManager ) diff --git a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/files.cmake b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/files.cmake similarity index 63% rename from Plugins/org.mitk.gui.qt.custommultiwidgeteditor/files.cmake rename to Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/files.cmake index 79481c4266..e293f83e5f 100644 --- a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/files.cmake +++ b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/files.cmake @@ -1,36 +1,36 @@ set(SRC_CPP_FILES - QmitkCustomMultiWidgetEditor.cpp + QmitkMxNMultiWidgetEditor.cpp QmitkMultiWidgetDecorationManager.cpp ) set(INTERNAL_CPP_FILES mitkPluginActivator.cpp - QmitkCustomMultiWidgetEditorPreferencePage.cpp + QmitkMxNMultiWidgetEditorPreferencePage.cpp ) set(UI_FILES - src/internal/QmitkCustomMultiWidgetEditorPreferencePage.ui + src/internal/QmitkMxNMultiWidgetEditorPreferencePage.ui ) set(MOC_H_FILES - src/QmitkCustomMultiWidgetEditor.h + src/QmitkMxNMultiWidgetEditor.h src/internal/mitkPluginActivator.h - src/internal/QmitkCustomMultiWidgetEditorPreferencePage.h + src/internal/QmitkMxNMultiWidgetEditorPreferencePage.h ) set(CACHED_RESOURCE_FILES - resources/CustomMultiWidgetEditor.svg + resources/MxNMultiWidgetEditor.svg plugin.xml ) set(QRC_FILES ) foreach(file ${SRC_CPP_FILES}) set(CPP_FILES ${CPP_FILES} src/${file}) endforeach(file ${SRC_CPP_FILES}) foreach(file ${INTERNAL_CPP_FILES}) set(CPP_FILES ${CPP_FILES} src/internal/${file}) endforeach(file ${INTERNAL_CPP_FILES}) diff --git a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/manifest_headers.cmake b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/manifest_headers.cmake similarity index 59% rename from Plugins/org.mitk.gui.qt.custommultiwidgeteditor/manifest_headers.cmake rename to Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/manifest_headers.cmake index a9b763fa3a..3f743d0a72 100644 --- a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/manifest_headers.cmake +++ b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/manifest_headers.cmake @@ -1,6 +1,5 @@ -set(Plugin-Name "MITK Custom Multi Widget Editor") +set(Plugin-Name "MITK MxN Multi Widget Editor") set(Plugin-Version "1.0.0") set(Plugin-Vendor "DKFZ, Division of Medical Image Computing") set(Plugin-ContactAddress "http://www.mitk.org") -set(Require-Plugin org.mitk.gui.qt.common) - +set(Require-Plugin org.mitk.gui.qt.common) \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/plugin.xml b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/plugin.xml new file mode 100644 index 0000000000..14dae7269c --- /dev/null +++ b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/plugin.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/resources/CustomMultiWidgetEditor.svg b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/resources/MxNMultiWidgetEditor.svg similarity index 100% rename from Plugins/org.mitk.gui.qt.custommultiwidgeteditor/resources/CustomMultiWidgetEditor.svg rename to Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/resources/MxNMultiWidgetEditor.svg diff --git a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/resources/QmitkCustomMultiWidgetEditor.qrc b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/resources/QmitkMxNMultiWidgetEditor.qrc similarity index 59% rename from Plugins/org.mitk.gui.qt.custommultiwidgeteditor/resources/QmitkCustomMultiWidgetEditor.qrc rename to Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/resources/QmitkMxNMultiWidgetEditor.qrc index 64a1a29379..655da7e3db 100644 --- a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/resources/QmitkCustomMultiWidgetEditor.qrc +++ b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/resources/QmitkMxNMultiWidgetEditor.qrc @@ -1,5 +1,5 @@ - + defaultWatermark.png diff --git a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/resources/defaultWatermark.png b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/resources/defaultWatermark.png similarity index 100% rename from Plugins/org.mitk.gui.qt.custommultiwidgeteditor/resources/defaultWatermark.png rename to Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/resources/defaultWatermark.png diff --git a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/QmitkMultiWidgetDecorationManager.cpp b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/QmitkMultiWidgetDecorationManager.cpp similarity index 87% rename from Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/QmitkMultiWidgetDecorationManager.cpp rename to Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/QmitkMultiWidgetDecorationManager.cpp index 6ef9f3d0c8..7e660f3764 100644 --- a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/QmitkMultiWidgetDecorationManager.cpp +++ b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/QmitkMultiWidgetDecorationManager.cpp @@ -1,458 +1,458 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. 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 "QmitkMultiWidgetDecorationManager.h" // org_mitk_gui_common #include // mitk annotation #include // vtk #include // qt #include -QmitkMultiWidgetDecorationManager::QmitkMultiWidgetDecorationManager(QmitkCustomMultiWidget* customMultiWidget) - : m_CustomMultiWidget(customMultiWidget) +QmitkMultiWidgetDecorationManager::QmitkMultiWidgetDecorationManager(QmitkMxNMultiWidget* mxnMultiWidget) + : m_MxNMultiWidget(mxnMultiWidget) , m_LogoAnnotation(mitk::LogoAnnotation::New()) { // nothing here } void QmitkMultiWidgetDecorationManager::DecorationPreferencesChanged(const berry::IBerryPreferences* preferences) { // Enable change of logo. If no DepartmentLogo was set explicitly, MBILogo is used. // Set new department logo by prefs->Set("DepartmentLogo", "PathToImage"); // If no logo was set for this plug-in specifically, walk the parent preference nodes // and lookup a logo value there. // Disable the logo first, otherwise setting a new logo will have no effect due to how mitkManufacturerLogo works ShowLogo(false); SetupLogo(qPrintable(":/org.mitk.gui.qt.stdmultiwidgeteditor/defaultWatermark.png")); ShowLogo(true); const berry::IPreferences* currentNode = preferences; while (currentNode) { bool logoFound = false; foreach(const QString& key, currentNode->Keys()) { if (key == "DepartmentLogo") { ShowLogo(false); QString departmentLogoLocation = currentNode->Get("DepartmentLogo", ""); if (!departmentLogoLocation.isEmpty()) { SetupLogo(qPrintable(departmentLogoLocation)); ShowLogo(true); } logoFound = true; break; } } if (logoFound) { break; } currentNode = currentNode->Parent().GetPointer(); } QmitkMultiWidgetDecorationManager::Colormap colormap = static_cast(preferences->GetInt("Render window widget colormap", 0)); SetColormap(colormap); // show colored rectangle ShowAllColoredRectangles(true); // show corner annotations ShowAllCornerAnnotations(true); } void QmitkMultiWidgetDecorationManager::ShowDecorations(bool show, const QStringList& decorations) { - if (nullptr != m_CustomMultiWidget) + if (nullptr != m_MxNMultiWidget) { return; } if (decorations.isEmpty() || decorations.contains(mitk::IRenderWindowPart::DECORATION_BORDER)) { ShowAllColoredRectangles(show); } if (decorations.isEmpty() || decorations.contains(mitk::IRenderWindowPart::DECORATION_LOGO)) { ShowLogo(show); } if (decorations.isEmpty() || decorations.contains(mitk::IRenderWindowPart::DECORATION_MENU)) { - //m_CustomMultiWidget->ActivateAllRenderWindowMenus(show); + //m_MxNMultiWidget->ActivateAllRenderWindowMenus(show); } if (decorations.isEmpty() || decorations.contains(mitk::IRenderWindowPart::DECORATION_BACKGROUND)) { ShowAllGradientBackgrounds(show); } if (decorations.isEmpty() || decorations.contains(mitk::IRenderWindowPart::DECORATION_CORNER_ANNOTATION)) { ShowAllCornerAnnotations(show); } } bool QmitkMultiWidgetDecorationManager::IsDecorationVisible(const QString& decoration) const { if (mitk::IRenderWindowPart::DECORATION_BORDER == decoration) { return AreAllColoredRectanglesVisible(); } else if (mitk::IRenderWindowPart::DECORATION_LOGO == decoration) { return IsLogoVisible(); } else if (mitk::IRenderWindowPart::DECORATION_MENU == decoration) { //return IsMenuWidgetEnabled(); } else if (mitk::IRenderWindowPart::DECORATION_BACKGROUND == decoration) { return AreAllGradientBackgroundsOn(); } else if (mitk::IRenderWindowPart::DECORATION_CORNER_ANNOTATION == decoration) { return AreAllCornerAnnotationsVisible(); } return false; } QStringList QmitkMultiWidgetDecorationManager::GetDecorations() const { QStringList decorations; decorations << mitk::IRenderWindowPart::DECORATION_BORDER << mitk::IRenderWindowPart::DECORATION_LOGO << mitk::IRenderWindowPart::DECORATION_MENU << mitk::IRenderWindowPart::DECORATION_BACKGROUND << mitk::IRenderWindowPart::DECORATION_CORNER_ANNOTATION; return decorations; } ////////////////////////////////////////////////////////////////////////// // PRIVATE ////////////////////////////////////////////////////////////////////////// void QmitkMultiWidgetDecorationManager::SetupLogo(const char* path) { m_LogoAnnotation->SetOpacity(0.5); mitk::Point2D offset; offset.Fill(0.03); m_LogoAnnotation->SetOffsetVector(offset); m_LogoAnnotation->SetRelativeSize(0.25); m_LogoAnnotation->SetCornerPosition(1); vtkSmartPointer vtkLogo = GetVtkLogo(path); SetLogo(vtkLogo); } vtkSmartPointer QmitkMultiWidgetDecorationManager::GetVtkLogo(const char* path) { QImage* qimage = new QImage(path); vtkSmartPointer qImageToVtk; qImageToVtk = vtkSmartPointer::New(); qImageToVtk->SetQImage(qimage); qImageToVtk->Update(); vtkSmartPointer vtkLogo = qImageToVtk->GetOutput(); return vtkLogo; } void QmitkMultiWidgetDecorationManager::SetLogo(vtkSmartPointer vtkLogo) { - std::shared_ptr renderWindowWidget = m_CustomMultiWidget->GetLastRenderWindowWidget(); + std::shared_ptr renderWindowWidget = m_MxNMultiWidget->GetLastRenderWindowWidget(); if (nullptr != renderWindowWidget && m_LogoAnnotation.IsNotNull()) { mitk::ManualPlacementAnnotationRenderer::AddAnnotation(m_LogoAnnotation.GetPointer(), renderWindowWidget->GetRenderWindow()->GetRenderer()); m_LogoAnnotation->SetLogoImage(vtkLogo); mitk::BaseRenderer *renderer = mitk::BaseRenderer::GetInstance(renderWindowWidget->GetRenderWindow()->GetVtkRenderWindow()); m_LogoAnnotation->Update(renderer); renderWindowWidget->RequestUpdate(); return; } MITK_ERROR << "Logo can not be set for an unknown widget."; } void QmitkMultiWidgetDecorationManager::ShowLogo(bool show) { - std::shared_ptr renderWindowWidget = m_CustomMultiWidget->GetLastRenderWindowWidget(); + std::shared_ptr renderWindowWidget = m_MxNMultiWidget->GetLastRenderWindowWidget(); if (nullptr != renderWindowWidget) { m_LogoAnnotation->SetVisibility(show); renderWindowWidget->RequestUpdate(); return; } MITK_ERROR << "Logo can not be shown for an unknown widget."; } bool QmitkMultiWidgetDecorationManager::IsLogoVisible() const { return m_LogoAnnotation->IsVisible(); } void QmitkMultiWidgetDecorationManager::SetColormap(QmitkMultiWidgetDecorationManager::Colormap colormap) { switch (colormap) { case Colormap::BlackAndWhite: { FillAllGradientBackgroundColorsWithBlack(); float white[3] = { 1.0f, 1.0f, 1.0f }; SetAllDecorationColors(white); break; } } } void QmitkMultiWidgetDecorationManager::SetDecorationColor(const QString& widgetID, const mitk::Color& color) { - std::shared_ptr renderWindowWidget = m_CustomMultiWidget->GetRenderWindowWidget(widgetID); + std::shared_ptr renderWindowWidget = m_MxNMultiWidget->GetRenderWindowWidget(widgetID); if (nullptr != renderWindowWidget) { renderWindowWidget->SetDecorationColor(color); return; } MITK_ERROR << "Decoration color can not be set for an unknown widget."; } void QmitkMultiWidgetDecorationManager::SetAllDecorationColors(const mitk::Color& color) { - QmitkCustomMultiWidget::RenderWindowWidgetMap renderWindowWidgets = m_CustomMultiWidget->GetRenderWindowWidgets(); + QmitkMxNMultiWidget::RenderWindowWidgetMap renderWindowWidgets = m_MxNMultiWidget->GetRenderWindowWidgets(); for (const auto& renderWindowWidget : renderWindowWidgets) { renderWindowWidget.second->SetDecorationColor(color); } } mitk::Color QmitkMultiWidgetDecorationManager::GetDecorationColor(const QString& widgetID) const { - std::shared_ptr renderWindowWidget = m_CustomMultiWidget->GetRenderWindowWidget(widgetID); + std::shared_ptr renderWindowWidget = m_MxNMultiWidget->GetRenderWindowWidget(widgetID); if (nullptr != renderWindowWidget) { return renderWindowWidget->GetDecorationColor(); } MITK_ERROR << "Decoration color can not be retrieved for an unknown widget. Returning black color!"; float black[3] = { 0.0f, 0.0f, 0.0f }; return mitk::Color(black); } void QmitkMultiWidgetDecorationManager::ShowColoredRectangle(const QString& widgetID, bool show) { - std::shared_ptr renderWindowWidget = m_CustomMultiWidget->GetRenderWindowWidget(widgetID); + std::shared_ptr renderWindowWidget = m_MxNMultiWidget->GetRenderWindowWidget(widgetID); if (nullptr != renderWindowWidget) { renderWindowWidget->ShowColoredRectangle(show); return; } MITK_ERROR << "Colored rectangle can not be set for an unknown widget."; } void QmitkMultiWidgetDecorationManager::ShowAllColoredRectangles(bool show) { - QmitkCustomMultiWidget::RenderWindowWidgetMap renderWindowWidgets = m_CustomMultiWidget->GetRenderWindowWidgets(); + QmitkMxNMultiWidget::RenderWindowWidgetMap renderWindowWidgets = m_MxNMultiWidget->GetRenderWindowWidgets(); for (const auto& renderWindowWidget : renderWindowWidgets) { renderWindowWidget.second->ShowColoredRectangle(show); } } bool QmitkMultiWidgetDecorationManager::IsColoredRectangleVisible(const QString& widgetID) const { - std::shared_ptr renderWindowWidget = m_CustomMultiWidget->GetRenderWindowWidget(widgetID); + std::shared_ptr renderWindowWidget = m_MxNMultiWidget->GetRenderWindowWidget(widgetID); if (nullptr != renderWindowWidget) { return renderWindowWidget->IsColoredRectangleVisible(); } MITK_ERROR << "Colored rectangle visibility can not be retrieved for an unknown widget. Returning 'false'."; return false; } bool QmitkMultiWidgetDecorationManager::AreAllColoredRectanglesVisible() const { - QmitkCustomMultiWidget::RenderWindowWidgetMap renderWindowWidgets = m_CustomMultiWidget->GetRenderWindowWidgets(); + QmitkMxNMultiWidget::RenderWindowWidgetMap renderWindowWidgets = m_MxNMultiWidget->GetRenderWindowWidgets(); bool allTrue = true; for (const auto& renderWindowWidget : renderWindowWidgets) { allTrue = allTrue && renderWindowWidget.second->IsColoredRectangleVisible(); } return allTrue; } void QmitkMultiWidgetDecorationManager::SetGradientBackgroundColors(const mitk::Color& upper, const mitk::Color& lower, const QString& widgetID) { - std::shared_ptr renderWindowWidget = m_CustomMultiWidget->GetRenderWindowWidget(widgetID); + std::shared_ptr renderWindowWidget = m_MxNMultiWidget->GetRenderWindowWidget(widgetID); if (nullptr != renderWindowWidget) { renderWindowWidget->SetGradientBackgroundColors(upper, lower); return; } MITK_ERROR << "Background color gradient can not be set for an unknown widget."; } void QmitkMultiWidgetDecorationManager::SetAllGradientBackgroundColors(const mitk::Color& upper, const mitk::Color& lower) { - QmitkCustomMultiWidget::RenderWindowWidgetMap renderWindowWidgets = m_CustomMultiWidget->GetRenderWindowWidgets(); + QmitkMxNMultiWidget::RenderWindowWidgetMap renderWindowWidgets = m_MxNMultiWidget->GetRenderWindowWidgets(); for (const auto& renderWindowWidget : renderWindowWidgets) { renderWindowWidget.second->SetGradientBackgroundColors(upper, lower); } } void QmitkMultiWidgetDecorationManager::FillAllGradientBackgroundColorsWithBlack() { float black[3] = { 0.0f, 0.0f, 0.0f }; SetAllGradientBackgroundColors(black, black); } void QmitkMultiWidgetDecorationManager::ShowGradientBackground(const QString& widgetID, bool show) { - std::shared_ptr renderWindowWidget = m_CustomMultiWidget->GetRenderWindowWidget(widgetID); + std::shared_ptr renderWindowWidget = m_MxNMultiWidget->GetRenderWindowWidget(widgetID); if (nullptr != renderWindowWidget) { renderWindowWidget->ShowGradientBackground(show); return; } MITK_ERROR << "Background color gradient can not be shown for an unknown widget."; } void QmitkMultiWidgetDecorationManager::ShowAllGradientBackgrounds(bool show) { - QmitkCustomMultiWidget::RenderWindowWidgetMap renderWindowWidgets = m_CustomMultiWidget->GetRenderWindowWidgets(); + QmitkMxNMultiWidget::RenderWindowWidgetMap renderWindowWidgets = m_MxNMultiWidget->GetRenderWindowWidgets(); for (const auto& renderWindowWidget : renderWindowWidgets) { renderWindowWidget.second->ShowGradientBackground(show); } } std::pair QmitkMultiWidgetDecorationManager::GetGradientBackgroundColors(const QString& widgetID) const { - std::shared_ptr renderWindowWidget = m_CustomMultiWidget->GetRenderWindowWidget(widgetID); + std::shared_ptr renderWindowWidget = m_MxNMultiWidget->GetRenderWindowWidget(widgetID); if (nullptr != renderWindowWidget) { return renderWindowWidget->GetGradientBackgroundColors(); } MITK_ERROR << "Background color gradient can not be retrieved for an unknown widget. Returning black color pair."; float black[3] = { 0.0f, 0.0f, 0.0f }; return std::make_pair(mitk::Color(black), mitk::Color(black)); } bool QmitkMultiWidgetDecorationManager::IsGradientBackgroundOn(const QString& widgetID) const { - std::shared_ptr renderWindowWidget = m_CustomMultiWidget->GetRenderWindowWidget(widgetID); + std::shared_ptr renderWindowWidget = m_MxNMultiWidget->GetRenderWindowWidget(widgetID); if (nullptr != renderWindowWidget) { return renderWindowWidget->IsGradientBackgroundOn(); } MITK_ERROR << "Background color gradient flag can not be retrieved for an unknown widget. Returning 'false'."; return false; } bool QmitkMultiWidgetDecorationManager::AreAllGradientBackgroundsOn() const { - QmitkCustomMultiWidget::RenderWindowWidgetMap renderWindowWidgets = m_CustomMultiWidget->GetRenderWindowWidgets(); + QmitkMxNMultiWidget::RenderWindowWidgetMap renderWindowWidgets = m_MxNMultiWidget->GetRenderWindowWidgets(); bool allTrue = true; for (const auto& renderWindowWidget : renderWindowWidgets) { allTrue = allTrue && renderWindowWidget.second->IsGradientBackgroundOn(); } return allTrue; } void QmitkMultiWidgetDecorationManager::SetCornerAnnotationText(const QString& widgetID, const std::string& cornerAnnotation) { - std::shared_ptr renderWindowWidget = m_CustomMultiWidget->GetRenderWindowWidget(widgetID); + std::shared_ptr renderWindowWidget = m_MxNMultiWidget->GetRenderWindowWidget(widgetID); if (nullptr != renderWindowWidget) { renderWindowWidget->SetCornerAnnotationText(cornerAnnotation); return; } MITK_ERROR << "Corner annotation text can not be retrieved for an unknown widget."; } std::string QmitkMultiWidgetDecorationManager::GetCornerAnnotationText(const QString& widgetID) const { - std::shared_ptr renderWindowWidget = m_CustomMultiWidget->GetRenderWindowWidget(widgetID); + std::shared_ptr renderWindowWidget = m_MxNMultiWidget->GetRenderWindowWidget(widgetID); if (nullptr != renderWindowWidget) { return renderWindowWidget->GetCornerAnnotationText(); } MITK_ERROR << "Corner annotation text can not be retrieved for an unknown widget."; return ""; } void QmitkMultiWidgetDecorationManager::ShowCornerAnnotation(const QString& widgetID, bool show) { - std::shared_ptr renderWindowWidget = m_CustomMultiWidget->GetRenderWindowWidget(widgetID); + std::shared_ptr renderWindowWidget = m_MxNMultiWidget->GetRenderWindowWidget(widgetID); if (nullptr != renderWindowWidget) { renderWindowWidget->ShowCornerAnnotation(show); return; } MITK_ERROR << "Corner annotation can not be set for an unknown widget."; } void QmitkMultiWidgetDecorationManager::ShowAllCornerAnnotations(bool show) { - QmitkCustomMultiWidget::RenderWindowWidgetMap renderWindowWidgets = m_CustomMultiWidget->GetRenderWindowWidgets(); + QmitkMxNMultiWidget::RenderWindowWidgetMap renderWindowWidgets = m_MxNMultiWidget->GetRenderWindowWidgets(); for (const auto& renderWindowWidget : renderWindowWidgets) { renderWindowWidget.second->ShowCornerAnnotation(show); } } bool QmitkMultiWidgetDecorationManager::IsCornerAnnotationVisible(const QString& widgetID) const { - std::shared_ptr renderWindowWidget = m_CustomMultiWidget->GetRenderWindowWidget(widgetID); + std::shared_ptr renderWindowWidget = m_MxNMultiWidget->GetRenderWindowWidget(widgetID); if (nullptr != renderWindowWidget) { return renderWindowWidget->IsCornerAnnotationVisible(); } MITK_ERROR << "Corner annotation visibility can not be retrieved for an unknown widget. Returning 'false'."; return false; } bool QmitkMultiWidgetDecorationManager::AreAllCornerAnnotationsVisible() const { - QmitkCustomMultiWidget::RenderWindowWidgetMap renderWindowWidgets = m_CustomMultiWidget->GetRenderWindowWidgets(); + QmitkMxNMultiWidget::RenderWindowWidgetMap renderWindowWidgets = m_MxNMultiWidget->GetRenderWindowWidgets(); bool allTrue = true; for (const auto& renderWindowWidget : renderWindowWidgets) { allTrue = allTrue && renderWindowWidget.second->IsCornerAnnotationVisible(); } return allTrue; } diff --git a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/QmitkMultiWidgetDecorationManager.h b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/QmitkMultiWidgetDecorationManager.h similarity index 88% rename from Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/QmitkMultiWidgetDecorationManager.h rename to Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/QmitkMultiWidgetDecorationManager.h index 6b0637d29a..8cc45cf9fa 100644 --- a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/QmitkMultiWidgetDecorationManager.h +++ b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/QmitkMultiWidgetDecorationManager.h @@ -1,144 +1,144 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. 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 QMITKMULTIWIDGETDECORATIONMANAGER_H -#define QMITKMULTIWIDGETDECORATIONMANAGER_H +#ifndef QMITKMXNMULTIWIDGETDECORATIONMANAGER_H +#define QMITKMXNMULTIWIDGETDECORATIONMANAGER_H -// custom multi widget editor -#include +// mxn multi widget editor +#include // mitk core #include // mitk annotation #include // mitk qtwidgets -#include +#include // berry #include // vtk #include #include // qt #include #include /** * @brief * * */ -class CUSTOMMULTIWIDGETEDITOR_EXPORT QmitkMultiWidgetDecorationManager +class MXNMULTIWIDGETEDITOR_EXPORT QmitkMultiWidgetDecorationManager { public: - QmitkMultiWidgetDecorationManager(QmitkCustomMultiWidget* customMultiWidget); + QmitkMultiWidgetDecorationManager(QmitkMxNMultiWidget* mxnMultiWidget); enum class Colormap { BlackAndWhite = 0 // black background, white decoration }; void DecorationPreferencesChanged(const berry::IBerryPreferences* preferences); /** * @brief Show or hide decorations like like colored borders or background, logos, menu widgets, logos and * text annotations. * * \@par Show the decorations specified in decorations if true. Hide them, if not. * \@par A list of decoration names. If empty, all supported decorations are affected. */ void ShowDecorations(bool show, const QStringList& decorations); /** * @brief Return if a specific decoration is visible. * * \return True, if the specified decoration is shown, false if not. */ bool IsDecorationVisible(const QString &decoration) const; QStringList GetDecorations() const; private: void SetupLogo(const char* path); vtkSmartPointer GetVtkLogo(const char* path); void SetLogo(vtkSmartPointer vtkLogo); void ShowLogo(bool show); bool IsLogoVisible() const; void SetColormap(Colormap colormap); void SetDecorationColor(const QString& widgetID, const mitk::Color& color); void SetAllDecorationColors(const mitk::Color& color); mitk::Color GetDecorationColor(const QString& widgetID) const; void ShowColoredRectangle(const QString& widgetID, bool show); void ShowAllColoredRectangles(bool show); bool IsColoredRectangleVisible(const QString& widgetID) const; bool AreAllColoredRectanglesVisible() const; /** * @brief Set a background color gradient for a specific render window. * * If two different input colors are used, a gradient background is generated. * * @param upper The color of the gradient background. * @param lower The color of the gradient background. * @param widgetID The widget identifier. */ void SetGradientBackgroundColors(const mitk::Color& upper, const mitk::Color& lower, const QString& widgetID); /** * @brief Set a background color gradient for all available render windows. * * If two different input colors are used, a gradient background is generated. * * @param upper The color of the gradient background. * @param lower The color of the gradient background. */ void SetAllGradientBackgroundColors(const mitk::Color& upper, const mitk::Color& lower); void FillAllGradientBackgroundColorsWithBlack(); void ShowGradientBackground(const QString& widgetID, bool show); void ShowAllGradientBackgrounds(bool show); /** - * @rief Return a render window (widget) specific background color gradient + * @brief Return a render window (widget) specific background color gradient * * @param widgetID The widget identifier. * * @return A color gradient as a pair of colors. * First entry: upper color value * Second entry: lower color value */ std::pair GetGradientBackgroundColors(const QString& widgetID) const; bool IsGradientBackgroundOn(const QString& widgetID) const; bool AreAllGradientBackgroundsOn() const; void SetCornerAnnotationText(const QString& widgetID, const std::string& cornerAnnotation); std::string GetCornerAnnotationText(const QString& widgetID) const; void ShowCornerAnnotation(const QString& widgetID, bool show); void ShowAllCornerAnnotations(bool show); bool IsCornerAnnotationVisible(const QString& widgetID) const; bool AreAllCornerAnnotationsVisible() const; - QmitkCustomMultiWidget* m_CustomMultiWidget; + QmitkMxNMultiWidget* m_MxNMultiWidget; mitk::LogoAnnotation::Pointer m_LogoAnnotation; }; -#endif // QMITKMULTIWIDGETDECORATIONMANAGER_H +#endif // QMITKMXNMULTIWIDGETDECORATIONMANAGER_H diff --git a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/QmitkCustomMultiWidgetEditor.cpp b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/QmitkMxNMultiWidgetEditor.cpp similarity index 51% rename from Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/QmitkCustomMultiWidgetEditor.cpp rename to Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/QmitkMxNMultiWidgetEditor.cpp index aaa86bf499..05bf8a3a77 100644 --- a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/QmitkCustomMultiWidgetEditor.cpp +++ b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/QmitkMxNMultiWidgetEditor.cpp @@ -1,255 +1,255 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. 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 "QmitkCustomMultiWidgetEditor.h" +#include "QmitkMxNMultiWidgetEditor.h" #include #include #include #include #include -// custom multi widget editor plugin +// mxn multi widget editor plugin #include "QmitkMultiWidgetDecorationManager.h" // mitk qt widgets module -#include +#include #include #include -const QString QmitkCustomMultiWidgetEditor::EDITOR_ID = "org.mitk.editors.custommultiwidget"; +const QString QmitkMxNMultiWidgetEditor::EDITOR_ID = "org.mitk.editors.mxnmultiwidget"; -class QmitkCustomMultiWidgetEditor::Impl final +class QmitkMxNMultiWidgetEditor::Impl final { public: Impl(); ~Impl(); - QmitkCustomMultiWidget* m_CustomMultiWidget; + QmitkMxNMultiWidget* m_MxNMultiWidget; QmitkInteractionSchemeToolBar* m_InteractionSchemeToolBar; QmitkMultiWidgetConfigurationToolBar* m_ConfigurationToolBar; std::unique_ptr m_MultiWidgetDecorationManager; }; -QmitkCustomMultiWidgetEditor::Impl::Impl() - : m_CustomMultiWidget(nullptr) +QmitkMxNMultiWidgetEditor::Impl::Impl() + : m_MxNMultiWidget(nullptr) , m_InteractionSchemeToolBar(nullptr) , m_ConfigurationToolBar(nullptr) { // nothing here } -QmitkCustomMultiWidgetEditor::Impl::~Impl() +QmitkMxNMultiWidgetEditor::Impl::~Impl() { // nothing here } ////////////////////////////////////////////////////////////////////////// -// QmitkCustomMultiWidgetEditor +// QmitkMxNMultiWidgetEditor ////////////////////////////////////////////////////////////////////////// -QmitkCustomMultiWidgetEditor::QmitkCustomMultiWidgetEditor() +QmitkMxNMultiWidgetEditor::QmitkMxNMultiWidgetEditor() : m_Impl(new Impl()) { // nothing here } -QmitkCustomMultiWidgetEditor::~QmitkCustomMultiWidgetEditor() +QmitkMxNMultiWidgetEditor::~QmitkMxNMultiWidgetEditor() { GetSite()->GetPage()->RemovePartListener(this); } -QmitkRenderWindow* QmitkCustomMultiWidgetEditor::GetActiveQmitkRenderWindow() const +QmitkRenderWindow* QmitkMxNMultiWidgetEditor::GetActiveQmitkRenderWindow() const { - if (nullptr != m_Impl->m_CustomMultiWidget) + if (nullptr != m_Impl->m_MxNMultiWidget) { - auto activeRenderWindowWidget = m_Impl->m_CustomMultiWidget->GetActiveRenderWindowWidget(); + auto activeRenderWindowWidget = m_Impl->m_MxNMultiWidget->GetActiveRenderWindowWidget(); if (nullptr != activeRenderWindowWidget) { return activeRenderWindowWidget->GetRenderWindow(); } } return nullptr; } -QHash QmitkCustomMultiWidgetEditor::GetQmitkRenderWindows() const +QHash QmitkMxNMultiWidgetEditor::GetQmitkRenderWindows() const { QHash result; - if (nullptr == m_Impl->m_CustomMultiWidget) + if (nullptr == m_Impl->m_MxNMultiWidget) { return result; } - result = m_Impl->m_CustomMultiWidget->GetRenderWindows(); + result = m_Impl->m_MxNMultiWidget->GetRenderWindows(); return result; } -QmitkRenderWindow* QmitkCustomMultiWidgetEditor::GetQmitkRenderWindow(const QString& id) const +QmitkRenderWindow* QmitkMxNMultiWidgetEditor::GetQmitkRenderWindow(const QString& id) const { - if (nullptr == m_Impl->m_CustomMultiWidget) + if (nullptr == m_Impl->m_MxNMultiWidget) { return nullptr; } - return m_Impl->m_CustomMultiWidget->GetRenderWindow(id); + return m_Impl->m_MxNMultiWidget->GetRenderWindow(id); } -mitk::Point3D QmitkCustomMultiWidgetEditor::GetSelectedPosition(const QString& id) const +mitk::Point3D QmitkMxNMultiWidgetEditor::GetSelectedPosition(const QString& id) const { - if (nullptr == m_Impl->m_CustomMultiWidget) + if (nullptr == m_Impl->m_MxNMultiWidget) { return mitk::Point3D(); } - return m_Impl->m_CustomMultiWidget->GetSelectedPosition(id); + return m_Impl->m_MxNMultiWidget->GetSelectedPosition(id); } -void QmitkCustomMultiWidgetEditor::SetSelectedPosition(const mitk::Point3D& pos, const QString& id) +void QmitkMxNMultiWidgetEditor::SetSelectedPosition(const mitk::Point3D& pos, const QString& id) { - if (nullptr != m_Impl->m_CustomMultiWidget) + if (nullptr != m_Impl->m_MxNMultiWidget) { - m_Impl->m_CustomMultiWidget->SetSelectedPosition(id, pos); + m_Impl->m_MxNMultiWidget->SetSelectedPosition(id, pos); } } -void QmitkCustomMultiWidgetEditor::EnableDecorations(bool enable, const QStringList& decorations) +void QmitkMxNMultiWidgetEditor::EnableDecorations(bool enable, const QStringList& decorations) { m_Impl->m_MultiWidgetDecorationManager->ShowDecorations(enable, decorations); } -bool QmitkCustomMultiWidgetEditor::IsDecorationEnabled(const QString& decoration) const +bool QmitkMxNMultiWidgetEditor::IsDecorationEnabled(const QString& decoration) const { return m_Impl->m_MultiWidgetDecorationManager->IsDecorationVisible(decoration); } -QStringList QmitkCustomMultiWidgetEditor::GetDecorations() const +QStringList QmitkMxNMultiWidgetEditor::GetDecorations() const { return m_Impl->m_MultiWidgetDecorationManager->GetDecorations(); } -berry::IPartListener::Events::Types QmitkCustomMultiWidgetEditor::GetPartEventTypes() const +berry::IPartListener::Events::Types QmitkMxNMultiWidgetEditor::GetPartEventTypes() const { return Events::CLOSED | Events::OPENED; } -void QmitkCustomMultiWidgetEditor::PartOpened(const berry::IWorkbenchPartReference::Pointer& partRef) +void QmitkMxNMultiWidgetEditor::PartOpened(const berry::IWorkbenchPartReference::Pointer& partRef) { - if (partRef->GetId() == QmitkCustomMultiWidgetEditor::EDITOR_ID) + if (partRef->GetId() == QmitkMxNMultiWidgetEditor::EDITOR_ID) { - m_Impl->m_CustomMultiWidget->ActivateAllCrosshairs(true); + m_Impl->m_MxNMultiWidget->ActivateAllCrosshairs(true); } } -void QmitkCustomMultiWidgetEditor::PartClosed(const berry::IWorkbenchPartReference::Pointer& partRef) +void QmitkMxNMultiWidgetEditor::PartClosed(const berry::IWorkbenchPartReference::Pointer& partRef) { - if (partRef->GetId() == QmitkCustomMultiWidgetEditor::EDITOR_ID) + if (partRef->GetId() == QmitkMxNMultiWidgetEditor::EDITOR_ID) { - m_Impl->m_CustomMultiWidget->ActivateAllCrosshairs(false); + m_Impl->m_MxNMultiWidget->ActivateAllCrosshairs(false); } } -QmitkCustomMultiWidget* QmitkCustomMultiWidgetEditor::GetCustomMultiWidget() +QmitkMxNMultiWidget* QmitkMxNMultiWidgetEditor::GetMxNMultiWidget() { - return m_Impl->m_CustomMultiWidget; + return m_Impl->m_MxNMultiWidget; } -void QmitkCustomMultiWidgetEditor::OnLayoutSet(int row, int column) +void QmitkMxNMultiWidgetEditor::OnLayoutSet(int row, int column) { - m_Impl->m_CustomMultiWidget->ResetLayout(row, column); - m_Impl->m_CustomMultiWidget->ActivateAllCrosshairs(true); + m_Impl->m_MxNMultiWidget->ResetLayout(row, column); + m_Impl->m_MxNMultiWidget->ActivateAllCrosshairs(true); FirePropertyChange(berry::IWorkbenchPartConstants::PROP_INPUT); } -void QmitkCustomMultiWidgetEditor::OnSynchronize(bool synchronized) +void QmitkMxNMultiWidgetEditor::OnSynchronize(bool synchronized) { - m_Impl->m_CustomMultiWidget->Synchronize(synchronized); + m_Impl->m_MxNMultiWidget->Synchronize(synchronized); } ////////////////////////////////////////////////////////////////////////// // PRIVATE ////////////////////////////////////////////////////////////////////////// -void QmitkCustomMultiWidgetEditor::SetFocus() +void QmitkMxNMultiWidgetEditor::SetFocus() { - if (nullptr != m_Impl->m_CustomMultiWidget) + if (nullptr != m_Impl->m_MxNMultiWidget) { - m_Impl->m_CustomMultiWidget->setFocus(); + m_Impl->m_MxNMultiWidget->setFocus(); } } -void QmitkCustomMultiWidgetEditor::CreateQtPartControl(QWidget* parent) +void QmitkMxNMultiWidgetEditor::CreateQtPartControl(QWidget* parent) { - if (nullptr == m_Impl->m_CustomMultiWidget) + if (nullptr == m_Impl->m_MxNMultiWidget) { QHBoxLayout* layout = new QHBoxLayout(parent); layout->setContentsMargins(0, 0, 0, 0); berry::IBerryPreferences* preferences = dynamic_cast(GetPreferences().GetPointer()); mitk::BaseRenderer::RenderingMode::Type renderingMode = static_cast(preferences->GetInt("Rendering Mode", 0)); - m_Impl->m_CustomMultiWidget = new QmitkCustomMultiWidget(parent, 0, 0, renderingMode); + m_Impl->m_MxNMultiWidget = new QmitkMxNMultiWidget(parent, 0, 0, renderingMode); // create left toolbar: interaction scheme toolbar to switch how the render window navigation behaves if (nullptr == m_Impl->m_InteractionSchemeToolBar) { m_Impl->m_InteractionSchemeToolBar = new QmitkInteractionSchemeToolBar(parent); layout->addWidget(m_Impl->m_InteractionSchemeToolBar); } - m_Impl->m_InteractionSchemeToolBar->SetInteractionEventHandler(m_Impl->m_CustomMultiWidget->GetInteractionEventHandler()); + m_Impl->m_InteractionSchemeToolBar->SetInteractionEventHandler(m_Impl->m_MxNMultiWidget->GetInteractionEventHandler()); - // add center widget: the custom multi widget - layout->addWidget(m_Impl->m_CustomMultiWidget); + // add center widget: the mxn multi widget + layout->addWidget(m_Impl->m_MxNMultiWidget); - m_Impl->m_CustomMultiWidget->SetDataStorage(GetDataStorage()); - m_Impl->m_CustomMultiWidget->InitializeRenderWindowWidgets(); + m_Impl->m_MxNMultiWidget->SetDataStorage(GetDataStorage()); + m_Impl->m_MxNMultiWidget->InitializeRenderWindowWidgets(); // create right toolbar: configuration toolbar to change the render window widget layout if (nullptr == m_Impl->m_ConfigurationToolBar) { - m_Impl->m_ConfigurationToolBar = new QmitkMultiWidgetConfigurationToolBar(m_Impl->m_CustomMultiWidget); + m_Impl->m_ConfigurationToolBar = new QmitkMultiWidgetConfigurationToolBar(); layout->addWidget(m_Impl->m_ConfigurationToolBar); } - connect(m_Impl->m_ConfigurationToolBar, &QmitkMultiWidgetConfigurationToolBar::LayoutSet, this, &QmitkCustomMultiWidgetEditor::OnLayoutSet); - connect(m_Impl->m_ConfigurationToolBar, &QmitkMultiWidgetConfigurationToolBar::Synchronized, this, &QmitkCustomMultiWidgetEditor::OnSynchronize); + connect(m_Impl->m_ConfigurationToolBar, &QmitkMultiWidgetConfigurationToolBar::LayoutSet, this, &QmitkMxNMultiWidgetEditor::OnLayoutSet); + connect(m_Impl->m_ConfigurationToolBar, &QmitkMultiWidgetConfigurationToolBar::Synchronized, this, &QmitkMxNMultiWidgetEditor::OnSynchronize); - m_Impl->m_MultiWidgetDecorationManager = std::make_unique(m_Impl->m_CustomMultiWidget); + m_Impl->m_MultiWidgetDecorationManager = std::make_unique(m_Impl->m_MxNMultiWidget); GetSite()->GetPage()->AddPartListener(this); OnPreferencesChanged(preferences); } } -void QmitkCustomMultiWidgetEditor::OnPreferencesChanged(const berry::IBerryPreferences* preferences) +void QmitkMxNMultiWidgetEditor::OnPreferencesChanged(const berry::IBerryPreferences* preferences) { - if (m_Impl->m_CustomMultiWidget->GetRenderWindowWidgets().empty()) + if (m_Impl->m_MxNMultiWidget->GetRenderWindowWidgets().empty()) { return; } // update decoration preferences m_Impl->m_MultiWidgetDecorationManager->DecorationPreferencesChanged(preferences); // zooming and panning preferences bool constrainedZooming = preferences->GetBool("Use constrained zooming and panning", true); mitk::RenderingManager::GetInstance()->SetConstrainedPanningZooming(constrainedZooming); mitk::RenderingManager::GetInstance()->InitializeViewsByBoundingObjects(GetDataStorage()); mitk::RenderingManager::GetInstance()->RequestUpdateAll(); } diff --git a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/QmitkCustomMultiWidgetEditor.h b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/QmitkMxNMultiWidgetEditor.h similarity index 80% rename from Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/QmitkCustomMultiWidgetEditor.h rename to Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/QmitkMxNMultiWidgetEditor.h index c7851f5512..148113866e 100644 --- a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/QmitkCustomMultiWidgetEditor.h +++ b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/QmitkMxNMultiWidgetEditor.h @@ -1,119 +1,118 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. 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 QMITKCUSTOMMULTIWIDGETEDITOR_H -#define QMITKCUSTOMMULTIWIDGETEDITOR_H +#ifndef QMITKMXNMULTIWIDGETEDITOR_H +#define QMITKMXNMULTIWIDGETEDITOR_H #include #include -// custom multi widget editor -#include +#include // berry #include #include -class QmitkCustomMultiWidget; +class QmitkMxNMultiWidget; -class CUSTOMMULTIWIDGETEDITOR_EXPORT QmitkCustomMultiWidgetEditor final : public QmitkAbstractRenderEditor, public berry::IPartListener +class MXNMULTIWIDGETEDITOR_EXPORT QmitkMxNMultiWidgetEditor final : public QmitkAbstractRenderEditor, public berry::IPartListener { Q_OBJECT public: - berryObjectMacro(QmitkCustomMultiWidgetEditor) + berryObjectMacro(QmitkMxNMultiWidgetEditor) static const QString EDITOR_ID; - QmitkCustomMultiWidgetEditor(); - ~QmitkCustomMultiWidgetEditor(); + QmitkMxNMultiWidgetEditor(); + ~QmitkMxNMultiWidgetEditor(); /** * @brief Overridden from QmitkAbstractRenderEditor : IRenderWindowPart */ virtual QmitkRenderWindow* GetActiveQmitkRenderWindow() const override; /** * @brief Overridden from QmitkAbstractRenderEditor : IRenderWindowPart */ virtual QHash GetQmitkRenderWindows() const override; /** * @brief Overridden from QmitkAbstractRenderEditor : IRenderWindowPart */ virtual QmitkRenderWindow* GetQmitkRenderWindow(const QString& id) const override; /** * @brief Overridden from QmitkAbstractRenderEditor : IRenderWindowPart */ virtual mitk::Point3D GetSelectedPosition(const QString& id = QString()) const override; /** * @brief Overridden from QmitkAbstractRenderEditor : IRenderWindowPart */ virtual void SetSelectedPosition(const mitk::Point3D& pos, const QString& id = QString()) override; /** * @brief Overridden from QmitkAbstractRenderEditor : IRenderWindowPart */ virtual void EnableDecorations(bool enable, const QStringList& decorations = QStringList()) override; /** * @brief Overridden from QmitkAbstractRenderEditor : IRenderWindowPart */ virtual bool IsDecorationEnabled(const QString& decoration) const override; /** * @brief Overridden from QmitkAbstractRenderEditor : IRenderWindowPart */ virtual QStringList GetDecorations() const override; /** * @brief Overridden from berry::IPartListener */ - berry::IPartListener::Events::Types QmitkCustomMultiWidgetEditor::GetPartEventTypes() const override; + berry::IPartListener::Events::Types GetPartEventTypes() const override; /** * @brief Overridden from berry::IPartListener */ void PartOpened(const berry::IWorkbenchPartReference::Pointer& partRef) override; /** * @brief Overridden from berry::IPartListener */ void PartClosed(const berry::IWorkbenchPartReference::Pointer& partRef) override; /** - * @brief Return the current custom multi widget of this editor. + * @brief Return the current MxN multi widget of this editor. */ - QmitkCustomMultiWidget* GetCustomMultiWidget(); + QmitkMxNMultiWidget* GetMxNMultiWidget(); private Q_SLOTS: void OnLayoutSet(int row, int column); void OnSynchronize(bool synchronized); private: /** * @brief Overridden from QmitkAbstractRenderEditor */ virtual void SetFocus() override; /** * @brief Overridden from QmitkAbstractRenderEditor */ virtual void CreateQtPartControl(QWidget* parent) override; /** * @brief Overridden from QmitkAbstractRenderEditor */ virtual void OnPreferencesChanged(const berry::IBerryPreferences* preferences) override; class Impl; const std::unique_ptr m_Impl; }; -#endif // QMITKCUSTOMMULTIWIDGETEDITOR_H +#endif // QMITKMXNMULTIWIDGETEDITOR_H diff --git a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/internal/QmitkCustomMultiWidgetEditorPreferencePage.cpp b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/internal/QmitkMxNMultiWidgetEditorPreferencePage.cpp similarity index 76% rename from Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/internal/QmitkCustomMultiWidgetEditorPreferencePage.cpp rename to Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/internal/QmitkMxNMultiWidgetEditorPreferencePage.cpp index de3c064e12..3d52dd803c 100644 --- a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/internal/QmitkCustomMultiWidgetEditorPreferencePage.cpp +++ b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/internal/QmitkMxNMultiWidgetEditorPreferencePage.cpp @@ -1,128 +1,128 @@ /*=================================================================== 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 "QmitkCustomMultiWidgetEditorPreferencePage.h" -#include +#include "QmitkMxNMultiWidgetEditorPreferencePage.h" +#include // berry framework #include #include -QmitkCustomMultiWidgetEditorPreferencePage::QmitkCustomMultiWidgetEditorPreferencePage() +QmitkMxNMultiWidgetEditorPreferencePage::QmitkMxNMultiWidgetEditorPreferencePage() : m_Preferences(nullptr) { // nothing here } -QmitkCustomMultiWidgetEditorPreferencePage::~QmitkCustomMultiWidgetEditorPreferencePage() +QmitkMxNMultiWidgetEditorPreferencePage::~QmitkMxNMultiWidgetEditorPreferencePage() { //nothing here } -void QmitkCustomMultiWidgetEditorPreferencePage::Init(berry::IWorkbench::Pointer) +void QmitkMxNMultiWidgetEditorPreferencePage::Init(berry::IWorkbench::Pointer) { // nothing here } -void QmitkCustomMultiWidgetEditorPreferencePage::CreateQtControl(QWidget* parent) +void QmitkMxNMultiWidgetEditorPreferencePage::CreateQtControl(QWidget* parent) { m_MainControl = new QWidget(parent); m_Ui.setupUi(m_MainControl); berry::IPreferencesService* preferenceService = berry::Platform::GetPreferencesService(); Q_ASSERT(preferenceService); - m_Preferences = preferenceService->GetSystemPreferences()->Node(QmitkCustomMultiWidgetEditor::EDITOR_ID); + m_Preferences = preferenceService->GetSystemPreferences()->Node(QmitkMxNMultiWidgetEditor::EDITOR_ID); connect(m_Ui.m_RenderingModeComboBox, SIGNAL(activated(int)), SLOT(ChangeRenderingMode(int))); connect(m_Ui.m_ColormapComboBox, SIGNAL(activated(int)), SLOT(ChangeColormap(int))); connect(m_Ui.m_ResetButton, SIGNAL(clicked()), SLOT(ResetPreferencesAndGUI())); Update(); } -QWidget* QmitkCustomMultiWidgetEditorPreferencePage::GetQtControl() const +QWidget* QmitkMxNMultiWidgetEditorPreferencePage::GetQtControl() const { return m_MainControl; } -bool QmitkCustomMultiWidgetEditorPreferencePage::PerformOk() +bool QmitkMxNMultiWidgetEditorPreferencePage::PerformOk() { m_Preferences->PutBool("Use constrained zooming and panning", m_Ui.m_EnableFlexibleZooming->isChecked()); m_Preferences->PutBool("Show level/window widget", m_Ui.m_ShowLevelWindowWidget->isChecked()); m_Preferences->PutBool("PACS like mouse interaction", m_Ui.m_PACSLikeMouseMode->isChecked()); m_Preferences->PutInt("Rendering Mode", m_Ui.m_RenderingModeComboBox->currentIndex()); m_Preferences->PutInt("Render window widget colormap", m_Ui.m_ColormapComboBox->currentIndex()); m_Preferences->PutBool("Render window individual decorations", m_Ui.m_IndividualDecorations->isChecked()); m_Preferences->PutInt("crosshair gap size", m_Ui.m_CrosshairGapSize->value()); return true; } -void QmitkCustomMultiWidgetEditorPreferencePage::PerformCancel() +void QmitkMxNMultiWidgetEditorPreferencePage::PerformCancel() { // nothing here } -void QmitkCustomMultiWidgetEditorPreferencePage::Update() +void QmitkMxNMultiWidgetEditorPreferencePage::Update() { m_Ui.m_EnableFlexibleZooming->setChecked(m_Preferences->GetBool("Use constrained zooming and panning", true)); m_Ui.m_ShowLevelWindowWidget->setChecked(m_Preferences->GetBool("Show level/window widget", true)); m_Ui.m_PACSLikeMouseMode->setChecked(m_Preferences->GetBool("PACS like mouse interaction", false)); int renderingMode = m_Preferences->GetInt("Rendering Mode", 0); m_Ui.m_RenderingModeComboBox->setCurrentIndex(renderingMode); int colormap = m_Preferences->GetInt("Render window widget colormap", 0); m_Ui.m_ColormapComboBox->setCurrentIndex(colormap); m_Ui.m_IndividualDecorations->setChecked(m_Preferences->GetBool("Render window individual decorations", false)); m_Ui.m_CrosshairGapSize->setValue(m_Preferences->GetInt("crosshair gap size", 32)); } -void QmitkCustomMultiWidgetEditorPreferencePage::ResetPreferencesAndGUI() +void QmitkMxNMultiWidgetEditorPreferencePage::ResetPreferencesAndGUI() { m_Preferences->Clear(); Update(); } -void QmitkCustomMultiWidgetEditorPreferencePage::ChangeRenderingMode(int i) +void QmitkMxNMultiWidgetEditorPreferencePage::ChangeRenderingMode(int i) { if (0 == i) { m_CurrentRenderingMode = "Standard"; } else if (1 == i) { m_CurrentRenderingMode = "Multisampling"; } else if (2 == i) { m_CurrentRenderingMode = "DepthPeeling"; } } -void QmitkCustomMultiWidgetEditorPreferencePage::ChangeColormap(int i) +void QmitkMxNMultiWidgetEditorPreferencePage::ChangeColormap(int i) { if (0 == i) { m_CurrentColormap = "Black and white"; } } \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/internal/QmitkCustomMultiWidgetEditorPreferencePage.h b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/internal/QmitkMxNMultiWidgetEditorPreferencePage.h similarity index 75% rename from Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/internal/QmitkCustomMultiWidgetEditorPreferencePage.h rename to Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/internal/QmitkMxNMultiWidgetEditorPreferencePage.h index 06ed1df152..3dfa1e002b 100644 --- a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/internal/QmitkCustomMultiWidgetEditorPreferencePage.h +++ b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/internal/QmitkMxNMultiWidgetEditorPreferencePage.h @@ -1,80 +1,80 @@ /*=================================================================== 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 QMITKCUSTOMMULTIWIDGETEDITORPREFERENCEPAGE_H -#define QMITKCUSTOMMULTIWIDGETEDITORPREFERENCEPAGE_H +#ifndef QMITKMXNMULTIWIDGETEDITORPREFERENCEPAGE_H +#define QMITKMXNMULTIWIDGETEDITORPREFERENCEPAGE_H -// custom multi widget editor -#include "ui_QmitkCustomMultiWidgetEditorPreferencePage.h" +#include "ui_QmitkMxNMultiWidgetEditorPreferencePage.h" #include #include #include #include #include -class QmitkCustomMultiWidgetEditorPreferencePage : public QObject, public berry::IQtPreferencePage +class QmitkMxNMultiWidgetEditorPreferencePage : public QObject, public berry::IQtPreferencePage { Q_OBJECT Q_INTERFACES(berry::IPreferencePage) public: - QmitkCustomMultiWidgetEditorPreferencePage(); - ~QmitkCustomMultiWidgetEditorPreferencePage(); + + QmitkMxNMultiWidgetEditorPreferencePage(); + ~QmitkMxNMultiWidgetEditorPreferencePage(); void Init(berry::IWorkbench::Pointer) override; void CreateQtControl(QWidget* parent) override; QWidget* GetQtControl() const override; bool PerformOk() override; void PerformCancel() override; void Update() override; public slots: /** * @brief ResetColors set default colors and refresh the GUI. */ void ResetPreferencesAndGUI(); /** * @brief ChangeRenderingMode slot to chose the rendering mode via QComboBox. * @param i index of the box. */ void ChangeRenderingMode(int i); void ChangeColormap(int i); protected: /** * @brief m_CurrentRenderingMode String for the rendering mode. */ std::string m_CurrentRenderingMode; std::string m_CurrentColormap; /** * @brief m_Preferences the berry preferences. */ berry::IPreferences::Pointer m_Preferences; private: - Ui::QmitkCustomMultiWidgetEditorPreferencePage m_Ui; + Ui::QmitkMxNMultiWidgetEditorPreferencePage m_Ui; QWidget* m_MainControl; }; -#endif // QMITKCUSTOMMULTIWIDGETEDITORPREFERENCEPAGE_H +#endif // QMITKMXNMULTIWIDGETEDITORPREFERENCEPAGE_H diff --git a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/internal/QmitkCustomMultiWidgetEditorPreferencePage.ui b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/internal/QmitkMxNMultiWidgetEditorPreferencePage.ui similarity index 94% rename from Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/internal/QmitkCustomMultiWidgetEditorPreferencePage.ui rename to Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/internal/QmitkMxNMultiWidgetEditorPreferencePage.ui index f360b20922..0bf3df7077 100644 --- a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/internal/QmitkCustomMultiWidgetEditorPreferencePage.ui +++ b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/internal/QmitkMxNMultiWidgetEditorPreferencePage.ui @@ -1,163 +1,163 @@ - QmitkCustomMultiWidgetEditorPreferencePage - + QmitkMxNMultiWidgetEditorPreferencePage + 0 0 520 320 External Programs - <html><head/><body><p>If activated, zooming and panning is limited to a certain space arround each image.</p></body></html> + <html><head/><body><p>If activated, zooming and panning is limited to a certain space around each image.</p></body></html> Qt::LeftToRight Use constraint zooming and panning true Qt::LeftToRight Show level/window widget true Qt::LeftToRight Use PACS like mouse interaction (select left mouse button action) Qt::Horizontal Rendering Mode* Standard Rendering Enable Multisampling (Antialiasing) Enable Depth Peeling * Changes require restart of MITK. Depth Peeling is only supported by Windows. For other OS, use Standard Rendering and enable the property 'Depth Sorting' in the property list of the surface data node. Qt::Horizontal Colormap Black and white 0 0 Allow render window individual decorations <html><head/><body><p>The gap in the middle of the crosshair in pixels.</p></body></html> Crosshair gap size 32 Reset preferences diff --git a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/internal/mitkPluginActivator.cpp b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/internal/mitkPluginActivator.cpp similarity index 55% rename from Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/internal/mitkPluginActivator.cpp rename to Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/internal/mitkPluginActivator.cpp index 76a4cb77aa..f4e79f4657 100644 --- a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/internal/mitkPluginActivator.cpp +++ b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/internal/mitkPluginActivator.cpp @@ -1,45 +1,45 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. 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 "mitkPluginActivator.h" -#include -#include "QmitkCustomMultiWidgetEditorPreferencePage.h" +#include +#include "QmitkMxNMultiWidgetEditorPreferencePage.h" namespace mitk { - ctkPluginContext* CustomMultiWidgetActivator::m_Context = nullptr; + ctkPluginContext* MxNMultiWidgetActivator::m_Context = nullptr; - void CustomMultiWidgetActivator::start(ctkPluginContext* context) + void MxNMultiWidgetActivator::start(ctkPluginContext* context) { m_Context = context; - BERRY_REGISTER_EXTENSION_CLASS(QmitkCustomMultiWidgetEditor, context) - BERRY_REGISTER_EXTENSION_CLASS(QmitkCustomMultiWidgetEditorPreferencePage, context) + BERRY_REGISTER_EXTENSION_CLASS(QmitkMxNMultiWidgetEditor, context) + BERRY_REGISTER_EXTENSION_CLASS(QmitkMxNMultiWidgetEditorPreferencePage, context) } - void CustomMultiWidgetActivator::stop(ctkPluginContext* context) + void MxNMultiWidgetActivator::stop(ctkPluginContext* context) { Q_UNUSED(context) m_Context = nullptr; } - ctkPluginContext* CustomMultiWidgetActivator::GetContext() + ctkPluginContext* MxNMultiWidgetActivator::GetContext() { return m_Context; } } \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/internal/mitkPluginActivator.h b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/internal/mitkPluginActivator.h similarity index 85% rename from Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/internal/mitkPluginActivator.h rename to Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/internal/mitkPluginActivator.h index b25c98fb6b..57910bd4f5 100644 --- a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/internal/mitkPluginActivator.h +++ b/Plugins/org.mitk.gui.qt.mxnmultiwidgeteditor/src/internal/mitkPluginActivator.h @@ -1,43 +1,43 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. 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 MITKPLUGINACTIVATOR_H #define MITKPLUGINACTIVATOR_H #include namespace mitk { - class CustomMultiWidgetActivator : public QObject, public ctkPluginActivator + class MxNMultiWidgetActivator : public QObject, public ctkPluginActivator { Q_OBJECT - Q_PLUGIN_METADATA(IID "org_mitk_gui_qt_custommultiwidgeteditor") + Q_PLUGIN_METADATA(IID "org_mitk_gui_qt_mxnmultiwidgeteditor") Q_INTERFACES(ctkPluginActivator) public: void start(ctkPluginContext* context) override; void stop(ctkPluginContext* context) override; static ctkPluginContext* GetContext(); private: static ctkPluginContext* m_Context; }; } #endif // MITKPLUGINACTIVATOR_H