+ SUIT_Desktop* desk = application()->desktop();
+
+ // VSR: 19/06/2011: do not use Paraview's methods, since it conflicts with SALOME GUI architecture
+ // ... the following code is commented...
+ // Save the state of the window ...
+ // pqApplicationCore::instance()->settings()->saveState(*desk, "MainWindow");
+ //
+ //for (int i = 0; i < myDockWidgets.size(); ++i)
+ // myDockWidgets.at(i)->setParent(0);
+ // ... and replaced - manually hide dock windows
+
+ // store dock widgets visibility state and hide'em all
+ QMapIterator<QWidget*, bool> it1( myDockWidgets );
+ while( it1.hasNext() ) {
+ it1.next();
+ QDockWidget* dw = qobject_cast<QDockWidget*>( it1.key() );
+ myDockWidgets[dw] = dw->isVisible();
+ dw->setVisible( false );
+ dw->toggleViewAction()->setVisible( false );
+ }
+ // store toolbar breaks state and remove all tollbar breaks
+ QMapIterator<QWidget*, bool> it2( myToolbarBreaks );
+ while( it2.hasNext() ) {
+ it2.next();
+ QToolBar* tb = qobject_cast<QToolBar*>( it2.key() );
+ myToolbarBreaks[tb] = desk->toolBarBreak( tb );
+ if ( myToolbarBreaks[tb] )
+ desk->removeToolBarBreak( tb );
+ }
+ // store toolbars visibility state and hide'em all
+ QMapIterator<QWidget*, bool> it3( myToolbars );
+ while( it3.hasNext() ) {
+ it3.next();
+ QToolBar* tb = qobject_cast<QToolBar*>( it3.key() );
+ myToolbars[tb] = tb->isVisible();
+ tb->setVisible( false );
+ tb->toggleViewAction()->setVisible( false );
+ }
+}
+
+/*!
+ \brief Restore states of dockable ParaView widgets.
+*/
+void PVGUI_Module::restoreDockWidgetsState()
+{
+ SUIT_Desktop* desk = application()->desktop();
+
+ // VSR: 19/06/2011: do not use Paraview's methods, since it conflicts with SALOME GUI architecture
+ // ... the following code is commented...
+ //for (int i = 0; i < myDockWidgets.size(); ++i)
+ // myDockWidgets.at(i)->setParent(desk);
+ //
+ // Restore the state of the window ...
+ //pqApplicationCore::instance()->settings()->restoreState("MainWindow", *desk);
+ // ... and replaced - manually hide dock windows
+
+ // restore dock widgets visibility state
+ QMapIterator<QWidget*, bool> it1( myDockWidgets );
+ while( it1.hasNext() ) {
+ it1.next();
+ QDockWidget* dw = qobject_cast<QDockWidget*>( it1.key() );
+ dw->setVisible( it1.value() );
+ dw->toggleViewAction()->setVisible( true );
+ }
+
+ // restore toolbar breaks state
+ QMapIterator<QWidget*, bool> it2( myToolbarBreaks );
+ while( it2.hasNext() ) {
+ it2.next();
+ QToolBar* tb = qobject_cast<QToolBar*>( it2.key() );
+ if ( myToolbarBreaks[tb] )
+ desk->insertToolBarBreak( tb );
+ }
+
+ // restore toolbar visibility state
+ QMapIterator<QWidget*, bool> it3( myToolbars );
+ while( it3.hasNext() ) {
+ it3.next();
+ QToolBar* tb = qobject_cast<QToolBar*>( it3.key() );
+ tb->setVisible( it3.value() );
+ 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.
+
+ //LightApp_Application* anApp = getApp();
+ SalomeApp_Application* anApp = getApp();
+ if(!anApp)
+ return;
+
+// int begin = SalomeApp_Application::WT_ObjectBrowser;
+// int end = SalomeApp_Application::WT_NoteBook;
+ int begin = LightApp_Application::WT_ObjectBrowser;
+ int end = LightApp_Application::WT_User;
+ 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<QDockWidget*>( 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();
+// LightApp_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<QDockWidget*>( w );
+ w = w->parentWidget();
+ }
+ if(dock) {
+ dock->setVisible(it.value());
+ }
+ }
+ }