Salome HOME
Support both 5.5 and 5.6 version of ParaView
[modules/gui.git] / src / SUIT / SUIT_ResourceMgr.cxx
index dd2d9024f1e497208006f7f08dc5e7530d7fcd43..0c98e4a2dc1daed5bf62a1461ef715677a13598b 100755 (executable)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -21,6 +21,7 @@
 //
 
 #include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
 
 #include <QDir>
 #include <QFileInfo>
@@ -81,11 +82,12 @@ QString SUIT_ResourceMgr::userFileName( const QString& appName, const bool for_l
 {
   QString pathName;
 
-  QStringList arguments = QApplication::arguments();
+  QStringList arguments;
+  if ( SUIT_Session::session() ) arguments = SUIT_Session::session()->arguments();
   // Try config file, given in arguments
   for (int i = 1; i < arguments.count(); i++) {
     QRegExp rx ("--resources=(.+)");
-    if ( rx.indexIn( arguments[i] ) >= 0 && rx.numCaptures() > 0 ) {
+    if ( rx.indexIn( arguments[i] ) >= 0 && rx.captureCount() > 0 ) {
       QString file = rx.cap(1);
       QFileInfo fi (file);
       pathName = fi.absoluteFilePath();
@@ -177,3 +179,21 @@ long SUIT_ResourceMgr::userFileId( const QString& ) const
 {
   return -1;
 }
+
+/*!
+  \brief Specify default language for the application.
+*/
+QString SUIT_ResourceMgr::defaultLanguage() const
+{
+  QStringList arguments;
+  QString language;
+  if ( SUIT_Session::session() ) arguments = SUIT_Session::session()->arguments();
+  // Try language, given in arguments
+  for (int i = 1; i < arguments.count(); i++) {
+    QRegExp rx ("--language=(.+)");
+    if ( rx.indexIn( arguments[i] ) >= 0 && rx.captureCount() > 0 ) {
+      language = rx.cap(1);
+    }
+  }
+  return language;
+}