diff options
-rw-r--r-- | src/quick3d/quick3dinput/items/items.pri | 5 | ||||
-rw-r--r-- | src/quick3d/quick3dinput/qt3dquickinput_global.cpp | 58 | ||||
-rw-r--r-- | src/quick3d/quick3dinput/qt3dquickinput_global.h | 56 | ||||
-rw-r--r-- | src/quick3d/quick3dinput/qt3dquickinput_global_p.h | 85 | ||||
-rw-r--r-- | src/quick3d/quick3dinput/qt3dquickinputnodefactory.cpp | 73 | ||||
-rw-r--r-- | src/quick3d/quick3dinput/qt3dquickinputnodefactory_p.h | 86 | ||||
-rw-r--r-- | src/quick3d/quick3dinput/quick3dinput.pro | 34 | ||||
-rw-r--r-- | src/src.pro | 4 | ||||
-rw-r--r-- | sync.profile | 1 |
9 files changed, 402 insertions, 0 deletions
diff --git a/src/quick3d/quick3dinput/items/items.pri b/src/quick3d/quick3dinput/items/items.pri new file mode 100644 index 000000000..8becb86ab --- /dev/null +++ b/src/quick3d/quick3dinput/items/items.pri @@ -0,0 +1,5 @@ +SOURCES += + +HEADERS += + +INCLUDEPATH += $$PWD diff --git a/src/quick3d/quick3dinput/qt3dquickinput_global.cpp b/src/quick3d/quick3dinput/qt3dquickinput_global.cpp new file mode 100644 index 000000000..e41dcdb4d --- /dev/null +++ b/src/quick3d/quick3dinput/qt3dquickinput_global.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qt3dquickinput_global_p.h" +#include "qt3dquickinputnodefactory_p.h" + +QT_BEGIN_NAMESPACE + +namespace Qt3DInput { +namespace Quick { + +void Quick3DInput_initialize() +{ + Qt3DCore::QAbstractNodeFactory::registerNodeFactory(QuickInputNodeFactory::instance()); +} + +void Quick3DInput_registerType(const char *className, const char *quickName, int major, int minor) +{ + QuickInputNodeFactory::instance()->registerType(className, quickName, major, minor); +} + +} // namespace Quick +} // namespace Qt3DInput + +QT_END_NAMESPACE diff --git a/src/quick3d/quick3dinput/qt3dquickinput_global.h b/src/quick3d/quick3dinput/qt3dquickinput_global.h new file mode 100644 index 000000000..be94836c4 --- /dev/null +++ b/src/quick3d/quick3dinput/qt3dquickinput_global.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3DQUICKINPUT_GLOBAL_H +#define QT3DQUICKINPUT_GLOBAL_H + +#include <QtCore/qglobal.h> + +QT_BEGIN_NAMESPACE + +#if defined(QT_SHARED) || !defined(QT_STATIC) +# if defined(QT3DQUICKINPUT_LIBRARY) +# define QT3DQUICKINPUTSHARED_EXPORT Q_DECL_EXPORT +# else +# define QT3DQUICKINPUTSHARED_EXPORT Q_DECL_IMPORT +# endif +#else +# define QT3DQUICKINPUTSHARED_EXPORT +#endif + +QT_END_NAMESPACE + +#endif // QT3DQUICKINPUT_GLOBAL_H diff --git a/src/quick3d/quick3dinput/qt3dquickinput_global_p.h b/src/quick3d/quick3dinput/qt3dquickinput_global_p.h new file mode 100644 index 000000000..2f5383d32 --- /dev/null +++ b/src/quick3d/quick3dinput/qt3dquickinput_global_p.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3DQUICKINPUT_GLOBAL_P_H +#define QT3DQUICKINPUT_GLOBAL_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <Qt3DQuickInput/qt3dquickinput_global.h> +#include <QtQml/qqml.h> + +#define QT3DQUICKINPUTSHARED_PRIVATE_EXPORT QT3DQUICKINPUTSHARED_EXPORT + +QT_BEGIN_NAMESPACE + +namespace Qt3DInput { + +namespace Quick { + +QT3DQUICKINPUTSHARED_PRIVATE_EXPORT void Quick3DInput_initialize(); +QT3DQUICKINPUTSHARED_PRIVATE_EXPORT void Quick3DInput_registerType(const char *className, const char *quickName, int major, int minor); + +template<class T, class E> void registerExtendedType(const char *className, const char *quickName, + const char *uri, int major, int minor, const char *name) +{ + qmlRegisterExtendedType<T, E>(uri, major, minor, name); + Quick3DInput_registerType(className, quickName, major, minor); +} + +template<class T> void registerType(const char *className, const char *quickName, + const char *uri, int major, int minor, const char *name) +{ + qmlRegisterType<T>(uri, major, minor, name); + Quick3DInput_registerType(className, quickName, major, minor); +} + +} // Quick + +} // Qt3D + +QT_END_NAMESPACE + +#endif // QT3DQUICKINPUT_GLOBAL_P_H diff --git a/src/quick3d/quick3dinput/qt3dquickinputnodefactory.cpp b/src/quick3d/quick3dinput/qt3dquickinputnodefactory.cpp new file mode 100644 index 000000000..c55e1ef15 --- /dev/null +++ b/src/quick3d/quick3dinput/qt3dquickinputnodefactory.cpp @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qt3dquickinputnodefactory_p.h" +#include <QtQml/private/qqmlmetatype_p.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3DInput { + +Q_GLOBAL_STATIC(QuickInputNodeFactory, quick_Input_node_factory) + +QuickInputNodeFactory *QuickInputNodeFactory::instance() +{ + return quick_Input_node_factory(); +} + +void QuickInputNodeFactory::registerType(const char *className, const char *quickName, int major, int minor) +{ + m_types.insert(className, Type(quickName, major, minor)); +} + +Qt3DCore::QNode *QuickInputNodeFactory::createNode(const char *type) +{ + if (!m_types.contains(type)) + return Q_NULLPTR; + + Type &typeInfo(m_types[type]); + + if (!typeInfo.resolved) { + typeInfo.resolved = true; + typeInfo.t = QQmlMetaType::qmlType(QString::fromLatin1(typeInfo.quickName), typeInfo.version.first, typeInfo.version.second); + } + + return typeInfo.t ? qobject_cast<Qt3DCore::QNode *>(typeInfo.t->create()) : Q_NULLPTR; +} + +} // namespace Qt3DInput + +QT_END_NAMESPACE diff --git a/src/quick3d/quick3dinput/qt3dquickinputnodefactory_p.h b/src/quick3d/quick3dinput/qt3dquickinputnodefactory_p.h new file mode 100644 index 000000000..fff8cd752 --- /dev/null +++ b/src/quick3d/quick3dinput/qt3dquickinputnodefactory_p.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QUICKINPUTNODEFACTORY_H +#define QUICKINPUTNODEFACTORY_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <Qt3DCore/qabstractnodefactory.h> +#include <QtCore/qhash.h> + +QT_BEGIN_NAMESPACE + +class QQmlType; + +namespace Qt3DInput { + +class QuickInputNodeFactory : public Qt3DCore::QAbstractNodeFactory +{ +public: + Qt3DCore::QNode *createNode(const char *type) Q_DECL_OVERRIDE; + + void registerType(const char *className, const char *quickName, int major, int minor); + + static QuickInputNodeFactory *instance(); + +private: + struct Type { + Type() : t(Q_NULLPTR), resolved(false) { } + Type(const char *quickName, int major, int minor) + : quickName(quickName), version(major, minor), t(Q_NULLPTR), resolved(false) { } + QByteArray quickName; + QPair<int, int> version; + QQmlType *t; + bool resolved; + }; + QHash<QByteArray, Type> m_types; +}; + +} // namespace Qt3DInput + +QT_END_NAMESPACE + +#endif // QUICKINPUTNODEFACTORY_H diff --git a/src/quick3d/quick3dinput/quick3dinput.pro b/src/quick3d/quick3dinput/quick3dinput.pro new file mode 100644 index 000000000..f32dde78f --- /dev/null +++ b/src/quick3d/quick3dinput/quick3dinput.pro @@ -0,0 +1,34 @@ +TARGET = Qt3DQuickInput + +QT += core core-private qml qml-private 3dcore 3dinput 3dquick 3dquick-private 3dcore-private 3dinput-private +CONFIG -= precompile_header + +DEFINES += QT3DQUICKINPUT_LIBRARY + +MODULE = 3dquickinput + +load(qt_module) + +gcov { + CONFIG += static + QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage + QMAKE_LFLAGS += -fprofile-arcs -ftest-coverage +} + +SOURCES += \ + qt3dquickinput_global.cpp \ + qt3dquickinputnodefactory.cpp + + +HEADERS += \ + qt3dquickinput_global_p.h \ + qt3dquickinput_global.h \ + qt3dquickinputnodefactory_p.h + +!contains(QT_CONFIG, egl):DEFINES += QT_NO_EGL + +# otherwise mingw headers do not declare common functions like ::strcasecmp +win32-g++*:QMAKE_CXXFLAGS_CXX11 = -std=gnu++0x + +include(./items/items.pri) + diff --git a/src/src.pro b/src/src.pro index 7dd028085..41151b784 100644 --- a/src/src.pro +++ b/src/src.pro @@ -24,6 +24,9 @@ src_quick3d_render.subdir = $$PWD/quick3d/quick3drender src_quick3d_render.target = sub-quick3d-render src_quick3d_render.depends = src_render src_quick3d_core +src_quick3d_input.subdir = $$PWD/quick3d/quick3dinput +src_quick3d_input.target = sub-quick3d-input +src_quick3d_input.depends = src_input src_quick3d_core # Quick3D imports src_quick3d_core_imports.file = $$PWD/quick3d/imports/core/importscore.pro @@ -59,6 +62,7 @@ SUBDIRS += \ src_quick3d_core \ src_quick3d_core_imports \ src_quick3d_render \ + src_quick3d_input \ src_quick3d_imports_render \ src_quick3d_imports_scene3d \ src_quick3d_imports_input \ diff --git a/sync.profile b/sync.profile index dd40b381e..f30e4f81a 100644 --- a/sync.profile +++ b/sync.profile @@ -4,6 +4,7 @@ "Qt3DQuick" => "$basedir/src/quick3d/quick3d", "Qt3DQuickRender" => "$basedir/src/quick3d/quick3drender", "Qt3DInput" => "$basedir/src/input", + "Qt3DQuickInput" => "$basedir/src/quick3d/quick3dinput", "Qt3DLogic" => "$basedir/src/logic", ); %moduleheaders = ( # restrict the module headers to those found in relative path |