1 | // Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QT3DINPUT_INPUT_INPUTSEQUENCE_H |
5 | #define QT3DINPUT_INPUT_INPUTSEQUENCE_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists for the convenience |
12 | // of other Qt classes. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <Qt3DCore/qnodeid.h> |
19 | |
20 | #include <Qt3DInput/private/abstractactioninput_p.h> |
21 | |
22 | QT_BEGIN_NAMESPACE |
23 | |
24 | namespace Qt3DInput { |
25 | |
26 | namespace Input { |
27 | |
28 | class Q_AUTOTEST_EXPORT InputSequence : public AbstractActionInput |
29 | { |
30 | public: |
31 | InputSequence(); |
32 | void cleanup(); |
33 | |
34 | inline QList<Qt3DCore::QNodeId> sequences() const { return m_sequences; } |
35 | inline qint64 timeout() const { return m_timeout; } |
36 | inline qint64 buttonInterval() const { return m_buttonInterval; } |
37 | inline qint64 startTime() const { return m_startTime; } |
38 | void setStartTime(qint64 time); |
39 | bool sequenceTriggered() const; |
40 | void reset(); |
41 | bool actionTriggered(Qt3DCore::QNodeId input, const qint64 currentTime); |
42 | void syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) override; |
43 | |
44 | bool process(InputHandler *inputHandler, qint64 currentTime) override; |
45 | |
46 | private: |
47 | QList<Qt3DCore::QNodeId> m_sequences; |
48 | QList<Qt3DCore::QNodeId> m_inputsToTrigger; |
49 | qint64 m_timeout; |
50 | qint64 m_buttonInterval; |
51 | qint64 m_startTime; |
52 | qint64 m_lastInputTime; |
53 | Qt3DCore::QNodeId m_lastInputId; |
54 | }; |
55 | |
56 | } // namespace Input |
57 | |
58 | } // namespace Qt3DInput |
59 | |
60 | QT_END_NAMESPACE |
61 | |
62 | #endif // QT3DINPUT_INPUT_INPUTSEQUENCE_H |
63 | |