diff --git a/Plugins/org.mitk.gui.qt.extapplication/CMakeLists.txt b/Plugins/org.mitk.gui.qt.extapplication/CMakeLists.txt index 64a92f7cab..50c9d87cc7 100644 --- a/Plugins/org.mitk.gui.qt.extapplication/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.extapplication/CMakeLists.txt @@ -1,6 +1,13 @@ +set(QT_USE_QTWEBKIT TRUE) +include(${QT_USE_FILE}) + +if(QT_QTWEBKIT_FOUND) + add_definitions(-DQT_WEBKIT) +endif(QT_QTWEBKIT_FOUND) + project(org_mitk_gui_qt_extapplication) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE MITK_QT_EXTAPP EXPORTED_INCLUDE_SUFFIXES src ) diff --git a/Plugins/org.mitk.gui.qt.extapplication/files.cmake b/Plugins/org.mitk.gui.qt.extapplication/files.cmake index 77328988e7..e7bcaae435 100644 --- a/Plugins/org.mitk.gui.qt.extapplication/files.cmake +++ b/Plugins/org.mitk.gui.qt.extapplication/files.cmake @@ -1,40 +1,49 @@ set(SRC_CPP_FILES ) set(INTERNAL_CPP_FILES QmitkExtApplication.cpp QmitkExtApplicationPlugin.cpp QmitkExtAppWorkbenchAdvisor.cpp - QmitkExtDefaultPerspective.cpp + QmitkMitkWorkbenchIntroPart.cpp + perspectives/QmitkEditorPerspective.cpp + perspectives/QmitkExtDefaultPerspective.cpp ) set(MOC_H_FILES src/internal/QmitkExtApplication.h src/internal/QmitkExtApplicationPlugin.h - src/internal/QmitkExtDefaultPerspective.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/resources/welcome/QmitkWelcomeScreenView.qrc b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/QmitkWelcomeScreenView.qrc new file mode 100644 index 0000000000..c24d388671 --- /dev/null +++ b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/QmitkWelcomeScreenView.qrc @@ -0,0 +1,12 @@ + + + style.css + function.js + pics/background.jpg + pics/popup_bttn_close.png + pics/experimental.png + pics/button_mitka.png + pics/button_mitk.png + mitkworkbenchwelcomeview.html + + diff --git a/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/function.js b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/function.js new file mode 100644 index 0000000000..513330f719 --- /dev/null +++ b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/function.js @@ -0,0 +1,257 @@ +// If you want to create a new button you have to add some data (strings) to the following five arrays. +// Make sure that you add your data at the same position in each array. +// The buttons will be generated in order to the array's index. e.g. data at array's index '0' will generate the first button. + +// enter the name of your module here +var moduleNames = new Array("MITK Downloads & News"); + +// add the MITK-link to your module +var moduleLinks = new Array("http://www.mitk.org"); + +// add the filename of your icon for the module. Place the picture in subdirectory "pics". +// The picture's width should be 136 pixel; the height 123 pixel. +var picFilenames = new Array("button_mitk.png"); + +// if you want to create an animated icon, add the name of your animated gif (placed in subdirectory "pics"). Otherwise enter an empty string "". +// The animation's width should be 136 pixel; the height 123 pixel. +var aniFilenames = new Array("button_mitka.png"); + +// if your module is not stable, you can mark it as experimental. +// just set true for experimental or false for stable. +var experimental = new Array(false); + +// add the description for your module. The description is displayed in a PopUp-window. +var moduleDescriptions = new Array("Open the MITK website in an external browser."); + +var bttns = new Array(); + +var d = document, da = d.all; + +// holds id of current mouseover-HTML-element +var currentTarget; + +// get the id of current mouseover-HTML-element +d.onmouseover = function(o){ + var e = da ? event.srcElement : o.target; + currentTarget = e.id; +} + + +// build-function called by onload-event in HTML-document +function createButtons(){ + + for (i=0; i < moduleNames.length; i++){ + bttns[i] = new Button(moduleNames[i],moduleLinks[i], picFilenames[i], aniFilenames[i],moduleDescriptions[i]); + bttns[i].createButton(); + } + + for (i=0; i < moduleNames.length; i++){ + + if(experimental[i]){ + setExperimental(i); + } + } + + createClearFloat(); +} + +// Class Button +function Button(moduleName, moduleLink, picFilename, aniFilename, moduleDescr){ + + // Properties + this.bttnID = "bttn" + moduleName; + this.modName = moduleName; + this.modLink = moduleLink; + this.picPath = "pics/" + picFilename; + this.aniPath = "pics/" + aniFilename; + this.modDescr = moduleDescr; + + // Methods + this.createButton = function(){ + + // get DIV-wrapper for Button and append it to HTML-document + bttnWrapper = this.createWrapper(); + document.getElementById("bttnField").appendChild(bttnWrapper); + + // get link-element for picture and append it to DIV-wrapper + bttnPicLink = this.createPicLink(); + bttnWrapper.appendChild(bttnPicLink); + + // set HTML attributes for button-element + bttn = document.createElement("img"); + bttn.src = this.picPath; + bttn.id = this.bttnID; + bttn.className = "modBttn"; + bttn.height = 123; + bttn.width = 136; + bttn.onmouseover = function(){startAni(this.id);}; + bttn.onmouseout = function(){stopAni(this.id);}; + + // append button to link-element + bttnPicLink.appendChild(bttn); + + // create text-link and add it to DIV-wrapper + bttnTxtLink = document.createElement("a"); + bttnTxtLink.href = this.modLink; + bttnTxtLink.className = "txtLink"; + bttnTxtLink.appendChild(document.createTextNode(this.modName)); + bttnWrapper.appendChild(bttnTxtLink); + + // create pop-up link for module description + bttnPopUpLink = document.createElement("a"); + modName = this.modName; + modDescr = this.modDescr; + bttnPopUpLink.onclick = function(){showPopUpWindow();}; + bttnPopUpLink.className = "popUpLink"; + bttnPopUpLink.id = "popup" + this.modName; + bttnPopUpLink.appendChild(document.createTextNode("more info >>")); + bttnWrapper.appendChild(document.createElement("br")); + bttnWrapper.appendChild(bttnPopUpLink); + + return bttn; + } + + this.createWrapper = function(){ + bttnWrapper = document.createElement("div"); + bttnWrapper.id = "wrapper" + this.modName; + bttnWrapper.className = "bttnWrap"; + + return bttnWrapper; + } + + this.createPicLink = function(){ + picLink = document.createElement("a"); + picLink.href = this.modLink; + picLink.id = "link" + this.modName; + + return picLink; + } + +} + + +function showPopUpWindow(){ + + // modules position in array? + modulePos = getPos(currentTarget,"popup"); + + // get reference to anchor-element in HTML-document + popUpAnchor = document.getElementById("popupAnchor"); + + // check if a popUp is open + if(popUpAnchor.hasChildNodes()){ + // if a popUp is open, remove it! + popUpAnchor.removeChild(document.getElementById("popup")); + } + + // create new container for popUp + container = document.createElement("div"); + container.id = "popup"; + container.align = "right"; + + // append popUp-container to HTML-document + popUpAnchor.appendChild(container); + + // create close-button and append it to popUp-container + bttnClose = document.createElement("img"); + bttnClose.src = "pics/popup_bttn_close.png"; + bttnClose.id = "bttnClose"; + bttnClose.onclick = function(){closeInfoWindow();}; + container.appendChild(bttnClose); + + // create container for content-elements + contHeadline = document.createElement("div"); + contHeadline.id = "contHeadline"; + contDescription = document.createElement("div"); + contDescription.id = "contDescription"; + contModLink = document.createElement("div"); + contModLink.id = "contModLink"; + + // append content-container to popUp-container + container.appendChild(contHeadline); + container.appendChild(contDescription); + container.appendChild(contModLink); + + // create text-elements with content + headline = document.createTextNode(moduleNames[modulePos] + " "); + description = document.createTextNode(moduleDescriptions[modulePos]); + moduleLink = document.createElement("a"); + moduleLink.href = moduleLinks[modulePos] ; + moduleLink.className = 'moduleLink'; + moduleLinkTxt = document.createTextNode("Click here to open '" + moduleNames[modulePos].toLowerCase() + "'"); + moduleLink.appendChild(moduleLinkTxt); + + // append text-elements to their container + contHeadline.appendChild(headline); + contDescription.appendChild(description); + contModLink.appendChild(moduleLink); +} + +function getPos(id,prefix){ + + if(prefix == "popup"){ + targetID = id.slice(5); + }else{ + if(prefix == "bttn"){ + targetID = id.slice(4); + } + } + + for(i=0; i < moduleNames.length; i++ ){ + if(moduleNames[i] == targetID){ + return i; + } + } +} + +function setExperimental(modPos){ + linkID = "link" + moduleNames[modPos]; + + expPic = document.createElement("img"); + expPic.src = "pics/experimental.png"; + expPic.className = "expPic"; + //alert(bttns[modPos].bttnID); + expPic.onmouseover = function(){startAni(bttns[modPos].bttnID);changeToHover(bttns[modPos].bttnID);}; + expPic.onmouseout = function(){stopAni(bttns[modPos].bttnID);changeToNormal(bttns[modPos].bttnID);}; + + document.getElementById(linkID).appendChild(expPic); +} + +function changeToHover(targetId){ + bttn = document.getElementById(targetId); + bttn.className = "modBttnHover"; +} + +function changeToNormal(targetId){ + bttn = document.getElementById(targetId); + bttn.className = "modBttn"; +} + +// function to close PopUp-window +function closeInfoWindow(){ + popUpAnchor = document.getElementById("popupAnchor"); + popUpAnchor.removeChild(document.getElementById("popup")); +} + +function createClearFloat(){ + cf = document.createElement("div"); + cf.className = "clearfloat"; + document.getElementById("bttnField").appendChild(cf); +} + +startAni = function(targetId){ + modulePos = getPos(targetId,"bttn"); + + if(aniFilenames[modulePos] != ''){ + bttn = document.getElementById(targetId); + bttn.src = "pics/" + aniFilenames[modulePos]; + } +} + +stopAni = function(targetId){ + modulePos = getPos(targetId,"bttn"); + + bttn = document.getElementById(targetId); + bttn.src = "pics/" + picFilenames[modulePos]; +} + diff --git a/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/mitkworkbenchwelcomeview.html b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/mitkworkbenchwelcomeview.html new file mode 100644 index 0000000000..eb16e88264 --- /dev/null +++ b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/mitkworkbenchwelcomeview.html @@ -0,0 +1,37 @@ + + + + + + MITK Workbench + + + + + + +
+ + +
+ +

Welcome to MITK Workbench!

+ + +
+ +
+ This application was developed at the German Cancer Research Center (DKFZ). The software is developed on the basis of the well established, free open source software toolkit The Medical Imaging Interaction Toolkit (MITK). For additional information check the help pages or our website www.mitk.org. +

Instructions:

+
+ +
+ + +
+ +
+ +
+ + diff --git a/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/background.jpg b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/background.jpg new file mode 100644 index 0000000000..c93f36df92 Binary files /dev/null and b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/background.jpg differ diff --git a/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/button_mitk.png b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/button_mitk.png new file mode 100644 index 0000000000..821e041d36 Binary files /dev/null and b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/button_mitk.png differ diff --git a/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/button_mitka.png b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/button_mitka.png new file mode 100644 index 0000000000..baf4f14a46 Binary files /dev/null and b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/button_mitka.png differ diff --git a/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/experimental.png b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/experimental.png new file mode 100644 index 0000000000..b05093ea2e Binary files /dev/null and b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/experimental.png differ diff --git a/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/popup_bg.png b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/popup_bg.png new file mode 100644 index 0000000000..9fef73a742 Binary files /dev/null and b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/popup_bg.png differ diff --git a/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/popup_bg_bottom.png b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/popup_bg_bottom.png new file mode 100644 index 0000000000..f181fb97e2 Binary files /dev/null and b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/popup_bg_bottom.png differ diff --git a/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/popup_bg_middle.png b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/popup_bg_middle.png new file mode 100644 index 0000000000..fd477da298 Binary files /dev/null and b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/popup_bg_middle.png differ diff --git a/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/popup_bg_top.png b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/popup_bg_top.png new file mode 100644 index 0000000000..99424cbbb7 Binary files /dev/null and b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/popup_bg_top.png differ diff --git a/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/popup_bttn_close.png b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/popup_bttn_close.png new file mode 100644 index 0000000000..279e340beb Binary files /dev/null and b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/popup_bttn_close.png differ diff --git a/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/shadow.png b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/shadow.png new file mode 100644 index 0000000000..83eda7b89e Binary files /dev/null and b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/pics/shadow.png differ diff --git a/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/style.css b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/style.css new file mode 100644 index 0000000000..55dc94a56b --- /dev/null +++ b/Plugins/org.mitk.gui.qt.extapplication/resources/welcome/style.css @@ -0,0 +1,174 @@ +@charset "utf-8"; + +body{ + margin:0px 0px; + padding: 0px 0px; +} + +h1{ + margin:0px 0px; + padding: 0px 0px; + font-family:"Times New Roman", Times, serif; + color:#333; +} + +img{border:none;} + +#screen{ + width:100%; + min-height:1060px; + height:100%; + padding-top:15px; + background-color:#888888; + background-image:url(pics/background.jpg); + background-repeat:repeat-x; +} + +#welcome{ + min-width:150px; + max-width:690px; + margin: 0 auto; + padding-left:5px; + font-family:"Times New Roman", Times, serif; + color:#333; +} + +#welcomeText{ + margin-top:15px; + margin-bottom:15px; + z-index:1; +} + +#bttnField{ + min-width:150px; + max-width:690px; + margin: 0 auto; + padding-left:5px; +} + +.bttnWrap{ + position:relative; + float:left; + width:140px; + height:190px; + margin-right:32px; + margin-top:5px; + z-index:2; +} + +.modBttn{ + margin-bottom:8px; + border: solid 2px #000; + -webkit-box-shadow: 5px 5px 6px rgba(0,0,0,0.6); +} + +.modBttn:hover{ + border: solid 2px #FFF; + cursor:pointer; + -webkit-box-shadow: none; +} + +.modBttnHover{ + margin-bottom:8px; + border: solid 2px #FFF; + cursor:pointer; + -webkit-box-shadow: none; +} + +.txtLink{ + font-family:"Times New Roman", Times, serif; + font-size:16px; + font-weight:bold; + text-decoration:none; + cursor:pointer; + color:#333; +} + +.txtLink:hover{ + text-decoration:underline; +} + +.popUpLink{ + font-family:"Times New Roman", Times, serif; + font-size:14px; + font-weight:normal; + line-height:16px; + color:#333; +} + +.popUpLink:hover{ + text-decoration:underline; + cursor:pointer; +} + +#popup{ + position:fixed; + max-width:690px; + min-width:150px; + background-color:#000000; + opacity: 0.8; + -webkit-border-radius: 1em; + z-index:3; + font-family:Arial, Helvetica, sans-serif; + color:#FFF; +} + +#bttnClose{ + position:relative; + right:10px; + top:10px; + cursor:pointer; +} + +#contHeadline{ + max-width:690px; + min-width:150px; + margin-left:10px; + margin-right:10px; + font-weight:bold; + font-size:14px; + text-align:left; +} + +#contDescription{ + max-width:690px; + min-width:150px; + margin-top:15px; + margin-bottom:15px; + margin-left:10px; + margin-right:10px; + line-height:21px; + font-family:Arial, Helvetica, sans-serif; + font-weight:normal; + font-size:14px; + text-align:left; +} + +#contModLink{ + max-width:690px; + min-width:150px; + height:50px; + margin-left:10px; + margin-right:10px; + text-align:left; +} + +.moduleLink{ + font-family:Arial, Helvetica, sans-serif; + color:#FFF; +} + +.expPic{ + margin-top:-126px; +} + +.clearfloat{clear:both;} + + + + + + + + + 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/QmitkExtDefaultPerspective.h b/Plugins/org.mitk.gui.qt.extapplication/src/internal/perspectives/QmitkEditorPerspective.cpp old mode 100755 new mode 100644 similarity index 55% copy from Plugins/org.mitk.gui.qt.extapplication/src/internal/QmitkExtDefaultPerspective.h copy to Plugins/org.mitk.gui.qt.extapplication/src/internal/perspectives/QmitkEditorPerspective.cpp index 48e98aae9f..6c787290a9 --- a/Plugins/org.mitk.gui.qt.extapplication/src/internal/QmitkExtDefaultPerspective.h +++ b/Plugins/org.mitk.gui.qt.extapplication/src/internal/perspectives/QmitkEditorPerspective.cpp @@ -1,36 +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" -#ifndef QMITKEXTDEFAULTPERSPECTIVE_H_ -#define QMITKEXTDEFAULTPERSPECTIVE_H_ - -#include - -class QmitkExtDefaultPerspective : public QObject, public berry::IPerspectiveFactory +void QmitkEditorPerspective::CreateInitialLayout(berry::IPageLayout::Pointer /*layout*/) { - Q_OBJECT - Q_INTERFACES(berry::IPerspectiveFactory) - -public: - - QmitkExtDefaultPerspective(); - - void CreateInitialLayout(berry::IPageLayout::Pointer layout); - -}; - -#endif /* QMITKEXTDEFAULTPERSPECTIVE_H_ */ +} diff --git a/Plugins/org.mitk.gui.qt.extapplication/src/internal/QmitkExtDefaultPerspective.h b/Plugins/org.mitk.gui.qt.extapplication/src/internal/perspectives/QmitkEditorPerspective.h old mode 100755 new mode 100644 similarity index 56% copy from Plugins/org.mitk.gui.qt.extapplication/src/internal/QmitkExtDefaultPerspective.h copy to Plugins/org.mitk.gui.qt.extapplication/src/internal/perspectives/QmitkEditorPerspective.h index 48e98aae9f..83496d942f --- a/Plugins/org.mitk.gui.qt.extapplication/src/internal/QmitkExtDefaultPerspective.h +++ b/Plugins/org.mitk.gui.qt.extapplication/src/internal/perspectives/QmitkEditorPerspective.h @@ -1,36 +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 QMITKEXTDEFAULTPERSPECTIVE_H_ -#define QMITKEXTDEFAULTPERSPECTIVE_H_ +#ifndef QMITKEDITORPERSPECTIVE_H_ +#define QMITKEDITORPERSPECTIVE_H_ #include -class QmitkExtDefaultPerspective : public QObject, public berry::IPerspectiveFactory +class QmitkEditorPerspective : public QObject, public berry::IPerspectiveFactory { Q_OBJECT Q_INTERFACES(berry::IPerspectiveFactory) - -public: - QmitkExtDefaultPerspective(); +public: - void CreateInitialLayout(berry::IPageLayout::Pointer layout); + QmitkEditorPerspective() {} + QmitkEditorPerspective(const QmitkEditorPerspective& other) + { + Q_UNUSED(other) + throw std::runtime_error("Copy constructor not implemented"); + } + ~QmitkEditorPerspective() {} + void CreateInitialLayout(berry::IPageLayout::Pointer /*layout*/); }; -#endif /* QMITKEXTDEFAULTPERSPECTIVE_H_ */ +#endif /* QMITKEDITORPERSPECTIVE_H_ */ diff --git a/Plugins/org.mitk.gui.qt.extapplication/src/internal/QmitkExtDefaultPerspective.cpp b/Plugins/org.mitk.gui.qt.extapplication/src/internal/perspectives/QmitkExtDefaultPerspective.cpp old mode 100755 new mode 100644 similarity index 100% rename from Plugins/org.mitk.gui.qt.extapplication/src/internal/QmitkExtDefaultPerspective.cpp rename to Plugins/org.mitk.gui.qt.extapplication/src/internal/perspectives/QmitkExtDefaultPerspective.cpp diff --git a/Plugins/org.mitk.gui.qt.extapplication/src/internal/QmitkExtDefaultPerspective.h b/Plugins/org.mitk.gui.qt.extapplication/src/internal/perspectives/QmitkExtDefaultPerspective.h old mode 100755 new mode 100644 similarity index 100% rename from Plugins/org.mitk.gui.qt.extapplication/src/internal/QmitkExtDefaultPerspective.h rename to Plugins/org.mitk.gui.qt.extapplication/src/internal/perspectives/QmitkExtDefaultPerspective.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 + + + + + + + + + +