From: sln Date: Tue, 24 Apr 2012 15:41:39 +0000 (+0000) Subject: Control "Activate module by default" removed in case of one module X-Git-Tag: CTH_1_7_3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f1898d93f554b91dac5b98c323f026779f261db8;p=modules%2Fgui.git Control "Activate module by default" removed in case of one module --- diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index f53fa4f3a..90160f403 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -2103,14 +2103,27 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) } // Default Module Preferences - int moduleGroup = pref->addPreference( tr( "PREF_DEFAULT_MODULE" ), genTab ); - int moduleNameCombo = pref->addPreference( tr( "PREF_DEF_MODULE_NAME" ), moduleGroup, LightApp_Preferences::Selector, "Activate", "def_module" ); - aValuesList.clear(); - anIndicesList.clear(); - aValuesList << tr("PREF_DEF_MODULE_NONE") << tr("PREF_DEF_MODULE_CATHARE") << tr("PREF_DEF_MODULE_DIAGRAM"); - anIndicesList << 0 << 1 << 2 ; - pref->setItemProperty( "strings", aValuesList, moduleNameCombo ); - pref->setItemProperty( "indexes", anIndicesList, moduleNameCombo ); + QStringList aModuleNames; + modules( aModuleNames, false ); + if ( aModuleNames.count() > 1 ) + { + int moduleGroup = pref->addPreference( tr( "PREF_DEFAULT_MODULE" ), genTab ); + int moduleNameCombo = pref->addPreference( tr( "PREF_DEF_MODULE_NAME" ), moduleGroup, LightApp_Preferences::Selector, "Activate", "def_module" ); + aValuesList.clear(); + anIndicesList.clear(); + aValuesList.append( tr("PREF_DEF_MODULE_NONE") ); + anIndicesList.append( 0 ); + QStringList::iterator it = aModuleNames.begin(); + for ( int ind = 1; it != aModuleNames.end(); ++it, ++ind ) + { + const QString& modName = *it; + aValuesList.append( modName ); + anIndicesList.append( ind ); + } + + pref->setItemProperty( "strings", aValuesList, moduleNameCombo ); + pref->setItemProperty( "indexes", anIndicesList, moduleNameCombo ); + } // theme values Style_Model* aSModel = 0;