diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/files.cmake b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/files.cmake
index 88a818c8cd..b4eac9b557 100644
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/files.cmake
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/files.cmake
@@ -1,106 +1,95 @@
SET(SRC_CPP_FILES
QmitkDiffusionImagingAppApplication.cpp
QmitkDiffusionImagingAppWorkbenchAdvisor.cpp
)
SET(INTERNAL_CPP_FILES
mitkPluginActivator.cpp
QmitkDiffusionImagingAppIntroPart.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
)
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/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
+ 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 186c6ee249..174abdcf6d 100644
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/plugin.xml
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/plugin.xml
@@ -1,67 +1,69 @@
-
+ icon="resources/perspectives/icon_home.png"/>-->
+
-
-
-
-
+
+
+
+
+
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 97feb7a3bb..e1807f72b2 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,116 @@
/*=========================================================================
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->SetInitialSize(berry::Point(1000,770));
QmitkExtWorkbenchWindowAdvisor* advisor = new QmitkExtWorkbenchWindowAdvisor(this, configurer);
+ advisor->ShowViewMenuItem(false);
+ advisor->ShowNewWindowMenuItem(false);
+ advisor->ShowClosePerspectiveMenuItem(false);
advisor->SetPerspectiveExcludeList(perspExcludeList);
advisor->SetViewExcludeList(viewExcludeList);
advisor->ShowViewToolbar(false);
advisor->ShowPerspectiveToolbar(true);
advisor->ShowVersionInfo(false);
advisor->ShowMitkVersionInfo(false);
- advisor->SetProductName("MITK Diffusion Imaging App");
+ advisor->SetProductName("MITK Diffusion");
advisor->SetWindowIcon(":/org.mitk.gui.qt.diffusionimagingapp/app-icon.png");
return advisor;
}
std::string QmitkDiffusionImagingAppWorkbenchAdvisor::GetInitialWindowPerspectiveId()
{
return WELCOME_PERSPECTIVE_ID;
}
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkFileImportPerspective.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkFileImportPerspective.cpp
deleted file mode 100644
index 554b99ebc7..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkFileImportPerspective.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*=========================================================================
-
- Program: BlueBerry Platform
- Language: C++
- Date: $Date: 2009-10-23 02:59:36 +0200 (Fr, 23 Okt 2009) $
- Version: $Revision: 19652 $
-
- 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 "QmitkFileImportPerspective.h"
-
-void QmitkFileImportPerspective::CreateInitialLayout(berry::IPageLayout::Pointer layout)
-{
- std::string editorArea = layout->GetEditorArea();
-
- layout->AddStandaloneView("org.mitk.views.datamanager", false, berry::IPageLayout::LEFT, 0.3f, editorArea);
-
- layout->AddStandaloneView("org.mitk.views.controlvisualizationpropertiesview",
- false, berry::IPageLayout::BOTTOM, .2f, "org.mitk.views.datamanager");
-
- berry::IFolderLayout::Pointer left =
- layout->CreateFolder("org.mitk.leftcontrols",
- berry::IPageLayout::BOTTOM, 0.2f, "org.mitk.views.controlvisualizationpropertiesview");
-
- left->AddView("org.mitk.views.diffusiondicomimport");
-
-
- berry::IViewLayout::Pointer lo = layout->GetViewLayout("org.mitk.views.diffusiondicomimport");
- lo->SetCloseable(false);
-}
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkFileImportPerspective.h b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkFileImportPerspective.h
deleted file mode 100644
index 86884e6811..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkFileImportPerspective.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*=========================================================================
-
- Program: BlueBerry Platform
- Language: C++
- Date: $Date: 2009-10-23 02:59:36 +0200 (Fr, 23 Okt 2009) $
- Version: $Revision: 19652 $
-
- 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 QmitkFileImportPerspective_H_
-#define QmitkFileImportPerspective_H_
-
-#include
-
-class QmitkFileImportPerspective : public QObject, public berry::IPerspectiveFactory
-{
- Q_OBJECT
- Q_INTERFACES(berry::IPerspectiveFactory)
-
-public:
-
- QmitkFileImportPerspective() {}
- QmitkFileImportPerspective(const QmitkFileImportPerspective& other)
- {
- Q_UNUSED(other)
- throw std::runtime_error("Copy constructor not implemented");
- }
- ~QmitkFileImportPerspective() {}
-
- void CreateInitialLayout(berry::IPageLayout::Pointer layout);
-};
-
-#endif /* QmitkFileImportPerspective_H_ */
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkQuantificationPerspective.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkQuantificationPerspective.cpp
deleted file mode 100644
index 3a2c039e27..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkQuantificationPerspective.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*=========================================================================
-
- Program: BlueBerry Platform
- Language: C++
- Date: $Date: 2009-10-23 02:59:36 +0200 (Fr, 23 Okt 2009) $
- Version: $Revision: 19652 $
-
- 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 "QmitkQuantificationPerspective.h"
-
-void QmitkQuantificationPerspective::CreateInitialLayout(berry::IPageLayout::Pointer layout)
-{
- std::string editorArea = layout->GetEditorArea();
-
- layout->AddStandaloneView("org.mitk.views.datamanager", false, berry::IPageLayout::LEFT, 0.3f, editorArea);
-
- layout->AddStandaloneView("org.mitk.views.controlvisualizationpropertiesview",
- false, berry::IPageLayout::BOTTOM, .2f, "org.mitk.views.datamanager");
-
- berry::IFolderLayout::Pointer left =
- layout->CreateFolder("org.mitk.leftcontrols",
- berry::IPageLayout::BOTTOM, 0.2f, "org.mitk.views.controlvisualizationpropertiesview");
-
- left->AddView("org.mitk.views.diffusionquantification");
- left->AddView("org.mitk.views.partialvolumeanalysisview");
- left->AddView("org.mitk.views.segmentation");
- left->AddView("org.mitk.views.measurement");
- left->AddView("org.mitk.views.imagestatistics");
-
-
- berry::IViewLayout::Pointer lo = layout->GetViewLayout("org.mitk.views.diffusionquantification");
- lo->SetCloseable(false);
- lo = layout->GetViewLayout("org.mitk.views.partialvolumeanalysisview");
- lo->SetCloseable(false);
- lo = layout->GetViewLayout("org.mitk.views.segmentation");
- lo->SetCloseable(false);
- lo = layout->GetViewLayout("org.mitk.views.measurement");
- lo->SetCloseable(false);
- lo = layout->GetViewLayout("org.mitk.views.imagestatistics");
- lo->SetCloseable(false);
-}
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkQuantificationPerspective.h b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkQuantificationPerspective.h
deleted file mode 100644
index 211085bde0..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkQuantificationPerspective.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*=========================================================================
-
- Program: BlueBerry Platform
- Language: C++
- Date: $Date: 2009-10-23 02:59:36 +0200 (Fr, 23 Okt 2009) $
- Version: $Revision: 19652 $
-
- 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 QmitkQuantificationPerspective_H_
-#define QmitkQuantificationPerspective_H_
-
-#include
-
-class QmitkQuantificationPerspective : public QObject, public berry::IPerspectiveFactory
-{
- Q_OBJECT
- Q_INTERFACES(berry::IPerspectiveFactory)
-
-public:
-
- QmitkQuantificationPerspective() {}
- QmitkQuantificationPerspective(const QmitkQuantificationPerspective& other)
- {
- Q_UNUSED(other)
- throw std::runtime_error("Copy constructor not implemented");
- }
- ~QmitkQuantificationPerspective() {}
-
- void CreateInitialLayout(berry::IPageLayout::Pointer layout);
-};
-
-#endif /* QmitkQuantificationPerspective_H_ */
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkReconstructionPerspective.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkReconstructionPerspective.cpp
deleted file mode 100644
index 0f5fd8a8da..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkReconstructionPerspective.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*=========================================================================
-
- Program: BlueBerry Platform
- Language: C++
- Date: $Date: 2009-10-23 02:59:36 +0200 (Fr, 23 Okt 2009) $
- Version: $Revision: 19652 $
-
- 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 "QmitkReconstructionPerspective.h"
-
-void QmitkReconstructionPerspective::CreateInitialLayout(berry::IPageLayout::Pointer layout)
-{
- std::string editorArea = layout->GetEditorArea();
-
- layout->AddStandaloneView("org.mitk.views.datamanager", false, berry::IPageLayout::LEFT, 0.3f, editorArea);
-
- layout->AddStandaloneView("org.mitk.views.controlvisualizationpropertiesview",
- false, berry::IPageLayout::BOTTOM, .2f, "org.mitk.views.datamanager");
-
- berry::IFolderLayout::Pointer left =
- layout->CreateFolder("org.mitk.leftcontrols",
- berry::IPageLayout::BOTTOM, 0.2f, "org.mitk.views.controlvisualizationpropertiesview");
-
- left->AddView("org.mitk.views.diffusionpreprocessing");
- left->AddView("org.mitk.views.tensorreconstruction");
- left->AddView("org.mitk.views.qballreconstruction");
- left->AddView("org.mitk.views.odfdetails");
-
-
- berry::IViewLayout::Pointer lo = layout->GetViewLayout("org.mitk.views.diffusionpreprocessing");
- lo->SetCloseable(false);
- lo = layout->GetViewLayout("org.mitk.views.tensorreconstruction");
- lo->SetCloseable(false);
- lo = layout->GetViewLayout("org.mitk.views.qballreconstruction");
- lo->SetCloseable(false);
- lo = layout->GetViewLayout("org.mitk.views.odfdetails");
- lo->SetCloseable(false);
-}
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkReconstructionPerspective.h b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkReconstructionPerspective.h
deleted file mode 100644
index d696361d69..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkReconstructionPerspective.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*=========================================================================
-
- Program: BlueBerry Platform
- Language: C++
- Date: $Date: 2009-10-23 02:59:36 +0200 (Fr, 23 Okt 2009) $
- Version: $Revision: 19652 $
-
- 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 QMITKReconstructionPERSPECTIVE_H_
-#define QMITKReconstructionPERSPECTIVE_H_
-
-#include
-
-class QmitkReconstructionPerspective : public QObject, public berry::IPerspectiveFactory
-{
- Q_OBJECT
- Q_INTERFACES(berry::IPerspectiveFactory)
-
-public:
-
- QmitkReconstructionPerspective() {}
- QmitkReconstructionPerspective(const QmitkReconstructionPerspective& other)
- {
- Q_UNUSED(other)
- throw std::runtime_error("Copy constructor not implemented");
- }
- ~QmitkReconstructionPerspective() {}
-
- void CreateInitialLayout(berry::IPageLayout::Pointer layout);
-};
-
-#endif /* QMITKReconstructionPERSPECTIVE_H_ */
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkTrackingPerspective.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkTrackingPerspective.cpp
deleted file mode 100644
index dacb3350b6..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkTrackingPerspective.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/*=========================================================================
-
- Program: BlueBerry Platform
- Language: C++
- Date: $Date: 2009-10-23 02:59:36 +0200 (Fr, 23 Okt 2009) $
- Version: $Revision: 19652 $
-
- 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 "QmitkTrackingPerspective.h"
-
-void QmitkTrackingPerspective::CreateInitialLayout(berry::IPageLayout::Pointer layout)
-{
- std::string editorArea = layout->GetEditorArea();
-
- layout->AddStandaloneView("org.mitk.views.datamanager", false, berry::IPageLayout::LEFT, 0.3f, editorArea);
-
- layout->AddStandaloneView("org.mitk.views.controlvisualizationpropertiesview",
- false, berry::IPageLayout::BOTTOM, .2f, "org.mitk.views.datamanager");
-
- berry::IFolderLayout::Pointer left =
- layout->CreateFolder("org.mitk.leftcontrols",
- berry::IPageLayout::BOTTOM, 0.2f, "org.mitk.views.controlvisualizationpropertiesview");
-
- left->AddView("org.mitk.views.gibbstracking");
- left->AddView("org.mitk.views.fiberbundleoperations");
-
-
- berry::IViewLayout::Pointer lo = layout->GetViewLayout("org.mitk.views.gibbstracking");
- lo->SetCloseable(false);
- lo = layout->GetViewLayout("org.mitk.views.fiberbundleoperations");
- lo->SetCloseable(false);
-}
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkTrackingPerspective.h b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkTrackingPerspective.h
deleted file mode 100644
index 2a1560b374..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkTrackingPerspective.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*=========================================================================
-
- Program: BlueBerry Platform
- Language: C++
- Date: $Date: 2009-10-23 02:59:36 +0200 (Fr, 23 Okt 2009) $
- Version: $Revision: 19652 $
-
- 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 QmitkTrackingPerspective_H_
-#define QmitkTrackingPerspective_H_
-
-#include
-
-class QmitkTrackingPerspective : public QObject, public berry::IPerspectiveFactory
-{
- Q_OBJECT
- Q_INTERFACES(berry::IPerspectiveFactory)
-
-public:
-
- QmitkTrackingPerspective() {}
- QmitkTrackingPerspective(const QmitkTrackingPerspective& other)
- {
- Q_UNUSED(other)
- throw std::runtime_error("Copy constructor not implemented");
- }
- ~QmitkTrackingPerspective() {}
-
- void CreateInitialLayout(berry::IPageLayout::Pointer layout);
-};
-
-#endif /* QmitkTrackingPerspective_H_ */
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkVolumeVisualizationPerspective.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkVolumeVisualizationPerspective.cpp
deleted file mode 100644
index e46999940e..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkVolumeVisualizationPerspective.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/*=========================================================================
-
- Program: BlueBerry Platform
- Language: C++
- Date: $Date: 2009-10-23 02:59:36 +0200 (Fr, 23 Okt 2009) $
- Version: $Revision: 19652 $
-
- 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 "QmitkVolumeVisualizationPerspective.h"
-
-void QmitkVolumeVisualizationPerspective::CreateInitialLayout(berry::IPageLayout::Pointer layout)
-{
- std::string editorArea = layout->GetEditorArea();
-
- layout->AddStandaloneView("org.mitk.views.datamanager", false, berry::IPageLayout::LEFT, 0.3f, editorArea);
-
- berry::IFolderLayout::Pointer left =
- layout->CreateFolder("org.mitk.leftcontrols",
- berry::IPageLayout::BOTTOM, 0.2f, "org.mitk.views.datamanager");
-
- left->AddView("org.mitk.views.volumevisualization");
-
-
- berry::IViewLayout::Pointer lo = layout->GetViewLayout("org.mitk.views.volumevisualization");
- lo->SetCloseable(false);
-}
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkVolumeVisualizationPerspective.h b/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkVolumeVisualizationPerspective.h
deleted file mode 100644
index a7e2c686c2..0000000000
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimagingapp/src/internal/QmitkVolumeVisualizationPerspective.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*=========================================================================
-
- Program: BlueBerry Platform
- Language: C++
- Date: $Date: 2009-10-23 02:59:36 +0200 (Fr, 23 Okt 2009) $
- Version: $Revision: 19652 $
-
- 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 QmitkVolumeVisualizationPerspective_H_
-#define QmitkVolumeVisualizationPerspective_H_
-
-#include
-
-class QmitkVolumeVisualizationPerspective : public QObject, public berry::IPerspectiveFactory
-{
- Q_OBJECT
- Q_INTERFACES(berry::IPerspectiveFactory)
-
-public:
-
- QmitkVolumeVisualizationPerspective() {}
- QmitkVolumeVisualizationPerspective(const QmitkVolumeVisualizationPerspective& other)
- {
- Q_UNUSED(other)
- throw std::runtime_error("Copy constructor not implemented");
- }
- ~QmitkVolumeVisualizationPerspective() {}
-
- void CreateInitialLayout(berry::IPageLayout::Pointer layout);
-};
-
-#endif /* QmitkVolumeVisualizationPerspective_H_ */
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 406aed62b4..c08bb4b388 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,151 +1,136 @@
/*=========================================================================
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/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(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 03d925daca..85de46a64b 100644
--- a/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.cpp
+++ b/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.cpp
@@ -1,1049 +1,1078 @@
/*=========================================================================
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 ),
+showPerspectiveToolbar(false),
showVersionInfo(true),
-showMitkVersionInfo(true)
+showMitkVersionInfo(true),
+showViewMenuItem(true),
+showNewWindowMenuItem(true),
+showClosePerspectiveMenuItem(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::ShowClosePerspectiveMenuItem(bool show)
+{
+ showClosePerspectiveMenuItem = show;
+}
+
+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 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();
+ if (showNewWindowMenuItem)
+ {
+ 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");
+
+ QMenu* viewMenu;
+ if (showViewMenuItem)
+ {
+ 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()));
+
+ 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();
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(showViewMenuItem)
+ 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 e2a1d64a0d..b8dd182379 100644
--- a/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.h
+++ b/Modules/Bundles/org.mitk.gui.qt.ext/src/QmitkExtWorkbenchWindowAdvisor.h
@@ -1,149 +1,158 @@
/*=========================================================================
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);
+ void ShowViewMenuItem(bool show);
+
+ void ShowNewWindowMenuItem(bool show);
+
+ void ShowClosePerspectiveMenuItem(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;
+ bool showViewMenuItem;
+ bool showNewWindowMenuItem;
+ bool showClosePerspectiveMenuItem;
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_*/