1 /* field_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 FIELDFILTEREDIT_H
11 #define FIELDFILTEREDIT_H
12 
13 #include <ui/qt/widgets/syntax_line_edit.h>
14 
15 class QEvent;
16 class StockIconToolButton;
17 
18 class FieldFilterEdit : public SyntaxLineEdit
19 {
20     Q_OBJECT
21 public:
22     explicit FieldFilterEdit(QWidget *parent = 0);
23 
24 protected:
keyPressEvent(QKeyEvent * event)25     void keyPressEvent(QKeyEvent *event) { completionKeyPressEvent(event); }
focusInEvent(QFocusEvent * event)26     void focusInEvent(QFocusEvent *event) { completionFocusInEvent(event); }
27     void focusOutEvent(QFocusEvent *event);
28 
29 public slots:
30     bool checkFilter();
31     void applyDisplayFilter();
32 
33 private slots:
34     void checkFilter(const QString &filter_text);
35     void clearFilter();
36     void changeEvent(QEvent* event);
37 
38     void showFilters();
39     void prepareFilter();
40 
41 private:
42     QString placeholder_text_;
43 
44     void setDefaultPlaceholderText();
45     void buildCompletionList(const QString& field_word);
46 
47 signals:
48     void pushFilterSyntaxStatus(const QString&);
49     void popFilterSyntaxStatus();
50     void pushFilterSyntaxWarning(const QString&);
51     void filterPackets(QString new_filter, bool force);
52 };
53 
54 #endif // FIELDFILTEREDIT_H
55