summaryrefslogtreecommitdiffhomepage
path: root/facetracknoir/shortcuts.h
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-09-15 02:04:11 +0200
committerStanislaw Halik <sthalik@misaki.pl>2013-09-15 02:04:11 +0200
commit51fb3e42f915c3b538c423cfb9e5dfae11778717 (patch)
tree053a64cd587d7cc1fb1fc426da5ab3a3cf4d6b9d /facetracknoir/shortcuts.h
parent463737c1b50246c56a67c35c1116732006348593 (diff)
parentb948329c7ae6ab2ff546cba43cdc4aca9b743cfd (diff)
Merge branch 'master' of github.com:opentrack/opentrack
Conflicts: facetracknoir/tracker.cpp ftnoir_filter_accela/ftnoir_filter_accela.cpp ftnoir_filter_accela/ftnoir_filter_accela.h ftnoir_filter_base/ftnoir_filter_base.h ftnoir_filter_ewma2/ftnoir_filter_ewma2.cpp ftnoir_filter_ewma2/ftnoir_filter_ewma2.h
Diffstat (limited to 'facetracknoir/shortcuts.h')
-rw-r--r--facetracknoir/shortcuts.h93
1 files changed, 93 insertions, 0 deletions
diff --git a/facetracknoir/shortcuts.h b/facetracknoir/shortcuts.h
new file mode 100644
index 00000000..685c78b6
--- /dev/null
+++ b/facetracknoir/shortcuts.h
@@ -0,0 +1,93 @@
+#pragma once
+#include <QWidget>
+#include <QElapsedTimer>
+#include <QThread>
+#include <QMessageBox>
+#include <QCheckBox>
+#include <QComboBox>
+#include <QSettings>
+#include "ui_ftnoir_keyboardshortcuts.h"
+
+class FaceTrackNoIR;
+
+class KeyboardShortcutDialog: public QWidget
+{
+ Q_OBJECT
+public:
+
+ explicit KeyboardShortcutDialog( FaceTrackNoIR *ftnoir, QWidget *parent );
+ virtual ~KeyboardShortcutDialog();
+ void showEvent ( QShowEvent * event );
+
+private:
+ Ui::UICKeyboardShortcutDialog ui;
+ void loadSettings();
+ void save();
+
+ bool settingsDirty;
+ FaceTrackNoIR *mainApp;
+
+private slots:
+ void doOK();
+ void doCancel();
+};
+
+extern QList<QString> global_key_sequences;
+
+#if defined(_WIN32)
+extern QList<int> global_windows_key_sequences;
+# undef DIRECTINPUT_VERSION
+# define DIRECTINPUT_VERSION 0x0800
+# include <windows.h>
+# undef DIRECTINPUT_VERSION
+# define DIRECTINPUT_VERSION 0x0800
+# include <dinput.h>
+
+struct Key {
+ BYTE keycode;
+ bool shift;
+ bool ctrl;
+ bool alt;
+ bool ever_pressed;
+ QElapsedTimer timer;
+public:
+ Key() : keycode(0), shift(false), ctrl(false), alt(false), ever_pressed(false)
+ {
+ }
+};
+#else
+typedef unsigned char BYTE;
+struct Key { int foo; };
+#endif
+
+#if defined(_WIN32)
+class KeybindingWorkerImpl {
+private:
+ LPDIRECTINPUT8 din;
+ LPDIRECTINPUTDEVICE8 dinkeyboard;
+ Key kCenter;
+ FaceTrackNoIR& window;
+public:
+ volatile bool should_quit;
+ ~KeybindingWorkerImpl();
+ KeybindingWorkerImpl(FaceTrackNoIR& w, Key keyCenter);
+ void run();
+};
+#else
+class KeybindingWorkerImpl {
+public:
+ KeybindingWorkerImpl(FaceTrackNoIR& w, Key keyCenter);
+ void run() {}
+};
+#endif
+
+class KeybindingWorker : public QThread, public KeybindingWorkerImpl {
+ Q_OBJECT
+public:
+ KeybindingWorker(FaceTrackNoIR& w, Key keyCenter) : KeybindingWorkerImpl(w, keyCenter)
+ {
+ }
+ void run() {
+ KeybindingWorkerImpl::run();
+ }
+};