diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/files.cmake b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/files.cmake
index e3d3041ce1..88a818c8cd 100644
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/files.cmake
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/files.cmake
@@ -1,98 +1,106 @@
SET(SRC_CPP_FILES
QmitkDiffusionImagingAppApplication.cpp
QmitkDiffusionImagingAppWorkbenchAdvisor.cpp
)
SET(INTERNAL_CPP_FILES
mitkPluginActivator.cpp
QmitkDiffusionImagingAppIntroPart.cpp
- QmitkMasterView.cpp
QmitkDiffusionImagingAppPerspective.cpp
QmitkWelcomePerspective.cpp
QmitkReconstructionPerspective.cpp
QmitkTrackingPerspective.cpp
QmitkFileImportPerspective.cpp
QmitkQuantificationPerspective.cpp
QmitkVolumeVisualizationPerspective.cpp
QmitkDIAppConnectomicsPerspective.cpp
QmitkDIAppDicomImportPerspective.cpp
QmitkDIAppFiberTractographyPerspective.cpp
QmitkDIAppIVIMPerspective.cpp
QmitkDIAppPreprocessingReconstructionPerspective.cpp
QmitkDIAppQuantificationPerspective.cpp
QmitkDIAppScreenshotsMoviesPerspective.cpp
QmitkDIAppTBSSPerspective.cpp
QmitkDIAppVolumeVisualizationPerspective.cpp
)
SET(UI_FILES
src/internal/QmitkWelcomeScreenViewControls.ui
- src/internal/QmitkMasterViewControls.ui
)
SET(MOC_H_FILES
src/internal/QmitkDiffusionImagingAppIntroPart.h
src/internal/mitkPluginActivator.h
src/internal/QmitkReconstructionPerspective.h
src/internal/QmitkTrackingPerspective.h
src/internal/QmitkFileImportPerspective.h
src/internal/QmitkQuantificationPerspective.h
src/internal/QmitkVolumeVisualizationPerspective.h
#src/internal/QmitkDiffusionImagingAppApplicationPlugin.h
- src/internal/QmitkMasterView.h
src/QmitkDiffusionImagingAppApplication.h
src/internal/QmitkDiffusionImagingAppPerspective.h
src/internal/QmitkWelcomePerspective.h
src/internal/QmitkDIAppConnectomicsPerspective.h
src/internal/QmitkDIAppDicomImportPerspective.h
src/internal/QmitkDIAppFiberTractographyPerspective.h
src/internal/QmitkDIAppIVIMPerspective.h
src/internal/QmitkDIAppPreprocessingReconstructionPerspective.h
src/internal/QmitkDIAppQuantificationPerspective.h
src/internal/QmitkDIAppScreenshotsMoviesPerspective.h
src/internal/QmitkDIAppTBSSPerspective.h
src/internal/QmitkDIAppVolumeVisualizationPerspective.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/icon_dicom.xpm
resources/diffusionimaging.png
resources/preprocessing.png
resources/Measurement_48.png
resources/volvis.png
+ resources/perspectives/diffusionimaging.png
+ resources/perspectives/icon_home.png
+ resources/perspectives/connectomics.png
+ resources/perspectives/dicomimport.png
+ resources/perspectives/tractography.png
+ resources/perspectives/ivim.png
+ resources/perspectives/preprocessingreconstruction.png
+ resources/perspectives/quantification.png
+ resources/perspectives/screenshotsmovies.png
+ resources/perspectives/tbss.png
+ resources/perspectives/volumevizualization.png
)
SET(QRC_FILES
# uncomment the following line if you want to use Qt resources
resources/welcome/QmitkWelcomeScreenView.qrc
resources/org_mitk_gui_qt_diffusionimagingapp.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})
#----------- Qt Help Collection Project -------------#
IF (BLUEBERRY_USE_QT_HELP)
SET(_plugin_qhcp_input "${CMAKE_CURRENT_SOURCE_DIR}/documentation/MitkDiffusionImagingAppQtHelpCollectionProject.qhcp")
SET(_plugin_qhcp_output "${PLUGIN_OUTPUT_DIR}/resources/MitkDiffusionImagingAppQtHelpCollection_${MBI_WC_REVISION_HASH}.qhc")
ADD_CUSTOM_COMMAND(OUTPUT ${_plugin_qhcp_output}
COMMAND ${QT_COLLECTIONGENERATOR_EXECUTABLE} ${_plugin_qhcp_input} -o ${_plugin_qhcp_output}
DEPENDS ${_plugin_qhcp_input}
)
SET(FILE_DEPENDENCIES ${_plugin_qhcp_output})
ENDIF()
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/plugin.xml b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/plugin.xml
index cef878fe63..186c6ee249 100644
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/plugin.xml
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/plugin.xml
@@ -1,67 +1,67 @@
+ icon="resources/perspectives/diffusionimaging.png"/>
+ icon="resources/perspectives/icon_home.png"/>
+ icon="resources/perspectives/connectomics.png"/>
+ icon="resources/perspectives/dicomimport.png"/>
+ icon="resources/perspectives/tractography.png"/>
+ icon="resources/perspectives/ivim.png"/>
+ icon="resources/perspectives/preprocessingreconstruction.png"/>
+ icon="resources/perspectives/quantification.png"/>
+ icon="resources/perspectives/screenshotsmovies.png"/>
+ icon="resources/perspectives/tbss.png"/>
+ icon="resources/perspectives/volumevizualization.png"/>
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/connectomics.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/connectomics.png
new file mode 100644
index 0000000000..7f458d358d
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/connectomics.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/dicomimport.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/dicomimport.png
new file mode 100644
index 0000000000..5f62594503
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/dicomimport.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/diffusionimaging.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/diffusionimaging.png
new file mode 100644
index 0000000000..d875ea96bd
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/diffusionimaging.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/icon_home.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/icon_home.png
new file mode 100644
index 0000000000..33959262c0
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/icon_home.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/ivim.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/ivim.png
new file mode 100644
index 0000000000..de05f60c7c
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/ivim.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/preprocessingreconstruction.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/preprocessingreconstruction.png
new file mode 100644
index 0000000000..783f0a4d16
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/preprocessingreconstruction.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/quantification.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/quantification.png
new file mode 100644
index 0000000000..523e688813
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/quantification.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/screenshotsmovies.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/screenshotsmovies.png
new file mode 100644
index 0000000000..392c1c07d9
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/screenshotsmovies.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/tbss.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/tbss.png
new file mode 100644
index 0000000000..15950524ae
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/tbss.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/tractography.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/tractography.png
new file mode 100644
index 0000000000..d875ea96bd
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/tractography.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/volumevizualization.png b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/volumevizualization.png
new file mode 100644
index 0000000000..37347e5a12
Binary files /dev/null and b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/resources/perspectives/volumevizualization.png differ
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/QmitkDiffusionImagingAppWorkbenchAdvisor.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/QmitkDiffusionImagingAppWorkbenchAdvisor.cpp
index 6a003b46e4..97feb7a3bb 100644
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/QmitkDiffusionImagingAppWorkbenchAdvisor.cpp
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/QmitkDiffusionImagingAppWorkbenchAdvisor.cpp
@@ -1,113 +1,113 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date: 2009-10-23 02:59:36 +0200 (Fri, 23 Oct 2009) $
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkDiffusionImagingAppWorkbenchAdvisor.h"
#include "internal/mitkPluginActivator.h"
#include
#include
#include
#include
#include
#include
const std::string QmitkDiffusionImagingAppWorkbenchAdvisor::WELCOME_PERSPECTIVE_ID = "org.mitk.diffusionimagingapp.perspectives.welcome";
void
QmitkDiffusionImagingAppWorkbenchAdvisor::Initialize(berry::IWorkbenchConfigurer::Pointer configurer)
{
berry::QtWorkbenchAdvisor::Initialize(configurer);
configurer->SetSaveAndRestore(true);
// TODO This should go into the products plugin_customization.ini file (when
// the product and branding support is finished, see bug 2146).
// This will not work anymore, if bug 2822 is fixed.
berry::IPreferencesService::Pointer prefService = berry::Platform::GetServiceRegistry().GetServiceById(berry::IPreferencesService::ID);
prefService->GetSystemPreferences()->Put(berry::WorkbenchPreferenceConstants::PREFERRED_SASH_LAYOUT, berry::WorkbenchPreferenceConstants::RIGHT);
QString collectionFile = mitkPluginActivator::GetDefault()->GetQtHelpCollectionFile();
if (!collectionFile.isEmpty())
{
// berry::QtAssistantUtil::SetHelpCollectionFile(collectionFile);
// berry::QtAssistantUtil::SetDefaultHelpUrl("qthelp://org.mitk.gui.qt.diffusionimagingapp/bundle/index.html");
typedef std::vector BundleContainer;
BundleContainer bundles = berry::Platform::GetBundles();
berry::QtAssistantUtil::RegisterQCHFiles(bundles);
}
}
berry::WorkbenchWindowAdvisor*
QmitkDiffusionImagingAppWorkbenchAdvisor::CreateWorkbenchWindowAdvisor(
berry::IWorkbenchWindowConfigurer::Pointer configurer)
{
std::vector perspExcludeList;
perspExcludeList.push_back( std::string("org.blueberry.uitest.util.EmptyPerspective") );
perspExcludeList.push_back( std::string("org.blueberry.uitest.util.EmptyPerspective2") );
perspExcludeList.push_back( std::string("org.mitk.coreapp.defaultperspective") );
perspExcludeList.push_back( std::string("org.mitk.extapp.defaultperspective") );
perspExcludeList.push_back( std::string("org.mitk.perspectives.publicdiffusionimaging") );
perspExcludeList.push_back( std::string("org.mitk.perspectives.diffusionimaginginternal") );
std::vector viewExcludeList;
// viewExcludeList.push_back( std::string("org.mitk.views.partialvolumeanalysis") );
// viewExcludeList.push_back( std::string("org.mitk.views.globalfibertracking") );
// viewExcludeList.push_back( std::string("org.mitk.views.tractbasedspatialstatistics") );
// viewExcludeList.push_back( std::string("org.mitk.views.fibertracking") );
// viewExcludeList.push_back( std::string("org.mitk.views.ivim") );
// viewExcludeList.push_back( std::string("org.mitk.views.qballreconstruction") );
// viewExcludeList.push_back( std::string("org.mitk.views.diffusiondicomimport") );
// viewExcludeList.push_back( std::string("org.mitk.views.diffusionpreprocessing") );
// viewExcludeList.push_back( std::string("org.mitk.views.diffusionquantification") );
// viewExcludeList.push_back( std::string("org.mitk.views.tensorreconstruction") );
// viewExcludeList.push_back( std::string("org.mitk.views.perspectiveswitcher") );
// viewExcludeList.push_back( std::string("org.mitk.views.basicimageprocessing") );
// viewExcludeList.push_back( std::string("org.mitk.views.fiberbundleoperations") );
// viewExcludeList.push_back( std::string("org.mitk.views.measurement") );
// viewExcludeList.push_back( std::string("org.mitk.views.moviemaker") );
// viewExcludeList.push_back( std::string("org.mitk.views.odfdetails") );
// viewExcludeList.push_back( std::string("org.mitk.views.propertylistview") );
// viewExcludeList.push_back( std::string("org.mitk.views.screenshotmaker") );
// viewExcludeList.push_back( std::string("org.mitk.views.segmentation") );
// viewExcludeList.push_back( std::string("org.mitk.views.imagestatistics") );
// viewExcludeList.push_back( std::string("org.mitk.views.controlvisualizationpropertiesview") );
// viewExcludeList.push_back( std::string("org.mitk.views.volumevisualization") );
// viewExcludeList.push_back( std::string("org.mitk.views.simplemeasurement") );
- configurer->SetShowPerspectiveBar(true);
configurer->SetInitialSize(berry::Point(1000,770));
QmitkExtWorkbenchWindowAdvisor* advisor = new QmitkExtWorkbenchWindowAdvisor(this, configurer);
advisor->SetPerspectiveExcludeList(perspExcludeList);
advisor->SetViewExcludeList(viewExcludeList);
advisor->ShowViewToolbar(false);
+ advisor->ShowPerspectiveToolbar(true);
advisor->ShowVersionInfo(false);
advisor->ShowMitkVersionInfo(false);
advisor->SetProductName("MITK Diffusion Imaging App");
advisor->SetWindowIcon(":/org.mitk.gui.qt.diffusionimagingapp/app-icon.png");
return advisor;
}
std::string QmitkDiffusionImagingAppWorkbenchAdvisor::GetInitialWindowPerspectiveId()
{
return WELCOME_PERSPECTIVE_ID;
}
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkMasterView.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkMasterView.cpp
deleted file mode 100644
index 46e401234d..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkMasterView.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-
-// Blueberry
-#include
-#include
-#include
-#include
-#include
-
-// Qmitk
-#include "QmitkMasterView.h"
-#include "QmitkStdMultiWidget.h"
-
-// Qt
-#include
-
-
-const std::string QmitkMasterView::VIEW_ID = "org.mitk.views.masterview";
-
-QmitkMasterView::QmitkMasterView()
- : QmitkFunctionality()
-{
-}
-
-QmitkMasterView::~QmitkMasterView()
-{
-}
-
-void QmitkMasterView::CreateQtPartControl( QWidget *parent )
-{
- // create GUI widgets from the Qt Designer's .ui file
- m_Controls.setupUi( parent );
- CreateConnections();
-
- berry::IPerspectiveRegistry* perspRegistry = GetSite()->GetPage()->GetWorkbenchWindow()->GetWorkbench()->GetPerspectiveRegistry();
- std::vector perspectives(perspRegistry->GetPerspectives());
- for (std::vector::iterator perspIt = perspectives.begin();
- perspIt != perspectives.end(); ++perspIt)
- {
- std::string perpid=((*perspIt)->GetId());
- MITK_INFO << perpid;
-
- }
-}
-
-void QmitkMasterView::CreateConnections()
-{
- connect( (QObject*)(m_Controls.m_OpenDicomImport), SIGNAL(clicked()),(QObject*) this, SLOT(OpenDicomImport()));
- connect( (QObject*)(m_Controls.m_OpenPreprocessingReconstruction), SIGNAL(clicked()),(QObject*) this, SLOT(OpenPreprocessingReconstruction()));
- connect( (QObject*)(m_Controls.m_OpenQuantification), SIGNAL(clicked()),(QObject*) this, SLOT(OpenQuantification()));
- connect( (QObject*)(m_Controls.m_OpenTractography), SIGNAL(clicked()),(QObject*) this, SLOT(OpenTractography()));
- connect( (QObject*)(m_Controls.m_OpenTBSS), SIGNAL(clicked()),(QObject*) this, SLOT(OpenTBSS()));
- connect( (QObject*)(m_Controls.m_OpenConnectomics), SIGNAL(clicked()),(QObject*) this, SLOT(OpenConnectomics()));
- connect( (QObject*)(m_Controls.m_OpenIVIM), SIGNAL(clicked()),(QObject*) this, SLOT(OpenIVIM()));
- connect( (QObject*)(m_Controls.m_OpenVolumeVisualization), SIGNAL(clicked()),(QObject*) this, SLOT(OpenVolumeVisualization()));
- connect( (QObject*)(m_Controls.m_OpenScreenshotsMovies), SIGNAL(clicked()),(QObject*) this, SLOT(OpenScreenshotsMovies()));
-}
-
-void QmitkMasterView::OnSelectionChanged( std::vector nodes )
-{
-}
-
-void QmitkMasterView::OpenPerspective(std::string id)
-{
- try
- {
- GetSite()->GetPage()->GetWorkbenchWindow()->GetWorkbench()->ShowPerspective(id, berry::IWorkbenchWindow::Pointer(GetSite()->GetPage()->GetWorkbenchWindow()));
- }
- catch (...)
- {
- QMessageBox::critical(0, "Opening Perspective Failed", QString("The perspective \"") + id.c_str() + "\" could not be opened.\nSee the log for details.");
- }
-}
-
-void QmitkMasterView::OpenDicomImport()
-{
- OpenPerspective("org.mitk.diffusionimagingapp.perspectives.dicomimport");
-}
-
-void QmitkMasterView::OpenPreprocessingReconstruction()
-{
- OpenPerspective("org.mitk.diffusionimagingapp.perspectives.preprocessingreconstruction");
-}
-
-void QmitkMasterView::OpenQuantification()
-{
- OpenPerspective("org.mitk.diffusionimagingapp.perspectives.quantification");
-}
-
-void QmitkMasterView::OpenTractography()
-{
- OpenPerspective("org.mitk.diffusionimagingapp.perspectives.tractography");
-}
-
-void QmitkMasterView::OpenTBSS()
-{
- OpenPerspective("org.mitk.diffusionimagingapp.perspectives.tbss");
-}
-
-void QmitkMasterView::OpenConnectomics()
-{
- OpenPerspective("org.mitk.diffusionimagingapp.perspectives.connectomics");
-}
-
-void QmitkMasterView::OpenIVIM()
-{
- OpenPerspective("org.mitk.diffusionimagingapp.perspectives.ivim");
-}
-
-void QmitkMasterView::OpenVolumeVisualization()
-{
- OpenPerspective("org.mitk.diffusionimagingapp.perspectives.volumevisualization");
-}
-
-void QmitkMasterView::OpenScreenshotsMovies()
-{
- OpenPerspective("org.mitk.diffusionimagingapp.perspectives.screenshotsmovies");
-}
-
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkMasterView.h b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkMasterView.h
deleted file mode 100644
index 775ea51b8f..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkMasterView.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*=========================================================================
-
-Program: Medical Imaging & Interaction Toolkit
-Language: C++
-Date: $Date$
-Version: $Revision$
-
-Copyright (c) German Cancer Research Center, Division of Medical and
-Biological Informatics. All rights reserved.
-See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
-
-This software is distributed WITHOUT ANY WARRANTY; without even
-the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
-
-
-#ifndef QmitkMasterView_h
-#define QmitkMasterView_h
-
-#include
-
-#include
-
-#include "ui_QmitkMasterViewControls.h"
-
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-
-/*!
- \brief QmitkMasterView
-
- \warning This class is not yet documented. Use "git blame" and ask the author to provide basic documentation.
-
- \sa QmitkFunctionality
- \ingroup ${plugin_target}_internal
-*/
-class QmitkMasterView : public QmitkFunctionality
-{
- // this is needed for all Qt objects that should have a Qt meta-object
- // (everything that derives from QObject and wants to have signal/slots)
- Q_OBJECT
-
- public:
-
- static const std::string VIEW_ID;
-
- QmitkMasterView();
- virtual ~QmitkMasterView();
-
- virtual void CreateQtPartControl(QWidget *parent);
-
- protected slots:
-
- void OpenDicomImport();
- void OpenPreprocessingReconstruction();
- void OpenQuantification();
- void OpenTractography();
- void OpenTBSS();
- void OpenConnectomics();
- void OpenIVIM();
- void OpenVolumeVisualization();
- void OpenScreenshotsMovies();
-
-protected:
-
- void CreateConnections();
-
- void OpenPerspective(std::string id);
-
- /// \brief called by QmitkFunctionality when DataManager's selection has changed
- virtual void OnSelectionChanged( std::vector nodes );
-
- Ui::QmitkMasterViewControls m_Controls;
-
- friend struct QmitkMasterViewListener;
-
-};
-
-#endif // QmitkMasterView_h
-
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkMasterViewControls.ui b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkMasterViewControls.ui
deleted file mode 100644
index 3d5b3d5912..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkMasterViewControls.ui
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
- QmitkMasterViewControls
-
-
-
- 0
- 0
- 253
- 381
-
-
-
-
- 0
- 0
-
-
-
- QmitkTemplate
-
-
-
- 0
-
-
- 0
-
- -
-
-
- QFrame::StyledPanel
-
-
- QFrame::Raised
-
-
-
- 0
-
-
- 0
-
-
-
-
-
- Dicom Import
-
-
-
- -
-
-
- Preprocessing / Reconstruction
-
-
-
- -
-
-
- Quantification
-
-
-
- -
-
-
- Tractography
-
-
-
- -
-
-
- TBSS
-
-
-
- -
-
-
- Connectomics
-
-
-
- -
-
-
- IVIM
-
-
-
- -
-
-
- Volume Visualization
-
-
-
- -
-
-
- Screenshots / Movies
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/mitkPluginActivator.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/mitkPluginActivator.cpp
index bdece26bfc..406aed62b4 100644
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/mitkPluginActivator.cpp
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/mitkPluginActivator.cpp
@@ -1,153 +1,151 @@
/*=========================================================================
Program: BlueBerry Platform
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkPluginActivator.h"
#include
#include
#include
#include "src/QmitkDiffusionImagingAppApplication.h"
#include "QmitkWelcomePerspective.h"
#include "QmitkReconstructionPerspective.h"
#include "QmitkTrackingPerspective.h"
#include "QmitkFileImportPerspective.h"
#include "QmitkQuantificationPerspective.h"
#include "QmitkVolumeVisualizationPerspective.h"
#include "src/internal/QmitkDiffusionImagingAppIntroPart.h"
#include "src/internal/QmitkDiffusionImagingAppPerspective.h"
-#include "src/internal/QmitkMasterView.h"
#include "src/internal/QmitkDIAppConnectomicsPerspective.h"
#include "src/internal/QmitkDIAppDicomImportPerspective.h"
#include "src/internal/QmitkDIAppFiberTractographyPerspective.h"
#include "src/internal/QmitkDIAppIVIMPerspective.h"
#include "src/internal/QmitkDIAppPreprocessingReconstructionPerspective.h"
#include "src/internal/QmitkDIAppQuantificationPerspective.h"
#include "src/internal/QmitkDIAppScreenshotsMoviesPerspective.h"
#include "src/internal/QmitkDIAppTBSSPerspective.h"
#include "src/internal/QmitkDIAppVolumeVisualizationPerspective.h"
#include
#include
mitkPluginActivator* mitkPluginActivator::inst = 0;
mitkPluginActivator::mitkPluginActivator()
: pluginListener(0)
{
inst = this;
}
mitkPluginActivator::~mitkPluginActivator()
{
delete pluginListener;
}
mitkPluginActivator* mitkPluginActivator::GetDefault()
{
return inst;
}
void mitkPluginActivator::start(ctkPluginContext* context)
{
berry::AbstractUICTKPlugin::start(context);
this->context = context;
BERRY_REGISTER_EXTENSION_CLASS(QmitkDiffusionImagingAppApplication, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkDiffusionImagingAppIntroPart, context)
- BERRY_REGISTER_EXTENSION_CLASS(QmitkMasterView, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkDiffusionImagingAppPerspective, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkFileImportPerspective, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkReconstructionPerspective, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkQuantificationPerspective, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkVolumeVisualizationPerspective, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkTrackingPerspective, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkWelcomePerspective, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkDIAppConnectomicsPerspective, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkDIAppDicomImportPerspective, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkDIAppFiberTractographyPerspective, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkDIAppIVIMPerspective, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkDIAppPreprocessingReconstructionPerspective, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkDIAppQuantificationPerspective, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkDIAppScreenshotsMoviesPerspective, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkDIAppTBSSPerspective, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkDIAppVolumeVisualizationPerspective, context)
// QString collectionFile = GetQtHelpCollectionFile();
// berry::QtAssistantUtil::SetHelpCollectionFile(collectionFile);
// berry::QtAssistantUtil::SetDefaultHelpUrl("qthelp://org.mitk.gui.qt.diffusionimagingapp/bundle/index.html");
delete pluginListener;
pluginListener = new berry::QCHPluginListener(context);
context->connectPluginListener(pluginListener, SLOT(pluginChanged(ctkPluginEvent)), Qt::DirectConnection);
// register all QCH files from all the currently installed plugins
pluginListener->processPlugins();
}
QString mitkPluginActivator::GetQtHelpCollectionFile() const
{
if (!helpCollectionFile.isEmpty())
{
return helpCollectionFile;
}
QString collectionFilename;
QString na("n/a");
// if (na != MITK_REVISION)
// collectionFilename = "MitkDiffusionImagingAppQtHelpCollection_" MITK_REVISION ".qhc";
// else
collectionFilename = "MitkDiffusionImagingAppQtHelpCollection.qhc";
QFileInfo collectionFileInfo = context->getDataFile(collectionFilename);
QFileInfo pluginFileInfo = QFileInfo(QUrl(context->getPlugin()->getLocation()).toLocalFile());
if (!collectionFileInfo.exists() ||
pluginFileInfo.lastModified() > collectionFileInfo.lastModified())
{
// extract the qhc file from the plug-in
QByteArray content = context->getPlugin()->getResource(collectionFilename);
if (content.isEmpty())
{
BERRY_WARN << "Could not get plug-in resource: " << collectionFilename.toStdString();
}
else
{
QFile file(collectionFileInfo.absoluteFilePath());
file.open(QIODevice::WriteOnly);
file.write(content);
file.close();
}
}
if (QFile::exists(collectionFileInfo.absoluteFilePath()))
{
helpCollectionFile = collectionFileInfo.absoluteFilePath();
}
return helpCollectionFile;
}
Q_EXPORT_PLUGIN2(org_mitk_gui_qt_diffusionimagingapp, mitkPluginActivator)
diff --git a/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.cpp b/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.cpp
index c8fd8eba03..03d925daca 100644
--- a/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.cpp
+++ b/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.cpp
@@ -1,1032 +1,1049 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#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
// UGLYYY
#include "internal/QmitkExtWorkbenchWindowAdvisorHack.h"
#include "internal/QmitkCommonExtPlugin.h"
#include "mitkUndoController.h"
#include "mitkVerboseLimitedLinearUndo.h"
#include
#include
#include
#include
QmitkExtWorkbenchWindowAdvisorHack
* QmitkExtWorkbenchWindowAdvisorHack::undohack =
new QmitkExtWorkbenchWindowAdvisorHack();
QString QmitkExtWorkbenchWindowAdvisor::QT_SETTINGS_FILENAME = "QtSettings.ini";
class PartListenerForTitle: public berry::IPartListener
{
public:
PartListenerForTitle(QmitkExtWorkbenchWindowAdvisor* wa) :
windowAdvisor(wa)
{
}
Events::Types GetPartEventTypes() const
{
return Events::ACTIVATED | Events::BROUGHT_TO_TOP | Events::CLOSED
| Events::HIDDEN | Events::VISIBLE;
}
void PartActivated(berry::IWorkbenchPartReference::Pointer ref)
{
if (ref.Cast ())
{
windowAdvisor->UpdateTitle(false);
}
}
void PartBroughtToTop(berry::IWorkbenchPartReference::Pointer ref)
{
if (ref.Cast ())
{
windowAdvisor->UpdateTitle(false);
}
}
void PartClosed(berry::IWorkbenchPartReference::Pointer /*ref*/)
{
windowAdvisor->UpdateTitle(false);
}
void PartHidden(berry::IWorkbenchPartReference::Pointer ref)
{
if (!windowAdvisor->lastActiveEditor.Expired() &&
ref->GetPart(false) == windowAdvisor->lastActiveEditor.Lock())
{
windowAdvisor->UpdateTitle(true);
}
}
void PartVisible(berry::IWorkbenchPartReference::Pointer ref)
{
if (!windowAdvisor->lastActiveEditor.Expired() &&
ref->GetPart(false) == windowAdvisor->lastActiveEditor.Lock())
{
windowAdvisor->UpdateTitle(false);
}
}
private:
QmitkExtWorkbenchWindowAdvisor* windowAdvisor;
};
class PartListenerForImageNavigator: public berry::IPartListener
{
public:
PartListenerForImageNavigator(QAction* act) :
imageNavigatorAction(act)
{
}
Events::Types GetPartEventTypes() const
{
return Events::OPENED | Events::CLOSED | Events::HIDDEN |
Events::VISIBLE;
}
void PartOpened(berry::IWorkbenchPartReference::Pointer ref)
{
if (ref->GetId()=="org.mitk.views.imagenavigator")
{
imageNavigatorAction->setChecked(true);
}
}
void PartClosed(berry::IWorkbenchPartReference::Pointer ref)
{
if (ref->GetId()=="org.mitk.views.imagenavigator")
{
imageNavigatorAction->setChecked(false);
}
}
void PartVisible(berry::IWorkbenchPartReference::Pointer ref)
{
if (ref->GetId()=="org.mitk.views.imagenavigator")
{
imageNavigatorAction->setChecked(true);
}
}
void PartHidden(berry::IWorkbenchPartReference::Pointer ref)
{
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
{
return Events::ACTIVATED | Events::SAVED_AS | Events::DEACTIVATED
// remove the following line when command framework is finished
| Events::CLOSED | Events::OPENED;
}
void PerspectiveActivated(berry::IWorkbenchPage::Pointer /*page*/,
berry::IPerspectiveDescriptor::Pointer /*perspective*/)
{
windowAdvisor->UpdateTitle(false);
}
void PerspectiveSavedAs(berry::IWorkbenchPage::Pointer /*page*/,
berry::IPerspectiveDescriptor::Pointer /*oldPerspective*/,
berry::IPerspectiveDescriptor::Pointer /*newPerspective*/)
{
windowAdvisor->UpdateTitle(false);
}
void PerspectiveDeactivated(berry::IWorkbenchPage::Pointer /*page*/,
berry::IPerspectiveDescriptor::Pointer /*perspective*/)
{
windowAdvisor->UpdateTitle(false);
}
void PerspectiveOpened(berry::IWorkbenchPage::Pointer /*page*/,
berry::IPerspectiveDescriptor::Pointer /*perspective*/)
{
if (perspectivesClosed)
{
QListIterator i(windowAdvisor->viewActions);
while (i.hasNext())
{
i.next()->setEnabled(true);
}
windowAdvisor->fileSaveProjectAction->setEnabled(true);
windowAdvisor->closeProjectAction->setEnabled(true);
windowAdvisor->undoAction->setEnabled(true);
windowAdvisor->redoAction->setEnabled(true);
windowAdvisor->imageNavigatorAction->setEnabled(true);
windowAdvisor->resetPerspAction->setEnabled(true);
windowAdvisor->closePerspAction->setEnabled(true);
}
perspectivesClosed = false;
}
void PerspectiveClosed(berry::IWorkbenchPage::Pointer /*page*/,
berry::IPerspectiveDescriptor::Pointer /*perspective*/)
{
berry::IWorkbenchWindow::Pointer wnd = windowAdvisor->GetWindowConfigurer()->GetWindow();
bool allClosed = true;
if (wnd->GetActivePage())
{
std::vector perspectives(wnd->GetActivePage()->GetOpenPerspectives());
allClosed = perspectives.empty();
}
if (allClosed)
{
perspectivesClosed = true;
QListIterator i(windowAdvisor->viewActions);
while (i.hasNext())
{
i.next()->setEnabled(false);
}
windowAdvisor->fileSaveProjectAction->setEnabled(false);
windowAdvisor->closeProjectAction->setEnabled(false);
windowAdvisor->undoAction->setEnabled(false);
windowAdvisor->redoAction->setEnabled(false);
windowAdvisor->imageNavigatorAction->setEnabled(false);
windowAdvisor->resetPerspAction->setEnabled(false);
windowAdvisor->closePerspAction->setEnabled(false);
}
}
private:
QmitkExtWorkbenchWindowAdvisor* windowAdvisor;
bool perspectivesClosed;
};
class PerspectiveListenerForMenu: public berry::IPerspectiveListener
{
public:
PerspectiveListenerForMenu(QmitkExtWorkbenchWindowAdvisor* wa) :
windowAdvisor(wa)
{
}
Events::Types GetPerspectiveEventTypes() const
{
return Events::ACTIVATED | Events::DEACTIVATED;
}
void PerspectiveActivated(berry::IWorkbenchPage::Pointer /*page*/,
berry::IPerspectiveDescriptor::Pointer perspective)
{
QAction* action = windowAdvisor->mapPerspIdToAction[perspective->GetId()];
if (action)
{
action->setChecked(true);
}
}
void PerspectiveDeactivated(berry::IWorkbenchPage::Pointer /*page*/,
berry::IPerspectiveDescriptor::Pointer perspective)
{
QAction* action = windowAdvisor->mapPerspIdToAction[perspective->GetId()];
if (action)
{
action->setChecked(false);
}
}
private:
QmitkExtWorkbenchWindowAdvisor* windowAdvisor;
};
QmitkExtWorkbenchWindowAdvisor::QmitkExtWorkbenchWindowAdvisor(berry::WorkbenchAdvisor* wbAdvisor,
berry::IWorkbenchWindowConfigurer::Pointer configurer) :
QmitkCommonWorkbenchWindowAdvisor(configurer),
lastInput(0),
wbAdvisor(wbAdvisor),
showViewToolbar(true),
+showPerspectiveToolbar( false ),
showVersionInfo(true),
showMitkVersionInfo(true)
{
productName = berry::Platform::GetConfiguration().getString("application.baseName");
}
berry::ActionBarAdvisor::Pointer QmitkExtWorkbenchWindowAdvisor::CreateActionBarAdvisor(
berry::IActionBarConfigurer::Pointer configurer)
{
berry::ActionBarAdvisor::Pointer actionBarAdvisor(
new QmitkExtActionBarAdvisor(configurer));
return actionBarAdvisor;
}
void* QmitkExtWorkbenchWindowAdvisor::CreateEmptyWindowContents(void* parent)
{
QWidget* parentWidget = static_cast(parent);
QLabel* 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::ShowViewToolbar(bool show)
{
showViewToolbar = 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 std::string& product)
{
productName = product;
}
void QmitkExtWorkbenchWindowAdvisor::SetWindowIcon(const std::string& wndIcon)
{
windowIcon = wndIcon;
}
void QmitkExtWorkbenchWindowAdvisor::PostWindowCreate()
{
QmitkCommonWorkbenchWindowAdvisor::PostWindowCreate();
// very bad hack...
berry::IWorkbenchWindow::Pointer window =
this->GetWindowConfigurer()->GetWindow();
QMainWindow* mainWindow =
static_cast (window->GetShell()->GetControl());
if (!windowIcon.empty())
{
mainWindow->setWindowIcon(QIcon(QString::fromStdString(windowIcon)));
}
mainWindow->setContextMenuPolicy(Qt::PreventContextMenu);
/*mainWindow->setStyleSheet("color: white;"
"background-color: #808080;"
"selection-color: #659EC7;"
"selection-background-color: #808080;"
" QMenuBar {"
"background-color: #808080; }");*/
// ==== Application menu ============================
QMenuBar* menuBar = mainWindow->menuBar();
menuBar->setContextMenuPolicy(Qt::PreventContextMenu);
QMenu* fileMenu = menuBar->addMenu("&File");
fileMenu->setObjectName("FileMenu");
QAction* fileOpenAction = new QmitkExtFileOpenAction(QIcon(":/org.mitk.gui.qt.ext/Load_48.png"), window);
fileMenu->addAction(fileOpenAction);
fileSaveProjectAction = new QmitkExtFileSaveProjectAction(window);
fileSaveProjectAction->setIcon(QIcon(":/org.mitk.gui.qt.ext/Save_48.png"));
fileMenu->addAction(fileSaveProjectAction);
closeProjectAction = new QmitkCloseProjectAction(window);
closeProjectAction->setIcon(QIcon(":/org.mitk.gui.qt.ext/Remove_48.png"));
fileMenu->addAction(closeProjectAction);
fileMenu->addSeparator();
QAction* fileExitAction = new QmitkFileExitAction(window);
fileExitAction->setObjectName("QmitkFileExitAction");
fileMenu->addAction(fileExitAction);
berry::IViewRegistry* viewRegistry =
berry::PlatformUI::GetWorkbench()->GetViewRegistry();
const std::vector& viewDescriptors =
viewRegistry->GetViews();
// another bad hack to get an edit/undo menu...
QMenu* editMenu = menuBar->addMenu("&Edit");
undoAction = editMenu->addAction(QIcon(":/org.mitk.gui.qt.ext/Undo_48.png"),
"&Undo",
QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onUndo()),
QKeySequence("CTRL+Z"));
undoAction->setToolTip("Undo the last action (not supported by all modules)");
redoAction = editMenu->addAction(QIcon(":/org.mitk.gui.qt.ext/Redo_48.png")
, "&Redo",
QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onRedo()),
QKeySequence("CTRL+Y"));
redoAction->setToolTip("execute the last action that was undone again (not supported by all modules)");
imageNavigatorAction = new QAction(QIcon(":/org.mitk.gui.qt.ext/Slider.png"), "&Image Navigator", NULL);
bool imageNavigatorViewFound = window->GetWorkbench()->GetViewRegistry()->Find("org.mitk.views.imagenavigator");
if (imageNavigatorViewFound)
{
QObject::connect(imageNavigatorAction, SIGNAL(triggered(bool)), QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onImageNavigator()));
imageNavigatorAction->setCheckable(true);
// add part listener for image navigator
imageNavigatorPartListener = new PartListenerForImageNavigator(imageNavigatorAction);
window->GetPartService()->AddPartListener(imageNavigatorPartListener);
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("Open image navigator for navigating through image");
}
// toolbar for showing file open, undo, redo and other main actions
QToolBar* mainActionsToolBar = new QToolBar;
mainActionsToolBar->setContextMenuPolicy(Qt::PreventContextMenu);
#ifdef __APPLE__
mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextUnderIcon );
#else
mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextBesideIcon );
#endif
mainActionsToolBar->addAction(fileOpenAction);
mainActionsToolBar->addAction(fileSaveProjectAction);
mainActionsToolBar->addAction(closeProjectAction);
mainActionsToolBar->addAction(undoAction);
mainActionsToolBar->addAction(redoAction);
if (imageNavigatorViewFound)
{
mainActionsToolBar->addAction(imageNavigatorAction);
}
mainWindow->addToolBar(mainActionsToolBar);
#ifdef __APPLE__
mainWindow->setUnifiedTitleAndToolBarOnMac(true);
#endif
// ==== Window Menu ==========================
QMenu* windowMenu = menuBar->addMenu("Window");
windowMenu->addAction("&New Window",
QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onNewWindow()));
windowMenu->addSeparator();
QMenu* perspMenu = windowMenu->addMenu("&Open Perspective");
QMenu* viewMenu = windowMenu->addMenu("Show &View");
viewMenu->setObjectName("Show View");
windowMenu->addSeparator();
resetPerspAction = windowMenu->addAction("&Reset Perspective",
QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onResetPerspective()));
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();
QActionGroup* perspGroup = new QActionGroup(menuBar);
std::vector perspectives(
perspRegistry->GetPerspectives());
bool skip = false;
for (std::vector::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 (unsigned int i=0; iGetId())
{
skip = true;
break;
}
}
if (skip)
{
skip = false;
continue;
}
}
QAction* perspAction = new berry::QtOpenPerspectiveAction(window,
*perspIt, perspGroup);
mapPerspIdToAction.insert(std::make_pair((*perspIt)->GetId(), perspAction));
}
perspMenu->addActions(perspGroup->actions());
// sort elements (converting vector to map...)
std::vector::const_iterator iter;
std::map VDMap;
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 (unsigned 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;
std::pair p(
(*iter)->GetLabel(), (*iter));
VDMap.insert(p);
}
// ==================================================
+ // ==== Perspective Toolbar ==================================
+ QToolBar* qPerspectiveToolbar = new QToolBar;
+
+ if (showPerspectiveToolbar)
+ {
+ qPerspectiveToolbar->addActions(perspGroup->actions());
+ mainWindow->addToolBar(qPerspectiveToolbar);
+ }
+ else
+ delete qPerspectiveToolbar;
+
// ==== View Toolbar ==================================
QToolBar* qToolbar = new QToolBar;
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);
viewMenu->addAction(viewAction);
if (showViewToolbar)
{
qToolbar->addAction(viewAction);
}
}
if (showViewToolbar)
{
mainWindow->addToolBar(qToolbar);
}
else
delete qToolbar;
QSettings settings(GetQSettingsFile(), QSettings::IniFormat);
mainWindow->restoreState(settings.value("ToolbarPosition").toByteArray());
// ====================================================
// ===== Help menu ====================================
QMenu* helpMenu = menuBar->addMenu("Help");
helpMenu->addAction("&Welcome",this, SLOT(onIntro()));
helpMenu->addAction("&Help Contents",this, SLOT(onHelp()), QKeySequence("F1"));
helpMenu->addAction("&About",this, SLOT(onAbout()));
// =====================================================
QStatusBar* qStatusBar = new QStatusBar();
//creating a QmitkStatusBar for Output on the QStatusBar and connecting it with the MainStatusBar
QmitkStatusBar *statusBar = new QmitkStatusBar(qStatusBar);
//disabling the SizeGrip in the lower right corner
statusBar->SetSizeGripEnabled(false);
QmitkProgressBar *progBar = new QmitkProgressBar();
qStatusBar->addPermanentWidget(progBar, 0);
progBar->hide();
// progBar->AddStepsToDo(2);
// progBar->Progress(1);
mainWindow->setStatusBar(qStatusBar);
QmitkMemoryUsageIndicatorView* 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 = new PerspectiveListenerForMenu(this);
configurer->GetWindow()->AddPerspectiveListener(menuPerspectiveListener);
}
void QmitkExtWorkbenchWindowAdvisor::onIntro()
{
QmitkExtWorkbenchWindowAdvisorHack::undohack->onIntro();
}
void QmitkExtWorkbenchWindowAdvisor::onHelp()
{
QmitkExtWorkbenchWindowAdvisorHack::undohack->onHelp();
}
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";
}
}
void QmitkExtWorkbenchWindowAdvisorHack::onImageNavigator()
{
// get ImageNavigatorView
berry::IViewPart::Pointer imageNavigatorView =
berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->FindView("org.mitk.views.imagenavigator");
if (imageNavigatorView)
{
bool isImageNavigatorVisible = berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->IsPartVisible(imageNavigatorView);
if (isImageNavigatorVisible)
{
berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->HideView(imageNavigatorView);
return;
}
}
berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->ShowView("org.mitk.views.imagenavigator");
//berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()->ResetPerspective();
}
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(0);
}
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); // Als Text-Datei nur zum Lesen öffnen
QString text = QString(file.readAll());
file.close();
QString title = text;
title.replace(reg, "");
title.replace(reg2, "");
std::cout << title.toStdString() << std::endl;
QMessageBox::information(NULL, title,
text, "Close");
}
else
{
berry::PlatformUI::GetWorkbench()->GetIntroManager()->ShowIntro(
berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow(), false);
}
}
void QmitkExtWorkbenchWindowAdvisorHack::onHelp()
{
berry::QtAssistantUtil::OpenActivePartHelp();
}
void QmitkExtWorkbenchWindowAdvisorHack::onAbout()
{
QmitkAboutDialog* aboutDialog = new QmitkAboutDialog(QApplication::activeWindow(),NULL);
aboutDialog->open();
}
void QmitkExtWorkbenchWindowAdvisor::HookTitleUpdateListeners(
berry::IWorkbenchWindowConfigurer::Pointer configurer)
{
// hook up the listeners to update the window title
titlePartListener = new PartListenerForTitle(this);
titlePerspectiveListener = new PerspectiveListenerForTitle(this);
editorPropertyListener = 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);
configurer->GetWindow()->GetPartService()->AddPartListener(titlePartListener);
}
std::string QmitkExtWorkbenchWindowAdvisor::ComputeTitle()
{
berry::IWorkbenchWindowConfigurer::Pointer configurer =
GetWindowConfigurer();
berry::IWorkbenchPage::Pointer currentPage =
configurer->GetWindow()->GetActivePage();
berry::IEditorPart::Pointer activeEditor;
if (currentPage)
{
activeEditor = lastActiveEditor.Lock();
}
std::string title;
//TODO Product
// IProduct product = Platform.getProduct();
// if (product != null) {
// title = product.getName();
// }
// instead of the product name, we use a custom variable for now
title = productName;
if(showMitkVersionInfo)
{
title += std::string(" ") + MITK_VERSION_STRING;
}
if (showVersionInfo)
{
// add version informatioin
QString mitkRevision(MITK_REVISION);
mitkRevision = mitkRevision.left(6) + " (" MITK_REVISION_NAME ")";
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(mitkRevision);
title += versions.toStdString();
}
if (currentPage)
{
if (activeEditor)
{
lastEditorTitle = activeEditor->GetTitleToolTip();
if (!lastEditorTitle.empty())
title = lastEditorTitle + " - " + title;
}
berry::IPerspectiveDescriptor::Pointer persp =
currentPage->GetPerspective();
std::string label = "";
if (persp)
{
label = persp->GetLabel();
}
berry::IAdaptable* input = currentPage->GetInput();
if (input && input != wbAdvisor->GetDefaultPageInput())
{
label = currentPage->GetLabel();
}
if (!label.empty())
{
title = label + " - " + title;
}
}
title += " (Not for use in diagnosis or treatment of patients)";
return title;
}
void QmitkExtWorkbenchWindowAdvisor::RecomputeTitle()
{
berry::IWorkbenchWindowConfigurer::Pointer configurer =
GetWindowConfigurer();
std::string oldTitle = configurer->GetTitle();
std::string 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 = 0;
if (currentPage)
{
activeEditor = currentPage->GetActiveEditor();
persp = currentPage->GetPerspective();
input = currentPage->GetInput();
}
if (editorHidden)
{
activeEditor = 0;
}
// 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);
}
lastActiveEditor = activeEditor;
lastActivePage = currentPage;
lastPerspective = persp;
lastInput = input;
if (activeEditor)
{
activeEditor->AddPropertyListener(editorPropertyListener);
}
RecomputeTitle();
}
void QmitkExtWorkbenchWindowAdvisor::PropertyChange(berry::Object::Pointer /*source*/, int propId)
{
if (propId == berry::IWorkbenchPartConstants::PROP_TITLE)
{
if (!lastActiveEditor.Expired())
{
std::string newTitle = lastActiveEditor.Lock()->GetPartName();
if (lastEditorTitle != newTitle)
{
RecomputeTitle();
}
}
}
}
void QmitkExtWorkbenchWindowAdvisor::SetPerspectiveExcludeList(std::vector v)
{
this->perspectiveExcludeList = v;
}
std::vector QmitkExtWorkbenchWindowAdvisor::GetPerspectiveExcludeList()
{
return this->perspectiveExcludeList;
}
void QmitkExtWorkbenchWindowAdvisor::SetViewExcludeList(std::vector v)
{
this->viewExcludeList = v;
}
std::vector 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/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.h b/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.h
index 3651a4f933..e2a1d64a0d 100644
--- a/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.h
+++ b/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.h
@@ -1,146 +1,149 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef QMITKEXTWORKBENCHWINDOWADVISOR_H_
#define QMITKEXTWORKBENCHWINDOWADVISOR_H_
#include
#include
#include
#include
#include
#include
#include "QmitkCommonWorkbenchWindowAdvisor.h"
#include
class QAction;
class QMenu;
class MITK_QT_COMMON_EXT_EXPORT QmitkExtWorkbenchWindowAdvisor : public QObject, public QmitkCommonWorkbenchWindowAdvisor
{
Q_OBJECT
public:
QmitkExtWorkbenchWindowAdvisor(berry::WorkbenchAdvisor* wbAdvisor,
berry::IWorkbenchWindowConfigurer::Pointer configurer);
berry::ActionBarAdvisor::Pointer CreateActionBarAdvisor(
berry::IActionBarConfigurer::Pointer configurer);
void* CreateEmptyWindowContents(void* parent);
void PostWindowCreate();
void PreWindowOpen();
void PostWindowClose();
void ShowViewToolbar(bool show);
+ void ShowPerspectiveToolbar(bool show);
+
void ShowVersionInfo(bool show);
void ShowMitkVersionInfo(bool show);
//TODO should be removed when product support is here
void SetProductName(const std::string& product);
void SetWindowIcon(const std::string& wndIcon);
void SetPerspectiveExcludeList(std::vector v);
std::vector GetPerspectiveExcludeList();
void SetViewExcludeList(std::vector v);
std::vector GetViewExcludeList();
protected slots:
virtual void onIntro();
virtual void onHelp();
virtual void onAbout();
private:
/**
* Hooks the listeners needed on the window
*
* @param configurer
*/
void HookTitleUpdateListeners(berry::IWorkbenchWindowConfigurer::Pointer configurer);
std::string 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(berry::Object::Pointer /*source*/, int propId);
static QString QT_SETTINGS_FILENAME;
berry::IPartListener::Pointer titlePartListener;
berry::IPerspectiveListener::Pointer titlePerspectiveListener;
berry::IPerspectiveListener::Pointer menuPerspectiveListener;
berry::IPartListener::Pointer imageNavigatorPartListener;
berry::IPropertyChangeListener::Pointer editorPropertyListener;
friend struct berry::PropertyChangeIntAdapter;
friend class PartListenerForTitle;
friend class PerspectiveListenerForTitle;
friend class PerspectiveListenerForMenu;
friend class PartListenerForImageNavigator;
berry::IEditorPart::WeakPtr lastActiveEditor;
berry::IPerspectiveDescriptor::WeakPtr lastPerspective;
berry::IWorkbenchPage::WeakPtr lastActivePage;
std::string lastEditorTitle;
berry::IAdaptable* lastInput;
berry::WorkbenchAdvisor* wbAdvisor;
bool showViewToolbar;
+ bool showPerspectiveToolbar;
bool showVersionInfo;
bool showMitkVersionInfo;
std::string productName;
std::string windowIcon;
// stringlist for excluding perspectives from the perspective menu entry (e.g. Welcome Perspective)
std::vector perspectiveExcludeList;
// stringlist for excluding views from the menu entry
std::vector viewExcludeList;
// maps perspective ids to QAction objects
std::map 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* resetPerspAction;
QAction* closePerspAction;
};
#endif /*QMITKEXTWORKBENCHWINDOWADVISOR_H_*/