blob: 5f9a304dd561e09cb59bb07f61c43767225a2361 (
plain)
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
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QWHIPSENSORGESTURERECOGNIZER_H
#define QWHIPSENSORGESTURERECOGNIZER_H
#include <QtSensors/qsensorgesturerecognizer.h>
#include "qtsensorgesturesensorhandler.h"
QT_BEGIN_NAMESPACE
class QWhipSensorGestureRecognizer : public QSensorGestureRecognizer
{
Q_OBJECT
public:
explicit QWhipSensorGestureRecognizer(QObject *parent = 0);
~QWhipSensorGestureRecognizer();
void create() override;
QString id() const override;
bool start() override;
bool stop() override;
bool isActive() override;
Q_SIGNALS:
void whip();
private slots:
void accelChanged(QAccelerometerReading *reading);
void orientationReadingChanged(QOrientationReading *reading);
void timeout();
private:
QOrientationReading *orientationReading;
qreal accelRange;
bool active;
qreal lastX;
qreal lastY;
qreal lastZ;
bool detecting;
bool whipOk;
QList<bool> whipMap;
void checkForWhip();
QList <bool> negativeList;
QList<qreal> zList;
quint64 lastTimestamp;
bool timerActive;
quint64 lapsedTime;
};
QT_END_NAMESPACE
#endif // QWHIPSENSORGESTURERECOGNIZER_H
|