Files
uartscope/include/rawview.h
2026-06-09 09:04:59 +02:00

51 lines
1.4 KiB
C++

#pragma once
#include <QWidget>
#include <QPlainTextEdit>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLineEdit>
#include <QPushButton>
#include <QCheckBox>
#include <QLabel>
#include <QSpinBox>
#include <QRegularExpression>
// RawView shows the raw UART output in a QPlainTextEdit with:
// - Timestamp prefix on every line (hh:mm:ss.zzz)
// - Configurable tag suppression (lines whose tag is in the filter set are hidden)
// - Unlimited history, H+V scrolling, incremental search
// - Copy-to-clipboard and Clear buttons
class RawView : public QWidget
{
Q_OBJECT
public:
explicit RawView(QWidget *parent = nullptr);
public slots:
// suppressedTags: set of uppercase tag names whose lines should NOT appear here
void appendLine(const QString &line, const QSet<QString> &suppressedTags = {});
void clear();
private slots:
void onSearch(const QString &text);
void onScrollValueChanged(int value);
void onAutoScrollToggled(bool enabled);
void copyToClipboard();
private:
void setupUi();
void applyColorScheme();
QPlainTextEdit *m_textEdit = nullptr;
QLineEdit *m_searchEdit = nullptr;
QPushButton *m_clearBtn = nullptr;
QPushButton *m_copyBtn = nullptr;
QCheckBox *m_autoScrollCb = nullptr;
QLabel *m_lineCountLbl = nullptr;
bool m_autoScroll = true;
int m_lineCount = 0;
static const QRegularExpression s_tagRe;
};