-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathToolkit.cpp
More file actions
25 lines (21 loc) · 939 Bytes
/
Toolkit.cpp
File metadata and controls
25 lines (21 loc) · 939 Bytes
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
#include "Toolkit.hpp"
#include "./ui_Toolkit.h"
// Статичные константы, общие для всего приложения.
const quint16 Toolkit::logMaxLines = 0x100;
Toolkit::Toolkit(QWidget *parent) : QMainWindow(parent)
{ // Конструктор основного интрфейса.
interface = new Ui::Toolkit;
interface->Ui::Toolkit::setupUi(this);
}
Toolkit::~Toolkit()
{ // Деструктор основного интерфейса.
delete interface;
}
void Toolkit::compactLog(QString* localLog, quint16 freeLines)
{ // Удаление более "давних" сообщения в журнале и освобождение минмиума свободных строк.
quint16 logLines = localLog->count("\n");
while ((logMaxLines - logLines) < freeLines) {
localLog->remove(0, localLog->indexOf('\n', 0, Qt::CaseInsensitive) + 1);
--logLines;
}
}