-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtablog.cpp
41 lines (35 loc) · 848 Bytes
/
tablog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "tablog.h"
#include "ui_tablog.h"
#include "setting.h"
TabLog::TabLog(QWidget *parent) :
QWidget(parent), ui(new Ui::TabLog)
{
ui->setupUi(this);
connect(ui->buttonClear, &QAbstractButton::clicked, this, &TabLog::onClear);
}
TabLog::~TabLog()
{
delete ui;
}
void TabLog::onAddLog(const QString &log)
{
ui->plainTextEdit->moveCursor(QTextCursor::End);
ui->plainTextEdit->insertPlainText(log);
ui->plainTextEdit->appendPlainText("");
}
void TabLog::onUpdateTimerClearLog()
{
m_timerClearLog.stop();
if (Setting::getAutoClearLog())
{
QObject::connect(&m_timerClearLog, &QTimer::timeout, this, [&]()
{
onClear();
});
m_timerClearLog.start(1000 * 60 * 60 * Setting::getClearLogHours());
}
}
void TabLog::onClear()
{
ui->plainTextEdit->clear();
}