34 lines
1.0 KiB
C++
34 lines
1.0 KiB
C++
#include <QVBoxLayout>
|
|
#include <QLabel>
|
|
#include <QPlainTextEdit>
|
|
#include "error_dialog.h"
|
|
|
|
namespace display {
|
|
|
|
ErrorDialog::ErrorDialog(std::vector<domain::ValidationError> errors)
|
|
: GenericDialog("msg_dialog_error_title", std::nullopt, "msg_dialog_error_close") {
|
|
|
|
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)
|
|
: GenericDialog("msg_dialog_error_title", std::nullopt, "msg_dialog_error_close") {
|
|
|
|
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
|