3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
7 * SPDX-License-Identifier: GPL-2.0-or-later
10 #ifndef FILTER_DIALOG_H
11 #define FILTER_DIALOG_H
13 #include "geometry_state_dialog.h"
15 #include <ui/qt/models/filter_list_model.h>
17 #include <QStyledItemDelegate>
21 class FilterTreeDelegate
;
27 class FilterDialog
: public GeometryStateDialog
32 enum FilterType
{ CaptureFilter
, DisplayFilter
, DisplayMacro
};
33 explicit FilterDialog(QWidget
*parent
= 0, FilterType filter_type
= CaptureFilter
, const QString new_filter
= QString());
39 FilterListModel
* model_
;
41 enum FilterType filter_type_
;
42 FilterTreeDelegate
*filter_tree_delegate_
;
44 void addFilter(QString name
, QString filter
, bool start_editing
= false);
49 void selectionChanged(const QItemSelection
&selected
, const QItemSelection
&deselected
);
51 void on_newToolButton_clicked();
52 void on_deleteToolButton_clicked();
53 void on_copyToolButton_clicked();
54 void on_buttonBox_accepted();
55 void on_buttonBox_helpRequested();
61 // Delegate for editing capture and display filters.
64 class FilterTreeDelegate
: public QStyledItemDelegate
69 FilterTreeDelegate(QObject
*parent
, FilterDialog::FilterType filter_type
);
71 virtual QWidget
*createEditor(QWidget
*parent
, const QStyleOptionViewItem
&option
, const QModelIndex
&index
) const override
;
72 virtual void setEditorData(QWidget
*editor
, const QModelIndex
&index
) const override
;
75 FilterDialog::FilterType filter_type_
;
78 class FilterValidator
: public QValidator
81 virtual QValidator::State
validate(QString
& input
, int & pos
) const override
;
84 class MacroNameValidator
: public QValidator
87 virtual QValidator::State
validate(QString
& input
, int & pos
) const override
;
90 #endif // FILTER_DIALOG_H