mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 17:14:52 -07:00
Log UI
This commit is contained in:
parent
e81a6d497b
commit
8db10be892
9 changed files with 178 additions and 12 deletions
35
cockatrice/src/dlg_viewlog.cpp
Normal file
35
cockatrice/src/dlg_viewlog.cpp
Normal 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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue