- Tags haben jetzt einen Verlauf

- Suchfunktion hat jetzt weiter und zurück
- Tags mit Bindestrich werden erkannt
This commit is contained in:
2026-08-18 00:24:43 +02:00
parent 1422efdc2f
commit a942f8385b
12 changed files with 415 additions and 224 deletions

View File

@@ -9,9 +9,11 @@
#include <QLabel>
#include <QSet>
#include <QRegularExpression>
#include <QTextDocument>
// RawView shows the raw UART output with timestamps, search, tag suppression,
// unlimited history, H+V scrolling and a copy-to-clipboard button.
// RawView shows the raw UART output with timestamps, search (with next/
// previous navigation and wrap-around), tag suppression, unlimited history,
// H+V scrolling and a copy-to-clipboard button.
// Auto-scroll is ON by default.
class RawView : public QWidget
{
@@ -29,13 +31,22 @@ private slots:
void onScrollValueChanged(int value);
void onAutoScrollToggled(bool enabled);
void copyToClipboard();
void findNext();
void findPrevious();
private:
void setupUi();
void applyColorScheme();
// Searches for `text` starting at the current cursor, honouring `flags`
// (e.g. QTextDocument::FindBackward). If nothing is found and
// `wrapAllowed` is true, retries once from the start/end of the
// document so search wraps around instead of dead-ending.
bool searchAndSelect(const QString &text, QTextDocument::FindFlags flags, bool wrapAllowed);
QPlainTextEdit *m_textEdit = nullptr;
QLineEdit *m_searchEdit = nullptr;
QPushButton *m_findPrevBtn = nullptr;
QPushButton *m_findNextBtn = nullptr;
QPushButton *m_clearBtn = nullptr;
QPushButton *m_copyBtn = nullptr;
QCheckBox *m_autoScrollCb = nullptr;

View File

@@ -5,17 +5,24 @@
#include <QHBoxLayout>
#include <QPushButton>
#include <QTableWidget>
#include <QPlainTextEdit>
#include <QTabWidget>
#include <QStringList>
#include <QMap>
// TagPanel displays the most recent data for a single tag (e.g. [WDG]).
// Key=value pairs are shown in a table that updates in-place.
// If a value contains ';', it is treated as a LIST: the key is shown once
// and each list element gets its own row below it (key cell left empty
// for the continuation rows, like a merged-cell look).
// Example: Devs=trackdisk.device;input.device
// Devs trackdisk.device
// input.device
// TagPanel displays the data received for a single tag (e.g. [WDG]) in two
// tabs:
// - "Aktuell": the most recent value(s), updating in-place (a table for
// key=value pairs, or a plain label for raw/free-form content). If a
// value contains ';', it is treated as a LIST: the key is shown once
// and each list element gets its own row below it (key cell left empty
// for the continuation rows, like a merged-cell look).
// Example: Devs=trackdisk.device;input.device
// Devs trackdisk.device
// input.device
// - "Verlauf": every value ever received for this tag, timestamped, in
// receive order - so you can see the full runtime history rather than
// just the latest snapshot.
class TagPanel : public QGroupBox
{
Q_OBJECT
@@ -30,16 +37,26 @@ public slots:
private slots:
void copyToClipboard();
void clearHistory();
private:
void parseKeyValue(const QString &value);
void showRaw(const QString &value);
// Replaces all rows belonging to `key` with one row per value in `values`.
void setKeyValues(const QString &key, const QStringList &values);
// Appends a timestamped entry for `value` to the "Verlauf" tab.
void appendHistory(const QString &value);
QString m_tag;
QTableWidget *m_table = nullptr;
QLabel *m_rawLabel = nullptr;
QTabWidget *m_tabs = nullptr;
QTableWidget *m_table = nullptr;
QLabel *m_rawLabel = nullptr;
QPlainTextEdit *m_historyEdit = nullptr;
int m_historyCount = 0;
// Cap history growth for very chatty/long-running tags so memory use
// stays bounded; oldest entries are dropped first (FIFO).
static constexpr int kMaxHistoryEntries = 5000;
// Track which table rows belong to which key, so repeated updates can
// replace the previous rows instead of appending duplicates.