This commit is contained in:
Fabio Bas 2016-06-24 10:39:44 +02:00
parent e81a6d497b
commit 8db10be892
9 changed files with 178 additions and 12 deletions

View file

@ -0,0 +1,35 @@
#include "dlg_viewlog.h"
#include "logger.h"
#include <QVBoxLayout>
#include <QPlainTextEdit>
DlgViewLog::DlgViewLog(QWidget *parent)
: QDialog(parent)
{
logArea = new QPlainTextEdit;
logArea->setReadOnly(true);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(logArea);
setLayout(mainLayout);
setWindowTitle(tr("View debug log"));
resize(800, 500);
loadInitialLogBuffer();
connect(&Logger::getInstance(), SIGNAL(logEntryAdded(QString)), this, SLOT(logEntryAdded(QString)));
}
void DlgViewLog::loadInitialLogBuffer()
{
QVector<QString> logBuffer = Logger::getInstance().getLogBuffer();
foreach(QString message, logBuffer)
logEntryAdded(message);
}
void DlgViewLog::logEntryAdded(QString message)
{
logArea->appendPlainText(message);
}