#pragma once #include #include #include #include #include #include #include #include // 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 class TagPanel : public QGroupBox { Q_OBJECT public: explicit TagPanel(const QString &tag, QWidget *parent = nullptr); const QString &tag() const { return m_tag; } public slots: void update(const QString &value); private slots: void copyToClipboard(); 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); QString m_tag; QTableWidget *m_table = nullptr; QLabel *m_rawLabel = nullptr; // Track which table rows belong to which key, so repeated updates can // replace the previous rows instead of appending duplicates. // Maps key -> (first row index, row count) struct KeyRange { int firstRow; int count; }; QMap m_keyRanges; };