diff --git a/Applications/mitkDiffusion/CMakeLists.txt b/Applications/mitkDiffusion/CMakeLists.txt index 09d8021344..d4b5d97133 100644 --- a/Applications/mitkDiffusion/CMakeLists.txt +++ b/Applications/mitkDiffusion/CMakeLists.txt @@ -1,52 +1,59 @@ project(mitkDiffusion) set(DIFFUSIONAPP_NAME mitkDiffusion) set(_app_options) if(MITK_SHOW_CONSOLE_WINDOW) list(APPEND _app_options SHOW_CONSOLE) endif() MITK_USE_MODULE(qtsingleapplication) include_directories(${ALL_INCLUDE_DIRECTORIES}) # Create a cache entry for the provisioning file which is used to export # the file name in the MITKConfig.cmake file. This will keep external projects # which rely on this file happy. set(DIFFUSIONIMAGINGAPP_PROVISIONING_FILE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${DIFFUSIONAPP_NAME}.provisioning" CACHE INTERNAL "${DIFFUSIONAPP_NAME} provisioning file" FORCE) set(_plugins + org.blueberry.compat + org.blueberry.ui.qt.help org.mitk.diffusionimaging org.mitk.gui.qt.diffusionimagingapp org.mitk.gui.qt.common.legacy org.mitk.gui.qt.ext org.mitk.gui.qt.datamanager org.mitk.gui.qt.measurementtoolbox org.mitk.gui.qt.segmentation org.mitk.gui.qt.volumevisualization org.mitk.gui.qt.diffusionimaging org.mitk.gui.qt.imagenavigator org.mitk.gui.qt.moviemaker org.mitk.planarfigure ) # Plug-ins listed below will not be # - added as a build-time dependency to the executable # - listed in the provisioning file for the executable # - installed if they are external plug-ins set(_exclude_plugins org.blueberry.test org.blueberry.uitest org.mitk.gui.qt.coreapplication org.mitk.gui.qt.extapplication ) FunctionCreateBlueBerryApplication( NAME ${DIFFUSIONAPP_NAME} DESCRIPTION "MITK Diffusion" PLUGINS ${_plugins} EXCLUDE_PLUGINS ${_exclude_plugins} LINK_LIBRARIES ${ALL_LIBRARIES} ${_app_options} ) + +# Add a build time dependency to legacy BlueBerry bundles. +if(MITK_MODULES_ENABLED_PLUGINS) + add_dependencies(ExtApp ${MITK_MODULES_ENABLED_PLUGINS}) +endif() \ No newline at end of file diff --git a/Applications/mitkDiffusion/mitkDiffusion.cpp b/Applications/mitkDiffusion/mitkDiffusion.cpp index 549db57ec2..22049b5439 100644 --- a/Applications/mitkDiffusion/mitkDiffusion.cpp +++ b/Applications/mitkDiffusion/mitkDiffusion.cpp @@ -1,141 +1,136 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Module: $RCSfile$ Language: C++ Date: $Date$ Version: $Revision: 13820 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/ 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 #include #include #include #include #include #include #include #include class QtSafeApplication : public QtSingleApplication { public: QtSafeApplication(int& argc, char** argv) : QtSingleApplication(argc, argv) {} /** * Reimplement notify to catch unhandled exceptions and open an error message. * * @param receiver * @param event * @return */ bool notify(QObject* receiver, QEvent* event) { QString msg; try { return QApplication::notify(receiver, event); } catch (Poco::Exception& e) { msg = QString::fromStdString(e.displayText()); } catch (std::exception& e) { msg = e.what(); } catch (...) { msg = "Unknown exception"; } QString text("An error occurred. You should save all data and quit the program to " "prevent possible data loss.\nSee the error log for details.\n\n"); text += msg; QMessageBox::critical(0, "Error", text); return false; } }; int main(int argc, char** argv) { // Create a QApplication instance first QtSafeApplication qSafeApp(argc, argv); qSafeApp.setApplicationName("mitkDiffusion"); qSafeApp.setOrganizationName("DKFZ"); bool showSplashScreen(true); QPixmap pixmap( ":/splash/splashscreen.png" ); QSplashScreen splash( pixmap ); splash.setMask( pixmap.mask() ); splash.setWindowFlags( Qt::SplashScreen | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint ); if (showSplashScreen) { splash.show(); qSafeApp.sendPostedEvents(); qSafeApp.processEvents(); qSafeApp.flush(); QTimer::singleShot(4000, &splash, SLOT(close()) ); } // This function checks if an instance is already running // and either sends a message to it (containing the command // line arguments) or checks if a new instance was forced by // providing the BlueBerry.newInstance command line argument. // In the latter case, a path to a temporary directory for // the new application's storage directory is returned. QString storageDir = handleNewAppInstance(&qSafeApp, argc, argv, "BlueBerry.newInstance"); // These paths replace the .ini file and are tailored for installation // packages created with CPack. If a .ini file is presented, it will // overwrite the settings in MapConfiguration Poco::Path basePath(argv[0]); basePath.setFileName(""); Poco::Path provFile(basePath); provFile.setFileName("mitkDiffusion.provisioning"); - Poco::Path extPath(basePath); - extPath.pushDirectory("ExtBundles"); - - std::string pluginDirs = extPath.toString(); - - Poco::Util::MapConfiguration* extConfig(new Poco::Util::MapConfiguration()); + Poco::Util::MapConfiguration* diffConfig(new Poco::Util::MapConfiguration()); if (!storageDir.isEmpty()) { - extConfig->setString(berry::Platform::ARG_STORAGE_DIR, storageDir.toStdString()); + diffConfig->setString(berry::Platform::ARG_STORAGE_DIR, storageDir.toStdString()); } - extConfig->setString(berry::Platform::ARG_PLUGIN_DIRS, pluginDirs); - extConfig->setString(berry::Platform::ARG_PROVISIONING, provFile.toString()); - extConfig->setString(berry::Platform::ARG_APPLICATION, "org.mitk.qt.diffusionimagingapp"); + + diffConfig->setString(berry::Platform::ARG_PROVISIONING, provFile.toString()); + diffConfig->setString(berry::Platform::ARG_APPLICATION, "org.mitk.qt.diffusionimagingapp"); // Preload the org.mitk.gui.qt.ext plug-in (and hence also QmitkExt) to speed // up a clean-cache start. This also works around bugs in older gcc and glibc implementations, // which have difficulties with multiple dynamic opening and closing of shared libraries with // many global static initializers. It also helps if dependent libraries have weird static // initialization methods and/or missing de-initialization code. - extConfig->setString(berry::Platform::ARG_PRELOAD_LIBRARY, "liborg_mitk_gui_qt_ext"); + diffConfig->setString(berry::Platform::ARG_PRELOAD_LIBRARY, "liborg_mitk_gui_qt_common"); - return berry::Starter::Run(argc, argv, extConfig); + return berry::Starter::Run(argc, argv, diffConfig); }