1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
6 * Created on: Apr 28, 2014
9 #include <XGUI_ErrorDialog.h>
11 #include <ModuleBase_Tools.h>
12 #include <Config_Translator.h>
14 #include <QDialogButtonBox>
15 #include <QHBoxLayout>
17 #include <QVBoxLayout>
20 XGUI_ErrorDialog::XGUI_ErrorDialog(QWidget* parent)
23 QVBoxLayout* aDlgLay = new QVBoxLayout(this);
24 setWindowTitle(tr("Application errors"));
25 myErrorLog = new QTextEdit(this);
26 myErrorLog->setReadOnly(true);
27 aDlgLay->addWidget(myErrorLog);
28 QDialogButtonBox* aButtonBox = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal,
30 aDlgLay->addWidget(aButtonBox);
31 aDlgLay->setContentsMargins(2, 2, 2, 2);
32 aDlgLay->setSpacing(2);
36 connect(aButtonBox, SIGNAL(accepted()), this, SLOT(clear()));
37 connect(aButtonBox, SIGNAL(rejected()), this, SLOT(clear()));
40 XGUI_ErrorDialog::~XGUI_ErrorDialog()
44 void XGUI_ErrorDialog::refresh()
47 foreach(QString eachError, myErrors)
49 myErrorLog->append(eachError);
53 void XGUI_ErrorDialog::clear()
60 void XGUI_ErrorDialog::addError(std::shared_ptr<Events_InfoMessage> theMsg)
62 std::string aError = Config_Translator::translate(theMsg);
63 myErrors.append(aError.c_str());
68 ModuleBase_Tools::activateWindow(this, "XGUI_ErrorDialog::addError");
72 void XGUI_ErrorDialog::removeError(const QString& theError)
74 myErrors.removeAll(theError);