-
Notifications
You must be signed in to change notification settings - Fork 0
/
pn_touchrecognizer.h
83 lines (57 loc) · 2.71 KB
/
pn_touchrecognizer.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef PN_TOUCHRECOGNIZER_H
#define PN_TOUCHRECOGNIZER_H
#include "processnode.h"
class PN_TouchRecognizer : public ProcessNode
{
Q_OBJECT
QML_ELEMENT
Q_PROPERTY(QList<float> touchThresholds READ touchThresholds WRITE setTouchThresholds NOTIFY touchThresholdsChanged)
Q_PROPERTY(QList<float> touchOffValues READ touchOffValues WRITE setTouchOffValues NOTIFY touchOffValuesChanged)
Q_PROPERTY(QList<float> currentTouchValues READ currentTouchValues WRITE setCurrentTouchValues NOTIFY currentTouchValuesChanged)
Q_PROPERTY(float thresholdValue READ thresholdValue WRITE setThresholdValue NOTIFY thresholdValueChanged)
public:
explicit PN_TouchRecognizer(QObject *parent = nullptr);
explicit PN_TouchRecognizer(QByteArray identifier, int idxInControlller,
PN_TouchRecognizer *controller,
TypeHelper::ValueType type=TypeHelper::Undefined, quint16 valueNumber=0,
QObject *parent = nullptr);
// ProcessNode interface
public:
ProcessNode *createSubprocessor(QString objectname_id) override;
const QList<float> &touchThresholds() const;
void setTouchThresholds(const QList<float> &newTouchThresholds);
void setTouchThresholdAtIdx(int idx, float threshold);
float thresholdValue() const;
void setThresholdValue(float newThresholdValue);
const QList<float> &touchOffValues() const;
void setTouchOffValues(const QList<float> &newTouchOffValues);
const QList<float> ¤tTouchValues() const;
void setCurrentTouchValues(const QList<float> &newCurrentTouchValues);
signals:
void touchThresholdsChanged(QList<float> touchThresh);
void thresholdValueChanged(float newThreshold);
void sig_catchOffValues();
void touchOffValuesChanged(QList<float> &newTouchOffValues);
void currentTouchValuesChanged();
private:
QList<float> m_touchThresholds{45,45,45,45,45,45};
// SaveLoadInterfaceClass interface
float m_thresholdValue = 0.5;
QList<float> m_touchOffValues = QList<float>(6);
QList<float> m_currentTouchValues = QList<float>(6);
void calcTouchThresholdValues();
bool catchOffValues = false;
bool catchValues = false;
QList<bool> touchedBoolList = QList<bool>(6);
QList<float> getTListFromQDomElement(QDomElement domElement, QString paramName);
public slots:
void initSaveData() override;
void loadDataFromQdomElement(QDomElement domElement) override;
void slot_catchOffValues();
// ValueNotifierClass interface
public:
bool acceptsInputType(TypeHelper::ValueType typ, int atIdx) const override;
public slots:
void slot_valuesChanged(QList<float> values, int frame) override;
};
#endif // PN_TOUCHRECOGNIZER_H