2022-06-13 22:53:46 +00:00
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QPlainTextEdit>
|
|
|
|
#include "error_dialog.h"
|
|
|
|
|
|
|
|
namespace display {
|
|
|
|
|
|
|
|
ErrorDialog::ErrorDialog(std::vector<domain::ValidationError> errors)
|
2022-06-19 18:10:44 +00:00
|
|
|
: GenericDialog("msg_dialog_error_title", std::nullopt, "msg_dialog_error_close") {
|
2022-06-13 22:53:46 +00:00
|
|
|
|
|
|
|
auto contentLayout = new QVBoxLayout();
|
|
|
|
content->setLayout(contentLayout);
|
|
|
|
|
|
|
|
for (auto &err: errors) {
|
|
|
|
contentLayout->addWidget(new QLabel(QString::fromStdString(err.message), this));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ErrorDialog::ErrorDialog(std::ostringstream& errorStream)
|
2022-06-19 18:10:44 +00:00
|
|
|
: GenericDialog("msg_dialog_error_title", std::nullopt, "msg_dialog_error_close") {
|
2022-06-13 22:53:46 +00:00
|
|
|
|
|
|
|
auto contentLayout = new QVBoxLayout();
|
|
|
|
content->setLayout(contentLayout);
|
|
|
|
|
|
|
|
setMinimumWidth(1000);
|
|
|
|
|
|
|
|
auto log = new QPlainTextEdit();
|
|
|
|
log->setFont(QFont("Courier"));
|
|
|
|
log->appendPlainText(QString::fromStdString(errorStream.str()));
|
|
|
|
log->setReadOnly(true);
|
|
|
|
contentLayout->addWidget(log);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // display
|