2021-11-30 13:01:36 +00:00
|
|
|
/** @file
|
2014-04-29 15:10:27 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
2014-04-29 15:10:27 +00:00
|
|
|
|
|
|
|
/* Derived from gtk/filter_utils.h */
|
|
|
|
|
|
|
|
#ifndef FILTER_ACTION_H
|
|
|
|
#define FILTER_ACTION_H
|
|
|
|
|
2015-10-04 17:10:29 +00:00
|
|
|
#include <wsutil/utf8_entities.h>
|
2014-04-29 15:10:27 +00:00
|
|
|
|
|
|
|
#include <QAction>
|
2019-08-26 13:30:22 +00:00
|
|
|
#include <QActionGroup>
|
2014-04-29 15:10:27 +00:00
|
|
|
|
|
|
|
class FilterAction : public QAction
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
/* Filter actions */
|
|
|
|
enum Action {
|
|
|
|
ActionApply,
|
|
|
|
ActionColorize,
|
2016-06-24 22:17:25 +00:00
|
|
|
ActionCopy,
|
|
|
|
ActionFind,
|
|
|
|
ActionPrepare,
|
|
|
|
ActionWebLookup
|
2014-04-29 15:10:27 +00:00
|
|
|
};
|
2019-08-26 13:30:22 +00:00
|
|
|
Q_ENUM(Action)
|
2014-04-29 15:10:27 +00:00
|
|
|
|
|
|
|
/* Action type - says what to do with the filter */
|
|
|
|
enum ActionType {
|
|
|
|
ActionTypePlain,
|
|
|
|
ActionTypeNot,
|
|
|
|
ActionTypeAnd,
|
|
|
|
ActionTypeOr,
|
|
|
|
ActionTypeAndNot,
|
|
|
|
ActionTypeOrNot
|
|
|
|
};
|
2019-08-26 13:30:22 +00:00
|
|
|
Q_ENUM(ActionType)
|
2014-04-29 15:10:27 +00:00
|
|
|
|
|
|
|
/* Action direction */
|
|
|
|
enum ActionDirection {
|
|
|
|
ActionDirectionAToFromB,
|
|
|
|
ActionDirectionAToB,
|
|
|
|
ActionDirectionAFromB,
|
|
|
|
ActionDirectionAToFromAny,
|
|
|
|
ActionDirectionAToAny,
|
|
|
|
ActionDirectionAFromAny,
|
|
|
|
ActionDirectionAnyToFromB,
|
|
|
|
ActionDirectionAnyToB,
|
|
|
|
ActionDirectionAnyFromB
|
|
|
|
};
|
|
|
|
|
2014-08-06 17:07:42 +00:00
|
|
|
explicit FilterAction(QObject *parent, Action action, ActionType type, ActionDirection direction);
|
|
|
|
explicit FilterAction(QObject *parent, Action action, ActionType type);
|
2015-02-03 16:39:14 +00:00
|
|
|
explicit FilterAction(QObject *parent, Action action);
|
2014-04-29 15:10:27 +00:00
|
|
|
|
|
|
|
Action action() { return action_; }
|
|
|
|
static const QList<Action> actions();
|
|
|
|
static const QString actionName(Action action);
|
|
|
|
|
|
|
|
ActionType actionType() { return type_; }
|
2015-06-05 20:17:13 +00:00
|
|
|
static const QList<ActionType> actionTypes(Action filter_action = ActionApply);
|
2014-04-29 15:10:27 +00:00
|
|
|
static const QString actionTypeName(ActionType type);
|
|
|
|
|
|
|
|
ActionDirection actionDirection() { return direction_; }
|
|
|
|
static const QList<ActionDirection> actionDirections();
|
|
|
|
static const QString actionDirectionName(ActionDirection direction);
|
|
|
|
|
2019-08-26 13:30:22 +00:00
|
|
|
static QActionGroup * createFilterGroup(QString filter, bool prepare, bool enabled, QWidget * parent);
|
2019-08-27 15:14:31 +00:00
|
|
|
static QMenu * createFilterMenu(FilterAction::Action act, QString filter, bool enabled, QWidget * parent);
|
2019-08-29 11:26:18 +00:00
|
|
|
static QAction * copyFilterAction(QString filter, QWidget *par);
|
2019-08-26 13:30:22 +00:00
|
|
|
|
2014-04-29 15:10:27 +00:00
|
|
|
signals:
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
private:
|
|
|
|
Action action_;
|
|
|
|
ActionType type_;
|
|
|
|
ActionDirection direction_;
|
|
|
|
|
2019-08-26 13:30:22 +00:00
|
|
|
private slots:
|
|
|
|
void groupTriggered(QAction *);
|
2019-08-29 11:26:18 +00:00
|
|
|
void copyActionTriggered();
|
2019-08-26 13:30:22 +00:00
|
|
|
|
2014-04-29 15:10:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // FILTER_ACTION_H
|