diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-12-28 07:34:11 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-12-28 07:34:11 +0100 |
commit | 3494748fab9e98b861f0be37e4c685276a0a7227 (patch) | |
tree | a0a81da48c6fa03731f393fd00d5e72798048e5c | |
parent | 5d9b1a16c64a7f1a6730c7bf873a3b2a53fc1c7b (diff) |
migration: fix for real this time
clang whines on the initial hack
-rw-r--r-- | migration/20160917_00-accela.cpp | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/migration/20160917_00-accela.cpp b/migration/20160917_00-accela.cpp index 61d53ce1..714f5f9b 100644 --- a/migration/20160917_00-accela.cpp +++ b/migration/20160917_00-accela.cpp @@ -15,8 +15,6 @@ using namespace migrations; using namespace options; -#define s (settings_accela()) - struct move_accela_to_sliders : migration { struct map @@ -27,28 +25,39 @@ struct move_accela_to_sliders : migration value<slider_value>* new_slider; }; - const map settings[8]; static constexpr const char* old_bundle_name = "Accela"; static constexpr const char* new_bundle_name = "accela-sliders"; static constexpr const char* slider_name = "rotation-nonlinearity"; - move_accela_to_sliders() : - settings { - { "rotation-threshold", 4, 1, &s.rot_sensitivity }, - { "translation-threshold", 4, 1, &s.trans_sensitivity }, - { "rotation-deadzone", 4, 0, &s.rot_deadzone }, - { "translation-deadzone", 4, 0, &s.trans_deadzone }, - { "ewma", 1.25, 0, &s.ewma }, - { nullptr, 0, 0, nullptr }, - } + using map_ = struct { map s[8]; }; + + static map_ make_settings(settings_accela& s) { + map_ ret + { + { + { "rotation-threshold", 4, 1, &s.rot_sensitivity }, + { "translation-threshold", 4, 1, &s.trans_sensitivity }, + { "rotation-deadzone", 4, 0, &s.rot_deadzone }, + { "translation-deadzone", 4, 0, &s.trans_deadzone }, + { "ewma", 1.25, 0, &s.ewma }, + { nullptr, 0, 0, nullptr }, + } + }; + return ret; } + move_accela_to_sliders() = default; + QString unique_date() const override { return "20160917_00"; } QString name() const override { return "move accela to .ini sliders"; } bool should_run() const override { + settings_accela s; + map_ ss = make_settings(s); + map* settings = ss.s; + const bundle old_b = make_bundle(old_bundle_name); const bundle new_b = make_bundle(new_bundle_name); @@ -71,6 +80,10 @@ struct move_accela_to_sliders : migration void run() override { + settings_accela s; + map_ ss = make_settings(s); + map* settings = ss.s; + bundle old_b = make_bundle(old_bundle_name); bundle new_b = make_bundle(new_bundle_name); |