summaryrefslogtreecommitdiffhomepage
path: root/logic/shortcuts.h
diff options
context:
space:
mode:
Diffstat (limited to 'logic/shortcuts.h')
-rw-r--r--logic/shortcuts.h30
1 files changed, 18 insertions, 12 deletions
diff --git a/logic/shortcuts.h b/logic/shortcuts.h
index 5f23d2e7..87926f66 100644
--- a/logic/shortcuts.h
+++ b/logic/shortcuts.h
@@ -11,7 +11,6 @@
#include "options/options.hpp"
#include "main-settings.hpp"
-#include "compat/util.hpp"
#ifdef _WIN32
# include "dinput/keybinding-worker.hpp"
@@ -25,12 +24,22 @@
#include <vector>
#include <functional>
+#if !defined __APPLE__
+# define OTR_HAS_KEY_UP_SUPPORT
+#endif
+
+namespace shortcuts_impl {
+
using namespace options;
-struct OTR_LOGIC_EXPORT Shortcuts final : public QObject
+class OTR_LOGIC_EXPORT Shortcuts final : public QObject
{
Q_OBJECT
+#ifdef _WIN32
+ void receiver(const Key& k);
+#endif
+
public:
using K =
#ifndef _WIN32
@@ -46,21 +55,18 @@ public:
using t_keys = std::vector<t_key>;
std::vector<tt> keys;
#ifdef _WIN32
- KeybindingWorker::Token key_token;
+ KeybindingWorker::Token key_token {[this](const Key& k) { receiver(k); }};
#endif
- Shortcuts()
-#ifdef _WIN32
- : key_token([&](const Key& k) { receiver(k); })
-#endif
- {}
- ~Shortcuts();
+ Shortcuts() = default;
+ ~Shortcuts() override;
void reload(const t_keys& keys_);
private:
void free_binding(K& key);
void bind_shortcut(K &key, const key_opts& k, bool held);
-#ifdef _WIN32
- void receiver(const Key& k);
-#endif
};
+
+} // ns shortcuts_impl
+
+using shortcuts_impl::Shortcuts;