summaryrefslogtreecommitdiffstats
path: root/src/quick3d
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2016-04-15 14:19:12 +0200
committerSean Harmer <sean.harmer@kdab.com>2016-04-15 18:52:04 +0000
commit10f24b782f3856e5f5ddfc6710ab4b94facbddb5 (patch)
tree508b18c72066c6f1f0d67e739f1cf6c2c523238b /src/quick3d
parentd6cd4dd23baca11915afc8e1d69c0278a7ff1e7b (diff)
Remove QAbstractAggregateActionInput
Change-Id: I48109b0149cf16699f5d3a6cafbaec4555d4db0b Task-number: QTBUG-51493 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/quick3d')
-rw-r--r--src/quick3d/imports/input/qt3dquick3dinputplugin.cpp8
-rw-r--r--src/quick3d/quick3dinput/items/items.pri6
-rw-r--r--src/quick3d/quick3dinput/items/quick3dinputchord.cpp91
-rw-r--r--src/quick3d/quick3dinput/items/quick3dinputchord_p.h (renamed from src/quick3d/quick3dinput/items/quick3daggregateaction_p.h)16
-rw-r--r--src/quick3d/quick3dinput/items/quick3dinputsequence.cpp (renamed from src/quick3d/quick3dinput/items/quick3daggregateaction.cpp)40
-rw-r--r--src/quick3d/quick3dinput/items/quick3dinputsequence_p.h88
6 files changed, 215 insertions, 34 deletions
diff --git a/src/quick3d/imports/input/qt3dquick3dinputplugin.cpp b/src/quick3d/imports/input/qt3dquick3dinputplugin.cpp
index 8f368c504..123e7c6d7 100644
--- a/src/quick3d/imports/input/qt3dquick3dinputplugin.cpp
+++ b/src/quick3d/imports/input/qt3dquick3dinputplugin.cpp
@@ -58,7 +58,8 @@
#include <Qt3DInput/private/qgenericinputdevice_p.h>
#include <Qt3DQuickInput/private/quick3daxis_p.h>
#include <Qt3DQuickInput/private/quick3daction_p.h>
-#include <Qt3DQuickInput/private/quick3daggregateaction_p.h>
+#include <Qt3DQuickInput/private/quick3dinputchord_p.h>
+#include <Qt3DQuickInput/private/quick3dinputsequence_p.h>
#include <Qt3DQuickInput/private/quick3dlogicaldevice_p.h>
#include <Qt3DQuickInput/private/quick3dphysicaldevice_p.h>
@@ -85,13 +86,12 @@ void Qt3DQuick3DInputPlugin::registerTypes(const char *uri)
qmlRegisterExtendedType<Qt3DInput::QLogicalDevice, Qt3DInput::Input::Quick::Quick3DLogicalDevice>(uri, 2, 0, "LogicalDevice");
qmlRegisterUncreatableType<Qt3DInput::QAbstractActionInput>(uri, 2, 0, "AbstractActionInput", QStringLiteral("AbstractActionInput is abstract"));
qmlRegisterType<Qt3DInput::QActionInput>(uri, 2, 0, "ActionInput");
- qmlRegisterUncreatableType<Qt3DInput::QAbstractAggregateActionInput>(uri, 2, 0, "AbstractAggregateActionInput", QStringLiteral("AbstractAggregateActionInput is abstract"));
qmlRegisterType<Qt3DInput::QAxisInput>(uri, 2, 0, "AxisInput");
qmlRegisterType<Qt3DInput::QAxisSetting>(uri, 2, 0, "AxisSetting");
qmlRegisterExtendedType<Qt3DInput::QAxis, Qt3DInput::Input::Quick::Quick3DAxis>(uri, 2, 0, "Axis");
qmlRegisterExtendedType<Qt3DInput::QAction, Qt3DInput::Input::Quick::Quick3DAction>(uri, 2, 0, "Action");
- qmlRegisterExtendedType<Qt3DInput::QInputSequence, Qt3DInput::Input::Quick::Quick3DAggregateAction>(uri, 2, 0, "InputSequence");
- qmlRegisterExtendedType<Qt3DInput::QInputChord, Qt3DInput::Input::Quick::Quick3DAggregateAction>(uri, 2, 0, "InputChord");
+ qmlRegisterExtendedType<Qt3DInput::QInputSequence, Qt3DInput::Input::Quick::Quick3DInputSequence>(uri, 2, 0, "InputSequence");
+ qmlRegisterExtendedType<Qt3DInput::QInputChord, Qt3DInput::Input::Quick::Quick3DInputChord>(uri, 2, 0, "InputChord");
qmlRegisterExtendedUncreatableType<Qt3DInput::QAbstractPhysicalDevice, Qt3DInput::Input::Quick::Quick3DPhysicalDevice>(uri, 2, 0, "QAbstractPhysicalDevice", QStringLiteral("QAbstractPhysicalDevice is abstract"));
qmlRegisterType<Qt3DInput::QGenericInputDevice>(uri, 2, 0, "GenericInputDevice");
#ifdef HAVE_QGAMEPAD
diff --git a/src/quick3d/quick3dinput/items/items.pri b/src/quick3d/quick3dinput/items/items.pri
index e59dcf069..c0ee04665 100644
--- a/src/quick3d/quick3dinput/items/items.pri
+++ b/src/quick3d/quick3dinput/items/items.pri
@@ -3,13 +3,15 @@ SOURCES += \
$$PWD/quick3daction.cpp \
$$PWD/quick3dlogicaldevice.cpp \
$$PWD/quick3dphysicaldevice.cpp \
- $$PWD/quick3daggregateaction.cpp
+ $$PWD/quick3dinputsequence.cpp \
+ $$PWD/quick3dinputchord.cpp
HEADERS += \
$$PWD/quick3daxis_p.h \
$$PWD/quick3daction_p.h \
$$PWD/quick3dlogicaldevice_p.h \
$$PWD/quick3dphysicaldevice_p.h \
- $$PWD/quick3daggregateaction_p.h
+ $$PWD/quick3dinputsequence_p.h \
+ $$PWD/quick3dinputchord_p.h
INCLUDEPATH += $$PWD
diff --git a/src/quick3d/quick3dinput/items/quick3dinputchord.cpp b/src/quick3d/quick3dinput/items/quick3dinputchord.cpp
new file mode 100644
index 000000000..9a192b422
--- /dev/null
+++ b/src/quick3d/quick3dinput/items/quick3dinputchord.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "quick3dinputchord_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+namespace Input {
+namespace Quick {
+
+Quick3DInputChord::Quick3DInputChord(QObject *parent)
+ : QObject(parent)
+{
+}
+
+QQmlListProperty<QAbstractActionInput> Quick3DInputChord::qmlActionInputs()
+{
+ return QQmlListProperty<QAbstractActionInput>(this, 0,
+ &Quick3DInputChord::appendActionInput,
+ &Quick3DInputChord::actionInputCount,
+ &Quick3DInputChord::actionInputAt,
+ &Quick3DInputChord::clearActionInputs);
+}
+
+void Quick3DInputChord::appendActionInput(QQmlListProperty<QAbstractActionInput> *list, QAbstractActionInput *input)
+{
+ Quick3DInputChord *action = qobject_cast<Quick3DInputChord *>(list->object);
+ action->parentChord()->addChord(input);
+}
+
+QAbstractActionInput *Quick3DInputChord::actionInputAt(QQmlListProperty<QAbstractActionInput> *list, int index)
+{
+ Quick3DInputChord *action = qobject_cast<Quick3DInputChord *>(list->object);
+ return action->parentChord()->chords().at(index);
+}
+
+int Quick3DInputChord::actionInputCount(QQmlListProperty<QAbstractActionInput> *list)
+{
+ Quick3DInputChord *action = qobject_cast<Quick3DInputChord *>(list->object);
+ return action->parentChord()->chords().count();
+}
+
+void Quick3DInputChord::clearActionInputs(QQmlListProperty<QAbstractActionInput> *list)
+{
+ Quick3DInputChord *action = qobject_cast<Quick3DInputChord *>(list->object);
+ Q_FOREACH (QAbstractActionInput *input, action->parentChord()->chords())
+ action->parentChord()->removeChord(input);
+}
+
+} // namespace Quick
+} // namespace Input
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/quick3d/quick3dinput/items/quick3daggregateaction_p.h b/src/quick3d/quick3dinput/items/quick3dinputchord_p.h
index 9bbb7a706..b65ec5f75 100644
--- a/src/quick3d/quick3dinput/items/quick3daggregateaction_p.h
+++ b/src/quick3d/quick3dinput/items/quick3dinputchord_p.h
@@ -37,8 +37,8 @@
**
****************************************************************************/
-#ifndef QT3DINPUT_INPUT_QUICK_QUICK3DAGGREGATEACTION_H
-#define QT3DINPUT_INPUT_QUICK_QUICK3DAGGREGATEACTION_H
+#ifndef QT3DINPUT_INPUT_QUICK_QUICK3DINPUTCHORD_H
+#define QT3DINPUT_INPUT_QUICK_QUICK3DINPUTCHORD_H
//
// W A R N I N G
@@ -52,7 +52,7 @@
//
#include <Qt3DQuickInput/private/qt3dquickinput_global_p.h>
-#include <Qt3DInput/QAbstractAggregateActionInput>
+#include <Qt3DInput/qinputchord.h>
#include <QQmlListProperty>
QT_BEGIN_NAMESPACE
@@ -61,14 +61,14 @@ namespace Qt3DInput {
namespace Input {
namespace Quick {
-class QT3DQUICKINPUTSHARED_PRIVATE_EXPORT Quick3DAggregateAction : public QObject
+class QT3DQUICKINPUTSHARED_PRIVATE_EXPORT Quick3DInputChord : public QObject
{
Q_OBJECT
- Q_PROPERTY(QQmlListProperty<Qt3DInput::QAbstractActionInput> inputs READ qmlActionInputs CONSTANT)
+ Q_PROPERTY(QQmlListProperty<Qt3DInput::QAbstractActionInput> chords READ qmlActionInputs CONSTANT)
public:
- explicit Quick3DAggregateAction(QObject *parent = Q_NULLPTR);
+ explicit Quick3DInputChord(QObject *parent = Q_NULLPTR);
- inline QAbstractAggregateActionInput *parentAction() const { return qobject_cast<QAbstractAggregateActionInput *>(parent()); }
+ inline QInputChord *parentChord() const { return qobject_cast<QInputChord *>(parent()); }
QQmlListProperty<QAbstractActionInput> qmlActionInputs();
private:
@@ -85,4 +85,4 @@ private:
QT_END_NAMESPACE
-#endif // QT3DINPUT_INPUT_QUICK_QUICK3DAGGREGATEACTION_H
+#endif // QT3DINPUT_INPUT_QUICK_QUICK3DINPUTCHORD_H
diff --git a/src/quick3d/quick3dinput/items/quick3daggregateaction.cpp b/src/quick3d/quick3dinput/items/quick3dinputsequence.cpp
index 6e0ccdb28..5303289ac 100644
--- a/src/quick3d/quick3dinput/items/quick3daggregateaction.cpp
+++ b/src/quick3d/quick3dinput/items/quick3dinputsequence.cpp
@@ -37,7 +37,7 @@
**
****************************************************************************/
-#include "quick3daggregateaction_p.h"
+#include "quick3dinputsequence_p.h"
QT_BEGIN_NAMESPACE
@@ -45,43 +45,43 @@ namespace Qt3DInput {
namespace Input {
namespace Quick {
-Quick3DAggregateAction::Quick3DAggregateAction(QObject *parent)
+Quick3DInputSequence::Quick3DInputSequence(QObject *parent)
: QObject(parent)
{
}
-QQmlListProperty<QAbstractActionInput> Quick3DAggregateAction::qmlActionInputs()
+QQmlListProperty<QAbstractActionInput> Quick3DInputSequence::qmlActionInputs()
{
return QQmlListProperty<QAbstractActionInput>(this, 0,
- &Quick3DAggregateAction::appendActionInput,
- &Quick3DAggregateAction::actionInputCount,
- &Quick3DAggregateAction::actionInputAt,
- &Quick3DAggregateAction::clearActionInputs);
+ &Quick3DInputSequence::appendActionInput,
+ &Quick3DInputSequence::actionInputCount,
+ &Quick3DInputSequence::actionInputAt,
+ &Quick3DInputSequence::clearActionInputs);
}
-void Quick3DAggregateAction::appendActionInput(QQmlListProperty<QAbstractActionInput> *list, QAbstractActionInput *input)
+void Quick3DInputSequence::appendActionInput(QQmlListProperty<QAbstractActionInput> *list, QAbstractActionInput *input)
{
- Quick3DAggregateAction *action = qobject_cast<Quick3DAggregateAction *>(list->object);
- action->parentAction()->addInput(input);
+ Quick3DInputSequence *action = qobject_cast<Quick3DInputSequence *>(list->object);
+ action->parentSequence()->addSequence(input);
}
-QAbstractActionInput *Quick3DAggregateAction::actionInputAt(QQmlListProperty<QAbstractActionInput> *list, int index)
+QAbstractActionInput *Quick3DInputSequence::actionInputAt(QQmlListProperty<QAbstractActionInput> *list, int index)
{
- Quick3DAggregateAction *action = qobject_cast<Quick3DAggregateAction *>(list->object);
- return action->parentAction()->inputs().at(index);
+ Quick3DInputSequence *action = qobject_cast<Quick3DInputSequence *>(list->object);
+ return action->parentSequence()->sequences().at(index);
}
-int Quick3DAggregateAction::actionInputCount(QQmlListProperty<QAbstractActionInput> *list)
+int Quick3DInputSequence::actionInputCount(QQmlListProperty<QAbstractActionInput> *list)
{
- Quick3DAggregateAction *action = qobject_cast<Quick3DAggregateAction *>(list->object);
- return action->parentAction()->inputs().count();
+ Quick3DInputSequence *action = qobject_cast<Quick3DInputSequence *>(list->object);
+ return action->parentSequence()->sequences().count();
}
-void Quick3DAggregateAction::clearActionInputs(QQmlListProperty<QAbstractActionInput> *list)
+void Quick3DInputSequence::clearActionInputs(QQmlListProperty<QAbstractActionInput> *list)
{
- Quick3DAggregateAction *action = qobject_cast<Quick3DAggregateAction *>(list->object);
- Q_FOREACH (QAbstractActionInput *input, action->parentAction()->inputs())
- action->parentAction()->removeInput(input);
+ Quick3DInputSequence *action = qobject_cast<Quick3DInputSequence *>(list->object);
+ Q_FOREACH (QAbstractActionInput *input, action->parentSequence()->sequences())
+ action->parentSequence()->removeSequence(input);
}
diff --git a/src/quick3d/quick3dinput/items/quick3dinputsequence_p.h b/src/quick3d/quick3dinput/items/quick3dinputsequence_p.h
new file mode 100644
index 000000000..ba0c8f56d
--- /dev/null
+++ b/src/quick3d/quick3dinput/items/quick3dinputsequence_p.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_INPUT_QUICK_QUICK3DINPUTSEQUENCE_H
+#define QT3DINPUT_INPUT_QUICK_QUICK3DINPUTSEQUENCE_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/private/qt3dquickinput_global_p.h>
+#include <Qt3DInput/qinputsequence.h>
+#include <QQmlListProperty>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+namespace Input {
+namespace Quick {
+
+class QT3DQUICKINPUTSHARED_PRIVATE_EXPORT Quick3DInputSequence : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlListProperty<Qt3DInput::QAbstractActionInput> sequences READ qmlActionInputs CONSTANT)
+public:
+ explicit Quick3DInputSequence(QObject *parent = Q_NULLPTR);
+
+ inline QInputSequence *parentSequence() const { return qobject_cast<QInputSequence *>(parent()); }
+ QQmlListProperty<QAbstractActionInput> qmlActionInputs();
+
+private:
+ static void appendActionInput(QQmlListProperty<QAbstractActionInput> *list, QAbstractActionInput *input);
+ static QAbstractActionInput *actionInputAt(QQmlListProperty<QAbstractActionInput> *list, int index);
+ static int actionInputCount(QQmlListProperty<QAbstractActionInput> *list);
+ static void clearActionInputs(QQmlListProperty<QAbstractActionInput> *list);
+};
+
+} // namespace Quick
+} // namespace Input
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+
+#endif // QT3DINPUT_INPUT_QUICK_QUICK3DINPUTSEQUENCE_H