diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-11-01 11:44:42 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-11-01 11:44:42 +0100 |
commit | 8dca727968bf64c8aa89cce09172f101c2ade069 (patch) | |
tree | dd947fb59941d3720c3313776b7901bcf4559c76 /opentrack/shortcuts.h | |
parent | 1e9579290745f1d375c4ab8b42f710cb1249bcec (diff) |
shortcuts: separate keybinding worker to another file
Diffstat (limited to 'opentrack/shortcuts.h')
-rw-r--r-- | opentrack/shortcuts.h | 69 |
1 files changed, 3 insertions, 66 deletions
diff --git a/opentrack/shortcuts.h b/opentrack/shortcuts.h index 81c1bb80..84231850 100644 --- a/opentrack/shortcuts.h +++ b/opentrack/shortcuts.h @@ -8,14 +8,6 @@ #pragma once #include <QObject> -#include <QWidget> -#include "opentrack-compat/timer.hpp" -#include <QThread> -#include <QMessageBox> -#include <QCheckBox> -#include <QComboBox> -#include <QSettings> -#include <QMutex> #ifdef BUILD_api # include "opentrack-compat/export.hpp" @@ -24,69 +16,14 @@ #endif #include "qxt-mini/QxtGlobalShortcut" -#include "opentrack/plugin-support.hpp" #include "opentrack-compat/options.hpp" #include "opentrack/main-settings.hpp" -using namespace options; - -namespace { - extern QList<QString> global_key_sequences; -} - -#if defined(_WIN32) - -namespace { - extern QList<int> global_windows_key_sequences; -} -# undef DIRECTINPUT_VERSION -# define DIRECTINPUT_VERSION 0x0800 -# include <windows.h> -# include <dinput.h> - -struct Key { - BYTE keycode; - bool shift; - bool ctrl; - bool alt; - Timer timer; -public: - Key() : keycode(0), shift(false), ctrl(false), alt(false) - { - } - - bool should_process() - { - if (keycode == 0) - return false; - bool ret = timer.elapsed_ms() > 100; - timer.start(); - return ret; - } -}; -#else -typedef unsigned char BYTE; -struct Key { int foo; }; -#endif - -struct OPENTRACK_EXPORT KeybindingWorker : public QThread { #ifdef _WIN32 -private: - LPDIRECTINPUT8 din; - LPDIRECTINPUTDEVICE8 dinkeyboard; - QMutex mtx; -public: - volatile bool should_quit; - std::function<void(Key&)> receiver; - ~KeybindingWorker(); - KeybindingWorker(std::function<void(Key&)> receiver, WId h); - void run(); -#else -public: - KeybindingWorker(Key, Key, Key, WId) {} - void run() {} +# include "keybinding-worker.hpp" #endif -}; + +using namespace options; struct OPENTRACK_EXPORT Shortcuts : public QObject { Q_OBJECT |