Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
decode_as_delegate.h
1 /* decode_as_delegate.h
2  * Delegates for editing various field types in a Decode As record.
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * SPDX-License-Identifier: GPL-2.0-or-later
9  */
10 
11 #ifndef DECODE_AS_DELEGATE_H
12 #define DECODE_AS_DELEGATE_H
13 
14 #include <config.h>
15 #include <glib.h>
16 
17 #include "cfile.h"
18 
19 #include <QStyledItemDelegate>
20 #include <QSet>
21 #include <QList>
22 #include <ui/qt/models/decode_as_model.h>
23 
24 typedef struct _packet_proto_data_t {
25  const gchar* proto_name;
26  const gchar* table_ui_name;
27  guint8 curr_layer_num;
29 
30 class DecodeAsDelegate : public QStyledItemDelegate
31 {
32  Q_OBJECT
33 
34 public:
35  DecodeAsDelegate(QObject *parent = 0, capture_file *cf = NULL);
36 
37  QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
38  const QModelIndex &index) const;
39  void setEditorData(QWidget *editor, const QModelIndex &index) const;
40  void setModelData(QWidget *editor, QAbstractItemModel *model,
41  const QModelIndex &index) const;
42 
43 #if 0
44  void updateEditorGeometry(QWidget *editor,
45  const QStyleOptionViewItem &option, const QModelIndex &index) const;
46 #endif
47 
48 private:
49  DecodeAsItem *indexToField(const QModelIndex &index) const;
50  void collectDAProtocols(QSet<QString>& all_protocols, QList<QString>& current_list) const;
51  void cachePacketProtocols();
52  bool isSelectorCombo(DecodeAsItem* item) const;
53 
54  static void decodeAddProtocol(const gchar *table_name, const gchar *proto_name, gpointer value, gpointer user_data);
55 
56  capture_file *cap_file_;
57  QList<packet_proto_data_t> packet_proto_list_;
58 };
59 #endif // DECODE_AS_DELEGATE_H
Definition: decode_as_delegate.h:30
Definition: pcapng.c:148
Definition: cfile.h:58
Definition: decode_as_delegate.h:24
Definition: decode_as_model.h:25