From 3494748fab9e98b861f0be37e4c685276a0a7227 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 28 Dec 2016 07:34:11 +0100 Subject: migration: fix for real this time clang whines on the initial hack --- migration/20160917_00-accela.cpp | 37 +++++++++++++++++++++++++------------ 1 file 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* 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); -- cgit v1.2.3