From: rnv Date: Tue, 21 Jan 2014 12:35:58 +0000 (+0000) Subject: Fix the first item of the 0022387: EDF GUI: New behaviour of store position of window... X-Git-Tag: V7_4_0a1~27 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cefbc12b9fc2e08b4b0583b031347ef8f113a387;p=modules%2Fgui.git Fix the first item of the 0022387: EDF GUI: New behaviour of store position of windows is not always suitable" issue: 1) Bad initial position of windows in some modules with the option "store position of windows" unchecked. --- diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 1461178bc..8f67b53aa 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -3255,7 +3255,7 @@ void LightApp_Application::loadDockWindowsState() if ( aResMgr->hasValue("windows_geometry" ,modName ) ) { QByteArray arr; aResMgr->value("windows_geometry", modName , arr ); - QByteArray aTargetArray = processState(arr, storeWin, storeTb, aDefaultState); + QByteArray aTargetArray = processState(arr, storeWin, storeTb, true, aDefaultState); desktop()->restoreState( aTargetArray ); } @@ -3336,7 +3336,7 @@ void LightApp_Application::saveDockWindowsState() modName = activeModule()->name(); QByteArray arr = desktop()->saveState(); - resourceMgr()->setValue( "windows_geometry", modName, processState(arr, storeWin, storeTb) ); + resourceMgr()->setValue( "windows_geometry", modName, processState(arr, storeWin, storeTb, false) ); QByteArray visArr; if ( myWinVis.contains( modName ) ) @@ -4135,12 +4135,27 @@ QList LightApp_Application::findToolBars() { /*! Internal method to parse toolbars and dockable windows state. */ -QByteArray LightApp_Application::processState(QByteArray& input, const bool processWin,const bool processTb, QByteArray defaultState) { +QByteArray LightApp_Application::processState(QByteArray& input, + const bool processWin, + const bool processTb, + const bool isRestoring, + QByteArray defaultState) { QByteArray aRes; bool hasDefaultState = !defaultState.isEmpty(); bool isDockWinWriten = false; - if(processWin && processTb) { + int nbDocWin = -1; + //Write date from users settings + if(isRestoring){ + QDataStream tmpInputData(&input, QIODevice::ReadOnly); + int marker, version; + uchar dockmarker; + tmpInputData >> marker; + tmpInputData >> version; + tmpInputData >> dockmarker; + tmpInputData >> nbDocWin; + } + if(processWin && processTb && !isRestoring) { aRes = input; } else if(!processWin && !processTb ) { if(hasDefaultState) @@ -4171,15 +4186,24 @@ QByteArray LightApp_Application::processState(QByteArray& input, const bool proc QDataStream* aTargetData = 0; int aTargetIndex = -1; - if(processWin) { - //Write date from users settings + QByteArray currentArr = desktop()->saveState(); + QDataStream anInputDataCur(¤tArr, QIODevice::ReadOnly); + bool useInputData = !isRestoring || (isRestoring && nbDocWin > 0); + if(processWin && useInputData) { aTargetData = &anInputData; aTargetIndex = toolBarMarkerIndex; } else { //Write date from default settings if(hasDefaultState) { aTargetData = &anInputDataDef; - aTargetIndex = toolBarMarkerIndexDef; + aTargetIndex = toolBarMarkerIndexDef; + } else { + //If no default state, write current snapshot of the dockable windows + if(isRestoring) { + aTargetData = &anInputDataCur; + int toolBarMarkerIndexCur = getToolbarMarkerIndex(currentArr, aNames); + aTargetIndex = toolBarMarkerIndexCur; + } } } diff --git a/src/LightApp/LightApp_Application.h b/src/LightApp/LightApp_Application.h index 967676ef1..d70f40153 100644 --- a/src/LightApp/LightApp_Application.h +++ b/src/LightApp/LightApp_Application.h @@ -288,7 +288,11 @@ private: void emptyPreferences( const QString& ); QList findToolBars(); - QByteArray processState(QByteArray& input, const bool processWin,const bool processTb, QByteArray defaultState = QByteArray()); + QByteArray processState(QByteArray& input, + const bool processWin, + const bool processTb, + const bool isRestoring, + QByteArray defaultState = QByteArray()); protected: typedef QPointer WinPtr; diff --git a/src/LightApp/resources/LightApp.xml b/src/LightApp/resources/LightApp.xml index 4f93798f4..bc8ecd272 100644 --- a/src/LightApp/resources/LightApp.xml +++ b/src/LightApp/resources/LightApp.xml @@ -243,4 +243,10 @@ +
+ +
+
+ +
diff --git a/src/SalomeApp/resources/SalomeApp.xml b/src/SalomeApp/resources/SalomeApp.xml index e4a353e9b..7349e8abf 100644 --- a/src/SalomeApp/resources/SalomeApp.xml +++ b/src/SalomeApp/resources/SalomeApp.xml @@ -61,4 +61,10 @@ +
+ +
+
+ +