Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
display_filter_edit.h
1 /* display_filter_edit.h
2  *
3  * Wireshark - Network traffic analyzer
4  * By Gerald Combs <gerald@wireshark.org>
5  * Copyright 1998 Gerald Combs
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  */
9 
10 #ifndef DISPLAYFILTEREDIT_H
11 #define DISPLAYFILTEREDIT_H
12 
13 #include <QDrag>
14 
15 #include <ui/qt/widgets/syntax_line_edit.h>
16 
17 class QEvent;
19 
20 typedef enum {
21  DisplayFilterToApply,
22  DisplayFilterToEnter,
23  ReadFilterToApply
24 } DisplayFilterEditType;
25 
27 {
28  Q_OBJECT
29 public:
30  explicit DisplayFilterEdit(QWidget *parent = 0, DisplayFilterEditType type = DisplayFilterToEnter);
31 
32 protected:
33  void paintEvent(QPaintEvent *evt);
34  void resizeEvent(QResizeEvent *);
35  void keyPressEvent(QKeyEvent *event) { completionKeyPressEvent(event); }
36  void focusInEvent(QFocusEvent *event) { completionFocusInEvent(event); }
37  void focusOutEvent(QFocusEvent *event);
38 
39  virtual void dragEnterEvent(QDragEnterEvent *event);
40  virtual void dragMoveEvent(QDragMoveEvent *event);
41  virtual void dropEvent(QDropEvent *event);
42 
43 public slots:
44  bool checkFilter();
45  void updateBookmarkMenu();
46  void applyDisplayFilter();
47  void displayFilterSuccess(bool success);
48 
49 private slots:
50  void checkFilter(const QString &filter_text);
51  void clearFilter();
52  void changeEvent(QEvent* event);
53 
54  void saveFilter();
55  void removeFilter();
56  void showFilters();
57  void showExpressionPrefs();
58  void applyOrPrepareFilter();
59 
60 private:
61  DisplayFilterEditType type_;
62  QString placeholder_text_;
63  QAction *save_action_;
64  QAction *remove_action_;
65  StockIconToolButton *bookmark_button_;
66  StockIconToolButton *clear_button_;
67  StockIconToolButton *apply_button_;
68 
69  void setDefaultPlaceholderText();
70  void buildCompletionList(const QString& field_word);
71 
72 signals:
73  void pushFilterSyntaxStatus(const QString&);
74  void popFilterSyntaxStatus();
75  void pushFilterSyntaxWarning(const QString&);
76  void filterPackets(QString new_filter, bool force);
77  void showPreferencesDialog(QString pane_name);
78 };
79 
80 #endif // DISPLAYFILTEREDIT_H
81 
82 /*
83  * Editor modelines
84  *
85  * Local Variables:
86  * c-basic-offset: 4
87  * tab-width: 8
88  * indent-tabs-mode: nil
89  * End:
90  *
91  * ex: set shiftwidth=4 tabstop=8 expandtab:
92  * :indentSize=4:tabSize=8:noTabs=true:
93  */
Definition: syntax_line_edit.h:22
Definition: display_filter_edit.h:26
Definition: stock_icon_tool_button.h:15