From: rnv Date: Fri, 4 Oct 2013 14:04:09 +0000 (+0000) Subject: Implementation of the "0021709: [CEA 583] Toolbar preferences" issue. X-Git-Tag: V7_3_0a1~29 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=137da6515933db160a26aded31138f2474f53634;p=modules%2Fparavis.git Implementation of the "0021709: [CEA 583] Toolbar preferences" issue. --- diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in index 7ac28971..3b41bfc5 100644 --- a/resources/SalomeApp.xml.in +++ b/resources/SalomeApp.xml.in @@ -45,4 +45,10 @@
+
+ +
+
+ +
diff --git a/src/PVGUI/PVGUI_Module.cxx b/src/PVGUI/PVGUI_Module.cxx index 70b4b50f..5aa1d7b9 100644 --- a/src/PVGUI/PVGUI_Module.cxx +++ b/src/PVGUI/PVGUI_Module.cxx @@ -861,6 +861,8 @@ bool PVGUI_Module::activateModule( SUIT_Study* study ) SUIT_ExceptionHandler::addCleanUpRoutine( paravisCleanUp ); + storeCommonWindowsState(); + bool isDone = SalomeApp_Module::activateModule( study ); if ( !isDone ) return false; @@ -951,6 +953,8 @@ bool PVGUI_Module::deactivateModule( SUIT_Study* study ) if (myOldMsgHandler) qInstallMsgHandler(myOldMsgHandler); + restoreCommonWindowsState(); + return SalomeApp_Module::deactivateModule( study ); } diff --git a/src/PVGUI/PVGUI_Module.h b/src/PVGUI/PVGUI_Module.h index 90c33146..b56bf235 100644 --- a/src/PVGUI/PVGUI_Module.h +++ b/src/PVGUI/PVGUI_Module.h @@ -211,6 +211,12 @@ private: //! update macros state void updateMacros(); + //! store visibility of the common dockable windows (OB, PyConsole, ... etc.) + void storeCommonWindowsState(); + + //! restore visibility of the common dockable windows (OB, PyConsole, ... etc.) + void restoreCommonWindowsState(); + private slots: void showHelpForProxy( const QString&, const QString& ); @@ -273,6 +279,9 @@ private: WgMap myToolbarBreaks; QList myMenus; + typedef QMap DockWindowMap; + DockWindowMap myCommonMap; + QStringList myTemporaryFiles; QtMsgHandler myOldMsgHandler; diff --git a/src/PVGUI/PVGUI_Module_widgets.cxx b/src/PVGUI/PVGUI_Module_widgets.cxx index 58189278..455c282a 100644 --- a/src/PVGUI/PVGUI_Module_widgets.cxx +++ b/src/PVGUI/PVGUI_Module_widgets.cxx @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -342,3 +343,71 @@ void PVGUI_Module::restoreDockWidgetsState() tb->toggleViewAction()->setVisible( true ); } } + + + +/*! + \brief Store visibility of the common dockable windows (OB, PyConsole, ... etc.) +*/ +void PVGUI_Module::storeCommonWindowsState() { + //rnv: Make behaviour of the dockable windows and toolbars coherent with others + // modules: if 'Save position of the windows' or 'Save position of the toolbars' + // in the General SALOME preferences are cheked, then properties of the windows and/or toolbars + // are stored/restored using standard Qt saveState(...) and restoreState(...) methods. + // Otherwise to the windows and toolbars applied default settins stored int the SalomeApp.xml + // configuration file. + // + // But in contrast to others modules ParaVis module default settings hide some dockable + // windows, so to restore it at the moment of the ParaVis de-activation we call + // restoreCommonWindowsState() method, and at the moment of the ParaVis activation we call + // this method. + + SalomeApp_Application* anApp = getApp(); + if(!anApp) + return; + + int begin = SalomeApp_Application::WT_ObjectBrowser; + int end = SalomeApp_Application::WT_NoteBook; + for( int i = begin; i <= end; i++ ) { + QWidget* wg = anApp->getWindow(i); + if(wg) { + QDockWidget* dock = 0; + QWidget* w = wg->parentWidget(); + while ( w && !dock ) { + dock = ::qobject_cast( w ); + w = w->parentWidget(); + } + if(dock){ + if(!myCommonMap.contains(i)){ + myCommonMap.insert(i,dock->isVisible()); + } else { + myCommonMap[i] = dock->isVisible(); + } + } + } + } +} + +/*! + \brief Restore visibility of the common dockable windows (OB, PyConsole, ... etc.) +*/ +void PVGUI_Module::restoreCommonWindowsState() { + SalomeApp_Application* anApp = getApp(); + if(!anApp) + return; + DockWindowMap::const_iterator it = myCommonMap.begin(); + for( ;it != myCommonMap.end(); it++ ) { + QWidget* wg = anApp->getWindow(it.key()); + if(wg) { + QDockWidget* dock = 0; + QWidget* w = wg->parentWidget(); + while ( w && !dock ) { + dock = ::qobject_cast( w ); + w = w->parentWidget(); + } + if(dock) { + dock->setVisible(it.value()); + } + } + } +}