diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2017-02-16 15:08:06 +0100 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2017-02-16 20:53:00 +0000 |
commit | 384c26622b0adc7eda415ba6e2a9fc704cd27794 (patch) | |
tree | d3967da649ac35e49adedaf69fe254ccbcc967b6 | |
parent | 7e9b7b596728e6d1ab1ab5dc01e6a24a3bfafd6b (diff) | |
download | wireshark-384c26622b0adc7eda415ba6e2a9fc704cd27794.tar.gz |
Qt: Preserve pane sizes when layout content changed
Preserve pane sizes when rearranging layout content in the
preferences dialog.
Change-Id: I2af2a60424a7bf94f1f92e7c63e6a1823985b60d
Reviewed-on: https://code.wireshark.org/review/20145
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
-rw-r--r-- | ui/qt/main_window_slots.cpp | 4 | ||||
-rw-r--r-- | ui/qt/preferences_dialog.cpp | 14 |
2 files changed, 15 insertions, 3 deletions
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index 0e1dc2772b..83fdd82811 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -2151,6 +2151,8 @@ void MainWindow::showPreferencesDialog(PreferencesDialog::PreferencesPane start_ { PreferencesDialog pref_dialog(this); + saveWindowGeometry(); // Save in case the layout panes are rearranged + pref_dialog.setPane(start_pane); pref_dialog.exec(); @@ -2163,6 +2165,8 @@ void MainWindow::showPreferencesDialog(QString module_name) { PreferencesDialog pref_dialog(this); + saveWindowGeometry(); // Save in case the layout panes are rearranged + pref_dialog.setPane(module_name); pref_dialog.exec(); diff --git a/ui/qt/preferences_dialog.cpp b/ui/qt/preferences_dialog.cpp index cca797affc..deb4a4baf4 100644 --- a/ui/qt/preferences_dialog.cpp +++ b/ui/qt/preferences_dialog.cpp @@ -870,7 +870,10 @@ void PreferencesDialog::on_buttonBox_accepted() gchar* err = NULL; gboolean must_redissect = FALSE; - layout_type_e old_layout_type = prefs.gui_layout_type; + 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; // XXX - We should validate preferences as the user changes them, not here. // XXX - We're also too enthusiastic about setting must_redissect. @@ -878,7 +881,12 @@ void PreferencesDialog::on_buttonBox_accepted() // return; /* Errors in some preference setting - already reported */ prefs_modules_foreach_submodules(NULL, module_prefs_unstash, (gpointer) &must_redissect); - if (prefs.gui_layout_type != old_layout_type) { + 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; + + if (new_layout[0] != old_layout[0]) { // Layout type changed, reset sizes recent.gui_geometry_main_upper_pane = 0; recent.gui_geometry_main_lower_pane = 0; @@ -928,7 +936,7 @@ void PreferencesDialog::on_buttonBox_accepted() } wsApp->queueAppSignal(WiresharkApplication::PreferencesChanged); - if (prefs.gui_layout_type != old_layout_type) { + if (new_layout != old_layout) { wsApp->queueAppSignal(WiresharkApplication::RecentPreferencesRead); } } |