Wireshark  4.3.0
The Wireshark network protocol analyzer
filter_dialog.h
Go to the documentation of this file.
1 
10 #ifndef FILTER_DIALOG_H
11 #define FILTER_DIALOG_H
12 
13 #include "geometry_state_dialog.h"
14 
16 
17 #include <QStyledItemDelegate>
18 #include <QValidator>
19 
20 class QItemSelection;
21 class FilterTreeDelegate;
22 
23 namespace Ui {
24 class FilterDialog;
25 }
26 
28 {
29  Q_OBJECT
30 
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();
35 
36 private:
37  Ui::FilterDialog *ui;
38 
39  FilterListModel * model_;
40 
41  enum FilterType filter_type_;
42  FilterTreeDelegate *filter_tree_delegate_;
43 
44  void addFilter(QString name, QString filter, bool start_editing = false);
45 
46 private slots:
47  void updateWidgets();
48 
49  void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
50 
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();
56 };
57 
58 
59 //
60 // FilterTreeDelegate
61 // Delegate for editing capture and display filters.
62 //
63 
64 class FilterTreeDelegate : public QStyledItemDelegate
65 {
66  Q_OBJECT
67 
68 public:
69  FilterTreeDelegate(QObject *parent, FilterDialog::FilterType filter_type);
70 
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;
73 
74 private:
75  FilterDialog::FilterType filter_type_;
76 };
77 
78 class FilterValidator : public QValidator
79 {
80 public:
81  virtual QValidator::State validate(QString & input, int & pos) const override;
82 };
83 
84 class MacroNameValidator : public QValidator
85 {
86 public:
87  virtual QValidator::State validate(QString & input, int & pos) const override;
88 };
89 
90 #endif // FILTER_DIALOG_H
Definition: filter_dialog.h:28
Definition: filter_list_model.h:22
Definition: filter_dialog.h:65
Definition: filter_dialog.h:79
Definition: geometry_state_dialog.h:17
Definition: filter_dialog.h:85
Definition: tvbuff_lz77huff.c:32