2016-01-05 10:20:47 +00:00
|
|
|
#include "CErrorLogDialog.h"
|
|
|
|
#include "ui_CErrorLogDialog.h"
|
|
|
|
#include "UICommon.h"
|
2016-02-15 12:28:20 +00:00
|
|
|
#include <Common/Log.h>
|
2016-01-05 10:20:47 +00:00
|
|
|
|
2016-03-27 19:09:38 +00:00
|
|
|
CErrorLogDialog::CErrorLogDialog(QWidget *pParent)
|
|
|
|
: QDialog(pParent)
|
|
|
|
, ui(new Ui::CErrorLogDialog)
|
2016-01-05 10:20:47 +00:00
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
connect(ui->CloseButton, SIGNAL(clicked()), this, SLOT(close()));
|
|
|
|
}
|
|
|
|
|
|
|
|
CErrorLogDialog::~CErrorLogDialog()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CErrorLogDialog::GatherErrors()
|
|
|
|
{
|
2018-12-12 05:50:46 +00:00
|
|
|
const TStringList& rkErrors = NLog::GetErrorLog();
|
2016-01-05 10:20:47 +00:00
|
|
|
if (rkErrors.empty()) return false;
|
|
|
|
|
|
|
|
QString DialogString;
|
|
|
|
|
|
|
|
for (auto it = rkErrors.begin(); it != rkErrors.end(); it++)
|
|
|
|
{
|
|
|
|
QString Error = TO_QSTRING(*it);
|
|
|
|
QString LineColor;
|
|
|
|
|
|
|
|
if (Error.startsWith("ERROR: "))
|
|
|
|
LineColor = "#ff0000";
|
|
|
|
else if (Error.startsWith("Warning: "))
|
|
|
|
LineColor = "#ff8000";
|
|
|
|
|
|
|
|
QString FullLine = Error;
|
|
|
|
|
|
|
|
if (!LineColor.isEmpty())
|
|
|
|
{
|
|
|
|
FullLine.prepend(QString("<font color=\"%1\">").arg(LineColor));
|
|
|
|
FullLine.append("</font>");
|
|
|
|
}
|
|
|
|
FullLine.append("<br />");
|
|
|
|
|
|
|
|
DialogString += FullLine;
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->ErrorLogTextEdit->setText(DialogString);
|
2018-12-12 05:50:46 +00:00
|
|
|
NLog::ClearErrorLog();
|
2016-01-05 10:20:47 +00:00
|
|
|
return true;
|
|
|
|
}
|