diff --git a/Plugins/org.mitk.gui.qt.extapplication/files.cmake b/Plugins/org.mitk.gui.qt.extapplication/files.cmake
index c64d10b7a7..e7bcaae435 100644
--- a/Plugins/org.mitk.gui.qt.extapplication/files.cmake
+++ b/Plugins/org.mitk.gui.qt.extapplication/files.cmake
@@ -1,41 +1,49 @@
set(SRC_CPP_FILES
)
set(INTERNAL_CPP_FILES
QmitkExtApplication.cpp
QmitkExtApplicationPlugin.cpp
QmitkExtAppWorkbenchAdvisor.cpp
+ QmitkMitkWorkbenchIntroPart.cpp
+ perspectives/QmitkEditorPerspective.cpp
perspectives/QmitkExtDefaultPerspective.cpp
)
set(MOC_H_FILES
src/internal/QmitkExtApplication.h
src/internal/QmitkExtApplicationPlugin.h
+ src/internal/QmitkMitkWorkbenchIntroPart.h
+ src/internal/perspectives/QmitkEditorPerspective.h
src/internal/perspectives/QmitkExtDefaultPerspective.h
)
+set(UI_FILES
+ src/internal/perspectives/QmitkWelcomeScreenViewControls.ui
+)
+
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_research.xpm
)
set(QRC_FILES
# uncomment the following line if you want to use Qt resources
# resources/QmitkExtApplication.qrc
resources/welcome/QmitkWelcomeScreenView.qrc
)
set(CPP_FILES )
foreach(file ${SRC_CPP_FILES})
set(CPP_FILES ${CPP_FILES} src/${file})
endforeach(file ${SRC_CPP_FILES})
foreach(file ${INTERNAL_CPP_FILES})
set(CPP_FILES ${CPP_FILES} src/internal/${file})
endforeach(file ${INTERNAL_CPP_FILES})
diff --git a/Plugins/org.mitk.gui.qt.extapplication/plugin.xml b/Plugins/org.mitk.gui.qt.extapplication/plugin.xml
index a9777eeb61..4cb8e70b51 100644
--- a/Plugins/org.mitk.gui.qt.extapplication/plugin.xml
+++ b/Plugins/org.mitk.gui.qt.extapplication/plugin.xml
@@ -1,18 +1,33 @@
+
+
+
+
+
+ icon="resources/icon_research.xpm">
+
+
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.extapplication/src/internal/QmitkExtApplicationPlugin.cpp b/Plugins/org.mitk.gui.qt.extapplication/src/internal/QmitkExtApplicationPlugin.cpp
index 47786d687d..c2411123d7 100644
--- a/Plugins/org.mitk.gui.qt.extapplication/src/internal/QmitkExtApplicationPlugin.cpp
+++ b/Plugins/org.mitk.gui.qt.extapplication/src/internal/QmitkExtApplicationPlugin.cpp
@@ -1,84 +1,88 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "QmitkExtApplicationPlugin.h"
-#include "QmitkExtDefaultPerspective.h"
+#include "perspectives/QmitkExtDefaultPerspective.h"
+#include "perspectives/QmitkEditorPerspective.h"
+#include "QmitkMitkWorkbenchIntroPart.h"
#include "QmitkExtApplication.h"
#include
#include
#include
#include
#include
#include
#include
QmitkExtApplicationPlugin* QmitkExtApplicationPlugin::inst = 0;
QmitkExtApplicationPlugin::QmitkExtApplicationPlugin()
{
inst = this;
}
QmitkExtApplicationPlugin::~QmitkExtApplicationPlugin()
{
}
QmitkExtApplicationPlugin* QmitkExtApplicationPlugin::GetDefault()
{
return inst;
}
void QmitkExtApplicationPlugin::start(ctkPluginContext* context)
{
berry::AbstractUICTKPlugin::start(context);
this->context = context;
BERRY_REGISTER_EXTENSION_CLASS(QmitkExtDefaultPerspective, context);
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkEditorPerspective, context);
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkMitkWorkbenchIntroPart, context);
BERRY_REGISTER_EXTENSION_CLASS(QmitkExtApplication, context);
ctkServiceReference cmRef = context->getServiceReference();
ctkConfigurationAdmin* configAdmin = 0;
if (cmRef)
{
configAdmin = context->getService(cmRef);
}
// Use the CTK Configuration Admin service to configure the BlueBerry help system
if (configAdmin)
{
ctkConfigurationPtr conf = configAdmin->getConfiguration("org.blueberry.services.help", QString());
ctkDictionary helpProps;
helpProps.insert("homePage", "qthelp://org.mitk.gui.qt.extapplication/bundle/index.html");
conf->update(helpProps);
context->ungetService(cmRef);
}
else
{
MITK_WARN << "Configuration Admin service unavailable, cannot set home page url.";
}
}
ctkPluginContext* QmitkExtApplicationPlugin::GetPluginContext() const
{
return context;
}
Q_EXPORT_PLUGIN2(org_mitk_gui_qt_extapplication, QmitkExtApplicationPlugin)
diff --git a/Plugins/org.mitk.gui.qt.extapplication/src/internal/QmitkMitkWorkbenchIntroPart.cpp b/Plugins/org.mitk.gui.qt.extapplication/src/internal/QmitkMitkWorkbenchIntroPart.cpp
new file mode 100644
index 0000000000..8e90bca52e
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.extapplication/src/internal/QmitkMitkWorkbenchIntroPart.cpp
@@ -0,0 +1,203 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+#include "QmitkMitkWorkbenchIntroPart.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+#include
+
+#include
+
+#include
+#include
+#include
+#ifdef QT_WEBKIT
+#include
+#include
+#endif
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "QmitkExtApplicationPlugin.h"
+#include "mitkDataStorageEditorInput.h"
+#include
+
+QmitkMitkWorkbenchIntroPart::QmitkMitkWorkbenchIntroPart()
+ : m_Controls(NULL)
+{
+ berry::IPreferences::Pointer workbenchPrefs = QmitkExtApplicationPlugin::GetDefault()->GetPreferencesService()->GetSystemPreferences();
+ workbenchPrefs->PutBool(berry::WorkbenchPreferenceConstants::SHOW_INTRO, true);
+ workbenchPrefs->Flush();
+}
+
+QmitkMitkWorkbenchIntroPart::~QmitkMitkWorkbenchIntroPart()
+{
+ // if the workbench is not closing (that means, welcome screen was closed explicitly), set "Show_intro" false
+ if (!this->GetIntroSite()->GetPage()->GetWorkbenchWindow()->GetWorkbench()->IsClosing())
+ {
+ berry::IPreferences::Pointer workbenchPrefs = QmitkExtApplicationPlugin::GetDefault()->GetPreferencesService()->GetSystemPreferences();
+ workbenchPrefs->PutBool(berry::WorkbenchPreferenceConstants::SHOW_INTRO, false);
+ workbenchPrefs->Flush();
+ }
+ else
+ {
+ berry::IPreferences::Pointer workbenchPrefs = QmitkExtApplicationPlugin::GetDefault()->GetPreferencesService()->GetSystemPreferences();
+ workbenchPrefs->PutBool(berry::WorkbenchPreferenceConstants::SHOW_INTRO, true);
+ workbenchPrefs->Flush();
+ }
+
+ // if workbench is not closing (Just welcome screen closing), open last used perspective
+ if (this->GetIntroSite()->GetPage()->GetPerspective()->GetId()
+ == "org.mitk.mitkworkbench.perspectives.editor" && !this->GetIntroSite()->GetPage()->GetWorkbenchWindow()->GetWorkbench()->IsClosing())
+ {
+ berry::IPerspectiveDescriptor::Pointer perspective = this->GetIntroSite()->GetWorkbenchWindow()->GetWorkbench()->GetPerspectiveRegistry()->FindPerspectiveWithId("org.mitk.mitkworkbench.perspectives.editor");
+ if (perspective)
+ {
+ this->GetIntroSite()->GetPage()->SetPerspective(perspective);
+ }
+ }
+
+}
+
+
+void QmitkMitkWorkbenchIntroPart::CreateQtPartControl(QWidget* parent)
+{
+ if (!m_Controls)
+ {
+ // create GUI widgets
+ m_Controls = new Ui::QmitkWelcomeScreenViewControls;
+ m_Controls->setupUi(parent);
+#ifdef QT_WEBKIT
+
+ // create a QWebView as well as a QWebPage and QWebFrame within the QWebview
+ m_view = new QWebView(parent);
+ m_view->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
+
+ QUrl urlQtResource(QString("qrc:/org.mitk.gui.qt.welcomescreen/mitkworkbenchwelcomeview.html"), QUrl::TolerantMode );
+ m_view->load( urlQtResource );
+
+ // adds the webview as a widget
+ parent->layout()->addWidget(m_view);
+ this->CreateConnections();
+#else
+ parent->layout()->addWidget(new QLabel("Please install Qt with the WebKit option to see cool pictures!
"));
+#endif
+ }
+}
+
+#ifdef QT_WEBKIT
+void QmitkMitkWorkbenchIntroPart::CreateConnections()
+{
+ if ( m_Controls )
+ {
+ connect( (QObject*)(m_view->page()), SIGNAL(linkClicked(const QUrl& )), this, SLOT(DelegateMeTo(const QUrl& )) );
+ }
+}
+
+
+void QmitkMitkWorkbenchIntroPart::DelegateMeTo(const QUrl& showMeNext)
+{
+ QString scheme = showMeNext.scheme();
+ QByteArray urlHostname = showMeNext.encodedHost();
+ QByteArray urlPath = showMeNext.encodedPath();
+ QByteArray dataset = showMeNext.encodedQueryItemValue("dataset");
+ QByteArray clear = showMeNext.encodedQueryItemValue("clear");
+
+ if (scheme.isEmpty()) MITK_INFO << " empty scheme of the to be delegated link" ;
+
+ // if the scheme is set to mitk, it is to be tested which action should be applied
+ if (scheme.contains(QString("mitk")) )
+ {
+ if(urlPath.isEmpty() ) MITK_INFO << " mitk path is empty " ;
+
+ // searching for the perspective keyword within the host name
+ if(urlHostname.contains(QByteArray("perspectives")) )
+ {
+ // the simplified method removes every whitespace
+ // ( whitespace means any character for which the standard C++ isspace() method returns true)
+ urlPath = urlPath.simplified();
+ QString tmpPerspectiveId(urlPath.data());
+ tmpPerspectiveId.replace(QString("/"), QString("") );
+ std::string perspectiveId = tmpPerspectiveId.toStdString();
+
+ // is working fine as long as the perspective id is valid, if not the application crashes
+ GetIntroSite()->GetWorkbenchWindow()->GetWorkbench()->ShowPerspective(perspectiveId, GetIntroSite()->GetWorkbenchWindow() );
+
+ // search the Workbench for opened StdMultiWidgets to ensure the focus does not stay on the welcome screen and is switched to
+ // an StdMultiWidget if one available
+ mitk::IDataStorageService::Pointer service =
+ berry::Platform::GetServiceRegistry().GetServiceById(mitk::IDataStorageService::ID);
+ berry::IEditorInput::Pointer editorInput;
+ editorInput = new mitk::DataStorageEditorInput( service->GetActiveDataStorage() );
+
+ // the solution is not clean, but the dependency to the StdMultiWidget was removed in order to fix a crash problem
+ // as described in Bug #11715
+ // This is the correct way : use the static string ID variable
+ // berry::IEditorPart::Pointer editor = GetIntroSite()->GetPage()->FindEditors( editorInput, QmitkStdMultiWidgetEditor::EDITOR_ID );
+ // QuickFix: we use the same string for an local variable
+ const std::string stdEditorID = "org.mitk.editors.stdmultiwidget";
+
+ // search for opened StdMultiWidgetEditors
+ std::vector editorList = GetIntroSite()->GetPage()->FindEditors( editorInput, stdEditorID, 1 );
+
+ // if an StdMultiWidgetEditor open was found, give focus to it
+ if(editorList.size())
+ {
+ GetIntroSite()->GetPage()->Activate( editorList[0]->GetPart(true) );
+ }
+
+ }
+ }
+ // if the scheme is set to http, by default no action is performed, if an external webpage needs to be
+ // shown it should be implemented below
+ else if (scheme.contains(QString("http")) )
+ {
+ QDesktopServices::openUrl(showMeNext);
+// m_view->load( ) ;
+ }
+ else if(scheme.contains("qrc"))
+ {
+ m_view->load(showMeNext);
+ }
+
+}
+
+#endif
+
+void QmitkMitkWorkbenchIntroPart::StandbyStateChanged(bool standby)
+{
+
+}
+
+
+void QmitkMitkWorkbenchIntroPart::SetFocus()
+{
+
+}
diff --git a/Plugins/org.mitk.gui.qt.extapplication/src/internal/QmitkMitkWorkbenchIntroPart.h b/Plugins/org.mitk.gui.qt.extapplication/src/internal/QmitkMitkWorkbenchIntroPart.h
new file mode 100644
index 0000000000..06db8a2e27
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.extapplication/src/internal/QmitkMitkWorkbenchIntroPart.h
@@ -0,0 +1,93 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+
+#ifndef QMITKWORKBENCHINTROPART_H_
+#define QMITKWORKBENCHINTROPART_H_
+
+#include
+
+#include
+#include
+
+
+/**
+ * \ingroup org_mitk_gui_qt_welcomescreen_internal
+ * \brief QmitkMitkWorkbenchIntroPart
+ * The WelcomeView Module is an helpful feature to people new to MITK. The main idea is to provide first
+ * information about the MITK Workbench.
+ * The WelcomeView is realized by making use of the QTWebKit Module. The Qt WebKit module
+ * provides an HTML browser engine that makes it easy to embed web content into native applications, and to enhance
+ * web content with native controls.
+ * For the welcome view of the application the QWebView, QWebPage classes have been used. The shown WelcomeView
+ * html start page is styled by an external css stylesheet. The required resources as well as the html pages are integrated
+ * into the QtResource system. The QT resource system allows the storage of files like html pages, css pages, jpgs etc.
+ * as binaries within the executable.
+ * This minimizes the risk of loosing resource files as well as the risk of getting files deleted. In order to use the Qt
+ * resource system the resource files have to be added to the associated qrt resource file list.
+ *
+ * The foundation is set to design more complex html pages. The Q::WebPage gives options to set a
+ * LinkDelegationPolicy. The used policy defines how links to external or internal resources are handled. To fit our needs
+ * the delegate all links policy is used. This requires all external as well as internal links of the html pages to be handle
+ * explicitly. In order to change mitk working modes (perspectives) a mitk url scheme has been designed. The url scheme
+ * is set to mitk. The url host provides information about what's next to do. In our case, the case of switching to a
+ * particular working mode the host is set to perspectives. The followed path provides information about the perspective id.
+ * (e.g. mitk//::mitk.perspectives/org.mitk.qt.defaultperspective) The the generic design of the mitk url scheme allows to
+ * execute other task depending on the mitk url host.
+ * \sa QmitkWelcomePage Editor
+ */
+
+class QWebView ;
+
+class QmitkMitkWorkbenchIntroPart : public berry::QtIntroPart
+{
+
+// this is needed for all Qt objects that should have a MOC object (everything that derives from QObject)
+ Q_OBJECT
+
+public:
+
+ QmitkMitkWorkbenchIntroPart();
+ QmitkMitkWorkbenchIntroPart(const QmitkMitkWorkbenchIntroPart& other)
+ {
+ Q_UNUSED(other)
+ throw std::runtime_error("Copy constructor not implemented");
+ }
+ ~QmitkMitkWorkbenchIntroPart();
+
+
+ virtual void CreateQtPartControl(QWidget *parent);
+
+ void StandbyStateChanged(bool standby);
+
+ void SetFocus();
+#ifdef QT_WEBKIT
+
+ virtual void CreateConnections();
+
+
+protected slots:
+
+
+ void DelegateMeTo(const QUrl& ShowMeNext);
+#endif
+protected:
+
+ Ui::QmitkWelcomeScreenViewControls* m_Controls;
+ QWebView* m_view;
+};
+
+#endif /* QMITKWORKBENCHINTROPART_H_ */
diff --git a/Plugins/org.mitk.gui.qt.extapplication/src/internal/perspectives/QmitkEditorPerspective.cpp b/Plugins/org.mitk.gui.qt.extapplication/src/internal/perspectives/QmitkEditorPerspective.cpp
new file mode 100644
index 0000000000..6c787290a9
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.extapplication/src/internal/perspectives/QmitkEditorPerspective.cpp
@@ -0,0 +1,21 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+#include "QmitkEditorPerspective.h"
+
+void QmitkEditorPerspective::CreateInitialLayout(berry::IPageLayout::Pointer /*layout*/)
+{
+}
diff --git a/Plugins/org.mitk.gui.qt.extapplication/src/internal/perspectives/QmitkEditorPerspective.h b/Plugins/org.mitk.gui.qt.extapplication/src/internal/perspectives/QmitkEditorPerspective.h
new file mode 100644
index 0000000000..83496d942f
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.extapplication/src/internal/perspectives/QmitkEditorPerspective.h
@@ -0,0 +1,41 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+
+#ifndef QMITKEDITORPERSPECTIVE_H_
+#define QMITKEDITORPERSPECTIVE_H_
+
+#include
+
+class QmitkEditorPerspective : public QObject, public berry::IPerspectiveFactory
+{
+ Q_OBJECT
+ Q_INTERFACES(berry::IPerspectiveFactory)
+
+public:
+
+ QmitkEditorPerspective() {}
+ QmitkEditorPerspective(const QmitkEditorPerspective& other)
+ {
+ Q_UNUSED(other)
+ throw std::runtime_error("Copy constructor not implemented");
+ }
+ ~QmitkEditorPerspective() {}
+
+ void CreateInitialLayout(berry::IPageLayout::Pointer /*layout*/);
+};
+
+#endif /* QMITKEDITORPERSPECTIVE_H_ */
diff --git a/Plugins/org.mitk.gui.qt.extapplication/src/internal/perspectives/QmitkWelcomeScreenViewControls.ui b/Plugins/org.mitk.gui.qt.extapplication/src/internal/perspectives/QmitkWelcomeScreenViewControls.ui
new file mode 100644
index 0000000000..4a7cda1314
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.extapplication/src/internal/perspectives/QmitkWelcomeScreenViewControls.ui
@@ -0,0 +1,34 @@
+
+
+ QmitkWelcomeScreenViewControls
+
+
+
+ 0
+ 0
+ 458
+ 398
+
+
+
+
+ 0
+ 0
+
+
+
+ QmitkTemplate
+
+
+
+ 0
+
+ -
+
+
+
+
+
+
+
+