Salome HOME
updated copyright message
[modules/gui.git] / src / SUIT / SUIT_ResourceMgr.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 92a64e7..c142047
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  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
@@ -82,12 +82,11 @@ QString SUIT_ResourceMgr::userFileName( const QString& appName, const bool for_l
 {
   QString pathName;
 
-  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++) {
+  QStringList args = QApplication::arguments();
+  for (int i = 1; i < args.count(); i++) {
     QRegExp rx ("--resources=(.+)");
-    if ( rx.indexIn( arguments[i] ) >= 0 && rx.captureCount() > 0 ) {
+    if ( rx.indexIn( args[i] ) >= 0 && rx.captureCount() > 0 ) {
       QString file = rx.cap(1);
       QFileInfo fi (file);
       pathName = fi.absoluteFilePath();
@@ -179,3 +178,22 @@ long SUIT_ResourceMgr::userFileId( const QString& ) const
 {
   return -1;
 }
+
+/*!
+  \brief Specify default language for the application.
+*/
+QString SUIT_ResourceMgr::defaultLanguage() const
+{
+  QString language;
+
+  // Try language, given in arguments
+  QStringList args = QApplication::arguments();
+  for (int i = 1; i < args.count(); i++) {
+    QRegExp rx ("--language=(.+)");
+    if ( rx.indexIn( args[i] ) >= 0 && rx.captureCount() > 0 ) {
+      language = rx.cap(1);
+    }
+  }
+
+  return language;
+}