diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-06-29 13:02:41 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-06-29 13:18:31 +0200 |
commit | 2dd8064c20d88c26a11240c6a871f670b5109d71 (patch) | |
tree | a6aa04113adc5837f02548464766b9291ecab89a /opentrack-logic | |
parent | 2eccd41897d6794a80b3ed2fcaaded85c453d46d (diff) |
logic, gui: reload keybinding description on profile change
Diffstat (limited to 'opentrack-logic')
-rw-r--r-- | opentrack-logic/shortcuts.cpp | 6 | ||||
-rw-r--r-- | opentrack-logic/shortcuts.h | 6 |
2 files changed, 7 insertions, 5 deletions
diff --git a/opentrack-logic/shortcuts.cpp b/opentrack-logic/shortcuts.cpp index 06c246af..8d818180 100644 --- a/opentrack-logic/shortcuts.cpp +++ b/opentrack-logic/shortcuts.cpp @@ -25,7 +25,7 @@ void Shortcuts::free_binding(K& key) #endif } -void Shortcuts::bind_keyboard_shortcut(K &key, const key_opts& k, unused_on_unix(bool, held)) +void Shortcuts::bind_shortcut(K &key, const key_opts& k, unused_on_unix(bool, held)) { #if !defined(_WIN32) using sh = QxtGlobalShortcut; @@ -98,7 +98,7 @@ void Shortcuts::receiver(const Key& k) } #endif -void Shortcuts::reload(const std::vector<std::tuple<key_opts&, fun, bool>> &keys_) +void Shortcuts::reload(const t_keys& keys_) { const unsigned sz = keys_.size(); keys = std::vector<tt>(); @@ -110,7 +110,7 @@ void Shortcuts::reload(const std::vector<std::tuple<key_opts&, fun, bool>> &keys const bool held = std::get<2>(kk); auto fun = std::get<1>(kk); K k; - bind_keyboard_shortcut(k, opts, held); + bind_shortcut(k, opts, held); keys.push_back(tt(k, [=](unused_on_unix(bool, flag)) -> void { #ifdef _WIN32 diff --git a/opentrack-logic/shortcuts.h b/opentrack-logic/shortcuts.h index 87e24d4f..d6a87672 100644 --- a/opentrack-logic/shortcuts.h +++ b/opentrack-logic/shortcuts.h @@ -45,6 +45,8 @@ public: using fun = std::function<void(bool)>; using tt = std::tuple<K, fun, bool>; + using t_key = std::tuple<key_opts&, fun, bool>; + using t_keys = std::vector<t_key>; std::vector<tt> keys; #ifdef _WIN32 KeybindingWorker::Token key_token; @@ -56,10 +58,10 @@ public: #endif {} - void reload(const std::vector<std::tuple<key_opts&, fun, bool>> &keys_); + void reload(const t_keys& keys_); private: void free_binding(K& key); - void bind_keyboard_shortcut(K &key, const key_opts& k, bool held); + void bind_shortcut(K &key, const key_opts& k, bool held); #ifdef _WIN32 void receiver(const Key& k); #endif |