summaryrefslogtreecommitdiffstats
path: root/ui/qt/module_preferences_scroll_area.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:53 +0000
commita86c5f7cae7ec9a3398300555a0b644689d946a1 (patch)
tree39fe4b107c71174fd1e8a8ceb9a4d2aa14116248 /ui/qt/module_preferences_scroll_area.cpp
parentReleasing progress-linux version 4.2.6-1~progress7.99u1. (diff)
downloadwireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.tar.xz
wireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.zip
Merging upstream version 4.4.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ui/qt/module_preferences_scroll_area.cpp')
-rw-r--r--ui/qt/module_preferences_scroll_area.cpp69
1 files changed, 43 insertions, 26 deletions
diff --git a/ui/qt/module_preferences_scroll_area.cpp b/ui/qt/module_preferences_scroll_area.cpp
index 56503e0a..d6f4718d 100644
--- a/ui/qt/module_preferences_scroll_area.cpp
+++ b/ui/qt/module_preferences_scroll_area.cpp
@@ -10,6 +10,7 @@
#include "module_preferences_scroll_area.h"
#include <ui_module_preferences_scroll_area.h>
#include <ui/qt/widgets/syntax_line_edit.h>
+#include <ui/qt/widgets/dissector_syntax_line_edit.h>
#include "ui/qt/widgets/wireshark_file_dialog.h"
#include <ui/qt/utils/qt_ui_utils.h>
#include "uat_dialog.h"
@@ -56,8 +57,8 @@ extern "C" {
// Callbacks prefs routines
/* Add a single preference to the QVBoxLayout of a preference page */
-static guint
-pref_show(pref_t *pref, gpointer user_data)
+static unsigned
+pref_show(pref_t *pref, void *user_data)
{
prefSearchData * data = static_cast<prefSearchData *>(user_data);
@@ -73,7 +74,6 @@ pref_show(pref_t *pref, gpointer user_data)
switch (prefs_get_type(pref)) {
case PREF_UINT:
- case PREF_DECODE_AS_UINT:
{
QHBoxLayout *hb = new QHBoxLayout();
QLabel *label = new QLabel(prefs_get_title(pref));
@@ -171,6 +171,21 @@ pref_show(pref_t *pref, gpointer user_data)
vb->addLayout(hb);
break;
}
+ case PREF_DISSECTOR:
+ {
+ QHBoxLayout *hb = new QHBoxLayout();
+ QLabel *label = new QLabel(prefs_get_title(pref));
+ label->setToolTip(tooltip);
+ hb->addWidget(label);
+ QLineEdit *string_le = new DissectorSyntaxLineEdit();
+ string_le->setToolTip(tooltip);
+ string_le->setProperty(pref_prop_, VariantPointer<pref_t>::asQVariant(pref));
+ string_le->setMinimumWidth(string_le->fontMetrics().height() * 20);
+ hb->addWidget(string_le);
+ hb->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum));
+ vb->addLayout(hb);
+ break;
+ }
case PREF_DECODE_AS_RANGE:
case PREF_RANGE:
{
@@ -305,7 +320,7 @@ ModulePreferencesScrollArea::ModulePreferencesScrollArea(module_t *module, QWidg
/* Show the preference's description at the top of the page */
QFont font;
- font.setBold(TRUE);
+ font.setBold(true);
QLabel *label = new QLabel(module->description);
label->setFont(font);
ui->verticalLayout->addWidget(label);
@@ -322,9 +337,6 @@ ModulePreferencesScrollArea::ModulePreferencesScrollArea(module_t *module, QWidg
if (!pref) continue;
switch (prefs_get_type(pref)) {
- case PREF_DECODE_AS_UINT:
- connect(le, &QLineEdit::textEdited, this, &ModulePreferencesScrollArea::uintLineEditTextEdited);
- break;
case PREF_UINT:
connect(le, &QLineEdit::textEdited, this, &ModulePreferencesScrollArea::uintLineEditTextEdited);
break;
@@ -333,6 +345,7 @@ ModulePreferencesScrollArea::ModulePreferencesScrollArea(module_t *module, QWidg
case PREF_OPEN_FILENAME:
case PREF_DIRNAME:
case PREF_PASSWORD:
+ case PREF_DISSECTOR:
connect(le, &QLineEdit::textEdited, this, &ModulePreferencesScrollArea::stringLineEditTextEdited);
break;
case PREF_RANGE:
@@ -471,11 +484,27 @@ void ModulePreferencesScrollArea::updateWidgets()
}
if (prefs_get_type(pref) == PREF_PROTO_TCP_SNDAMB_ENUM && !prefs_get_enum_radiobuttons(pref)) {
- MainWindow* topWidget = dynamic_cast<MainWindow*> (mainApp->mainWindow());
- /* Ensure there is one unique or multiple selections. See issue 18642 */
- if (topWidget->hasSelection() || topWidget->hasUniqueSelection()) {
- frame_data * fdata = topWidget->frameDataForRow((topWidget->selectedRows()).at(0));
- enum_cb->setCurrentIndex(fdata->tcp_snd_manual_analysis);
+ if (prefs_get_list_value(pref, pref_stashed) == NULL) {
+ /* We haven't added a list of frames that could have their
+ * analysis changed. Set the current value to whatever the
+ * first selected frame has for its its TCP Sequence Analysis
+ * override.
+ */
+ MainWindow* topWidget = qobject_cast<MainWindow*>(mainApp->mainWindow());
+ /* Ensure there is one unique or multiple selections. See issue 18642 */
+ if (topWidget->hasSelection() || topWidget->hasUniqueSelection()) {
+ frame_data * fdata = topWidget->frameDataForRow((topWidget->selectedRows()).at(0));
+ enum_cb->setCurrentIndex(enum_cb->findData(fdata->tcp_snd_manual_analysis));
+ QList<int> rows = topWidget->selectedRows();
+ foreach (int row, rows) {
+ frame_data * fdata = topWidget->frameDataForRow(row);
+ prefs_add_list_value(pref, fdata, pref_stashed);
+ }
+ }
+ } else {
+ /* The initial value was already set from the selected frames,
+ * use the current value from when the CB was changed. */
+ enum_cb->setCurrentIndex(enum_cb->findData(prefs_get_enum_value(pref, pref_current)));
}
}
}
@@ -640,20 +669,8 @@ void ModulePreferencesScrollArea::enumComboBoxCurrentIndexChanged_PROTO_TCP(int
pref_t *pref = VariantPointer<pref_t>::asPtr(enum_cb->property(pref_prop_));
if (!pref) return;
- MainWindow* topWidget = dynamic_cast<MainWindow*> (mainApp->mainWindow());
-
- // method 1 : apply to one single packet
- /* frame_data * fdata = topWidget->frameDataForRow((topWidget->selectedRows()).at(0));
- fdata->tcp_snd_manual_analysis = enum_cb->itemData(index).toInt();*/
-
- // method 2 : we can leverage the functionality by allowing multiple selections
- QList<int> rows = topWidget->selectedRows();
- foreach (int row, rows) {
- frame_data * fdata = topWidget->frameDataForRow(row);
- fdata->tcp_snd_manual_analysis = enum_cb->itemData(index).toInt();
- }
-
+ // Store the index value in the current value, not the stashed value.
+ // We use the stashed value to store the frame data pointers.
prefs_set_enum_value(pref, enum_cb->itemData(index).toInt(), pref_current);
//prefs_set_enum_value(pref, enum_cb->itemData(index).toInt(), pref_stashed);
- updateWidgets();
}