From 5d554656d7f2392a0c98a4474641f997c7b47543 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 3 Feb 2019 15:13:24 +0100 Subject: options, opentrack: fix migrations with tie_setting Migrations only ran after `tie_setting()' handlers were done, clobbering the settings that were about to be migrated. Applying QSignalBlocker to few comboboxes isn't enough as it affects everything touched by `tie_setting()'. Split reload and notify phases in the options system. --- variant/default/main-window.cpp | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'variant') diff --git a/variant/default/main-window.cpp b/variant/default/main-window.cpp index 2e9461ed..53872644 100644 --- a/variant/default/main-window.cpp +++ b/variant/default/main-window.cpp @@ -650,42 +650,39 @@ void main_window::exit(int status) void main_window::set_profile(const QString& new_name_, bool migrate) { - QString new_name = new_name_; - QSignalBlocker b(ui.iconcomboProfile); + QString new_name = new_name_; + if (!profile_list.contains(new_name)) { new_name = OPENTRACK_DEFAULT_PROFILE; - refresh_profile_list(); if (!profile_list.contains(new_name)) migrate = false; } - if (new_name != ini_filename()) - { - ui.iconcomboProfile->setCurrentText(new_name); + const bool status = new_name != ini_filename(); + + if (status) set_profile_in_registry(new_name); - options::detail::bundler::refresh_all_bundles(); - } + using bundler = options::detail::bundler; - // this needs to run on app start -sh 20190203 - if (migrate) - { - // workaround migration breakage -sh 20180428 - QSignalBlocker b1(ui.iconcomboTrackerSource); - QSignalBlocker b2(ui.iconcomboProtocol); - QSignalBlocker b3(ui.iconcomboFilter); + bundler::reload_no_notify(); + if (migrate) // migrations are for config layout changes and other user-visible // incompatibilities in future versions run_migrations(); - } else mark_profile_as_not_needing_migration(); + bundler::notify(); + set_title(); + + if (status) + ui.iconcomboProfile->setCurrentText(new_name); } void main_window::ensure_tray() -- cgit v1.2.3