1// Copyright (C) 2015 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_QINPUTDEVICEINTEGRATION_P_H
5#define QT3DINPUT_QINPUTDEVICEINTEGRATION_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/qt3dinput_global.h>
19#include <Qt3DCore/qaspectjob.h>
20#include <Qt3DCore/qnodeid.h>
21#include <QtCore/QObject>
22
23#ifndef Q_QDOC
24#include <Qt3DInput/private/qabstractphysicaldevicebackendnode_p.h>
25#endif
26
27QT_BEGIN_NAMESPACE
28
29namespace Qt3DCore {
30class QBackendNodeMapper;
31typedef QSharedPointer<QBackendNodeMapper> QBackendNodeMapperPtr;
32}
33
34
35namespace Qt3DInput {
36
37class QInputAspect;
38class QAbstractPhysicalDevice;
39class QInputDeviceIntegrationPrivate;
40
41class Q_3DINPUTSHARED_PRIVATE_EXPORT QInputDeviceIntegration : public QObject
42{
43 Q_OBJECT
44protected:
45 explicit QInputDeviceIntegration(QObject *parent = nullptr);
46 explicit QInputDeviceIntegration(QInputDeviceIntegrationPrivate &dd, QObject *parent = nullptr);
47
48 template<class Frontend>
49 void registerBackendType(const Qt3DCore::QBackendNodeMapperPtr &functor)
50 {
51 registerBackendType(Frontend::staticMetaObject, functor);
52 }
53
54 void registerBackendType(const QMetaObject &metaObject, const Qt3DCore::QBackendNodeMapperPtr &functor);
55
56public:
57 void initialize(Qt3DInput::QInputAspect *aspect);
58
59 virtual std::vector<Qt3DCore::QAspectJobPtr> jobsToExecute(qint64 time) = 0;
60 virtual QAbstractPhysicalDevice *createPhysicalDevice(const QString &name) = 0;
61 virtual QList<Qt3DCore::QNodeId> physicalDevices() const = 0;
62 virtual QAbstractPhysicalDeviceBackendNode *physicalDevice(Qt3DCore::QNodeId id) const = 0;
63 virtual QStringList deviceNames() const = 0;
64
65protected:
66 QInputAspect *inputAspect() const;
67
68private:
69 virtual void onInitialize() = 0;
70
71 Q_DECLARE_PRIVATE(QInputDeviceIntegration)
72};
73
74} // namespace Qt3DInput
75
76QT_END_NAMESPACE
77
78#endif // QT3DINPUT_QINPUTDEVICEINTEGRATION_P_H
79

source code of qt3d/src/input/frontend/qinputdeviceintegration_p.h