diff options
author | Michael Mann <mmann78@netscape.net> | 2018-01-06 19:03:36 -0500 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2018-01-09 13:09:18 +0000 |
commit | 3f2f16411fb2f9582294227594549fb8fdd9a227 (patch) | |
tree | dc36813894b0668eee2bbbb10b02a72c6e377440 /ui/qt/preferences_dialog.cpp | |
parent | 4e87f6c01a7bd0dc29959492e758eb6fae0a9fc9 (diff) |
Convert GUI layout preferences to use preference effects.
Another simple example of how to use preference effects to limit
the times a capture file is redissected unnecessarily.
Also clean up some of the grammar of preference effect descriptions.
Change-Id: I2db92e8e3ee913d3b37162916bd0ef7ac8ecd794
Reviewed-on: https://code.wireshark.org/review/25175
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/qt/preferences_dialog.cpp')
-rw-r--r-- | ui/qt/preferences_dialog.cpp | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/ui/qt/preferences_dialog.cpp b/ui/qt/preferences_dialog.cpp index a6b41671ce..78547d12c8 100644 --- a/ui/qt/preferences_dialog.cpp +++ b/ui/qt/preferences_dialog.cpp @@ -201,25 +201,13 @@ void PreferencesDialog::on_advancedSearchLineEdit_textEdited(const QString &sear void PreferencesDialog::on_buttonBox_accepted() { gchar* err = NULL; - unsigned int must_redissect = 0; - - QVector<unsigned> old_layout = QVector<unsigned>() << prefs.gui_layout_type - << prefs.gui_layout_content_1 - << prefs.gui_layout_content_2 - << prefs.gui_layout_content_3; + unsigned int redissect_flags = 0; // XXX - We should validate preferences as the user changes them, not here. // XXX - We're also too enthusiastic about setting must_redissect. -// if (!prefs_main_fetch_all(parent_w, &must_redissect)) -// return; /* Errors in some preference setting - already reported */ - prefs_modules_foreach_submodules(NULL, module_prefs_unstash, (gpointer)&must_redissect); - - QVector<unsigned> new_layout = QVector<unsigned>() << prefs.gui_layout_type - << prefs.gui_layout_content_1 - << prefs.gui_layout_content_2 - << prefs.gui_layout_content_3; + prefs_modules_foreach_submodules(NULL, module_prefs_unstash, (gpointer)&redissect_flags); - if (new_layout[0] != old_layout[0]) { + if (redissect_flags & PREF_EFFECT_GUI_LAYOUT) { // Layout type changed, reset sizes recent.gui_geometry_main_upper_pane = 0; recent.gui_geometry_main_lower_pane = 0; @@ -269,13 +257,13 @@ void PreferencesDialog::on_buttonBox_accepted() wsApp->setMonospaceFont(prefs.gui_qt_font_name); - if (must_redissect & PREF_EFFECT_DISSECTION) { + if (redissect_flags & PREF_EFFECT_DISSECTION) { /* Redissect all the packets, and re-evaluate the display filter. */ wsApp->queueAppSignal(WiresharkApplication::PacketDissectionChanged); } wsApp->queueAppSignal(WiresharkApplication::PreferencesChanged); - if (new_layout != old_layout) { + if (redissect_flags & PREF_EFFECT_GUI_LAYOUT) { wsApp->queueAppSignal(WiresharkApplication::RecentPreferencesRead); } } |