* 1/3 Add .clang-format file and travis compilation check * 2/3 Run clang-format * 3/3 Fix compilation problems due to include reordering * 3bis/3 AfterControlStatement: false
57 lines
1.5 KiB
C++
57 lines
1.5 KiB
C++
#include "dlg_viewlog.h"
|
|
#include "logger.h"
|
|
#include "settingscache.h"
|
|
|
|
#include <QPlainTextEdit>
|
|
#include <QVBoxLayout>
|
|
|
|
DlgViewLog::DlgViewLog(QWidget *parent) : QDialog(parent)
|
|
{
|
|
|
|
logArea = new QPlainTextEdit;
|
|
logArea->setReadOnly(true);
|
|
|
|
auto *mainLayout = new QVBoxLayout;
|
|
mainLayout->addWidget(logArea);
|
|
|
|
coClearLog = new QCheckBox;
|
|
coClearLog->setText(tr("Clear log when closing"));
|
|
coClearLog->setChecked(settingsCache->servers().getClearDebugLogStatus(true));
|
|
connect(coClearLog, SIGNAL(toggled(bool)), this, SLOT(actCheckBoxChanged(bool)));
|
|
mainLayout->addWidget(coClearLog);
|
|
|
|
setLayout(mainLayout);
|
|
|
|
setWindowTitle(tr("Debug Log"));
|
|
resize(800, 500);
|
|
|
|
loadInitialLogBuffer();
|
|
connect(&Logger::getInstance(), SIGNAL(logEntryAdded(QString)), this, SLOT(logEntryAdded(QString)));
|
|
}
|
|
|
|
void DlgViewLog::actCheckBoxChanged(bool abNewValue)
|
|
{
|
|
settingsCache->servers().setClearDebugLogStatus(abNewValue);
|
|
}
|
|
|
|
void DlgViewLog::loadInitialLogBuffer()
|
|
{
|
|
QList<QString> logBuffer = Logger::getInstance().getLogBuffer();
|
|
foreach (QString message, logBuffer)
|
|
logEntryAdded(message);
|
|
}
|
|
|
|
void DlgViewLog::logEntryAdded(QString message)
|
|
{
|
|
logArea->appendPlainText(message);
|
|
}
|
|
|
|
void DlgViewLog::closeEvent(QCloseEvent * /* event */)
|
|
{
|
|
if (coClearLog->isChecked()) {
|
|
logArea->clear();
|
|
}
|
|
|
|
logArea->appendPlainText(Logger::getInstance().getClientVersion());
|
|
logArea->appendPlainText(Logger::getInstance().getSystemArchitecture());
|
|
}
|