diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-02-18 11:06:28 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-02-18 11:06:28 +0100 |
commit | f0c1b0c5ac63cc7611f4afa21699f1240fed7a9f (patch) | |
tree | 9e1f12a95d5ec03773601c2316caa3e18f18a3b9 /logic | |
parent | f575f6402fc4e79e2d12c2bc897b616f112af4d9 (diff) |
gui, logic: allow for two keybindings for each function
Also, remove "disable reltrans while held" cause it's too specific.
Diffstat (limited to 'logic')
-rw-r--r-- | logic/main-settings.hpp | 41 | ||||
-rw-r--r-- | logic/work.cpp | 20 |
2 files changed, 41 insertions, 20 deletions
diff --git a/logic/main-settings.hpp b/logic/main-settings.hpp index 203f531a..f66bff7d 100644 --- a/logic/main-settings.hpp +++ b/logic/main-settings.hpp @@ -102,10 +102,15 @@ struct main_settings value<int> center_method; value<int> neck_y, neck_z; value<bool> neck_enable; - key_opts key_start_tracking, key_stop_tracking, key_toggle_tracking, key_restart_tracking; - key_opts key_center, key_toggle, key_zero; - key_opts key_toggle_press, key_zero_press; - key_opts key_disable_tcomp_press; + key_opts key_start_tracking1, key_start_tracking2; + key_opts key_stop_tracking1, key_stop_tracking2; + key_opts key_toggle_tracking1, key_toggle_tracking2; + key_opts key_restart_tracking1, key_restart_tracking2; + key_opts key_center1, key_center2; + key_opts key_toggle1, key_toggle2; + key_opts key_zero1, key_zero2; + key_opts key_toggle_press1, key_toggle_press2; + key_opts key_zero_press1, key_zero_press2; value<bool> tracklogging_enabled; value<QString> tracklogging_filename; main_settings() : @@ -135,16 +140,24 @@ struct main_settings neck_y(b, "neck-height", 0), neck_z(b, "neck-depth", 0), neck_enable(b, "neck-enable", false), - key_start_tracking(b, "start-tracking"), - key_stop_tracking(b, "stop-tracking"), - key_toggle_tracking(b, "toggle-tracking"), - key_restart_tracking(b, "restart-tracking"), - key_center(b, "center"), - key_toggle(b, "toggle"), - key_zero(b, "zero"), - key_toggle_press(b, "toggle-press"), - key_zero_press(b, "zero-press"), - key_disable_tcomp_press(b, "disable-translation-compensation-while-held"), + key_start_tracking1(b, "start-tracking"), + key_start_tracking2(b, "start-tracking-alt"), + key_stop_tracking1(b, "stop-tracking"), + key_stop_tracking2(b, "stop-tracking-alt"), + key_toggle_tracking1(b, "toggle-tracking"), + key_toggle_tracking2(b, "toggle-tracking-alt"), + key_restart_tracking1(b, "restart-tracking"), + key_restart_tracking2(b, "restart-tracking-alt"), + key_center1(b, "center"), + key_center2(b, "center-alt"), + key_toggle1(b, "toggle"), + key_toggle2(b, "toggle-alt"), + key_zero1(b, "zero"), + key_zero2(b, "zero-alt"), + key_toggle_press1(b, "toggle-press"), + key_toggle_press2(b, "toggle-press-alt"), + key_zero_press1(b, "zero-press"), + key_zero_press2(b, "zero-press-alt"), tracklogging_enabled(b, "tracklogging-enabled", false), tracklogging_filename(b, "tracklogging-filename", QString()) { diff --git a/logic/work.cpp b/logic/work.cpp index d2a16139..ebac4c39 100644 --- a/logic/work.cpp +++ b/logic/work.cpp @@ -67,12 +67,20 @@ Work::Work(Mappings& m, SelectedLibraries& libs, WId handle) : sc(std::make_shared<Shortcuts>()), handle(handle), keys { - key_tuple(s.key_center, [&](bool) -> void { tracker->center(); }, true), - key_tuple(s.key_toggle, [&](bool) -> void { tracker->toggle_enabled(); }, true), - key_tuple(s.key_zero, [&](bool) -> void { tracker->zero(); }, true), - key_tuple(s.key_toggle_press, [&](bool x) -> void { tracker->set_toggle(!x); }, false), - key_tuple(s.key_zero_press, [&](bool x) -> void { tracker->set_zero(x); }, false), - key_tuple(s.key_disable_tcomp_press, [&](bool x) { tracker->set_tcomp_disabled(x); }, false), + key_tuple(s.key_center1, [&](bool) -> void { tracker->center(); }, true), + key_tuple(s.key_center2, [&](bool) -> void { tracker->center(); }, true), + + key_tuple(s.key_toggle1, [&](bool) -> void { tracker->toggle_enabled(); }, true), + key_tuple(s.key_toggle2, [&](bool) -> void { tracker->toggle_enabled(); }, true), + + key_tuple(s.key_zero1, [&](bool) -> void { tracker->zero(); }, true), + key_tuple(s.key_zero2, [&](bool) -> void { tracker->zero(); }, true), + + key_tuple(s.key_toggle_press1, [&](bool x) -> void { tracker->set_toggle(!x); }, false), + key_tuple(s.key_toggle_press2, [&](bool x) -> void { tracker->set_toggle(!x); }, false), + + key_tuple(s.key_zero_press1, [&](bool x) -> void { tracker->set_zero(x); }, false), + key_tuple(s.key_zero_press2, [&](bool x) -> void { tracker->set_zero(x); }, false), } { reload_shortcuts(); |