Kerberos: add kerberos_inject_longterm_key() helper function
[wireshark-sm.git] / ui / qt / filter_dialog.h
blob90d2f1b26c3142be7c89b71918c1f2f1020cbab3
1 /** @file
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
8 */
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>
18 #include <QValidator>
20 class QItemSelection;
21 class FilterTreeDelegate;
23 namespace Ui {
24 class FilterDialog;
27 class FilterDialog : public GeometryStateDialog
29 Q_OBJECT
31 public:
32 enum FilterType { CaptureFilter, DisplayFilter, DisplayMacro };
33 explicit FilterDialog(QWidget *parent = 0, FilterType filter_type = CaptureFilter, const QString new_filter = QString());
34 ~FilterDialog();
36 private:
37 Ui::FilterDialog *ui;
39 FilterListModel * model_;
41 enum FilterType filter_type_;
42 FilterTreeDelegate *filter_tree_delegate_;
44 void addFilter(QString name, QString filter, bool start_editing = false);
46 private slots:
47 void updateWidgets();
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();
60 // FilterTreeDelegate
61 // Delegate for editing capture and display filters.
64 class FilterTreeDelegate : public QStyledItemDelegate
66 Q_OBJECT
68 public:
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;
74 private:
75 FilterDialog::FilterType filter_type_;
78 class FilterValidator : public QValidator
80 public:
81 virtual QValidator::State validate(QString & input, int & pos) const override;
84 class MacroNameValidator : public QValidator
86 public:
87 virtual QValidator::State validate(QString & input, int & pos) const override;
90 #endif // FILTER_DIALOG_H