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 <[email protected]>
5 *
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <[email protected]>
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
58 void rowCountChanged();
59 void invalidField(const QModelIndex &index, const QString &errMessage);
60 void validField(const QModelIndex &index);
61 void treeItemClicked(const QModelIndex &index);
62
63 void fontSizeChanged(int idx);
64 void separatorChanged(const QString &text);
65 void linkClickChanged(int idx);
66
67private:
68 Ui::TaggingRulesDialog *ui;
69
70 QPushButton *import_button_;
71 QPushButton *export_button_;
72
73 tag_prefs_t originalPrefs_; // saved at open; restored if user cancels
74 tag_prefs_t pendingPrefs_;
75 QString profilePath_; // path to the active profile's tagrules.jsonc file
76
77 TaggingRulesModel tagRuleModel_;
78 TaggingRulesDelegate tagRuleDelegate_;
79
80 QMap<QModelIndex, QString> errors_;
81 std::function<void()> coloring_accepted_cb_;
82
83 void reject() override;
84 void updateHint(QModelIndex idx = QModelIndex());
85 void addRule(bool copy_from_current);
86 bool isValidFilter(QString filter, QString *error);
87};
88
89#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.