diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-01-18 23:08:30 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-01-18 23:08:30 +0100 |
commit | e0866f30d25abd62fadb4b29fff90143c288e9ff (patch) | |
tree | 8e482e9d549e6bed4f6843d103b39c2591cb92d8 /migration | |
parent | ee7a635a4c2222b8a77f26956dadcd9d515536a7 (diff) |
logic: change relative translation triggering
Relative translation mode now has three states:
- disabled
- always enabled
- enabled when not aiming
In the third mode, looking very close to center disables reltrans. The
exact values aren't final.
Diffstat (limited to 'migration')
-rw-r--r-- | migration/20180118_00-reltrans.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/migration/20180118_00-reltrans.cpp b/migration/20180118_00-reltrans.cpp new file mode 100644 index 00000000..ba35e7f0 --- /dev/null +++ b/migration/20180118_00-reltrans.cpp @@ -0,0 +1,44 @@ +#include "migration.hpp" +#include "options/options.hpp" + +using namespace options; +using namespace migrations; + +enum reltrans_state +{ + reltrans_disabled = 0, + reltrans_enabled = 1, + reltrans_non_center = 2, +}; + +static const char* old_name = "compensate-translation"; +static const char* new_name = "relative-translation-mode"; + +struct reltrans_enum : migration +{ + QString unique_date() const override + { + return "20180118_00"; + } + + QString name() const override + { + return "reltrans modes"; + } + + bool should_run() const override + { + auto b = make_bundle("opentrack-ui"); + return b->contains(old_name) && !b->contains(new_name); + } + + void run() override + { + auto b = make_bundle("opentrack-ui"); + bool value = b->get<bool>(old_name); + b->store_kv(new_name, int(value ? reltrans_enabled : reltrans_disabled)); + b->save(); + } +}; + +OPENTRACK_MIGRATION(reltrans_enum); |