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_PHYSICALDEVICEPROXY_P_H |
5 | #define QT3DINPUT_INPUT_PHYSICALDEVICEPROXY_P_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 <Qt3DInput/private/backendnode_p.h> |
19 | #include <Qt3DCore/qnodeid.h> |
20 | |
21 | QT_BEGIN_NAMESPACE |
22 | |
23 | namespace Qt3DInput { |
24 | |
25 | class QAbstractPhysicalDevice; |
26 | |
27 | namespace Input { |
28 | |
29 | class PhysicalDeviceProxyManager; |
30 | |
31 | class Q_AUTOTEST_EXPORT PhysicalDeviceProxy : public BackendNode |
32 | { |
33 | public: |
34 | PhysicalDeviceProxy(); |
35 | void cleanup(); |
36 | |
37 | QString deviceName() const; |
38 | |
39 | void setManager(PhysicalDeviceProxyManager *manager); |
40 | PhysicalDeviceProxyManager *manager() const; |
41 | |
42 | // Called from a job to update the frontend |
43 | void setDevice(QAbstractPhysicalDevice *device); |
44 | Qt3DCore::QNodeId physicalDeviceId() const; |
45 | |
46 | void syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) override; |
47 | |
48 | private: |
49 | QString m_deviceName; |
50 | PhysicalDeviceProxyManager *m_manager; |
51 | Qt3DCore::QNodeId m_physicalDeviceId; |
52 | }; |
53 | |
54 | class PhysicalDeviceProxyNodeFunctor: public Qt3DCore::QBackendNodeMapper |
55 | { |
56 | public: |
57 | explicit PhysicalDeviceProxyNodeFunctor(PhysicalDeviceProxyManager *manager); |
58 | |
59 | Qt3DCore::QBackendNode *create(Qt3DCore::QNodeId id) const final; |
60 | Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const final; |
61 | void destroy(Qt3DCore::QNodeId id) const final; |
62 | |
63 | private: |
64 | PhysicalDeviceProxyManager *m_manager; |
65 | }; |
66 | |
67 | } // namespace Input |
68 | |
69 | } // namespace Qt3DInput |
70 | |
71 | QT_END_NAMESPACE |
72 | |
73 | #endif // QT3DINPUT_INPUT_PHYSICALDEVICEPROXY_P_H |
74 | |