From: dmv Date: Tue, 23 Nov 2010 16:18:45 +0000 (+0000) Subject: correct changes for 0000059: Activate module by default X-Git-Tag: DIAGRAM_0_1~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=603fab555b8e88fde8bf770ae2253a882d9e6f77;p=modules%2Fgui.git correct changes for 0000059: Activate module by default --- diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 363bb9dbe..a66da96d2 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -674,9 +674,12 @@ QString LightApp_Application::defaultModule() const { QStringList aModuleNames; modules( aModuleNames, false ); // obtain a complete list of module names for the current configuration - //! If there's the one and only module --> activate it automatically - //! TODO: Possible improvement - default module can be taken from preferences - return aModuleNames.count() > 1 ? QString( "" ) : ( aModuleNames.count() ? aModuleNames.first() : "" ); + + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int sel = 0; + sel = resMgr->integerValue( "Activate", "def_module" ); + + return aModuleNames.count() > 1 && sel > 0 ? aModuleNames.at( sel - 1 ) : ( aModuleNames.count() ? aModuleNames.first() : "" ); } /*!On new window slot.*/ @@ -734,8 +737,6 @@ void LightApp_Application::onNewDoc() saveDockWindowsState(); CAM_Application::onNewDoc(); - - activateDefaultModule(); } /*! @@ -753,8 +754,6 @@ void LightApp_Application::onOpenDoc() updateWindows(); updateViewManagers(); } - - activateDefaultModule(); } /*! @@ -3216,23 +3215,4 @@ 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 b2bb19510..ae6522855 100644 --- a/src/LightApp/LightApp_Application.h +++ b/src/LightApp/LightApp_Application.h @@ -222,8 +222,6 @@ protected: void loadDockWindowsState(); void saveDockWindowsState(); - void activateDefaultModule(); - virtual void studyOpened( SUIT_Study* ); virtual void studyCreated( SUIT_Study* );