-
Notifications
You must be signed in to change notification settings - Fork 2
/
VirtualTouchScreen.h
66 lines (61 loc) · 1.74 KB
/
VirtualTouchScreen.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef VirtualTouchScreen_H
#define VirtualTouchScreen_H
#include <QtWidgets/QMainWindow>
#include <Windows.h>
#include <QPoint>
#include <QPointF>
#include <QVector>
#include <QMutex>
#include "util_pipeline.h"
class GestureThread;
class GestureAlgos;
class TouchInputEmulator;
class ConfigDialog;
class VirtualTouchScreen : public QMainWindow
{
Q_OBJECT
friend class GestureThread;
friend class ConfigDialog;
friend class GestureAlgos;
public:
explicit VirtualTouchScreen(QWidget *parent = 0);
~VirtualTouchScreen();
enum {OFFSET_X = 200, OFFSET_Y = 100,
SCALE_FACTOR_x100 = 100,
VIRTUAL_SCREEN_THRESHOLD_CM = 35,
FINGER_ICON_SIZE = 32};
enum Hand {THUMB = 0, INDEX, POINTS};
public slots:
void showMenu();
void showHelp();
void onMoveHand();
void onShowThumb(bool visible);
void onSwipe(BYTE code);
//touch screen slots
void onTouchDown(const QPoint &ptThumb, const QPoint &ptIndex);
void onTouchDown(const QPoint &ptIndex);
void onTouchUp(const QPoint &ptThumb, const QPoint &ptIndex);
void onTouchUp(const QPoint &ptIndex);
private:
void setFingerPointer(QWidget *target, const QString &iconPath, int iconSize = -1,
bool rotate = false);
void loadFingerIcons(const QString &iconPath, int iconSize);
QImage rotate270(const QImage &src);
void setupActions();
void loadSettings();
void saveSettings();
GestureThread *gestureThread;
GestureAlgos *gestureAlgos;
QPoint offset;
qreal scaleFactor;
QWidget *thumbPointer;
ConfigDialog *config;
QVector<QPointF> handSkeletonPoints_;
QMutex skeletonPointMutex_;
TouchInputEmulator *touch_;
qreal virtualScreenThreshold_;
QString fingerIcon_;
int fingerIconSize_;
bool hideThumb_;
};
#endif // VirtualTouchScreen_H