diff options
author | David Perry <boolean263@protonmail.com> | 2021-08-30 16:02:17 -0400 |
---|---|---|
committer | AndersBroman <a.broman58@gmail.com> | 2021-09-09 12:58:38 +0000 |
commit | 84a01416834b50adabccc92a3c5c15d86052cc20 (patch) | |
tree | 9c7496b12f5ac897b65683db0990b47012a86b76 /ui/qt | |
parent | 02285e53b8a8f478a0e14c7f57b5d59a3a0140e8 (diff) |
[#12331] Persist cmd-line prefs on reloading Lua
Save a list of all user options that were specified on the Wireshark
command line using the `-o` option. Reapply those preferences after
reloading Lua plugins. Fixes the behaviour given in #12331 wherein such
prefs were reset to the defaults, not the command-line values, when
reloading Lua plugins.
When the user changes a preference in the Wireshark UI, remove that
preference from the stored command line options, so it doesn't get reset
when Lua plugins are reloaded again.
Diffstat (limited to 'ui/qt')
-rw-r--r-- | ui/qt/main.cpp | 1 | ||||
-rw-r--r-- | ui/qt/main_window_slots.cpp | 1 | ||||
-rw-r--r-- | ui/qt/preferences_dialog.cpp | 3 | ||||
-rw-r--r-- | ui/qt/protocol_preferences_menu.cpp | 10 |
4 files changed, 15 insertions, 0 deletions
diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp index b7107ad557..d5ec5191e9 100644 --- a/ui/qt/main.cpp +++ b/ui/qt/main.cpp @@ -1090,5 +1090,6 @@ clean_exit: codecs_cleanup(); wtap_cleanup(); free_progdirs(); + commandline_options_free(); exit_application(ret_val); } diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index aa08bf3d9e..1fd311413d 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -1527,6 +1527,7 @@ void MainWindow::reloadLuaPlugins() main_ui_->preferenceEditorFrame->animatedHide(); wsApp->readConfigurationFiles(true); + commandline_options_reapply(); prefs_apply_all(); fieldsChanged(); diff --git a/ui/qt/preferences_dialog.cpp b/ui/qt/preferences_dialog.cpp index b1cbc70d56..74ba141ab3 100644 --- a/ui/qt/preferences_dialog.cpp +++ b/ui/qt/preferences_dialog.cpp @@ -16,6 +16,8 @@ #include <epan/decode_as.h> #include <ui/language.h> #include <ui/preference_utils.h> +#include <cfile.h> +#include <ui/commandline.h> #include <ui/simple_dialog.h> #include <ui/recent.h> #include <main_window.h> @@ -43,6 +45,7 @@ module_prefs_unstash(module_t *module, gpointer data) unstashed_data.module = module; pref_unstash(pref, &unstashed_data); + commandline_options_drop(module->name, prefs_get_name(pref)); } /* If any of them changed, indicate that we must redissect and refilter diff --git a/ui/qt/protocol_preferences_menu.cpp b/ui/qt/protocol_preferences_menu.cpp index 72ef26bdcf..58b0309aae 100644 --- a/ui/qt/protocol_preferences_menu.cpp +++ b/ui/qt/protocol_preferences_menu.cpp @@ -15,6 +15,8 @@ #include <epan/prefs-int.h> #include <epan/proto.h> +#include <cfile.h> +#include <ui/commandline.h> #include <ui/preference_utils.h> #include <wsutil/utf8_entities.h> @@ -45,6 +47,8 @@ public: return prefs_set_bool_value(pref_, isChecked(), pref_current); } + pref_t *getPref() { return pref_; } + private: pref_t *pref_; }; @@ -66,6 +70,8 @@ public: return prefs_set_enum_value(pref_, enumval_, pref_current); } + pref_t *getPref() { return pref_; } + private: pref_t *pref_; int enumval_; @@ -89,6 +95,8 @@ public: uat_dlg->show(); } + pref_t *getPref() { return pref_; } + private: pref_t *pref_; }; @@ -285,6 +293,7 @@ void ProtocolPreferencesMenu::boolPreferenceTriggered() prefs_apply(module_); prefs_main_write(); + commandline_options_drop(module_->name, prefs_get_name(bpa->getPref())); if (changed_flags & PREF_EFFECT_FIELDS) { wsApp->emitAppSignal(WiresharkApplication::FieldsChanged); @@ -304,6 +313,7 @@ void ProtocolPreferencesMenu::enumPreferenceTriggered() module_->prefs_changed_flags |= changed_flags; prefs_apply(module_); prefs_main_write(); + commandline_options_drop(module_->name, prefs_get_name(epa->getPref())); if (changed_flags & PREF_EFFECT_FIELDS) { wsApp->emitAppSignal(WiresharkApplication::FieldsChanged); |