aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/proto_tree.cpp
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-06-16 17:24:19 -0700
committerGerald Combs <gerald@wireshark.org>2015-06-17 01:25:27 +0000
commit26dacfc8c3befed5fb6dacd84e7d6107c6920b2e (patch)
tree21c776b6be914699bafbdd816da1fd7e632b298d /ui/qt/proto_tree.cpp
parentd5215c2ef6e73b5f073eb0d50e01da7d06d34923 (diff)
Qt: Add protocol preferences menus.
Add protocol preferences in the packet list and packet detail context menus. Note that we need a PreferencesEditorFrame in the main window for editing numeric and string preferences. For now we just show the prefs dialog. Change-Id: Ice0cc8e9bc25963cc14aa47698f042f2a73088d8 Reviewed-on: https://code.wireshark.org/review/8957 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/qt/proto_tree.cpp')
-rw-r--r--ui/qt/proto_tree.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/ui/qt/proto_tree.cpp b/ui/qt/proto_tree.cpp
index 2d1b404587..e2848f41f3 100644
--- a/ui/qt/proto_tree.cpp
+++ b/ui/qt/proto_tree.cpp
@@ -251,8 +251,8 @@ ProtoTree::ProtoTree(QWidget *parent) :
// " <menuitem name='WikiProtocolPage' action='/WikiProtocolPage'/>\n"
// " <menuitem name='FilterFieldReference' action='/FilterFieldReference'/>\n"
// " <menuitem name='ProtocolHelp' action='/ProtocolHelp'/>\n"
-// " <menuitem name='ProtocolPreferences' action='/ProtocolPreferences'/>\n"
-// ctx_menu_.addSeparator();
+ ctx_menu_.addMenu(&proto_prefs_menu_);
+ ctx_menu_.addSeparator();
decode_as_ = window()->findChild<QAction *>("actionAnalyzeDecodeAs");
ctx_menu_.addAction(decode_as_);
// " <menuitem name='DisableProtocol' action='/DisableProtocol'/>\n"
@@ -269,6 +269,9 @@ ProtoTree::ProtoTree(QWidget *parent) :
connect(this, SIGNAL(collapsed(QModelIndex)), this, SLOT(collapse(QModelIndex)));
connect(this, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)),
this, SLOT(itemDoubleClick(QTreeWidgetItem*, int)));
+
+ connect(&proto_prefs_menu_, SIGNAL(showProtocolPreferences(QString)),
+ this, SIGNAL(showProtocolPreferences(QString)));
}
void ProtoTree::clear() {
@@ -286,6 +289,19 @@ void ProtoTree::contextMenuEvent(QContextMenuEvent *event)
conv_menu_.addAction(action);
}
+ const char *module_name = NULL;
+ if (selectedItems().count() > 0) {
+ field_info *fi = selectedItems()[0]->data(0, Qt::UserRole).value<field_info *>();
+ if (fi && fi->hfinfo) {
+ if (fi->hfinfo->parent == -1) {
+ module_name = fi->hfinfo->abbrev;
+ } else {
+ module_name = proto_registrar_get_abbrev(fi->hfinfo->parent);
+ }
+ }
+ }
+ proto_prefs_menu_.setModule(module_name);
+
decode_as_->setData(qVariantFromValue(true));
ctx_menu_.exec(event->globalPos());
decode_as_->setData(QVariant());