summaryrefslogtreecommitdiffstats
path: root/src/logic
diff options
context:
space:
mode:
authorFranck Arrecot <franck.arrecot@kdab.com>2016-03-10 09:58:16 +0100
committerFranck Arrecot <franck.arrecot@gmail.com>2016-03-11 13:55:04 +0000
commitc4d7ad6b1e4672a98384724f5aa45338686f2e64 (patch)
tree50fc2946e24b8d0c3cd849224c9924d012546d87 /src/logic
parent55e681ac6cad2a059785a08ac920748b5f60acf9 (diff)
Class QLogicComponent changes
Task-number: QTBUG-51448 Change-Id: I1359cbfe61dbef291859d15b16bda61639493432 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/logic')
-rw-r--r--src/logic/executor.cpp8
-rw-r--r--src/logic/logic.pri6
-rw-r--r--src/logic/qframeaction.cpp (renamed from src/logic/qlogiccomponent.cpp)34
-rw-r--r--src/logic/qframeaction.h (renamed from src/logic/qlogiccomponent.h)24
-rw-r--r--src/logic/qframeaction_p.h (renamed from src/logic/qlogiccomponent_p.h)14
-rw-r--r--src/logic/qlogicaspect.cpp4
6 files changed, 45 insertions, 45 deletions
diff --git a/src/logic/executor.cpp b/src/logic/executor.cpp
index 5ca3cb229..c8eb6881f 100644
--- a/src/logic/executor.cpp
+++ b/src/logic/executor.cpp
@@ -38,7 +38,7 @@
****************************************************************************/
#include "executor_p.h"
-#include <Qt3DLogic/qlogiccomponent.h>
+#include <Qt3DLogic/qframeaction.h>
#include <Qt3DCore/qnode.h>
#include <Qt3DCore/private/qscene_p.h>
#include <QtCore/qsemaphore.h>
@@ -93,9 +93,9 @@ void Executor::processLogicFrameUpdates(float dt)
Q_ASSERT(m_semaphore);
const QVector<QNode *> nodes = m_scene->lookupNodes(m_nodeIds);
for (QNode *node : nodes) {
- QLogicComponent *logicComponent = qobject_cast<QLogicComponent *>(node);
- if (logicComponent)
- logicComponent->onFrameUpdate(dt);
+ QFrameAction *frameAction = qobject_cast<QFrameAction *>(node);
+ if (frameAction)
+ frameAction->onTriggered(dt);
}
// Release the semaphore so the calling Manager can continue
diff --git a/src/logic/logic.pri b/src/logic/logic.pri
index b8291f075..a8a3573a8 100644
--- a/src/logic/logic.pri
+++ b/src/logic/logic.pri
@@ -4,9 +4,9 @@ HEADERS += \
$$PWD/qt3dlogic_global.h \
$$PWD/qlogicaspect.h \
$$PWD/qlogicaspect_p.h \
- $$PWD/qlogiccomponent.h \
+ $$PWD/qframeaction.h \
$$PWD/handle_types_p.h \
- $$PWD/qlogiccomponent_p.h \
+ $$PWD/qframeaction_p.h \
$$PWD/callbackjob_p.h \
$$PWD/executor_p.h \
$$PWD/handler_p.h \
@@ -15,7 +15,7 @@ HEADERS += \
SOURCES += \
$$PWD/qlogicaspect.cpp \
- $$PWD/qlogiccomponent.cpp \
+ $$PWD/qframeaction.cpp \
$$PWD/manager.cpp \
$$PWD/handler.cpp \
$$PWD/executor.cpp \
diff --git a/src/logic/qlogiccomponent.cpp b/src/logic/qframeaction.cpp
index 2ea9b03a1..27d969235 100644
--- a/src/logic/qlogiccomponent.cpp
+++ b/src/logic/qframeaction.cpp
@@ -37,59 +37,59 @@
**
****************************************************************************/
-#include "qlogiccomponent.h"
-#include "qlogiccomponent_p.h"
+#include "qframeaction.h"
+#include "qframeaction_p.h"
QT_BEGIN_NAMESPACE
namespace Qt3DLogic {
-QLogicComponentPrivate::QLogicComponentPrivate()
+QFrameActionPrivate::QFrameActionPrivate()
: QComponentPrivate()
{
}
/*!
- \class Qt3DLogic::QLogicComponent
+ \class Qt3DLogic::QFrameAction
\inmodule Qt3DLogic
\since 5.5
\brief Provides a way to have a synchronous function executed each frame.
- The QLogicComponent provides a way to perform tasks each frame in
+ The QFrameAction provides a way to perform tasks each frame in
synchronized with the Qt3D backend. This is useful to implement some
aspects of application logic and to prototype functionality that can later
be folded into an additional Qt3D aspect.
- For example, the QLogicComponent can be used to animate a property in sync
+ For example, the QFrameAction can be used to animate a property in sync
with the Qt3D engine where a Qt Quick animation element is not perfectly
synchronized and may lead to stutters in some cases.
- To execute your own code each frame override the onFrameUpdate function.
+ To execute your own code each frame override the onTriggered function.
*/
/*!
- \qmltype LogicComponent
+ \qmltype FrameAction
\inqmlmodule Qt3D.Logic
- \instantiates Qt3DLogic::QLogicComponent
+ \instantiates Qt3DLogic::QFrameAction
\inherits Component3D
\since 5.5
*/
/*!
- Constructs a new QLogicComponent instance with parent \a parent.
+ Constructs a new QFrameAction instance with parent \a parent.
*/
-QLogicComponent::QLogicComponent(QNode *parent)
- : QComponent(*new QLogicComponentPrivate, parent)
+QFrameAction::QFrameAction(QNode *parent)
+ : QComponent(*new QFrameActionPrivate, parent)
{
}
/*! \internal */
-QLogicComponent::QLogicComponent(QLogicComponentPrivate &dd, QNode *parent)
+QFrameAction::QFrameAction(QFrameActionPrivate &dd, QNode *parent)
: QComponent(dd, parent)
{
}
-QLogicComponent::~QLogicComponent()
+QFrameAction::~QFrameAction()
{
QNode::cleanup();
}
@@ -98,11 +98,11 @@ QLogicComponent::~QLogicComponent()
This virtual function will be called in a synchronous manner once each frame by
the Logic aspect.
*/
-void QLogicComponent::onFrameUpdate(float dt)
+void QFrameAction::onTriggered(float dt)
{
- // Emit signal so that QML instances get the onFrameUpdate() signal
+ // Emit signal so that QML instances get the onTriggered() signal
// handler called
- emit frameUpdate(dt);
+ emit triggered(dt);
}
} // namespace Qt3DLogic
diff --git a/src/logic/qlogiccomponent.h b/src/logic/qframeaction.h
index 084aecfb8..52ef1b9b0 100644
--- a/src/logic/qlogiccomponent.h
+++ b/src/logic/qframeaction.h
@@ -37,8 +37,8 @@
**
****************************************************************************/
-#ifndef QT3DLOGIC_QLOGICCOMPONENT_H
-#define QT3DLOGIC_QLOGICCOMPONENT_H
+#ifndef QT3DLOGIC_QFRAMEACTION_H
+#define QT3DLOGIC_QFRAMEACTION_H
#include <Qt3DCore/qcomponent.h>
#include <Qt3DLogic/qt3dlogic_global.h>
@@ -48,31 +48,31 @@ QT_BEGIN_NAMESPACE
namespace Qt3DLogic {
class QLogicAspect;
-class QLogicComponentPrivate;
+class QFrameActionPrivate;
namespace Logic {
class Executor;
}
-class QT3DLOGICSHARED_EXPORT QLogicComponent : public Qt3DCore::QComponent
+class QT3DLOGICSHARED_EXPORT QFrameAction : public Qt3DCore::QComponent
{
Q_OBJECT
public:
- explicit QLogicComponent(Qt3DCore::QNode *parent = 0);
- ~QLogicComponent();
+ explicit QFrameAction(Qt3DCore::QNode *parent = 0);
+ ~QFrameAction();
protected:
- QLogicComponent(QLogicComponentPrivate &dd, QNode *parent = 0);
+ QFrameAction(QFrameActionPrivate &dd, QNode *parent = 0);
Q_SIGNALS:
- void frameUpdate(float dt);
+ void triggered(float dt);
private:
- Q_DECLARE_PRIVATE(QLogicComponent)
- QT3D_CLONEABLE(QLogicComponent)
+ Q_DECLARE_PRIVATE(QFrameAction)
+ QT3D_CLONEABLE(QFrameAction)
- virtual void onFrameUpdate(float dt);
+ virtual void onTriggered(float dt);
friend class Logic::Executor;
};
@@ -81,4 +81,4 @@ private:
QT_END_NAMESPACE
-#endif // QT3DLOGIC_QLOGICCOMPONENT_H
+#endif // QT3DLOGIC_QFRAMEACTION_H
diff --git a/src/logic/qlogiccomponent_p.h b/src/logic/qframeaction_p.h
index 5c23f9d89..17155ffd3 100644
--- a/src/logic/qlogiccomponent_p.h
+++ b/src/logic/qframeaction_p.h
@@ -37,8 +37,8 @@
**
****************************************************************************/
-#ifndef QT3DLOGIC_QLOGICCOMPONENT_P_H
-#define QT3DLOGIC_QLOGICCOMPONENT_P_H
+#ifndef QT3DLOGIC_QFRAMEACTION_P_H
+#define QT3DLOGIC_QFRAMEACTION_P_H
//
// W A R N I N G
@@ -57,18 +57,18 @@ QT_BEGIN_NAMESPACE
namespace Qt3DLogic {
-class QLogicComponent;
+class QFrameAction;
-class QLogicComponentPrivate : public Qt3DCore::QComponentPrivate
+class QFrameActionPrivate : public Qt3DCore::QComponentPrivate
{
public:
- QLogicComponentPrivate();
+ QFrameActionPrivate();
- Q_DECLARE_PUBLIC(QLogicComponent)
+ Q_DECLARE_PUBLIC(QFrameAction)
};
} // namespace Qt3DLogic
QT_END_NAMESPACE
-#endif // QT3DLOGIC_QLOGICCOMPONENT_P_H
+#endif // QT3DLOGIC_QFRAMEACTION_P_H
diff --git a/src/logic/qlogicaspect.cpp b/src/logic/qlogicaspect.cpp
index 5c72cde0d..79f4df34d 100644
--- a/src/logic/qlogicaspect.cpp
+++ b/src/logic/qlogicaspect.cpp
@@ -42,7 +42,7 @@
#include "executor_p.h"
#include "handler_p.h"
#include "manager_p.h"
-#include "qlogiccomponent.h"
+#include "qframeaction.h"
#include <Qt3DCore/qnode.h>
#include <Qt3DCore/private/qchangearbiter_p.h>
@@ -87,7 +87,7 @@ QLogicAspect::QLogicAspect(QLogicAspectPrivate &dd, QObject *parent)
void QLogicAspect::registerBackendTypes()
{
- registerBackendType<QLogicComponent>(QBackendNodeMapperPtr(new Logic::HandlerFunctor(d_func()->m_manager.data())));
+ registerBackendType<QFrameAction>(QBackendNodeMapperPtr(new Logic::HandlerFunctor(d_func()->m_manager.data())));
}
QVector<QAspectJobPtr> QLogicAspect::jobsToExecute(qint64 time)