| 727 | } |
| 728 | |
| 729 | void BaseApplication::initialize(Poco::Util::Application &self) |
| 730 | { |
| 731 | // 1. Call the super-class method |
| 732 | Poco::Util::Application::initialize(self); |
| 733 | |
| 734 | // 2. Initialize the Qt framework (by creating a QCoreApplication) |
| 735 | this->initializeQt(); |
| 736 | |
| 737 | // 3. Load the "default" configuration, which involves parsing |
| 738 | // an optional <executable-name>.ini file and parsing any |
| 739 | // command line arguments |
| 740 | this->loadConfiguration(); |
| 741 | |
| 742 | // 4. Add configuration data from the command line and the |
| 743 | // optional <executable-name>.ini file as CTK plugin |
| 744 | // framework properties. |
| 745 | d->initializeCTKPluginFrameworkProperties(this->config()); |
| 746 | |
| 747 | // 5. Initialize splash screen if an image path is provided |
| 748 | // in the .ini file |
| 749 | this->initializeSplashScreen(qApp); |
| 750 | |
| 751 | // 6. Set the custom CTK Plugin Framework storage directory |
| 752 | QString storageDir = this->getCTKFrameworkStorageDir(); |
| 753 | |
| 754 | if (!storageDir.isEmpty()) |
| 755 | { |
| 756 | d->m_FWProps[ctkPluginConstants::FRAMEWORK_STORAGE] = storageDir; |
| 757 | |
| 758 | if (!(storageDir.endsWith('/') || storageDir.endsWith('\\'))) |
| 759 | storageDir.append('/'); |
| 760 | |
| 761 | // Initialize core service preferences at the exact same location as their predecessor BlueBerry preferences |
| 762 | mitk::CoreServicePointer preferencesService(mitk::CoreServices::GetPreferencesService()); |
| 763 | preferencesService->InitializeStorage(storageDir.toStdString() + "data/3/prefs.xml"); |
| 764 | |
| 765 | if (!d->m_PreferencesPatches.isEmpty()) |
| 766 | ApplyPreferencesPatchesFromCLI(d->m_PreferencesPatches, preferencesService->GetSystemPreferences()); |
| 767 | |
| 768 | if (!d->m_PreferencesOverrides.isEmpty()) |
| 769 | ApplyPreferencesOverridesFromCLI(d->m_PreferencesOverrides, preferencesService->GetSystemPreferences()); |
| 770 | } |
| 771 | else |
| 772 | { |
| 773 | if (!d->m_PreferencesPatches.isEmpty()) |
| 774 | MITK_WARN << "Preferences patches were supplied but could not be applied because the storage directory was not initialized (e.g. another instance is already running)."; |
| 775 | |
| 776 | if (!d->m_PreferencesOverrides.isEmpty()) |
| 777 | MITK_WARN << "Preferences overrides were supplied but could not be applied because the storage directory was not initialized (e.g. another instance is already running)."; |
| 778 | } |
| 779 | |
| 780 | // 7. Set the library search paths and the pre-load library property |
| 781 | this->initializeLibraryPaths(); |
| 782 | |
| 783 | auto preloadLibs = this->getPreloadLibraries(); |
| 784 | |
| 785 | if (!preloadLibs.isEmpty()) |
| 786 | d->m_FWProps[ctkPluginConstants::FRAMEWORK_PRELOAD_LIBRARIES] = preloadLibs; |