diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-02-03 15:13:24 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-02-09 12:13:32 +0100 |
commit | 5d554656d7f2392a0c98a4474641f997c7b47543 (patch) | |
tree | 2dcec940f648d8c9cd20d89d6fd06f06a04840f4 /variant | |
parent | 7dd05e0be7a1243d7f3026fadd3492eb054006fb (diff) |
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.
Diffstat (limited to 'variant')
-rw-r--r-- | variant/default/main-window.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
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() |