| 1 | // Copyright (C) 2014 Robin Burchell <robin.burchell@viroteck.net> |
|---|---|
| 2 | // Copyright (C) 2016 The Qt Company Ltd. |
| 3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 4 | |
| 5 | #ifndef QTUIOHANDLER_P_H |
| 6 | #define QTUIOHANDLER_P_H |
| 7 | |
| 8 | #include <QList> |
| 9 | #include <QObject> |
| 10 | #include <QMap> |
| 11 | #include <QUdpSocket> |
| 12 | #include <QTransform> |
| 13 | |
| 14 | #include <qpa/qwindowsysteminterface.h> |
| 15 | |
| 16 | QT_BEGIN_NAMESPACE |
| 17 | |
| 18 | class QPointingDevice; |
| 19 | class QOscMessage; |
| 20 | class QTuioCursor; |
| 21 | class QTuioToken; |
| 22 | |
| 23 | class QTuioHandler : public QObject |
| 24 | { |
| 25 | Q_OBJECT |
| 26 | Q_MOC_INCLUDE("qoscmessage_p.h") |
| 27 | |
| 28 | public: |
| 29 | explicit QTuioHandler(const QString &specification); |
| 30 | virtual ~QTuioHandler(); |
| 31 | |
| 32 | private slots: |
| 33 | void processPackets(); |
| 34 | void process2DCurSource(const QOscMessage &message); |
| 35 | void process2DCurAlive(const QOscMessage &message); |
| 36 | void process2DCurSet(const QOscMessage &message); |
| 37 | void process2DCurFseq(const QOscMessage &message); |
| 38 | void process2DObjSource(const QOscMessage &message); |
| 39 | void process2DObjAlive(const QOscMessage &message); |
| 40 | void process2DObjSet(const QOscMessage &message); |
| 41 | void process2DObjFseq(const QOscMessage &message); |
| 42 | |
| 43 | private: |
| 44 | QWindowSystemInterface::TouchPoint cursorToTouchPoint(const QTuioCursor &tc, QWindow *win); |
| 45 | QWindowSystemInterface::TouchPoint tokenToTouchPoint(const QTuioToken &tc, QWindow *win); |
| 46 | |
| 47 | QPointingDevice *m_device = nullptr; |
| 48 | QUdpSocket m_socket; |
| 49 | QMap<int, QTuioCursor> m_activeCursors; |
| 50 | QList<QTuioCursor> m_deadCursors; |
| 51 | QMap<int, QTuioToken> m_activeTokens; |
| 52 | QList<QTuioToken> m_deadTokens; |
| 53 | QTransform m_transform; |
| 54 | }; |
| 55 | |
| 56 | QT_END_NAMESPACE |
| 57 | |
| 58 | #endif // QTUIOHANDLER_P_H |
| 59 |
