Wireshark  4.3.0
The Wireshark network protocol analyzer
filter_action.h
Go to the documentation of this file.
1 
10 /* Derived from gtk/filter_utils.h */
11 
12 #ifndef FILTER_ACTION_H
13 #define FILTER_ACTION_H
14 
15 #include <wsutil/utf8_entities.h>
16 
17 #include <QAction>
18 #include <QActionGroup>
19 
20 class FilterAction : public QAction
21 {
22  Q_OBJECT
23 public:
24  /* Filter actions */
25  enum Action {
26  ActionApply,
27  ActionColorize,
28  ActionCopy,
29  ActionFind,
30  ActionPrepare,
31  ActionWebLookup
32  };
33  Q_ENUM(Action)
34 
35  /* Action type - says what to do with the filter */
36  enum ActionType {
37  ActionTypePlain,
38  ActionTypeNot,
39  ActionTypeAnd,
40  ActionTypeOr,
41  ActionTypeAndNot,
42  ActionTypeOrNot
43  };
44  Q_ENUM(ActionType)
45 
46  /* Action direction */
47  enum ActionDirection {
48  ActionDirectionAToFromB,
49  ActionDirectionAToB,
50  ActionDirectionAFromB,
51  ActionDirectionAToFromAny,
52  ActionDirectionAToAny,
53  ActionDirectionAFromAny,
54  ActionDirectionAnyToFromB,
55  ActionDirectionAnyToB,
56  ActionDirectionAnyFromB
57  };
58 
59  explicit FilterAction(QObject *parent, Action action, ActionType type, QString actionName);
60  explicit FilterAction(QObject *parent, Action action, ActionType type, ActionDirection direction);
61  explicit FilterAction(QObject *parent, Action action, ActionType type);
62  explicit FilterAction(QObject *parent, Action action);
63 
64  Action action() { return action_; }
65  static const QList<Action> actions();
66  static const QString actionName(Action action);
67 
68  ActionType actionType() { return type_; }
69  static const QList<ActionType> actionTypes(Action filter_action = ActionApply);
70  static const QString actionTypeName(ActionType type);
71 
72  ActionDirection actionDirection() { return direction_; }
73  static const QList<ActionDirection> actionDirections();
74  static const QString actionDirectionName(ActionDirection direction);
75 
76  static QActionGroup * createFilterGroup(QString filter, bool prepare, bool enabled, QWidget * parent);
77  static QMenu * createFilterMenu(FilterAction::Action act, QString filter, bool enabled, QWidget * parent);
78  static QAction * copyFilterAction(QString filter, QWidget *par);
79 
80 signals:
81 
82 public slots:
83 
84 private:
85  Action action_;
86  ActionType type_;
87  ActionDirection direction_;
88 
89  QString actionName_;
90 
91 private slots:
92  void groupTriggered(QAction *);
93  void copyActionTriggered();
94 
95 };
96 
97 #endif // FILTER_ACTION_H
Definition: filter_action.h:21