Salome HOME
Merge branch 'master' of ssh://git.salome-platform.org/modules/gui
[modules/gui.git] / src / Session / SALOME_Session_Server.cxx
index 3f78ea2a08812d8d29ee7e2b77fa9825a554c13b..695015339a978d28812dfa2b20b02e07fac5e410 100755 (executable)
@@ -110,29 +110,6 @@ void MessageOutput( QtMsgType type, const char* msg )
   }
 }
 
-/* XPM */
-static const char* pixmap_not_found_xpm[] = {
-"16 16 3 1",
-"       c None",
-".      c #000000",
-"+      c #A80000",
-"                ",
-"                ",
-"    .     .     ",
-"   .+.   .+.    ",
-"  .+++. .+++.   ",
-"   .+++.+++.    ",
-"    .+++++.     ",
-"     .+++.      ",
-"    .+++++.     ",
-"   .+++.+++.    ",
-"  .+++. .+++.   ",
-"   .+.   .+.    ",
-"    .     .     ",
-"                ",
-"                ",
-"                "};
-
 QString salomeVersion()
 {
   return GUI_VERSION_STR;
@@ -145,7 +122,6 @@ public:
   {
     setCurrentFormat( "xml" );
     setOption( "translators", QString( "%P_msg_%L.qm|%P_icons.qm|%P_images.qm" ) );
-    setDefaultPixmap( QPixmap( pixmap_not_found_xpm ) );
   }
   static void initResourceMgr()
   {
@@ -228,36 +204,10 @@ protected:
       // for backward compatibility we also check files prepended with "." with lower priority
       QRegExp exp( QString( "\\.?%1rc\\.([a-zA-Z0-9.]+)" ).arg( myExtAppName ) );
 #endif
-      QRegExp vers_exp( "^([0-9]+)([A-Z]|RC)?([0-9]*)", Qt::CaseInsensitive );
-      
       QString fname = QFileInfo( _fname ).fileName();
-      if( exp.exactMatch( fname ) ) {
-          QStringList vers = exp.cap( 1 ).split( ".", QString::SkipEmptyParts );
-          int major=0, minor=0;
-          int release = 0, dev1 = 0, dev2 = 0;
-          if ( vers.count() > 0 ) major = vers[0].toInt();
-          if ( vers.count() > 1 ) minor = vers[1].toInt();
-          if ( vers.count() > 2 ) {
-              if ( vers_exp.indexIn( vers[2] ) != -1 ) {
-                  release = vers_exp.cap( 1 ).toInt();
-                  QString tag = vers_exp.cap( 2 ).toLower();
-                  if ( !tag.isEmpty() ) {
-                      if ( tag == "rc" ) // release candidate
-                        dev1 = 49;       // 'rc'=49
-                      else               // a, b, c, ...
-                        dev1 = (int)( tag[ 0 ].toLatin1() ) - (int)( QChar('a').toLatin1() ) + 1; // 'a'=1, 'b'=2, ..., 'z'=26
-                  }
-                  if ( !vers_exp.cap( 3 ).isEmpty() )
-                    dev2 = vers_exp.cap( 3 ).toInt();
-              }
-          }
-
-          int dev = dev1*100+dev2;
-          id = major;
-          id*=100; id+=minor;
-          id*=100; id+=release;
-          id*=10000;
-          if ( dev > 0 ) id-=dev;
+      if ( exp.exactMatch( fname ) ) {
+       long fid = Qtx::versionToId( exp.cap( 1 ) );
+       if ( fid > 0 ) id = fid;
       }
     }
     return id;
@@ -277,7 +227,7 @@ public:
   SALOME_Session() : SUIT_Session() {}
   virtual ~SALOME_Session() {}
 
-protected:
+public:
   virtual SUIT_ResourceMgr* createResourceMgr( const QString& appName ) const
   {
     SALOME_ResourceMgr::initResourceMgr();
@@ -414,6 +364,19 @@ int main( int argc, char **argv )
   if ( !qtdir.isEmpty() )
     QApplication::addLibraryPath( QDir( qtdir ).absoluteFilePath( "plugins" ) );
 
+  {
+    SALOME_Session s;
+    QApplication::setApplicationName( "salome" );
+    SUIT_ResourceMgr* resMgr = s.createResourceMgr( "SalomeApp" );
+    bool isCloc = resMgr->booleanValue( "language", "locale", true );
+    if ( isCloc ) { 
+      QLocale::setDefault( QLocale::c() );
+    }
+    else {
+      QLocale::setDefault( QLocale::system() );
+    }
+  }
+
   // Create Qt application instance;
   // this should be done the very first!
   SALOME_QApplication _qappl( argc, argv );