2013-08-08 00:26:57 +00:00
|
|
|
/* capture_filter_edit.h
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-04-30 07:47:58 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2013-08-08 00:26:57 +00:00
|
|
|
|
|
|
|
#ifndef CAPTURE_FILTER_EDIT_H
|
|
|
|
#define CAPTURE_FILTER_EDIT_H
|
|
|
|
|
|
|
|
#include <QThread>
|
|
|
|
#include <QToolButton>
|
2019-11-04 14:43:16 +00:00
|
|
|
#include <QActionGroup>
|
|
|
|
|
2017-07-25 14:15:18 +00:00
|
|
|
#include <ui/qt/widgets/syntax_line_edit.h>
|
2015-06-03 23:26:00 +00:00
|
|
|
|
|
|
|
class CaptureFilterSyntaxWorker;
|
2015-09-10 21:42:07 +00:00
|
|
|
class StockIconToolButton;
|
2013-08-08 00:26:57 +00:00
|
|
|
|
|
|
|
class CaptureFilterEdit : public SyntaxLineEdit
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit CaptureFilterEdit(QWidget *parent = 0, bool plain = false);
|
2021-04-04 13:09:50 +00:00
|
|
|
~CaptureFilterEdit();
|
2016-02-23 18:04:16 +00:00
|
|
|
void setConflict(bool conflict = false);
|
|
|
|
// No selections: (QString(), false)
|
|
|
|
// Selections, same filter: (filter, false)
|
|
|
|
// Selections, different filters (QString(), true)
|
|
|
|
static QPair<const QString, bool> getSelectedFilter();
|
2013-08-08 00:26:57 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent *evt);
|
|
|
|
void resizeEvent(QResizeEvent *);
|
2015-05-19 17:18:54 +00:00
|
|
|
void keyPressEvent(QKeyEvent *event) { completionKeyPressEvent(event); }
|
|
|
|
void focusInEvent(QFocusEvent *event) { completionFocusInEvent(event); }
|
2013-08-08 00:26:57 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void checkFilter();
|
2016-01-27 20:33:24 +00:00
|
|
|
void updateBookmarkMenu();
|
|
|
|
void saveFilter();
|
|
|
|
void removeFilter();
|
|
|
|
void showFilters();
|
|
|
|
void prepareFilter();
|
2013-08-08 00:26:57 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void applyCaptureFilter();
|
2016-01-07 17:27:13 +00:00
|
|
|
void checkFilter(const QString &filter);
|
2016-01-01 17:00:19 +00:00
|
|
|
void setFilterSyntaxState(QString filter, int state, QString err_msg);
|
2013-08-08 00:26:57 +00:00
|
|
|
void bookmarkClicked();
|
2016-02-25 18:15:14 +00:00
|
|
|
void clearFilter();
|
2013-08-08 00:26:57 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool plain_;
|
|
|
|
bool field_name_only_;
|
2016-01-27 20:33:24 +00:00
|
|
|
bool enable_save_action_;
|
2015-05-11 17:25:27 +00:00
|
|
|
QString placeholder_text_;
|
2016-01-27 20:33:24 +00:00
|
|
|
QAction *save_action_;
|
|
|
|
QAction *remove_action_;
|
2019-11-04 14:43:16 +00:00
|
|
|
QActionGroup * actions_;
|
2015-09-10 21:42:07 +00:00
|
|
|
StockIconToolButton *bookmark_button_;
|
|
|
|
StockIconToolButton *clear_button_;
|
|
|
|
StockIconToolButton *apply_button_;
|
2013-08-08 00:26:57 +00:00
|
|
|
CaptureFilterSyntaxWorker *syntax_worker_;
|
2021-04-04 13:09:50 +00:00
|
|
|
QThread *syntax_thread_;
|
2013-08-08 00:26:57 +00:00
|
|
|
|
2015-05-19 17:18:54 +00:00
|
|
|
void buildCompletionList(const QString& primitive_word);
|
|
|
|
|
2013-08-08 00:26:57 +00:00
|
|
|
signals:
|
|
|
|
void captureFilterSyntaxChanged(bool valid);
|
2021-04-04 13:09:50 +00:00
|
|
|
void captureFilterChanged(const QString filter);
|
2013-08-08 00:26:57 +00:00
|
|
|
void startCapture();
|
2015-03-04 23:43:33 +00:00
|
|
|
void addBookmark(const QString filter);
|
2013-08-08 00:26:57 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CAPTURE_FILTER_EDIT_H
|