Commit 2501290f authored by lassoan's avatar lassoan

ENH: Made default startup and favorite module configurable

When building custom applications based on Slicer it is often required to change the default startup module (Welcome) and favorite modules (on toolbar). Made these settings configurable from CMake, without requiring patching of source files.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@24250 3bd1e089-480b-0410-8dfb-8563597acbee
parent a1134755
......@@ -121,9 +121,18 @@ void qSlicerSettingsModulesPanelPrivate::init()
this->TemporaryDirectoryButton->setDirectory(coreApp->defaultTemporaryPath());
this->DisableModulesListView->setFactoryManager( factoryManager );
this->FavoritesModulesListView->setFactoryManager( factoryManager );
this->ModulesMenu->setCurrentModule("Welcome");
this->ModulesMenu->setCurrentModule(Slicer_DEFAULT_HOME_MODULE);
// Slicer_DEFAULT_FAVORITE_MODULES contains module names in a comma-separated list
// (chosen this format because the same format is used for storing the favorites list in the .ini file).
QStringList favoritesRaw = QString(Slicer_DEFAULT_FAVORITE_MODULES).split(",", QString::SkipEmptyParts);
// The separator commas have been removed, but we also need need to remove leading and trailing spaces from the retrieved names.
QStringList favorites;
favorites << "SubjectHierarchy" << "Volumes" << "Models" << "Transforms" << "Markups" << "Editor";
foreach(QString s, favoritesRaw)
{
favorites << s.trimmed();
}
this->FavoritesModulesListView->filterModel()->setShowModules(favorites);
// Register settings
......
......@@ -11,6 +11,9 @@
#define SLICER_REVISION_SPECIFIC_USER_SETTINGS_FILEBASENAME "@SLICER_REVISION_SPECIFIC_USER_SETTINGS_FILEBASENAME@"
#define Slicer_DEFAULT_HOME_MODULE "@Slicer_DEFAULT_HOME_MODULE@"
#define Slicer_DEFAULT_FAVORITE_MODULES "@Slicer_DEFAULT_FAVORITE_MODULES@"
#if defined(WIN32) && !defined(VTKSLICER_STATIC)
#pragma warning ( disable : 4275 )
#endif
......
......@@ -429,6 +429,24 @@ message(STATUS "Configuring ${Slicer_MAIN_PROJECT_APPLICATION_NAME} organization
set(SLICER_REVISION_SPECIFIC_USER_SETTINGS_FILEBASENAME "")
#-----------------------------------------------------------------------------
# Home and favorite modules
#-----------------------------------------------------------------------------
if(NOT DEFINED Slicer_DEFAULT_HOME_MODULE)
set(Slicer_DEFAULT_HOME_MODULE "Welcome" CACHE STRING "Name of the module that Slicer activates on start-up by default")
endif()
mark_as_advanced(Slicer_DEFAULT_HOME_MODULE)
mark_as_superbuild(Slicer_DEFAULT_HOME_MODULE)
message(STATUS "Configuring ${Slicer_MAIN_PROJECT_APPLICATION_NAME} default home module [${Slicer_DEFAULT_HOME_MODULE}]")
if(NOT DEFINED Slicer_DEFAULT_FAVORITE_MODULES)
set(Slicer_DEFAULT_FAVORITE_MODULES "SubjectHierarchy, Volumes, Models, Transforms, Markups, Editor" CACHE STRING "Name of the modules shown on the toolbar by default (comma-separated list)")
endif()
mark_as_advanced(Slicer_DEFAULT_FAVORITE_MODULES)
mark_as_superbuild(Slicer_DEFAULT_FAVORITE_MODULES)
message(STATUS "Configuring ${Slicer_MAIN_PROJECT_APPLICATION_NAME} default favorite modules [${Slicer_DEFAULT_FAVORITE_MODULES}]")
#-----------------------------------------------------------------------------
# Slicer version number.
#-----------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment