Files
seer/src/SeerSeerLogWidget.cpp
T
2025-08-26 17:26:05 -05:00

62 lines
1.4 KiB
C++

// SPDX-FileCopyrightText: 2021 Ernie Pasveer <epasveer@att.net>
//
// SPDX-License-Identifier: GPL-3.0-or-later
#include "SeerSeerLogWidget.h"
#include "SeerUtl.h"
#include <QtWidgets/QScrollBar>
#include <QRegularExpression>
#include <QtCore/QTime>
#include <QtCore/QDebug>
SeerSeerLogWidget::SeerSeerLogWidget (QWidget* parent) : SeerLogWidget(parent) {
}
SeerSeerLogWidget::~SeerSeerLogWidget () {
}
void SeerSeerLogWidget::processText (const QString& text) {
// Only log '^', '*', and '=' records.
bool selected = false;
if (selected == false && text.front() == '^') {
selected = true;
}
if (selected == false && text.front() == '*') {
selected = true;
}
if (selected == false && text.front() == '=') {
selected = true;
}
if (selected == false && text.contains(QRegularExpression("^([0-9]+)\\^")) == true) {
selected = true;
}
if (selected == false && text.contains(QRegularExpression("^([0-9]+)\\*")) == true) {
selected = true;
}
if (selected == false && text.contains(QRegularExpression("^([0-9]+)\\=")) == true) {
selected = true;
}
if (selected == false) {
return;
}
// No filtering.
QString str = text;
if (isTimeStampEnabled()) {
str = QString("[") + QTime::currentTime().toString("hh:mm:ss.zz") + QString("] ") + str;
}
// Write the string to the log.
textEdit->append(str);
}