From 5c68d14ae08c64bb0ab3b94aaee653208a02995d Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 19 Apr 2006 14:20:47 +0000 Subject: [PATCH] Improve modules configuration an launching procedure: - allow reading of user configuration files from previous SALOME versions on startup if current is not found - allow imporing additional configuration files from GUI - use own configuration file for each SALOME module --- src/LightApp/resources/LightApp_msg_en.po | 9 ++++++- src/Session/SALOME_Session_Server.cxx | 33 +++++++++++++++++++++-- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/LightApp/resources/LightApp_msg_en.po b/src/LightApp/resources/LightApp_msg_en.po index 3f5476557..b9398bdc1 100644 --- a/src/LightApp/resources/LightApp_msg_en.po +++ b/src/LightApp/resources/LightApp_msg_en.po @@ -260,7 +260,13 @@ msgid "LightApp_PreferencesDlg::WARNING" msgstr "Warning" msgid "LightApp_PreferencesDlg::DEFAULT_QUESTION" -msgstr "Do you want to retrieve default preferences?" +msgstr "Do you want to retrieve default preferences?" + +msgid "LightApp_PreferencesDlg::IMPORT_PREFERENCES" +msgstr "Import preferences" + +msgid "LightApp_PreferencesDlg::IMPORT_BTN_TEXT" +msgstr "Import" //======================================================================================= @@ -325,3 +331,4 @@ msgstr "Rename" msgid "LightApp_NameDlg::NAME_LBL" msgstr "Name: " + diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index a577c47a3..0ef468bee 100755 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -42,6 +42,7 @@ #include #include #include +#include #include "Utils_SALOME_Exception.hxx" #include "Utils_CorbaException.hxx" @@ -180,10 +181,38 @@ public: QString version() const { return myExtAppVersion; } protected: - QString userFileName( const QString& appName ) const + QString userFileName( const QString& appName, const bool for_load ) const { if ( version().isNull() ) return ""; - return SUIT_ResourceMgr::userFileName( myExtAppName ); + return SUIT_ResourceMgr::userFileName( myExtAppName, for_load ); + } + + virtual int userFileId( const QString& _fname ) const + { + QRegExp exp( "\\.SalomeApprc\\.([a-zA-Z0-9.]+)$" ); + QRegExp vers_exp( "^([0-9]+)([A-Za-z]?)([0-9]*)" ); + + QString fname = QFileInfo( _fname ).fileName(); + if( exp.exactMatch( fname ) ) + { + QStringList vers = QStringList::split( ".", exp.cap( 1 ) ); + int major=0, minor=0; + major = vers[0].toInt(); + minor = vers[1].toInt(); + vers_exp.search( vers[2] ); + int release = 0, dev1 = 0, dev2 = 0; + release = vers_exp.cap( 1 ).toInt(); + dev1 = vers_exp.cap( 2 )[ 0 ].latin1(); + dev2 = vers_exp.cap( 3 ).toInt(); + + int dev = dev1*100+dev2, id = major; + id*=100; id+=minor; + id*=100; id+=release; + id*=10000; id+=dev; + return id; + } + + return -1; } public: -- 2.39.2