Salome HOME
Clear text in ModuleBase_WidgetFeatureSelector when object deselected.
[modules/shaper.git] / src / XGUI / XGUI_ErrorDialog.cpp
index ee076f1c4796c30840d58e5b5de55f207efdb139..511d1f578efdfa131d81cb16bfc24098b6ce344c 100644 (file)
@@ -8,11 +8,15 @@
  */
 #include <XGUI_ErrorDialog.h>
 
+#include <ModuleBase_Tools.h>
+#include <Config_Translator.h>
+
 #include <QDialogButtonBox>
 #include <QHBoxLayout>
 #include <QLabel>
 #include <QVBoxLayout>
 #include <QTextEdit>
+#include <QTextCodec>
 
 XGUI_ErrorDialog::XGUI_ErrorDialog(QWidget* parent)
     : QDialog(parent)
@@ -54,14 +58,17 @@ void XGUI_ErrorDialog::clear()
   QDialog::reject();
 }
 
-void XGUI_ErrorDialog::addError(const QString& theError)
+void XGUI_ErrorDialog::addError(std::shared_ptr<Events_InfoMessage> theMsg)
 {
-  myErrors.append(theError);
+  std::string aError = Config_Translator::translate(*theMsg);
+  std::string aCodec = Config_Translator::codec(theMsg->context());
+  QString aMsg = QTextCodec::codecForName(aCodec.c_str())->toUnicode(aError.c_str());
+  myErrors.append(aMsg);
   refresh();
   if (!isVisible()) {
     show();
     raise();
-    activateWindow();
+    ModuleBase_Tools::activateWindow(this, "XGUI_ErrorDialog::addError");
   }
 }