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
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CAPTURE_FILTER_EDIT_H
|
|
|
|
#define CAPTURE_FILTER_EDIT_H
|
|
|
|
|
|
|
|
#include <QThread>
|
|
|
|
#include <QToolButton>
|
|
|
|
#include "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);
|
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_;
|
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_;
|
|
|
|
|
2015-05-19 17:18:54 +00:00
|
|
|
void buildCompletionList(const QString& primitive_word);
|
|
|
|
|
2013-08-08 00:26:57 +00:00
|
|
|
signals:
|
2015-03-04 23:43:33 +00:00
|
|
|
void pushFilterSyntaxStatus(const QString&);
|
2013-08-08 00:26:57 +00:00
|
|
|
void popFilterSyntaxStatus();
|
|
|
|
void captureFilterSyntaxChanged(bool valid);
|
|
|
|
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
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines
|
|
|
|
*
|
|
|
|
* Local Variables:
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* ex: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
|
|
*/
|