Tag-Filter hinzugefügt
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "tableview.h"
|
||||
#include "tagwidget.h"
|
||||
#include "connectdialog.h"
|
||||
#include <QSet>
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
@@ -35,6 +36,7 @@ private slots:
|
||||
void onNewLine(const QString &line);
|
||||
void onTagDetected(const QString &tag, const QString &value);
|
||||
void showFormatReference();
|
||||
void configureTagFilter();
|
||||
|
||||
private:
|
||||
void setupUi();
|
||||
@@ -64,5 +66,6 @@ private:
|
||||
QAction *m_connectAction = nullptr;
|
||||
QAction *m_disconnectAction = nullptr;
|
||||
|
||||
SerialConfig m_lastConfig;
|
||||
SerialConfig m_lastConfig;
|
||||
QSet<QString> m_suppressedTags; // tags hidden from Raw view
|
||||
};
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
#include <QCheckBox>
|
||||
#include <QLabel>
|
||||
#include <QSpinBox>
|
||||
#include <QRegularExpression>
|
||||
|
||||
// RawView shows the raw UART output in a QPlainTextEdit with:
|
||||
// - Configurable maximum line count (default: unlimited / very large)
|
||||
// - Auto-scroll that pauses when the user scrolls up
|
||||
// - Horizontal scroll (word wrap off)
|
||||
// - Incremental text search
|
||||
// - Clear button
|
||||
// - 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
|
||||
@@ -23,13 +23,15 @@ public:
|
||||
explicit RawView(QWidget *parent = nullptr);
|
||||
|
||||
public slots:
|
||||
void appendLine(const QString &line);
|
||||
// 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();
|
||||
@@ -38,8 +40,11 @@ private:
|
||||
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;
|
||||
};
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
#pragma once
|
||||
#include <QWidget>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QDateTime>
|
||||
#include <QList>
|
||||
#include <QPair>
|
||||
#include <QPushButton>
|
||||
#include <QTableWidget>
|
||||
#include <QStringList>
|
||||
|
||||
// TagPanel displays the most recent data associated with a single tag (e.g. [WDG]).
|
||||
// Values are parsed as key=value pairs, or shown as a raw string if no '=' is found.
|
||||
// Example input line: [WDG] uptime=1234 temp=42.1 load=0.8
|
||||
// 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.
|
||||
// A "Copy" button copies the current values to the clipboard.
|
||||
// No timestamp is shown here – timestamps belong in the Raw view.
|
||||
class TagPanel : public QGroupBox
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -24,14 +23,16 @@ public:
|
||||
public slots:
|
||||
void update(const QString &value);
|
||||
|
||||
private slots:
|
||||
void copyToClipboard();
|
||||
|
||||
private:
|
||||
void parseKeyValue(const QString &value);
|
||||
void showRaw(const QString &value);
|
||||
void ensureRow(const QString &key);
|
||||
|
||||
QString m_tag;
|
||||
QTableWidget *m_table = nullptr;
|
||||
QLabel *m_rawLabel = nullptr;
|
||||
QLabel *m_timestampLabel = nullptr;
|
||||
QStringList m_keys; // ordered list for row lookup
|
||||
QTableWidget *m_table = nullptr;
|
||||
QLabel *m_rawLabel = nullptr;
|
||||
QStringList m_keys;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user