Wireshark 5.1.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
tagging_rules_dialog.h
1/* tagging_rules_dialog.h
2 *
3 * Dialog for managing tagging rules
4 * Copyright 2026, Mark Stout <mark.stout@markstout.com>
5 *
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
9 *
10 * SPDX-License-Identifier: GPL-2.0-or-later
11 */
12
13#ifndef TAGGING_RULES_DIALOG_H
14#define TAGGING_RULES_DIALOG_H
15
17
19
20#include <epan/tag_rules.h>
21#include <ui/qt/models/tagging_rules_model.h>
22#include <ui/qt/models/tagging_rules_delegate.h>
23
24#include <QItemSelection>
25#include <QMap>
26#include <functional>
27
28class QAbstractButton;
29
30namespace Ui {
31class TaggingRulesDialog;
32}
33
34class TaggingRulesDialog : public GeometryStateDialog
35{
36 Q_OBJECT
37
38public:
39 explicit TaggingRulesDialog(QWidget *parent = nullptr);
40 ~TaggingRulesDialog();
41
42 void setColoringAcceptedCallback(std::function<void()> cb) { coloring_accepted_cb_ = std::move(cb); }
43
44
45private slots:
46 void copyFromProfile(QString fileName);
47 void tagRuleSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
48 void on_copyToColoringRuleButton_clicked();
49
50 void on_newToolButton_clicked();
51 void on_deleteToolButton_clicked();
52 void on_copyToolButton_clicked();
53 void on_clearToolButton_clicked();
54
55 void on_buttonBox_clicked(QAbstractButton *button);
56 void on_buttonBox_accepted();
57 void on_buttonBox_helpRequested();
58
59 void rowCountChanged();
60 void invalidField(const QModelIndex &index, const QString &errMessage);
61 void validField(const QModelIndex &index);
62 void treeItemClicked(const QModelIndex &index);
63
64 void fontSizeChanged(int idx);
65 void separatorChanged(const QString &text);
66 void linkClickChanged(int idx);
67
68private:
69 Ui::TaggingRulesDialog *ui;
70
71 QPushButton *import_button_;
72 QPushButton *export_button_;
73
74 tag_prefs_t originalPrefs_; // saved at open; restored if user cancels
75 tag_prefs_t pendingPrefs_;
76 QString profilePath_; // path to the active profile's tagrules.jsonc file
77
78 TaggingRulesModel tagRuleModel_;
79 TaggingRulesDelegate tagRuleDelegate_;
80
81 QMap<QModelIndex, QString> errors_;
82 std::function<void()> coloring_accepted_cb_;
83
84 void reject() override;
85 void updateHint(QModelIndex idx = QModelIndex());
86 void addRule(bool copy_from_current);
87 bool isValidFilter(QString filter, QString *error);
88};
89
90#endif // TAGGING_RULES_DIALOG_H
A dialog for managing and configuring packet coloring rules.
Definition coloring_rules_dialog.h:31
GeometryStateDialog(QWidget *parent, Qt::WindowFlags f=Qt::Window)
Constructs a new GeometryStateDialog with the specified parent and window flags.
Definition geometry_state_dialog.h:91
Definition tagging_rules_delegate.h:22
A model managing the tagging rules for packet display.
Definition tagging_rules_model.h:92
struct _tag_prefs tag_prefs_t
Display preferences for the tagging subsystem.