+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
/*
* XGUI_ErrorDialog.cpp
*
*/
#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)
myErrorLog = new QTextEdit(this);
myErrorLog->setReadOnly(true);
aDlgLay->addWidget(myErrorLog);
- QDialogButtonBox* aButtonBox =
- new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, this);
+ QDialogButtonBox* aButtonBox = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal,
+ this);
aDlgLay->addWidget(aButtonBox);
- aDlgLay->setContentsMargins(2,2,2,2);
+ aDlgLay->setContentsMargins(2, 2, 2, 2);
aDlgLay->setSpacing(2);
setLayout(aDlgLay);
resize(420, 240);
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()) {
+ if (!isVisible()) {
show();
raise();
- activateWindow();
+ ModuleBase_Tools::activateWindow(this, "XGUI_ErrorDialog::addError");
}
}