aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorJohn Thacker <johnthacker@gmail.com>2023-02-05 21:33:10 -0500
committerJohn Thacker <johnthacker@gmail.com>2023-02-11 16:40:13 +0000
commit994669e5b3112ae2845ea8910dc80ba9738ae8c5 (patch)
tree36a2b9860ecd2976d7729b27726db619a534268b /ui
parent0c79fecac3086369ac7aed54a88e5a778e9bf172 (diff)
UAT: Have a combobox for Dissectors
Add a drop-down combobox for UATs, including User DLTs, that have a choice of dissectors. Make the combobox editable, which will provide suggestions, and pass things through to the existing UAT validation for dissectors. (It's a very long list, especially with 1717 entries, including 530 just from various BT GATT UUIDs, so being able to still type it in seems useful.) Dissectors are not protocols. Rename the UAT field from PROTO to DISSECTOR where used. Update the column names and long descriptions to use dissector instead of protocol in dissectors that used this. There may at some point be UATs that want protocols instead of dissectors, but that's not what the current behavior does and none of the current dissectors that use the existing types want. Update the documentation to use "dissector" instead of "protocol." Put the names of the actual current three Ethernet dissectors. Clarify that the "ip" dissector actually tries IPv4 and IPv6, instead of just IPv4. UAT entries are backwards and forwards compatible with versions without this change. Fix #18836.
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/models/uat_delegate.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/ui/qt/models/uat_delegate.cpp b/ui/qt/models/uat_delegate.cpp
index 31481748a2..c01f8358b7 100644
--- a/ui/qt/models/uat_delegate.cpp
+++ b/ui/qt/models/uat_delegate.cpp
@@ -11,6 +11,7 @@
*/
#include <ui/qt/models/uat_delegate.h>
+#include <epan/packet.h> // for get_dissector_names()
#include "epan/value_string.h"
#include <wsutil/ws_assert.h>
#include <QRegularExpression>
@@ -77,6 +78,23 @@ QWidget *UatDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &
break;
}
+ case PT_TXTMOD_DISSECTOR:
+ {
+ QComboBox *cb_editor = new QComboBox(parent);
+ GList* dissector_names = get_dissector_names();
+ for (GList* l = dissector_names; l != NULL; l = l->next) {
+ const char *name = (const char *) l->data;
+ cb_editor->addItem(name, QVariant(name));
+ }
+ cb_editor->model()->sort(0);
+ g_list_free(dissector_names);
+ cb_editor->setInsertPolicy(QComboBox::NoInsert);
+ cb_editor->setEditable(true);
+ editor = cb_editor;
+ cb_editor->setMinimumWidth(cb_editor->minimumSizeHint().width());
+ break;
+ }
+
case PT_TXTMOD_STRING:
// TODO add a live validator? Should SyntaxLineEdit be used?
editor = QStyledItemDelegate::createEditor(parent, option, index);
@@ -135,6 +153,7 @@ void UatDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
qobject_cast<PathSelectionEdit *>(editor)->setPath(index.model()->data(index, Qt::EditRole).toString());
break;
case PT_TXTMOD_ENUM:
+ case PT_TXTMOD_DISSECTOR:
{
QComboBox *combobox = static_cast<QComboBox *>(editor);
const QString &data = index.model()->data(index, Qt::EditRole).toString();
@@ -169,6 +188,7 @@ void UatDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
const_cast<QAbstractItemModel *>(index.model())->setData(index, qobject_cast<PathSelectionEdit *>(editor)->path(), Qt::EditRole);
break;
case PT_TXTMOD_ENUM:
+ case PT_TXTMOD_DISSECTOR:
{
QComboBox *combobox = static_cast<QComboBox *>(editor);
const QString &data = combobox->currentText();