]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #652: Provide locale management similarly to SALOME
authorvsv <vitaly.smetannikov@opencascade.com>
Tue, 23 Jun 2015 09:23:41 +0000 (12:23 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Tue, 23 Jun 2015 09:23:41 +0000 (12:23 +0300)
src/XGUI/NewGeom.xml
src/XGUI/XGUI_Workshop.cpp

index 02062241886dd7c06c4cf9c561254281209de761..267113d71dd84bf4fbbded27cc45cb3a62462f41 100644 (file)
@@ -3,6 +3,11 @@
 <!--
 -->
 <document>
+  <section name="language">
+    <!-- Language settings (resource manager)-->
+    <parameter name="language"    value="en"/>
+    <parameter name="locale"      value="true"/>
+  </section>
   <section name="Viewer" >
     <!-- Viewer preferences -->
     <parameter name="background" value="bt=2;fn=;tm=0;ts=false;c1=#cddbff;c2=#698fff;gt=1;gr=" />
index 203e2a89714a346fed45d9b62ab8d13350b5654b..ec7ddf45abc9553a84184f3ccbdea0bdddf103fc 100644 (file)
@@ -68,6 +68,8 @@
 #include <Config_PropManager.h>
 #include <Config_SelectionFilterMessage.h>
 
+#include <SUIT_ResourceMgr.h>
+
 #include <QApplication>
 #include <QFileDialog>
 #include <QMessageBox>
@@ -80,6 +82,7 @@
 #include <QMenu>
 #include <QToolButton>
 #include <QAction>
+#include <QDesktopWidget>
 
 #ifdef _DEBUG
 #include <QDebug>
@@ -110,6 +113,15 @@ XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
 {
   myMainWindow = mySalomeConnector ? 0 : new AppElements_MainWindow();
 
+  if (myMainWindow) {
+    SUIT_ResourceMgr* aResMgr = ModuleBase_Preferences::resourceMgr();
+    bool aCloc = aResMgr->booleanValue("language", "locale", true);
+    if (aCloc)
+      QLocale::setDefault( QLocale::c() );
+    else 
+      QLocale::setDefault( QLocale::system() );
+  }
+
   myDisplayer = new XGUI_Displayer(this);
 
   mySelector = new XGUI_SelectionMgr(this);
@@ -117,7 +129,7 @@ XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
 
   myOperationMgr = new XGUI_OperationMgr(this);
   myActionsMgr = new XGUI_ActionsMgr(this);
-  myErrorDlg = new XGUI_ErrorDialog(myMainWindow);
+  myErrorDlg = new XGUI_ErrorDialog(QApplication::desktop());
   myContextMenuMgr = new XGUI_ContextMenuMgr(this);
   connect(myContextMenuMgr, SIGNAL(actionTriggered(const QString&, bool)), this,
           SLOT(onContextMenuCommand(const QString&, bool)));
@@ -138,7 +150,8 @@ XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
           SLOT(onOperationCommitted(ModuleBase_Operation*)));
   connect(myOperationMgr, SIGNAL(operationAborted(ModuleBase_Operation*)), 
           SLOT(onOperationAborted(ModuleBase_Operation*)));
-  connect(myMainWindow, SIGNAL(exitKeySequence()), SLOT(onExit()));
+  if (myMainWindow)
+    connect(myMainWindow, SIGNAL(exitKeySequence()), SLOT(onExit()));
   connect(this, SIGNAL(errorOccurred(const QString&)), myErrorDlg, SLOT(addError(const QString&)));
 }