servatrice/cockatrice/src/dlg_viewlog.cpp
tooomm c095daa282 log ui window title change
While translating I realized that `View Debug Log` for the menu is perfectly fine, the dialog window should just say `Debug Log` though...
2016-06-30 17:15:37 +02:00

35 lines
818 B
C++

#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("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);
}