Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
capture_filter_edit.h
1 /* capture_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 CAPTURE_FILTER_EDIT_H
11 #define CAPTURE_FILTER_EDIT_H
12 
13 #include <QThread>
14 #include <QToolButton>
15 #include <ui/qt/widgets/syntax_line_edit.h>
16 
19 
21 {
22  Q_OBJECT
23 public:
24  explicit CaptureFilterEdit(QWidget *parent = 0, bool plain = false);
25  void setConflict(bool conflict = false);
26  // No selections: (QString(), false)
27  // Selections, same filter: (filter, false)
28  // Selections, different filters (QString(), true)
29  static QPair<const QString, bool> getSelectedFilter();
30 
31 protected:
32  void paintEvent(QPaintEvent *evt);
33  void resizeEvent(QResizeEvent *);
34  void keyPressEvent(QKeyEvent *event) { completionKeyPressEvent(event); }
35  void focusInEvent(QFocusEvent *event) { completionFocusInEvent(event); }
36 
37 public slots:
38  void checkFilter();
39  void updateBookmarkMenu();
40  void saveFilter();
41  void removeFilter();
42  void showFilters();
43  void prepareFilter();
44 
45 private slots:
46  void applyCaptureFilter();
47  void checkFilter(const QString &filter);
48  void setFilterSyntaxState(QString filter, int state, QString err_msg);
49  void bookmarkClicked();
50  void clearFilter();
51 
52 private:
53  bool plain_;
54  bool field_name_only_;
55  bool enable_save_action_;
56  QString placeholder_text_;
57  QAction *save_action_;
58  QAction *remove_action_;
59  StockIconToolButton *bookmark_button_;
60  StockIconToolButton *clear_button_;
61  StockIconToolButton *apply_button_;
62  CaptureFilterSyntaxWorker *syntax_worker_;
63 
64  void buildCompletionList(const QString& primitive_word);
65 
66 signals:
67  void pushFilterSyntaxStatus(const QString&);
68  void popFilterSyntaxStatus();
69  void captureFilterSyntaxChanged(bool valid);
70  void startCapture();
71  void addBookmark(const QString filter);
72 
73 };
74 
75 #endif // CAPTURE_FILTER_EDIT_H
76 
77 /*
78  * Editor modelines
79  *
80  * Local Variables:
81  * c-basic-offset: 4
82  * tab-width: 8
83  * indent-tabs-mode: nil
84  * End:
85  *
86  * ex: set shiftwidth=4 tabstop=8 expandtab:
87  * :indentSize=4:tabSize=8:noTabs=true:
88  */
Definition: syntax_line_edit.h:22
Definition: capture_filter_syntax_worker.h:17
Definition: capture_filter_edit.h:20
Definition: stock_icon_tool_button.h:15