From: dmv Date: Fri, 12 Nov 2010 08:03:15 +0000 (+0000) Subject: 0000059: Activate module by default X-Git-Tag: DIAGRAM_0_1~27 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b93edcce2f24161b5c47e9e6a6320cd76e474d63;p=modules%2Fgui.git 0000059: Activate module by default --- diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 9c0206afa..363bb9dbe 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -734,6 +734,8 @@ void LightApp_Application::onNewDoc() saveDockWindowsState(); CAM_Application::onNewDoc(); + + activateDefaultModule(); } /*! @@ -751,6 +753,8 @@ void LightApp_Application::onOpenDoc() updateWindows(); updateViewManagers(); } + + activateDefaultModule(); } /*! @@ -2092,6 +2096,16 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) pref->setItemProperty( "strings", aValuesList, mruLinkType ); pref->setItemProperty( "indexes", anIndicesList, mruLinkType ); + // 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 ); + // theme values Style_Model* aSModel = 0; QStyle* style = qApp->style(); @@ -3203,3 +3217,22 @@ bool LightApp_Application::openAction( const int choice, const QString& aName ) return res; } + +void LightApp_Application::activateDefaultModule() +{ + QString defModName(""); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int sel = resMgr->integerValue( "Activate", "def_module" ); + if ( sel > 0 ) { + LightApp_ModuleAction* moduleAction = + qobject_cast( action( ModulesListId ) ); + if ( moduleAction && moduleAction->activeModule() == "" ) + { + switch( sel ) { + case 1: defModName = "CATHARE GUI"; break; + case 2: defModName = "DIAGRAMS"; break; + } + activateModule( defModName ); + } + } +} \ No newline at end of file diff --git a/src/LightApp/LightApp_Application.h b/src/LightApp/LightApp_Application.h index ae6522855..b2bb19510 100644 --- a/src/LightApp/LightApp_Application.h +++ b/src/LightApp/LightApp_Application.h @@ -222,6 +222,8 @@ protected: void loadDockWindowsState(); void saveDockWindowsState(); + void activateDefaultModule(); + virtual void studyOpened( SUIT_Study* ); virtual void studyCreated( SUIT_Study* ); diff --git a/src/LightApp/resources/LightApp.xml b/src/LightApp/resources/LightApp.xml index 71894f13f..79f876d83 100644 --- a/src/LightApp/resources/LightApp.xml +++ b/src/LightApp/resources/LightApp.xml @@ -87,6 +87,10 @@ +
+ + +
diff --git a/src/LightApp/resources/LightApp_msg_en.ts b/src/LightApp/resources/LightApp_msg_en.ts index 1a18fac4d..97a13a8bf 100644 --- a/src/LightApp/resources/LightApp_msg_en.ts +++ b/src/LightApp/resources/LightApp_msg_en.ts @@ -578,6 +578,26 @@ File does not exist PREF_MRU_LINK_FULL Full + + PREF_DEFAULT_MODULE + Start Options + + + PREF_DEF_MODULE_NAME + Activate module by default: + + + PREF_DEF_MODULE_NONE + Activate nothing + + + PREF_DEF_MODULE_CATHARE + Cathare module + + + PREF_DEF_MODULE_DIAGRAM + Diagram module +