diff options
Diffstat (limited to 'src/declarative/util')
51 files changed, 1117 insertions, 1117 deletions
diff --git a/src/declarative/util/qfxglobal.h b/src/declarative/util/qfxglobal.h index d720406..eb57963 100644 --- a/src/declarative/util/qfxglobal.h +++ b/src/declarative/util/qfxglobal.h @@ -67,7 +67,7 @@ QT_MODULE(Declarative) return status == Yes; \ } -struct QFx_DerivedObject : public QObject +struct QmlGraphics_DerivedObject : public QObject { void setParent_noEvent(QObject *parent) { bool sce = d_ptr->sendChildEvents; @@ -82,9 +82,9 @@ struct QFx_DerivedObject : public QObject neither \a parent nor the object's previous parent (if it had one) will receive ChildRemoved or ChildAdded events. */ -inline void QFx_setParent_noEvent(QObject *object, QObject *parent) +inline void QmlGraphics_setParent_noEvent(QObject *object, QObject *parent) { - static_cast<QFx_DerivedObject *>(object)->setParent_noEvent(parent); + static_cast<QmlGraphics_DerivedObject *>(object)->setParent_noEvent(parent); } QT_END_NAMESPACE diff --git a/src/declarative/util/qfxperf.cpp b/src/declarative/util/qfxperf.cpp index c55e34f..8fcab2b 100644 --- a/src/declarative/util/qfxperf.cpp +++ b/src/declarative/util/qfxperf.cpp @@ -39,11 +39,11 @@ ** ****************************************************************************/ -#include "private/qfxperf_p.h" +#include "private/qfxperf_p_p.h" QT_BEGIN_NAMESPACE -Q_DEFINE_PERFORMANCE_LOG(QFxPerf, "QFx") { +Q_DEFINE_PERFORMANCE_LOG(QmlPerf, "QmlGraphics") { Q_DEFINE_PERFORMANCE_METRIC(QmlParsing, "Compilation: QML Parsing") Q_DEFINE_PERFORMANCE_METRIC(Compilation, " QML Compilation") Q_DEFINE_PERFORMANCE_METRIC(VMEExecution, "Execution: QML VME Execution") @@ -54,13 +54,13 @@ Q_DEFINE_PERFORMANCE_LOG(QFxPerf, "QFx") { Q_DEFINE_PERFORMANCE_METRIC(BindableValueUpdate, "QmlBinding::update") Q_DEFINE_PERFORMANCE_METRIC(PixmapLoad, "Pixmap loading") Q_DEFINE_PERFORMANCE_METRIC(FontDatabase, "Font database creation") - Q_DEFINE_PERFORMANCE_METRIC(QFxPathViewPathCache, "FX Items: QFxPathView: Path cache") - Q_DEFINE_PERFORMANCE_METRIC(CreateParticle, " QFxParticles: Particle creation") - Q_DEFINE_PERFORMANCE_METRIC(ItemComponentComplete, " QFxItem::componentComplete") - Q_DEFINE_PERFORMANCE_METRIC(ImageComponentComplete, " QFxImage::componentComplete") - Q_DEFINE_PERFORMANCE_METRIC(BaseLayoutComponentComplete, " QFxBasePositioner::componentComplete") - Q_DEFINE_PERFORMANCE_METRIC(TextComponentComplete, " QFxText::componentComplete") - Q_DEFINE_PERFORMANCE_METRIC(QFxText_setText, " QFxText::setText") + Q_DEFINE_PERFORMANCE_METRIC(QmlGraphicsPathViewPathCache, "FX Items: QmlGraphicsPathView: Path cache") + Q_DEFINE_PERFORMANCE_METRIC(CreateParticle, " QmlGraphicsParticles: Particle creation") + Q_DEFINE_PERFORMANCE_METRIC(ItemComponentComplete, " QmlGraphicsItem::componentComplete") + Q_DEFINE_PERFORMANCE_METRIC(ImageComponentComplete, " QmlGraphicsImage::componentComplete") + Q_DEFINE_PERFORMANCE_METRIC(BaseLayoutComponentComplete, " QmlGraphicsBasePositioner::componentComplete") + Q_DEFINE_PERFORMANCE_METRIC(TextComponentComplete, " QmlGraphicsText::componentComplete") + Q_DEFINE_PERFORMANCE_METRIC(QmlGraphicsText_setText, " QmlGraphicsText::setText") Q_DEFINE_PERFORMANCE_METRIC(AddScript, "QmlScript::addScriptToEngine") } diff --git a/src/declarative/util/qfxperf_p.h b/src/declarative/util/qfxperf_p_p.h index 3956eb1..c16bf7b 100644 --- a/src/declarative/util/qfxperf_p.h +++ b/src/declarative/util/qfxperf_p_p.h @@ -52,7 +52,7 @@ // We mean it. // -#include "private/qperformancelog_p.h" +#include "private/qperformancelog_p_p.h" QT_BEGIN_HEADER @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -Q_DECLARE_PERFORMANCE_LOG(QFxPerf) { +Q_DECLARE_PERFORMANCE_LOG(QmlPerf) { Q_DECLARE_PERFORMANCE_METRIC(QmlParsing) Q_DECLARE_PERFORMANCE_METRIC(Compilation) @@ -73,13 +73,13 @@ Q_DECLARE_PERFORMANCE_LOG(QFxPerf) { Q_DECLARE_PERFORMANCE_METRIC(BindableValueUpdate) Q_DECLARE_PERFORMANCE_METRIC(PixmapLoad) Q_DECLARE_PERFORMANCE_METRIC(FontDatabase) - Q_DECLARE_PERFORMANCE_METRIC(QFxPathViewPathCache) + Q_DECLARE_PERFORMANCE_METRIC(QmlGraphicsPathViewPathCache) Q_DECLARE_PERFORMANCE_METRIC(CreateParticle) Q_DECLARE_PERFORMANCE_METRIC(ItemComponentComplete) Q_DECLARE_PERFORMANCE_METRIC(ImageComponentComplete) Q_DECLARE_PERFORMANCE_METRIC(BaseLayoutComponentComplete) Q_DECLARE_PERFORMANCE_METRIC(TextComponentComplete) - Q_DECLARE_PERFORMANCE_METRIC(QFxText_setText) + Q_DECLARE_PERFORMANCE_METRIC(QmlGraphicsText_setText) Q_DECLARE_PERFORMANCE_METRIC(AddScript) } diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index 5d6b4bb..47d7146 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -39,15 +39,15 @@ ** ****************************************************************************/ -#include "qmlanimation.h" +#include "qmlanimation_p.h" #include "qvariant.h" #include "qcolor.h" #include "qfile.h" #include "qmlpropertyvaluesource.h" #include "qml.h" #include "qmlinfo.h" -#include "qmlanimation_p.h" -#include "qmlbehavior.h" +#include "qmlanimation_p_p.h" +#include <private/qmlbehavior_p.h> #include <QParallelAnimationGroup> #include <QSequentialAnimationGroup> #include <QtCore/qset.h> @@ -55,7 +55,7 @@ #include <QtCore/qpoint.h> #include <QtCore/qsize.h> #include <QtDeclarative/qmlexpression.h> -#include <QtDeclarative/qmlstateoperations.h> +#include <private/qmlstateoperations_p.h> #include <private/qmlstringconverters_p.h> #include <private/qvariantanimation_p.h> @@ -663,7 +663,7 @@ void QmlPauseAnimationPrivate::init() { Q_Q(QmlPauseAnimation); pa = new QPauseAnimation; - QFx_setParent_noEvent(pa, q); + QmlGraphics_setParent_noEvent(pa, q); } /*! @@ -786,7 +786,7 @@ void QmlScriptActionPrivate::init() { Q_Q(QmlScriptAction); rsa = new QActionAnimation(&proxy); - QFx_setParent_noEvent(rsa, q); + QmlGraphics_setParent_noEvent(rsa, q); } /*! @@ -904,7 +904,7 @@ void QmlPropertyActionPrivate::init() { Q_Q(QmlPropertyAction); spa = new QActionAnimation; - QFx_setParent_noEvent(spa, q); + QmlGraphics_setParent_noEvent(spa, q); } /*! @@ -1097,28 +1097,28 @@ void QmlParentActionPrivate::init() { Q_Q(QmlParentAction); cpa = new QActionAnimation; - QFx_setParent_noEvent(cpa, q); + QmlGraphics_setParent_noEvent(cpa, q); } -QFxItem *QmlParentAction::object() const +QmlGraphicsItem *QmlParentAction::object() const { Q_D(const QmlParentAction); return d->pcTarget; } -void QmlParentAction::setObject(QFxItem *target) +void QmlParentAction::setObject(QmlGraphicsItem *target) { Q_D(QmlParentAction); d->pcTarget = target; } -QFxItem *QmlParentAction::parent() const +QmlGraphicsItem *QmlParentAction::parent() const { Q_D(const QmlParentAction); return d->pcParent; } -void QmlParentAction::setParent(QFxItem *parent) +void QmlParentAction::setParent(QmlGraphicsItem *parent) { Q_D(QmlParentAction); d->pcParent = parent; @@ -1516,7 +1516,7 @@ void QmlPropertyAnimationPrivate::init() { Q_Q(QmlPropertyAnimation); va = new QmlTimeLineValueAnimator; - QFx_setParent_noEvent(va, q); + QmlGraphics_setParent_noEvent(va, q); va->setStartValue(QVariant(0.0f)); va->setEndValue(QVariant(1.0f)); diff --git a/src/declarative/util/qmlanimation.h b/src/declarative/util/qmlanimation.h deleted file mode 100644 index f1d297d..0000000 --- a/src/declarative/util/qmlanimation.h +++ /dev/null @@ -1,407 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLANIMATION_H -#define QMLANIMATION_H - -#include <QtCore/qvariant.h> -#include <QtCore/QAbstractAnimation> -#include <QtGui/qcolor.h> -#include <QtDeclarative/qmltransition.h> -#include <QtDeclarative/qmlpropertyvaluesource.h> -#include <QtDeclarative/qmlstate.h> -#include <QtDeclarative/qml.h> -#include <QtDeclarative/qmlscriptstring.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class QmlAbstractAnimationPrivate; -class QmlAnimationGroup; -class Q_AUTOTEST_EXPORT QmlAbstractAnimation : public QObject, public QmlPropertyValueSource, public QmlParserStatus -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlAbstractAnimation) - - Q_INTERFACES(QmlParserStatus) - Q_INTERFACES(QmlPropertyValueSource) - Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged) - Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged) - Q_PROPERTY(bool alwaysRunToEnd READ alwaysRunToEnd WRITE setAlwaysRunToEnd NOTIFY alwaysRunToEndChanged()) - Q_PROPERTY(bool repeat READ repeat WRITE setRepeat NOTIFY repeatChanged) - Q_CLASSINFO("DefaultMethod", "start()") - Q_INTERFACES(QmlParserStatus) - -public: - QmlAbstractAnimation(QObject *parent=0); - virtual ~QmlAbstractAnimation(); - - bool isRunning() const; - void setRunning(bool); - bool isPaused() const; - void setPaused(bool); - bool alwaysRunToEnd() const; - void setAlwaysRunToEnd(bool); - bool repeat() const; - void setRepeat(bool); - - int currentTime(); - void setCurrentTime(int); - - QmlAnimationGroup *group() const; - void setGroup(QmlAnimationGroup *); - - //### these belong at a lower level in the hierarchy - QObject *target() const; - void setTarget(QObject *); - QString property() const; - void setProperty(const QString &); - - virtual void setTarget(const QmlMetaProperty &); - - void classBegin(); - void componentComplete(); - -Q_SIGNALS: - void started(); - void completed(); - void runningChanged(bool); - void pausedChanged(bool); - void repeatChanged(bool); - void targetChanged(QObject *, const QString &); - void alwaysRunToEndChanged(bool); - -public Q_SLOTS: - void restart(); - void start(); - void pause(); - void resume(); - void stop(); - void complete(); - -protected: - QmlAbstractAnimation(QmlAbstractAnimationPrivate &dd, QObject *parent); - -public: - enum TransitionDirection { Forward, Backward }; - virtual void transition(QmlStateActions &actions, - QmlMetaProperties &modified, - TransitionDirection direction); - virtual void prepare(QmlMetaProperty &); - virtual QAbstractAnimation *qtAnimation() = 0; - -private Q_SLOTS: - void timelineComplete(); -}; - -class QmlPauseAnimationPrivate; -class QmlPauseAnimation : public QmlAbstractAnimation -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlPauseAnimation) - - Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged) - -public: - QmlPauseAnimation(QObject *parent=0); - virtual ~QmlPauseAnimation(); - - int duration() const; - void setDuration(int); - -Q_SIGNALS: - void durationChanged(int); - -protected: - virtual QAbstractAnimation *qtAnimation(); -}; - -class QmlScriptActionPrivate; -class QmlScriptAction : public QmlAbstractAnimation -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlScriptAction) - - Q_PROPERTY(QmlScriptString script READ script WRITE setScript) - Q_PROPERTY(QString stateChangeScriptName READ stateChangeScriptName WRITE setStateChangeScriptName) - -public: - QmlScriptAction(QObject *parent=0); - virtual ~QmlScriptAction(); - - QmlScriptString script() const; - void setScript(const QmlScriptString &); - - QString stateChangeScriptName() const; - void setStateChangeScriptName(const QString &); - -protected: - virtual void transition(QmlStateActions &actions, - QmlMetaProperties &modified, - TransitionDirection direction); - virtual QAbstractAnimation *qtAnimation(); -}; - -class QmlPropertyActionPrivate; -class QmlPropertyAction : public QmlAbstractAnimation -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlPropertyAction) - - Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged) - Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY targetChanged) - Q_PROPERTY(QString properties READ properties WRITE setProperties NOTIFY propertiesChanged) - Q_PROPERTY(QList<QObject *>* targets READ targets) - Q_PROPERTY(QList<QObject *>* exclude READ exclude) - Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged) - -public: - QmlPropertyAction(QObject *parent=0); - virtual ~QmlPropertyAction(); - - QString properties() const; - void setProperties(const QString &); - - QList<QObject *> *targets(); - QList<QObject *> *exclude(); - - QVariant value() const; - void setValue(const QVariant &); - -Q_SIGNALS: - void valueChanged(const QVariant &); - void propertiesChanged(const QString &); - -protected: - virtual void transition(QmlStateActions &actions, - QmlMetaProperties &modified, - TransitionDirection direction); - virtual QAbstractAnimation *qtAnimation(); - virtual void prepare(QmlMetaProperty &); -}; - -class QFxItem; -class QmlParentActionPrivate; -class QmlParentAction : public QmlAbstractAnimation -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlParentAction) - - Q_PROPERTY(QFxItem *target READ object WRITE setObject) - Q_PROPERTY(QFxItem *parent READ parent WRITE setParent) - -public: - QmlParentAction(QObject *parent=0); - virtual ~QmlParentAction(); - - QFxItem *object() const; - void setObject(QFxItem *); - - QFxItem *parent() const; - void setParent(QFxItem *); - -protected: - virtual void transition(QmlStateActions &actions, - QmlMetaProperties &modified, - TransitionDirection direction); - virtual QAbstractAnimation *qtAnimation(); -}; - -class QmlPropertyAnimationPrivate; -class Q_AUTOTEST_EXPORT QmlPropertyAnimation : public QmlAbstractAnimation -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlPropertyAnimation) - - Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged) - Q_PROPERTY(QVariant from READ from WRITE setFrom NOTIFY fromChanged) - Q_PROPERTY(QVariant to READ to WRITE setTo NOTIFY toChanged) - Q_PROPERTY(QString easing READ easing WRITE setEasing NOTIFY easingChanged) - Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged) - Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY targetChanged) - Q_PROPERTY(QString properties READ properties WRITE setProperties NOTIFY propertiesChanged) - Q_PROPERTY(QList<QObject *>* targets READ targets) - Q_PROPERTY(QList<QObject *>* exclude READ exclude) - -public: - QmlPropertyAnimation(QObject *parent=0); - virtual ~QmlPropertyAnimation(); - - int duration() const; - void setDuration(int); - - QVariant from() const; - void setFrom(const QVariant &); - - QVariant to() const; - void setTo(const QVariant &); - - QString easing() const; - void setEasing(const QString &); - - QString properties() const; - void setProperties(const QString &); - - QList<QObject *> *targets(); - QList<QObject *> *exclude(); - -protected: - virtual void transition(QmlStateActions &actions, - QmlMetaProperties &modified, - TransitionDirection direction); - virtual QAbstractAnimation *qtAnimation(); - virtual void prepare(QmlMetaProperty &); - -Q_SIGNALS: - void durationChanged(int); - void fromChanged(QVariant); - void toChanged(QVariant); - void easingChanged(const QString &); - void propertiesChanged(const QString &); -}; - -class Q_AUTOTEST_EXPORT QmlColorAnimation : public QmlPropertyAnimation -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlPropertyAnimation) - Q_PROPERTY(QColor from READ from WRITE setFrom NOTIFY fromChanged) - Q_PROPERTY(QColor to READ to WRITE setTo NOTIFY toChanged) - -public: - QmlColorAnimation(QObject *parent=0); - virtual ~QmlColorAnimation(); - - QColor from() const; - void setFrom(const QColor &); - - QColor to() const; - void setTo(const QColor &); -}; - -class Q_AUTOTEST_EXPORT QmlNumberAnimation : public QmlPropertyAnimation -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlPropertyAnimation) - - Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged) - Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged) - -public: - QmlNumberAnimation(QObject *parent=0); - virtual ~QmlNumberAnimation(); - - qreal from() const; - void setFrom(qreal); - - qreal to() const; - void setTo(qreal); -}; - -class QmlAnimationGroupPrivate; -class QmlAnimationGroup : public QmlAbstractAnimation -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlAnimationGroup) - - Q_CLASSINFO("DefaultProperty", "animations") - Q_PROPERTY(QmlList<QmlAbstractAnimation *> *animations READ animations) - -public: - QmlAnimationGroup(QObject *parent); - virtual ~QmlAnimationGroup(); - - QmlList<QmlAbstractAnimation *>* animations(); - friend class QmlAbstractAnimation; -}; - -class QmlSequentialAnimation : public QmlAnimationGroup -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlAnimationGroup) - -public: - QmlSequentialAnimation(QObject *parent=0); - virtual ~QmlSequentialAnimation(); - -protected: - virtual void transition(QmlStateActions &actions, - QmlMetaProperties &modified, - TransitionDirection direction); - virtual QAbstractAnimation *qtAnimation(); - virtual void prepare(QmlMetaProperty &); -}; - -class QmlParallelAnimation : public QmlAnimationGroup -{ - Q_OBJECT - Q_DECLARE_PRIVATE(QmlAnimationGroup) - -public: - QmlParallelAnimation(QObject *parent=0); - virtual ~QmlParallelAnimation(); - -protected: - virtual void transition(QmlStateActions &actions, - QmlMetaProperties &modified, - TransitionDirection direction); - virtual QAbstractAnimation *qtAnimation(); - virtual void prepare(QmlMetaProperty &); -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QmlAbstractAnimation) -QML_DECLARE_TYPE(QmlPauseAnimation) -QML_DECLARE_TYPE(QmlScriptAction) -QML_DECLARE_TYPE(QmlPropertyAction) -QML_DECLARE_TYPE(QmlParentAction) -QML_DECLARE_TYPE(QmlPropertyAnimation) -QML_DECLARE_TYPE(QmlColorAnimation) -QML_DECLARE_TYPE(QmlNumberAnimation) -QML_DECLARE_TYPE(QmlSequentialAnimation) -QML_DECLARE_TYPE(QmlParallelAnimation) - -QT_END_HEADER - -#endif // QMLANIMATION_H diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h index 9a667a0..214bab9 100644 --- a/src/declarative/util/qmlanimation_p.h +++ b/src/declarative/util/qmlanimation_p.h @@ -39,324 +39,369 @@ ** ****************************************************************************/ -#ifndef QMLANIMATION_P_H -#define QMLANIMATION_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <private/qobject_p.h> -#include <private/qmlnullablevalue_p.h> -#include <private/qvariantanimation_p.h> -#include <QtCore/QPauseAnimation> -#include <QtCore/QVariantAnimation> -#include <QtCore/QAnimationGroup> -#include <QtGui/QColor> -#include <QtDeclarative/qmlanimation.h> +#ifndef QMLANIMATION_H +#define QMLANIMATION_H + +#include <QtCore/qvariant.h> +#include <QtCore/QAbstractAnimation> +#include <QtGui/qcolor.h> +#include <private/qmltransition_p.h> +#include <QtDeclarative/qmlpropertyvaluesource.h> +#include <private/qmlstate_p.h> #include <QtDeclarative/qml.h> -#include <QtDeclarative/qmlcontext.h> -#include <private/qmltimeline_p.h> +#include <QtDeclarative/qmlscriptstring.h> + +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -//interface for classes that provide animation actions for QActionAnimation -class QAbstractAnimationAction -{ -public: - virtual ~QAbstractAnimationAction() {} - virtual void doAction() = 0; -}; +QT_MODULE(Declarative) -//templated animation action -//allows us to specify an action that calls a function of a class. -//(so that class doesn't have to inherit QmlAbstractAnimationAction) -template<class T, void (T::*method)()> -class QAnimationActionProxy : public QAbstractAnimationAction +class QmlAbstractAnimationPrivate; +class QmlAnimationGroup; +class Q_AUTOTEST_EXPORT QmlAbstractAnimation : public QObject, public QmlPropertyValueSource, public QmlParserStatus { + Q_OBJECT + Q_DECLARE_PRIVATE(QmlAbstractAnimation) + + Q_INTERFACES(QmlParserStatus) + Q_INTERFACES(QmlPropertyValueSource) + Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged) + Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged) + Q_PROPERTY(bool alwaysRunToEnd READ alwaysRunToEnd WRITE setAlwaysRunToEnd NOTIFY alwaysRunToEndChanged()) + Q_PROPERTY(bool repeat READ repeat WRITE setRepeat NOTIFY repeatChanged) + Q_CLASSINFO("DefaultMethod", "start()") + Q_INTERFACES(QmlParserStatus) + public: - QAnimationActionProxy(T *p) : m_p(p) {} - virtual void doAction() { (m_p->*method)(); } + QmlAbstractAnimation(QObject *parent=0); + virtual ~QmlAbstractAnimation(); + + bool isRunning() const; + void setRunning(bool); + bool isPaused() const; + void setPaused(bool); + bool alwaysRunToEnd() const; + void setAlwaysRunToEnd(bool); + bool repeat() const; + void setRepeat(bool); + + int currentTime(); + void setCurrentTime(int); + + QmlAnimationGroup *group() const; + void setGroup(QmlAnimationGroup *); + + //### these belong at a lower level in the hierarchy + QObject *target() const; + void setTarget(QObject *); + QString property() const; + void setProperty(const QString &); + + virtual void setTarget(const QmlMetaProperty &); + + void classBegin(); + void componentComplete(); + +Q_SIGNALS: + void started(); + void completed(); + void runningChanged(bool); + void pausedChanged(bool); + void repeatChanged(bool); + void targetChanged(QObject *, const QString &); + void alwaysRunToEndChanged(bool); + +public Q_SLOTS: + void restart(); + void start(); + void pause(); + void resume(); + void stop(); + void complete(); + +protected: + QmlAbstractAnimation(QmlAbstractAnimationPrivate &dd, QObject *parent); -private: - T *m_p; +public: + enum TransitionDirection { Forward, Backward }; + virtual void transition(QmlStateActions &actions, + QmlMetaProperties &modified, + TransitionDirection direction); + virtual void prepare(QmlMetaProperty &); + virtual QAbstractAnimation *qtAnimation() = 0; + +private Q_SLOTS: + void timelineComplete(); }; -//performs an action of type QAbstractAnimationAction -class QActionAnimation : public QAbstractAnimation +class QmlPauseAnimationPrivate; +class QmlPauseAnimation : public QmlAbstractAnimation { Q_OBJECT + Q_DECLARE_PRIVATE(QmlPauseAnimation) + + Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged) + public: - QActionAnimation(QObject *parent = 0) : QAbstractAnimation(parent), animAction(0), policy(KeepWhenStopped) {} - QActionAnimation(QAbstractAnimationAction *action, QObject *parent = 0) - : QAbstractAnimation(parent), animAction(action), policy(KeepWhenStopped) {} - virtual int duration() const { return 0; } - void setAnimAction(QAbstractAnimationAction *action, DeletionPolicy p) - { - if (state() == Running) - stop(); - animAction = action; - policy = p; - } + QmlPauseAnimation(QObject *parent=0); + virtual ~QmlPauseAnimation(); + + int duration() const; + void setDuration(int); + +Q_SIGNALS: + void durationChanged(int); + protected: - virtual void updateCurrentTime(int) {} - - virtual void updateState(State /*oldState*/, State newState) - { - if (newState == Running) { - if (animAction) - animAction->doAction(); - } else if (newState == Stopped && policy == DeleteWhenStopped) { - delete animAction; - animAction = 0; - } - } - -private: - QAbstractAnimationAction *animAction; - DeletionPolicy policy; + virtual QAbstractAnimation *qtAnimation(); }; -//animates QmlTimeLineValue (assumes start and end values will be reals or compatible) -class QmlTimeLineValueAnimator : public QVariantAnimation +class QmlScriptActionPrivate; +class QmlScriptAction : public QmlAbstractAnimation { Q_OBJECT + Q_DECLARE_PRIVATE(QmlScriptAction) + + Q_PROPERTY(QmlScriptString script READ script WRITE setScript) + Q_PROPERTY(QString stateChangeScriptName READ stateChangeScriptName WRITE setStateChangeScriptName) + public: - QmlTimeLineValueAnimator(QObject *parent = 0) : QVariantAnimation(parent), animValue(0), fromSourced(0), policy(KeepWhenStopped) {} - void setAnimValue(QmlTimeLineValue *value, DeletionPolicy p) - { - if (state() == Running) - stop(); - animValue = value; - policy = p; - } - void setFromSourcedValue(bool *value) - { - fromSourced = value; - } + QmlScriptAction(QObject *parent=0); + virtual ~QmlScriptAction(); + + QmlScriptString script() const; + void setScript(const QmlScriptString &); + + QString stateChangeScriptName() const; + void setStateChangeScriptName(const QString &); + protected: - virtual void updateCurrentValue(const QVariant &value) - { - if (animValue) - animValue->setValue(value.toDouble()); - } - virtual void updateState(State oldState, State newState) - { - QVariantAnimation::updateState(oldState, newState); - if (newState == Running) { - //check for new from every loop - if (fromSourced) - *fromSourced = false; - } else if (newState == Stopped && policy == DeleteWhenStopped) { - delete animValue; - animValue = 0; - } - } - -private: - QmlTimeLineValue *animValue; - bool *fromSourced; - DeletionPolicy policy; + virtual void transition(QmlStateActions &actions, + QmlMetaProperties &modified, + TransitionDirection direction); + virtual QAbstractAnimation *qtAnimation(); }; -//an animation that just gives a tick -template<class T, void (T::*method)(int)> -class QTickAnimationProxy : public QAbstractAnimation +class QmlPropertyActionPrivate; +class QmlPropertyAction : public QmlAbstractAnimation { - //Q_OBJECT //doesn't work with templating -public: - QTickAnimationProxy(T *p, QObject *parent = 0) : QAbstractAnimation(parent), m_p(p) {} - virtual int duration() const { return -1; } -protected: - virtual void updateCurrentTime(int msec) { (m_p->*method)(msec); } + Q_OBJECT + Q_DECLARE_PRIVATE(QmlPropertyAction) -private: - T *m_p; -}; + Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged) + Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY targetChanged) + Q_PROPERTY(QString properties READ properties WRITE setProperties NOTIFY propertiesChanged) + Q_PROPERTY(QList<QObject *>* targets READ targets) + Q_PROPERTY(QList<QObject *>* exclude READ exclude) + Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged) -class QmlAbstractAnimationPrivate : public QObjectPrivate -{ - Q_DECLARE_PUBLIC(QmlAbstractAnimation) public: - QmlAbstractAnimationPrivate() - : running(false), paused(false), alwaysRunToEnd(false), repeat(false), - connectedTimeLine(false), componentComplete(true), startOnCompletion(false), - target(0), group(0) {} - - bool running; - bool paused; - bool alwaysRunToEnd; - bool repeat; - bool connectedTimeLine; + QmlPropertyAction(QObject *parent=0); + virtual ~QmlPropertyAction(); - bool componentComplete; - bool startOnCompletion; + QString properties() const; + void setProperties(const QString &); - void commence(); + QList<QObject *> *targets(); + QList<QObject *> *exclude(); - QmlNullableValue<QmlMetaProperty> userProperty; - QObject *target; - QString propertyName; + QVariant value() const; + void setValue(const QVariant &); - QmlMetaProperty property; - QmlAnimationGroup *group; +Q_SIGNALS: + void valueChanged(const QVariant &); + void propertiesChanged(const QString &); - QmlMetaProperty createProperty(QObject *obj, const QString &str); +protected: + virtual void transition(QmlStateActions &actions, + QmlMetaProperties &modified, + TransitionDirection direction); + virtual QAbstractAnimation *qtAnimation(); + virtual void prepare(QmlMetaProperty &); }; -class QmlPauseAnimationPrivate : public QmlAbstractAnimationPrivate +class QmlGraphicsItem; +class QmlParentActionPrivate; +class QmlParentAction : public QmlAbstractAnimation { - Q_DECLARE_PUBLIC(QmlPauseAnimation) -public: - QmlPauseAnimationPrivate() - : QmlAbstractAnimationPrivate(), pa(0) {} - - void init(); + Q_OBJECT + Q_DECLARE_PRIVATE(QmlParentAction) - QPauseAnimation *pa; -}; + Q_PROPERTY(QmlGraphicsItem *target READ object WRITE setObject) + Q_PROPERTY(QmlGraphicsItem *parent READ parent WRITE setParent) -class QmlScriptActionPrivate : public QmlAbstractAnimationPrivate -{ - Q_DECLARE_PUBLIC(QmlScriptAction) public: - QmlScriptActionPrivate() - : QmlAbstractAnimationPrivate(), hasRunScriptScript(false), proxy(this), rsa(0) {} + QmlParentAction(QObject *parent=0); + virtual ~QmlParentAction(); - void init(); + QmlGraphicsItem *object() const; + void setObject(QmlGraphicsItem *); - QmlScriptString script; - QString name; - QmlScriptString runScriptScript; - bool hasRunScriptScript; + QmlGraphicsItem *parent() const; + void setParent(QmlGraphicsItem *); - void execute(); - - QAnimationActionProxy<QmlScriptActionPrivate, - &QmlScriptActionPrivate::execute> proxy; - QActionAnimation *rsa; +protected: + virtual void transition(QmlStateActions &actions, + QmlMetaProperties &modified, + TransitionDirection direction); + virtual QAbstractAnimation *qtAnimation(); }; -class QmlPropertyActionPrivate : public QmlAbstractAnimationPrivate +class QmlPropertyAnimationPrivate; +class Q_AUTOTEST_EXPORT QmlPropertyAnimation : public QmlAbstractAnimation { - Q_DECLARE_PUBLIC(QmlPropertyAction) + Q_OBJECT + Q_DECLARE_PRIVATE(QmlPropertyAnimation) + + Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged) + Q_PROPERTY(QVariant from READ from WRITE setFrom NOTIFY fromChanged) + Q_PROPERTY(QVariant to READ to WRITE setTo NOTIFY toChanged) + Q_PROPERTY(QString easing READ easing WRITE setEasing NOTIFY easingChanged) + Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged) + Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY targetChanged) + Q_PROPERTY(QString properties READ properties WRITE setProperties NOTIFY propertiesChanged) + Q_PROPERTY(QList<QObject *>* targets READ targets) + Q_PROPERTY(QList<QObject *>* exclude READ exclude) + public: - QmlPropertyActionPrivate() - : QmlAbstractAnimationPrivate(), proxy(this), spa(0) {} + QmlPropertyAnimation(QObject *parent=0); + virtual ~QmlPropertyAnimation(); - void init(); + int duration() const; + void setDuration(int); - QString properties; - QList<QObject *> targets; - QList<QObject *> exclude; + QVariant from() const; + void setFrom(const QVariant &); - QmlNullableValue<QVariant> value; + QVariant to() const; + void setTo(const QVariant &); - void doAction(); + QString easing() const; + void setEasing(const QString &); - QAnimationActionProxy<QmlPropertyActionPrivate, - &QmlPropertyActionPrivate::doAction> proxy; - QActionAnimation *spa; + QString properties() const; + void setProperties(const QString &); + + QList<QObject *> *targets(); + QList<QObject *> *exclude(); + +protected: + virtual void transition(QmlStateActions &actions, + QmlMetaProperties &modified, + TransitionDirection direction); + virtual QAbstractAnimation *qtAnimation(); + virtual void prepare(QmlMetaProperty &); + +Q_SIGNALS: + void durationChanged(int); + void fromChanged(QVariant); + void toChanged(QVariant); + void easingChanged(const QString &); + void propertiesChanged(const QString &); }; -class QmlParentActionPrivate : public QmlAbstractAnimationPrivate +class Q_AUTOTEST_EXPORT QmlColorAnimation : public QmlPropertyAnimation { - Q_DECLARE_PUBLIC(QmlParentAction) -public: - QmlParentActionPrivate() - : QmlAbstractAnimationPrivate(), pcTarget(0), pcParent(0) {} + Q_OBJECT + Q_DECLARE_PRIVATE(QmlPropertyAnimation) + Q_PROPERTY(QColor from READ from WRITE setFrom NOTIFY fromChanged) + Q_PROPERTY(QColor to READ to WRITE setTo NOTIFY toChanged) - void init(); +public: + QmlColorAnimation(QObject *parent=0); + virtual ~QmlColorAnimation(); - QFxItem *pcTarget; - QFxItem *pcParent; + QColor from() const; + void setFrom(const QColor &); - void doAction(); - QActionAnimation *cpa; + QColor to() const; + void setTo(const QColor &); }; -class QmlAnimationGroupPrivate : public QmlAbstractAnimationPrivate +class Q_AUTOTEST_EXPORT QmlNumberAnimation : public QmlPropertyAnimation { - Q_DECLARE_PUBLIC(QmlAnimationGroup) + Q_OBJECT + Q_DECLARE_PRIVATE(QmlPropertyAnimation) + + Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged) + Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged) + public: - QmlAnimationGroupPrivate() - : QmlAbstractAnimationPrivate(), animations(this), ag(0) {} - - struct AnimationList : public QmlConcreteList<QmlAbstractAnimation *> - { - AnimationList(QmlAnimationGroupPrivate *p) - : anim(p) {} - virtual void append(QmlAbstractAnimation *a) { - QmlConcreteList<QmlAbstractAnimation *>::append(a); - a->setGroup(anim->q_func()); - } - virtual void clear() - { - for (int i = 0; i < count(); ++i) - at(i)->setGroup(0); - QmlConcreteList<QmlAbstractAnimation *>::clear(); - } - virtual void removeAt(int i) - { - at(i)->setGroup(0); - QmlConcreteList<QmlAbstractAnimation *>::removeAt(i); - } - virtual void insert(int i, QmlAbstractAnimation *a) - { - QmlConcreteList<QmlAbstractAnimation *>::insert(i, a); - a->setGroup(anim->q_func()); - } - - QmlAnimationGroupPrivate *anim; - }; - - AnimationList animations; - QAnimationGroup *ag; + QmlNumberAnimation(QObject *parent=0); + virtual ~QmlNumberAnimation(); + + qreal from() const; + void setFrom(qreal); + + qreal to() const; + void setTo(qreal); }; -class QmlPropertyAnimationPrivate : public QmlAbstractAnimationPrivate +class QmlAnimationGroupPrivate; +class QmlAnimationGroup : public QmlAbstractAnimation { - Q_DECLARE_PUBLIC(QmlPropertyAnimation) -public: - QmlPropertyAnimationPrivate() - : QmlAbstractAnimationPrivate(), fromSourced(false), fromIsDefined(false), toIsDefined(false), - defaultToInterpolatorType(0), interpolatorType(0), interpolator(0), va(0), - value(this, &QmlPropertyAnimationPrivate::valueChanged) {} + Q_OBJECT + Q_DECLARE_PRIVATE(QmlAnimationGroup) - void init(); + Q_CLASSINFO("DefaultProperty", "animations") + Q_PROPERTY(QmlList<QmlAbstractAnimation *> *animations READ animations) - QVariant from; - QVariant to; +public: + QmlAnimationGroup(QObject *parent); + virtual ~QmlAnimationGroup(); - QString easing; + QmlList<QmlAbstractAnimation *>* animations(); + friend class QmlAbstractAnimation; +}; - QString properties; - QList<QObject *> targets; - QList<QObject *> exclude; +class QmlSequentialAnimation : public QmlAnimationGroup +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QmlAnimationGroup) - bool fromSourced; - bool fromIsDefined; - bool toIsDefined; - bool defaultToInterpolatorType; - int interpolatorType; - QVariantAnimation::Interpolator interpolator; +public: + QmlSequentialAnimation(QObject *parent=0); + virtual ~QmlSequentialAnimation(); - QmlTimeLineValueAnimator *va; - virtual void valueChanged(qreal); +protected: + virtual void transition(QmlStateActions &actions, + QmlMetaProperties &modified, + TransitionDirection direction); + virtual QAbstractAnimation *qtAnimation(); + virtual void prepare(QmlMetaProperty &); +}; - QmlTimeLineValueProxy<QmlPropertyAnimationPrivate> value; +class QmlParallelAnimation : public QmlAnimationGroup +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QmlAnimationGroup) + +public: + QmlParallelAnimation(QObject *parent=0); + virtual ~QmlParallelAnimation(); - static QVariant interpolateVariant(const QVariant &from, const QVariant &to, qreal progress); - static void convertVariant(QVariant &variant, int type); +protected: + virtual void transition(QmlStateActions &actions, + QmlMetaProperties &modified, + TransitionDirection direction); + virtual QAbstractAnimation *qtAnimation(); + virtual void prepare(QmlMetaProperty &); }; QT_END_NAMESPACE -#endif // QMLANIMATION_P_H +QML_DECLARE_TYPE(QmlAbstractAnimation) +QML_DECLARE_TYPE(QmlPauseAnimation) +QML_DECLARE_TYPE(QmlScriptAction) +QML_DECLARE_TYPE(QmlPropertyAction) +QML_DECLARE_TYPE(QmlParentAction) +QML_DECLARE_TYPE(QmlPropertyAnimation) +QML_DECLARE_TYPE(QmlColorAnimation) +QML_DECLARE_TYPE(QmlNumberAnimation) +QML_DECLARE_TYPE(QmlSequentialAnimation) +QML_DECLARE_TYPE(QmlParallelAnimation) + +QT_END_HEADER + +#endif // QMLANIMATION_H diff --git a/src/declarative/util/qmlanimation_p_p.h b/src/declarative/util/qmlanimation_p_p.h new file mode 100644 index 0000000..1372343 --- /dev/null +++ b/src/declarative/util/qmlanimation_p_p.h @@ -0,0 +1,362 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLANIMATION_P_H +#define QMLANIMATION_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <private/qobject_p.h> +#include <private/qmlnullablevalue_p_p.h> +#include <private/qvariantanimation_p.h> +#include <QtCore/QPauseAnimation> +#include <QtCore/QVariantAnimation> +#include <QtCore/QAnimationGroup> +#include <QtGui/QColor> +#include <private/qmlanimation_p.h> +#include <QtDeclarative/qml.h> +#include <QtDeclarative/qmlcontext.h> +#include <private/qmltimeline_p_p.h> + +QT_BEGIN_NAMESPACE + +//interface for classes that provide animation actions for QActionAnimation +class QAbstractAnimationAction +{ +public: + virtual ~QAbstractAnimationAction() {} + virtual void doAction() = 0; +}; + +//templated animation action +//allows us to specify an action that calls a function of a class. +//(so that class doesn't have to inherit QmlAbstractAnimationAction) +template<class T, void (T::*method)()> +class QAnimationActionProxy : public QAbstractAnimationAction +{ +public: + QAnimationActionProxy(T *p) : m_p(p) {} + virtual void doAction() { (m_p->*method)(); } + +private: + T *m_p; +}; + +//performs an action of type QAbstractAnimationAction +class QActionAnimation : public QAbstractAnimation +{ + Q_OBJECT +public: + QActionAnimation(QObject *parent = 0) : QAbstractAnimation(parent), animAction(0), policy(KeepWhenStopped) {} + QActionAnimation(QAbstractAnimationAction *action, QObject *parent = 0) + : QAbstractAnimation(parent), animAction(action), policy(KeepWhenStopped) {} + virtual int duration() const { return 0; } + void setAnimAction(QAbstractAnimationAction *action, DeletionPolicy p) + { + if (state() == Running) + stop(); + animAction = action; + policy = p; + } +protected: + virtual void updateCurrentTime(int) {} + + virtual void updateState(State /*oldState*/, State newState) + { + if (newState == Running) { + if (animAction) + animAction->doAction(); + } else if (newState == Stopped && policy == DeleteWhenStopped) { + delete animAction; + animAction = 0; + } + } + +private: + QAbstractAnimationAction *animAction; + DeletionPolicy policy; +}; + +//animates QmlTimeLineValue (assumes start and end values will be reals or compatible) +class QmlTimeLineValueAnimator : public QVariantAnimation +{ + Q_OBJECT +public: + QmlTimeLineValueAnimator(QObject *parent = 0) : QVariantAnimation(parent), animValue(0), fromSourced(0), policy(KeepWhenStopped) {} + void setAnimValue(QmlTimeLineValue *value, DeletionPolicy p) + { + if (state() == Running) + stop(); + animValue = value; + policy = p; + } + void setFromSourcedValue(bool *value) + { + fromSourced = value; + } +protected: + virtual void updateCurrentValue(const QVariant &value) + { + if (animValue) + animValue->setValue(value.toDouble()); + } + virtual void updateState(State oldState, State newState) + { + QVariantAnimation::updateState(oldState, newState); + if (newState == Running) { + //check for new from every loop + if (fromSourced) + *fromSourced = false; + } else if (newState == Stopped && policy == DeleteWhenStopped) { + delete animValue; + animValue = 0; + } + } + +private: + QmlTimeLineValue *animValue; + bool *fromSourced; + DeletionPolicy policy; +}; + +//an animation that just gives a tick +template<class T, void (T::*method)(int)> +class QTickAnimationProxy : public QAbstractAnimation +{ + //Q_OBJECT //doesn't work with templating +public: + QTickAnimationProxy(T *p, QObject *parent = 0) : QAbstractAnimation(parent), m_p(p) {} + virtual int duration() const { return -1; } +protected: + virtual void updateCurrentTime(int msec) { (m_p->*method)(msec); } + +private: + T *m_p; +}; + +class QmlAbstractAnimationPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QmlAbstractAnimation) +public: + QmlAbstractAnimationPrivate() + : running(false), paused(false), alwaysRunToEnd(false), repeat(false), + connectedTimeLine(false), componentComplete(true), startOnCompletion(false), + target(0), group(0) {} + + bool running; + bool paused; + bool alwaysRunToEnd; + bool repeat; + bool connectedTimeLine; + + bool componentComplete; + bool startOnCompletion; + + void commence(); + + QmlNullableValue<QmlMetaProperty> userProperty; + QObject *target; + QString propertyName; + + QmlMetaProperty property; + QmlAnimationGroup *group; + + QmlMetaProperty createProperty(QObject *obj, const QString &str); +}; + +class QmlPauseAnimationPrivate : public QmlAbstractAnimationPrivate +{ + Q_DECLARE_PUBLIC(QmlPauseAnimation) +public: + QmlPauseAnimationPrivate() + : QmlAbstractAnimationPrivate(), pa(0) {} + + void init(); + + QPauseAnimation *pa; +}; + +class QmlScriptActionPrivate : public QmlAbstractAnimationPrivate +{ + Q_DECLARE_PUBLIC(QmlScriptAction) +public: + QmlScriptActionPrivate() + : QmlAbstractAnimationPrivate(), hasRunScriptScript(false), proxy(this), rsa(0) {} + + void init(); + + QmlScriptString script; + QString name; + QmlScriptString runScriptScript; + bool hasRunScriptScript; + + void execute(); + + QAnimationActionProxy<QmlScriptActionPrivate, + &QmlScriptActionPrivate::execute> proxy; + QActionAnimation *rsa; +}; + +class QmlPropertyActionPrivate : public QmlAbstractAnimationPrivate +{ + Q_DECLARE_PUBLIC(QmlPropertyAction) +public: + QmlPropertyActionPrivate() + : QmlAbstractAnimationPrivate(), proxy(this), spa(0) {} + + void init(); + + QString properties; + QList<QObject *> targets; + QList<QObject *> exclude; + + QmlNullableValue<QVariant> value; + + void doAction(); + + QAnimationActionProxy<QmlPropertyActionPrivate, + &QmlPropertyActionPrivate::doAction> proxy; + QActionAnimation *spa; +}; + +class QmlParentActionPrivate : public QmlAbstractAnimationPrivate +{ + Q_DECLARE_PUBLIC(QmlParentAction) +public: + QmlParentActionPrivate() + : QmlAbstractAnimationPrivate(), pcTarget(0), pcParent(0) {} + + void init(); + + QmlGraphicsItem *pcTarget; + QmlGraphicsItem *pcParent; + + void doAction(); + QActionAnimation *cpa; +}; + +class QmlAnimationGroupPrivate : public QmlAbstractAnimationPrivate +{ + Q_DECLARE_PUBLIC(QmlAnimationGroup) +public: + QmlAnimationGroupPrivate() + : QmlAbstractAnimationPrivate(), animations(this), ag(0) {} + + struct AnimationList : public QmlConcreteList<QmlAbstractAnimation *> + { + AnimationList(QmlAnimationGroupPrivate *p) + : anim(p) {} + virtual void append(QmlAbstractAnimation *a) { + QmlConcreteList<QmlAbstractAnimation *>::append(a); + a->setGroup(anim->q_func()); + } + virtual void clear() + { + for (int i = 0; i < count(); ++i) + at(i)->setGroup(0); + QmlConcreteList<QmlAbstractAnimation *>::clear(); + } + virtual void removeAt(int i) + { + at(i)->setGroup(0); + QmlConcreteList<QmlAbstractAnimation *>::removeAt(i); + } + virtual void insert(int i, QmlAbstractAnimation *a) + { + QmlConcreteList<QmlAbstractAnimation *>::insert(i, a); + a->setGroup(anim->q_func()); + } + + QmlAnimationGroupPrivate *anim; + }; + + AnimationList animations; + QAnimationGroup *ag; +}; + +class QmlPropertyAnimationPrivate : public QmlAbstractAnimationPrivate +{ + Q_DECLARE_PUBLIC(QmlPropertyAnimation) +public: + QmlPropertyAnimationPrivate() + : QmlAbstractAnimationPrivate(), fromSourced(false), fromIsDefined(false), toIsDefined(false), + defaultToInterpolatorType(0), interpolatorType(0), interpolator(0), va(0), + value(this, &QmlPropertyAnimationPrivate::valueChanged) {} + + void init(); + + QVariant from; + QVariant to; + + QString easing; + + QString properties; + QList<QObject *> targets; + QList<QObject *> exclude; + + bool fromSourced; + bool fromIsDefined; + bool toIsDefined; + bool defaultToInterpolatorType; + int interpolatorType; + QVariantAnimation::Interpolator interpolator; + + QmlTimeLineValueAnimator *va; + virtual void valueChanged(qreal); + + QmlTimeLineValueProxy<QmlPropertyAnimationPrivate> value; + + static QVariant interpolateVariant(const QVariant &from, const QVariant &to, qreal progress); + static void convertVariant(QVariant &variant, int type); +}; + +QT_END_NAMESPACE + +#endif // QMLANIMATION_P_H diff --git a/src/declarative/util/qmlbind.cpp b/src/declarative/util/qmlbind.cpp index baa8d68..eadad08 100644 --- a/src/declarative/util/qmlbind.cpp +++ b/src/declarative/util/qmlbind.cpp @@ -47,8 +47,8 @@ #include <QtScript/qscriptvalue.h> #include <QtScript/qscriptcontext.h> #include <QtScript/qscriptengine.h> -#include <private/qmlnullablevalue_p.h> -#include "qmlbind.h" +#include <private/qmlnullablevalue_p_p.h> +#include "qmlbind_p.h" QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmlbind.h b/src/declarative/util/qmlbind_p.h index a4ba81d..a4ba81d 100644 --- a/src/declarative/util/qmlbind.h +++ b/src/declarative/util/qmlbind_p.h diff --git a/src/declarative/util/qmlconnection.cpp b/src/declarative/util/qmlconnection.cpp index 73d69ff..27ac374 100644 --- a/src/declarative/util/qmlconnection.cpp +++ b/src/declarative/util/qmlconnection.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmlconnection.h" +#include "qmlconnection_p.h" #include <QtDeclarative/qmlexpression.h> #include "private/qmlboundsignal_p.h" #include "private/qobject_p.h" diff --git a/src/declarative/util/qmlconnection.h b/src/declarative/util/qmlconnection_p.h index 7a69771..7a69771 100644 --- a/src/declarative/util/qmlconnection.h +++ b/src/declarative/util/qmlconnection_p.h diff --git a/src/declarative/util/qmleasefollow.cpp b/src/declarative/util/qmleasefollow.cpp index cf750cd..5447c56 100644 --- a/src/declarative/util/qmleasefollow.cpp +++ b/src/declarative/util/qmleasefollow.cpp @@ -39,11 +39,11 @@ ** ****************************************************************************/ -#include "qmleasefollow.h" +#include "qmleasefollow_p.h" #include <QtDeclarative/qmlmetaproperty.h> #include <math.h> #include <QtCore/qdebug.h> -#include <private/qmlanimation_p.h> +#include <private/qmlanimation_p_p.h> QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmleasefollow.h b/src/declarative/util/qmleasefollow_p.h index 3de72f2..3de72f2 100644 --- a/src/declarative/util/qmleasefollow.h +++ b/src/declarative/util/qmleasefollow_p.h diff --git a/src/declarative/util/qmllistaccessor.cpp b/src/declarative/util/qmllistaccessor.cpp index cdde748..910f2a5 100644 --- a/src/declarative/util/qmllistaccessor.cpp +++ b/src/declarative/util/qmllistaccessor.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmllistaccessor.h" +#include "qmllistaccessor_p.h" #include <QStringList> #include <qmlmetatype.h> #include <QtCore/qdebug.h> diff --git a/src/declarative/util/qmllistaccessor.h b/src/declarative/util/qmllistaccessor_p.h index 2697606..2697606 100644 --- a/src/declarative/util/qmllistaccessor.h +++ b/src/declarative/util/qmllistaccessor_p.h diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp index 26aa7a7..dba2203 100644 --- a/src/declarative/util/qmllistmodel.cpp +++ b/src/declarative/util/qmllistmodel.cpp @@ -44,9 +44,9 @@ #include <QXmlStreamReader> #include <private/qmlcustomparser_p.h> #include <private/qmlparser_p.h> -#include "qmlopenmetaobject.h" +#include "qmlopenmetaobject_p.h" #include <qmlcontext.h> -#include "qmllistmodel.h" +#include "qmllistmodel_p.h" #include <QtScript/qscriptvalueiterator.h> Q_DECLARE_METATYPE(QListModelInterface *) diff --git a/src/declarative/util/qmllistmodel.h b/src/declarative/util/qmllistmodel_p.h index 5568fd2..ff6521c 100644 --- a/src/declarative/util/qmllistmodel.h +++ b/src/declarative/util/qmllistmodel_p.h @@ -49,7 +49,7 @@ #include <QtCore/QVariant> #include <QtDeclarative/qfxglobal.h> #include <QtDeclarative/qml.h> -#include <QtDeclarative/qlistmodelinterface.h> +#include <private/qlistmodelinterface_p.h> #include <QtScript/qscriptvalue.h> diff --git a/src/declarative/util/qmlnullablevalue_p.h b/src/declarative/util/qmlnullablevalue_p_p.h index 151a3d4..151a3d4 100644 --- a/src/declarative/util/qmlnullablevalue_p.h +++ b/src/declarative/util/qmlnullablevalue_p_p.h diff --git a/src/declarative/util/qmlopenmetaobject.cpp b/src/declarative/util/qmlopenmetaobject.cpp index a9be1ff..05ff80a 100644 --- a/src/declarative/util/qmlopenmetaobject.cpp +++ b/src/declarative/util/qmlopenmetaobject.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmlopenmetaobject.h" +#include "qmlopenmetaobject_p.h" #include "private/qmetaobjectbuilder_p.h" #include <QDebug> diff --git a/src/declarative/util/qmlopenmetaobject.h b/src/declarative/util/qmlopenmetaobject_p.h index 1cf12f8..1cf12f8 100644 --- a/src/declarative/util/qmlopenmetaobject.h +++ b/src/declarative/util/qmlopenmetaobject_p.h diff --git a/src/declarative/util/qmlpackage.cpp b/src/declarative/util/qmlpackage.cpp index b6bdd1a..4d7fa86 100644 --- a/src/declarative/util/qmlpackage.cpp +++ b/src/declarative/util/qmlpackage.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "private/qobject_p.h" -#include "qmlpackage.h" +#include "qmlpackage_p.h" QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmlpackage.h b/src/declarative/util/qmlpackage_p.h index abb57c6..abb57c6 100644 --- a/src/declarative/util/qmlpackage.h +++ b/src/declarative/util/qmlpackage_p.h diff --git a/src/declarative/util/qmlpropertychanges.cpp b/src/declarative/util/qmlpropertychanges.cpp index d2c002b..8ba4b25 100644 --- a/src/declarative/util/qmlpropertychanges.cpp +++ b/src/declarative/util/qmlpropertychanges.cpp @@ -40,8 +40,8 @@ ****************************************************************************/ #include "private/qobject_p.h" -#include "qmlopenmetaobject.h" -#include "qmlpropertychanges.h" +#include "qmlopenmetaobject_p.h" +#include "qmlpropertychanges_p.h" #include <QtCore/qdebug.h> #include <QtDeclarative/qmlinfo.h> #include <private/qmlcustomparser_p.h> diff --git a/src/declarative/util/qmlpropertychanges.h b/src/declarative/util/qmlpropertychanges_p.h index 87562de..2c0cba9 100644 --- a/src/declarative/util/qmlpropertychanges.h +++ b/src/declarative/util/qmlpropertychanges_p.h @@ -42,7 +42,7 @@ #ifndef QMLPROPERTYCHANGES_H #define QMLPROPERTYCHANGES_H -#include <QtDeclarative/qmlstateoperations.h> +#include <private/qmlstateoperations_p.h> QT_BEGIN_HEADER diff --git a/src/declarative/util/qmlpropertymap.cpp b/src/declarative/util/qmlpropertymap.cpp index c6641b7..8abf09f 100644 --- a/src/declarative/util/qmlpropertymap.cpp +++ b/src/declarative/util/qmlpropertymap.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qmlpropertymap.h" -#include <qmlopenmetaobject.h> +#include "qmlpropertymap_p.h" +#include <private/qmlopenmetaobject_p.h> #include <QDebug> QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmlpropertymap.h b/src/declarative/util/qmlpropertymap_p.h index 0f641b2..0f641b2 100644 --- a/src/declarative/util/qmlpropertymap.h +++ b/src/declarative/util/qmlpropertymap_p.h diff --git a/src/declarative/util/qmlspringfollow.cpp b/src/declarative/util/qmlspringfollow.cpp index 82a856d..e743aa5 100644 --- a/src/declarative/util/qmlspringfollow.cpp +++ b/src/declarative/util/qmlspringfollow.cpp @@ -43,8 +43,8 @@ #include <math.h> #include <QtCore/qdebug.h> #include "private/qobject_p.h" -#include "qmlspringfollow.h" -#include "private/qmlanimation_p.h" +#include "qmlspringfollow_p.h" +#include "private/qmlanimation_p_p.h" QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmlspringfollow.h b/src/declarative/util/qmlspringfollow_p.h index cadb344..cadb344 100644 --- a/src/declarative/util/qmlspringfollow.h +++ b/src/declarative/util/qmlspringfollow_p.h diff --git a/src/declarative/util/qmlstate.cpp b/src/declarative/util/qmlstate.cpp index f64b6ab..a5978a5 100644 --- a/src/declarative/util/qmlstate.cpp +++ b/src/declarative/util/qmlstate.cpp @@ -39,14 +39,14 @@ ** ****************************************************************************/ -#include "qmltransition.h" -#include "qmlstategroup.h" -#include "qmlstate_p.h" +#include "qmltransition_p.h" +#include "qmlstategroup_p.h" +#include "qmlstate_p_p.h" #include "qmlbinding.h" -#include "qmlstateoperations.h" -#include "qmlanimation.h" +#include "qmlstateoperations_p.h" #include "qmlanimation_p.h" -#include "qmlstate.h" +#include "qmlanimation_p_p.h" +#include "qmlstate_p.h" #include <QtCore/qdebug.h> QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmlstate.h b/src/declarative/util/qmlstate.h deleted file mode 100644 index 9d18390..0000000 --- a/src/declarative/util/qmlstate.h +++ /dev/null @@ -1,174 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLSTATE_H -#define QMLSTATE_H - -#include <QtCore/qobject.h> -#include <QtCore/QSequentialAnimationGroup> -#include <QtDeclarative/qfxglobal.h> -#include <QtDeclarative/qml.h> - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) - -class ActionEvent; -class QmlBinding; -class Action -{ -public: - Action(); - Action(QObject *, const QString &, const QVariant &); - - bool restore:1; - bool actionDone:1; - bool reverseEvent:1; - bool deletableToBinding:1; - - QmlMetaProperty property; - QVariant fromValue; - QVariant toValue; - - QmlAbstractBinding *fromBinding; - QmlAbstractBinding *toBinding; - ActionEvent *event; - - //strictly for matching - QObject *specifiedObject; - QString specifiedProperty; - - void deleteFromBinding(); -}; - -class ActionEvent -{ -public: - virtual ~ActionEvent(); - virtual QString typeName() const; - - virtual void execute(); - virtual bool isReversable(); - virtual void reverse(); - virtual void saveOriginals() {} - - //virtual bool hasExtraActions(); - virtual QList<Action> extraActions(); - - virtual bool changesBindings(); - virtual void clearForwardBindings(); - virtual void clearReverseBindings(); - virtual bool override(ActionEvent*other); -}; - -//### rename to QmlStateChange? -class QmlStateGroup; -class Q_DECLARATIVE_EXPORT QmlStateOperation : public QObject -{ - Q_OBJECT -public: - QmlStateOperation(QObject *parent = 0) - : QObject(parent) {} - typedef QList<Action> ActionList; - - virtual ActionList actions(); - -protected: - QmlStateOperation(QObjectPrivate &dd, QObject *parent = 0); -}; - -typedef QmlStateOperation::ActionList QmlStateActions; - -class QmlTransition; -class QmlStatePrivate; -class Q_DECLARATIVE_EXPORT QmlState : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QString name READ name WRITE setName) - Q_PROPERTY(QmlBinding *when READ when WRITE setWhen) - Q_PROPERTY(QString extend READ extends WRITE setExtends) - Q_PROPERTY(QmlList<QmlStateOperation *>* changes READ changes) - Q_CLASSINFO("DefaultProperty", "changes") - -public: - QmlState(QObject *parent=0); - virtual ~QmlState(); - - QString name() const; - void setName(const QString &); - - /*'when' is a QmlBinding to limit state changes oscillation - due to the unpredictable order of evaluation of bound expressions*/ - bool isWhenKnown() const; - QmlBinding *when() const; - void setWhen(QmlBinding *); - - QString extends() const; - void setExtends(const QString &); - - QmlList<QmlStateOperation *> *changes(); - QmlState &operator<<(QmlStateOperation *); - - void apply(QmlStateGroup *, QmlTransition *, QmlState *revert); - void cancel(); - - QmlStateGroup *stateGroup() const; - void setStateGroup(QmlStateGroup *); - -Q_SIGNALS: - void completed(); - -private: - Q_DECLARE_PRIVATE(QmlState) - Q_DISABLE_COPY(QmlState) -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QmlStateOperation) -QML_DECLARE_TYPE(QmlState) - -QT_END_HEADER - -#endif // QMLSTATE_H diff --git a/src/declarative/util/qmlstate_p.h b/src/declarative/util/qmlstate_p.h index 5e414dc..9d18390 100644 --- a/src/declarative/util/qmlstate_p.h +++ b/src/declarative/util/qmlstate_p.h @@ -39,83 +39,136 @@ ** ****************************************************************************/ -#ifndef QMLSTATE_P_H -#define QMLSTATE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtDeclarative/qmlstate.h> -#include <private/qobject_p.h> -#include <private/qmlanimation_p.h> -#include <private/qmltransitionmanager_p.h> +#ifndef QMLSTATE_H +#define QMLSTATE_H + +#include <QtCore/qobject.h> +#include <QtCore/QSequentialAnimationGroup> +#include <QtDeclarative/qfxglobal.h> +#include <QtDeclarative/qml.h> + +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class SimpleAction +QT_MODULE(Declarative) + +class ActionEvent; +class QmlBinding; +class Action { public: - enum State { StartState, EndState }; - SimpleAction(const Action &a, State state = StartState) - { - property = a.property; - specifiedObject = a.specifiedObject; - specifiedProperty = a.specifiedProperty; - event = a.event; - if (state == StartState) { - value = a.fromValue; - binding = property.binding(); - reverseEvent = true; - } else { - value = a.toValue; - binding = a.toBinding; - reverseEvent = false; - } - } + Action(); + Action(QObject *, const QString &, const QVariant &); + + bool restore:1; + bool actionDone:1; + bool reverseEvent:1; + bool deletableToBinding:1; QmlMetaProperty property; - QVariant value; - QmlAbstractBinding *binding; + QVariant fromValue; + QVariant toValue; + + QmlAbstractBinding *fromBinding; + QmlAbstractBinding *toBinding; + ActionEvent *event; + + //strictly for matching QObject *specifiedObject; QString specifiedProperty; - ActionEvent *event; - bool reverseEvent; + + void deleteFromBinding(); }; -class QmlStatePrivate : public QObjectPrivate +class ActionEvent { - Q_DECLARE_PUBLIC(QmlState) +public: + virtual ~ActionEvent(); + virtual QString typeName() const; + + virtual void execute(); + virtual bool isReversable(); + virtual void reverse(); + virtual void saveOriginals() {} + + //virtual bool hasExtraActions(); + virtual QList<Action> extraActions(); + virtual bool changesBindings(); + virtual void clearForwardBindings(); + virtual void clearReverseBindings(); + virtual bool override(ActionEvent*other); +}; + +//### rename to QmlStateChange? +class QmlStateGroup; +class Q_DECLARATIVE_EXPORT QmlStateOperation : public QObject +{ + Q_OBJECT public: - QmlStatePrivate() - : when(0), inState(false), group(0) {} + QmlStateOperation(QObject *parent = 0) + : QObject(parent) {} + typedef QList<Action> ActionList; - typedef QList<SimpleAction> SimpleActionList; + virtual ActionList actions(); - QString name; - QmlBinding *when; - QmlConcreteList<QmlStateOperation *> operations; +protected: + QmlStateOperation(QObjectPrivate &dd, QObject *parent = 0); +}; + +typedef QmlStateOperation::ActionList QmlStateActions; + +class QmlTransition; +class QmlStatePrivate; +class Q_DECLARATIVE_EXPORT QmlState : public QObject +{ + Q_OBJECT + + Q_PROPERTY(QString name READ name WRITE setName) + Q_PROPERTY(QmlBinding *when READ when WRITE setWhen) + Q_PROPERTY(QString extend READ extends WRITE setExtends) + Q_PROPERTY(QmlList<QmlStateOperation *>* changes READ changes) + Q_CLASSINFO("DefaultProperty", "changes") + +public: + QmlState(QObject *parent=0); + virtual ~QmlState(); - QmlTransitionManager transitionManager; + QString name() const; + void setName(const QString &); - SimpleActionList revertList; - QList<QmlMetaProperty> reverting; - QString extends; - mutable bool inState; - QmlStateGroup *group; + /*'when' is a QmlBinding to limit state changes oscillation + due to the unpredictable order of evaluation of bound expressions*/ + bool isWhenKnown() const; + QmlBinding *when() const; + void setWhen(QmlBinding *); - QmlStateOperation::ActionList generateActionList(QmlStateGroup *) const; - void complete(); + QString extends() const; + void setExtends(const QString &); + + QmlList<QmlStateOperation *> *changes(); + QmlState &operator<<(QmlStateOperation *); + + void apply(QmlStateGroup *, QmlTransition *, QmlState *revert); + void cancel(); + + QmlStateGroup *stateGroup() const; + void setStateGroup(QmlStateGroup *); + +Q_SIGNALS: + void completed(); + +private: + Q_DECLARE_PRIVATE(QmlState) + Q_DISABLE_COPY(QmlState) }; QT_END_NAMESPACE -#endif // QMLSTATE_P_H +QML_DECLARE_TYPE(QmlStateOperation) +QML_DECLARE_TYPE(QmlState) + +QT_END_HEADER + +#endif // QMLSTATE_H diff --git a/src/declarative/util/qmlstate_p_p.h b/src/declarative/util/qmlstate_p_p.h new file mode 100644 index 0000000..095a7d2 --- /dev/null +++ b/src/declarative/util/qmlstate_p_p.h @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLSTATE_P_H +#define QMLSTATE_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <private/qmlstate_p.h> +#include <private/qobject_p.h> +#include <private/qmlanimation_p_p.h> +#include <private/qmltransitionmanager_p_p.h> + +QT_BEGIN_NAMESPACE + +class SimpleAction +{ +public: + enum State { StartState, EndState }; + SimpleAction(const Action &a, State state = StartState) + { + property = a.property; + specifiedObject = a.specifiedObject; + specifiedProperty = a.specifiedProperty; + event = a.event; + if (state == StartState) { + value = a.fromValue; + binding = property.binding(); + reverseEvent = true; + } else { + value = a.toValue; + binding = a.toBinding; + reverseEvent = false; + } + } + + QmlMetaProperty property; + QVariant value; + QmlAbstractBinding *binding; + QObject *specifiedObject; + QString specifiedProperty; + ActionEvent *event; + bool reverseEvent; +}; + +class QmlStatePrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QmlState) + +public: + QmlStatePrivate() + : when(0), inState(false), group(0) {} + + typedef QList<SimpleAction> SimpleActionList; + + QString name; + QmlBinding *when; + QmlConcreteList<QmlStateOperation *> operations; + + QmlTransitionManager transitionManager; + + SimpleActionList revertList; + QList<QmlMetaProperty> reverting; + QString extends; + mutable bool inState; + QmlStateGroup *group; + + QmlStateOperation::ActionList generateActionList(QmlStateGroup *) const; + void complete(); +}; + +QT_END_NAMESPACE + +#endif // QMLSTATE_P_H diff --git a/src/declarative/util/qmlstategroup.cpp b/src/declarative/util/qmlstategroup.cpp index c2a419f..cff25c3 100644 --- a/src/declarative/util/qmlstategroup.cpp +++ b/src/declarative/util/qmlstategroup.cpp @@ -40,8 +40,8 @@ ****************************************************************************/ #include "private/qobject_p.h" -#include "qmlstategroup.h" -#include "qmltransition.h" +#include "qmlstategroup_p.h" +#include "qmltransition_p.h" #include <QtDeclarative/qmlbinding.h> #include <QtCore/qdebug.h> @@ -274,7 +274,7 @@ void QmlStateGroupPrivate::setCurrentStateInternal(const QString &state, } if (oldState == 0 || newState == 0) { - if (!nullState) { nullState = new QmlState; QFx_setParent_noEvent(nullState, q); } + if (!nullState) { nullState = new QmlState; QmlGraphics_setParent_noEvent(nullState, q); } if (!oldState) oldState = nullState; if (!newState) newState = nullState; } diff --git a/src/declarative/util/qmlstategroup.h b/src/declarative/util/qmlstategroup_p.h index a8f393c..f4c6d86 100644 --- a/src/declarative/util/qmlstategroup.h +++ b/src/declarative/util/qmlstategroup_p.h @@ -42,7 +42,7 @@ #ifndef QMLSTATEGROUP_H #define QMLSTATEGROUP_H -#include <QtDeclarative/qmlstate.h> +#include <private/qmlstate_p.h> QT_BEGIN_HEADER diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp index af7f797..ccb9a41 100644 --- a/src/declarative/util/qmlstateoperations.cpp +++ b/src/declarative/util/qmlstateoperations.cpp @@ -43,11 +43,11 @@ #include <qml.h> #include <QtDeclarative/qmlcontext.h> #include <QtDeclarative/qmlexpression.h> -#include "qmlstateoperations.h" +#include "qmlstateoperations_p.h" #include <QtCore/qdebug.h> #include <QtDeclarative/qmlinfo.h> -#include <private/qfxanchors_p.h> -#include <private/qfxitem_p.h> +#include <private/qmlgraphicsanchors_p_p.h> +#include <private/qmlgraphicsitem_p.h> #include <QtGui/qgraphicsitem.h> #include <QtCore/qmath.h> @@ -59,15 +59,15 @@ class QmlParentChangePrivate : public QObjectPrivate public: QmlParentChangePrivate() : target(0), parent(0), origParent(0), origStackBefore(0) {} - QFxItem *target; - QFxItem *parent; - QGuard<QFxItem> origParent; - QGuard<QFxItem> origStackBefore; + QmlGraphicsItem *target; + QmlGraphicsItem *parent; + QGuard<QmlGraphicsItem> origParent; + QGuard<QmlGraphicsItem> origStackBefore; - void doChange(QFxItem *targetParent, QFxItem *stackBefore = 0); + void doChange(QmlGraphicsItem *targetParent, QmlGraphicsItem *stackBefore = 0); }; -void QmlParentChangePrivate::doChange(QFxItem *targetParent, QFxItem *stackBefore) +void QmlParentChangePrivate::doChange(QmlGraphicsItem *targetParent, QmlGraphicsItem *stackBefore) { if (targetParent && target && target->parentItem()) { //### for backwards direction, can we just restore original x, y, scale, rotation @@ -105,7 +105,7 @@ void QmlParentChangePrivate::doChange(QFxItem *targetParent, QFxItem *stackBefor qreal xt = transform.dx(); qreal yt = transform.dy(); - if (target->transformOrigin() != QFxItem::TopLeft) { + if (target->transformOrigin() != QmlGraphicsItem::TopLeft) { qreal tempxt = target->transformOriginPoint().x(); qreal tempyt = target->transformOriginPoint().y(); QTransform t; @@ -166,13 +166,13 @@ QmlParentChange::~QmlParentChange() This property holds the item to be reparented */ -QFxItem *QmlParentChange::object() const +QmlGraphicsItem *QmlParentChange::object() const { Q_D(const QmlParentChange); return d->target; } -void QmlParentChange::setObject(QFxItem *target) +void QmlParentChange::setObject(QmlGraphicsItem *target) { Q_D(QmlParentChange); d->target = target; @@ -183,13 +183,13 @@ void QmlParentChange::setObject(QFxItem *target) This property holds the parent for the item in this state */ -QFxItem *QmlParentChange::parent() const +QmlGraphicsItem *QmlParentChange::parent() const { Q_D(const QmlParentChange); return d->parent; } -void QmlParentChange::setParent(QFxItem *parent) +void QmlParentChange::setParent(QmlGraphicsItem *parent) { Q_D(QmlParentChange); d->parent = parent; @@ -207,13 +207,13 @@ QmlStateOperation::ActionList QmlParentChange::actions() return ActionList() << a; } -class AccessibleFxItem : public QFxItem +class AccessibleFxItem : public QmlGraphicsItem { Q_OBJECT - Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QFxItem) + Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QmlGraphicsItem) public: int siblingIndex() { - Q_D(QFxItem); + Q_D(QmlGraphicsItem); return d->siblingIndex; } }; @@ -238,7 +238,7 @@ void QmlParentChange::saveOriginals() int siblingIndex = ((AccessibleFxItem*)d->target)->siblingIndex() + 1; QList<QGraphicsItem*> children = d->origParent->childItems(); for (int i = 0; i < children.count(); ++i) { - QFxItem *child = qobject_cast<QFxItem*>(children.at(i)); + QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem*>(children.at(i)); if (!child) continue; if (((AccessibleFxItem*)child)->siblingIndex() == siblingIndex) { @@ -368,24 +368,24 @@ public: QmlAnchorChangesPrivate() : target(0) {} QString name; - QFxItem *target; + QmlGraphicsItem *target; QString resetString; QStringList resetList; - QFxAnchorLine left; - QFxAnchorLine right; - QFxAnchorLine horizontalCenter; - QFxAnchorLine top; - QFxAnchorLine bottom; - QFxAnchorLine verticalCenter; - QFxAnchorLine baseline; - - QFxAnchorLine origLeft; - QFxAnchorLine origRight; - QFxAnchorLine origHCenter; - QFxAnchorLine origTop; - QFxAnchorLine origBottom; - QFxAnchorLine origVCenter; - QFxAnchorLine origBaseline; + QmlGraphicsAnchorLine left; + QmlGraphicsAnchorLine right; + QmlGraphicsAnchorLine horizontalCenter; + QmlGraphicsAnchorLine top; + QmlGraphicsAnchorLine bottom; + QmlGraphicsAnchorLine verticalCenter; + QmlGraphicsAnchorLine baseline; + + QmlGraphicsAnchorLine origLeft; + QmlGraphicsAnchorLine origRight; + QmlGraphicsAnchorLine origHCenter; + QmlGraphicsAnchorLine origTop; + QmlGraphicsAnchorLine origBottom; + QmlGraphicsAnchorLine origVCenter; + QmlGraphicsAnchorLine origBaseline; qreal origX; qreal origY; qreal origWidth; @@ -413,13 +413,13 @@ QmlAnchorChanges::ActionList QmlAnchorChanges::actions() return ActionList() << a; } -QFxItem *QmlAnchorChanges::object() const +QmlGraphicsItem *QmlAnchorChanges::object() const { Q_D(const QmlAnchorChanges); return d->target; } -void QmlAnchorChanges::setObject(QFxItem *target) +void QmlAnchorChanges::setObject(QmlGraphicsItem *target) { Q_D(QmlAnchorChanges); d->target = target; @@ -450,85 +450,85 @@ void QmlAnchorChanges::setReset(const QString &reset) These properties change the respective anchors of the item. */ -QFxAnchorLine QmlAnchorChanges::left() const +QmlGraphicsAnchorLine QmlAnchorChanges::left() const { Q_D(const QmlAnchorChanges); return d->left; } -void QmlAnchorChanges::setLeft(const QFxAnchorLine &edge) +void QmlAnchorChanges::setLeft(const QmlGraphicsAnchorLine &edge) { Q_D(QmlAnchorChanges); d->left = edge; } -QFxAnchorLine QmlAnchorChanges::right() const +QmlGraphicsAnchorLine QmlAnchorChanges::right() const { Q_D(const QmlAnchorChanges); return d->right; } -void QmlAnchorChanges::setRight(const QFxAnchorLine &edge) +void QmlAnchorChanges::setRight(const QmlGraphicsAnchorLine &edge) { Q_D(QmlAnchorChanges); d->right = edge; } -QFxAnchorLine QmlAnchorChanges::horizontalCenter() const +QmlGraphicsAnchorLine QmlAnchorChanges::horizontalCenter() const { Q_D(const QmlAnchorChanges); return d->horizontalCenter; } -void QmlAnchorChanges::setHorizontalCenter(const QFxAnchorLine &edge) +void QmlAnchorChanges::setHorizontalCenter(const QmlGraphicsAnchorLine &edge) { Q_D(QmlAnchorChanges); d->horizontalCenter = edge; } -QFxAnchorLine QmlAnchorChanges::top() const +QmlGraphicsAnchorLine QmlAnchorChanges::top() const { Q_D(const QmlAnchorChanges); return d->top; } -void QmlAnchorChanges::setTop(const QFxAnchorLine &edge) +void QmlAnchorChanges::setTop(const QmlGraphicsAnchorLine &edge) { Q_D(QmlAnchorChanges); d->top = edge; } -QFxAnchorLine QmlAnchorChanges::bottom() const +QmlGraphicsAnchorLine QmlAnchorChanges::bottom() const { Q_D(const QmlAnchorChanges); return d->bottom; } -void QmlAnchorChanges::setBottom(const QFxAnchorLine &edge) +void QmlAnchorChanges::setBottom(const QmlGraphicsAnchorLine &edge) { Q_D(QmlAnchorChanges); d->bottom = edge; } -QFxAnchorLine QmlAnchorChanges::verticalCenter() const +QmlGraphicsAnchorLine QmlAnchorChanges::verticalCenter() const { Q_D(const QmlAnchorChanges); return d->verticalCenter; } -void QmlAnchorChanges::setVerticalCenter(const QFxAnchorLine &edge) +void QmlAnchorChanges::setVerticalCenter(const QmlGraphicsAnchorLine &edge) { Q_D(QmlAnchorChanges); d->verticalCenter = edge; } -QFxAnchorLine QmlAnchorChanges::baseline() const +QmlGraphicsAnchorLine QmlAnchorChanges::baseline() const { Q_D(const QmlAnchorChanges); return d->baseline; } -void QmlAnchorChanges::setBaseline(const QFxAnchorLine &edge) +void QmlAnchorChanges::setBaseline(const QmlGraphicsAnchorLine &edge) { Q_D(QmlAnchorChanges); d->baseline = edge; @@ -541,19 +541,19 @@ void QmlAnchorChanges::execute() return; //set any anchors that have been specified - if (d->left.anchorLine != QFxAnchorLine::Invalid) + if (d->left.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setLeft(d->left); - if (d->right.anchorLine != QFxAnchorLine::Invalid) + if (d->right.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setRight(d->right); - if (d->horizontalCenter.anchorLine != QFxAnchorLine::Invalid) + if (d->horizontalCenter.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setHorizontalCenter(d->horizontalCenter); - if (d->top.anchorLine != QFxAnchorLine::Invalid) + if (d->top.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setTop(d->top); - if (d->bottom.anchorLine != QFxAnchorLine::Invalid) + if (d->bottom.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setBottom(d->bottom); - if (d->verticalCenter.anchorLine != QFxAnchorLine::Invalid) + if (d->verticalCenter.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setVerticalCenter(d->verticalCenter); - if (d->baseline.anchorLine != QFxAnchorLine::Invalid) + if (d->baseline.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setBaseline(d->baseline); } @@ -569,19 +569,19 @@ void QmlAnchorChanges::reverse() return; //restore previous anchors - if (d->origLeft.anchorLine != QFxAnchorLine::Invalid) + if (d->origLeft.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setLeft(d->origLeft); - if (d->origRight.anchorLine != QFxAnchorLine::Invalid) + if (d->origRight.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setRight(d->origRight); - if (d->origHCenter.anchorLine != QFxAnchorLine::Invalid) + if (d->origHCenter.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setHorizontalCenter(d->origHCenter); - if (d->origTop.anchorLine != QFxAnchorLine::Invalid) + if (d->origTop.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setTop(d->origTop); - if (d->origBottom.anchorLine != QFxAnchorLine::Invalid) + if (d->origBottom.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setBottom(d->origBottom); - if (d->origVCenter.anchorLine != QFxAnchorLine::Invalid) + if (d->origVCenter.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setVerticalCenter(d->origVCenter); - if (d->origBaseline.anchorLine != QFxAnchorLine::Invalid) + if (d->origBaseline.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->setBaseline(d->origBaseline); } @@ -662,19 +662,19 @@ void QmlAnchorChanges::clearForwardBindings() d->target->anchors()->resetBaseline(); //reset any anchors that we'll be setting in the state - if (d->left.anchorLine != QFxAnchorLine::Invalid) + if (d->left.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetLeft(); - if (d->right.anchorLine != QFxAnchorLine::Invalid) + if (d->right.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetRight(); - if (d->horizontalCenter.anchorLine != QFxAnchorLine::Invalid) + if (d->horizontalCenter.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetHorizontalCenter(); - if (d->top.anchorLine != QFxAnchorLine::Invalid) + if (d->top.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetTop(); - if (d->bottom.anchorLine != QFxAnchorLine::Invalid) + if (d->bottom.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetBottom(); - if (d->verticalCenter.anchorLine != QFxAnchorLine::Invalid) + if (d->verticalCenter.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetVerticalCenter(); - if (d->baseline.anchorLine != QFxAnchorLine::Invalid) + if (d->baseline.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetBaseline(); } @@ -687,35 +687,35 @@ void QmlAnchorChanges::clearReverseBindings() d->origHeight = d->target->height(); //reset any anchors that were set in the state - if (d->left.anchorLine != QFxAnchorLine::Invalid) + if (d->left.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetLeft(); - if (d->right.anchorLine != QFxAnchorLine::Invalid) + if (d->right.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetRight(); - if (d->horizontalCenter.anchorLine != QFxAnchorLine::Invalid) + if (d->horizontalCenter.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetHorizontalCenter(); - if (d->top.anchorLine != QFxAnchorLine::Invalid) + if (d->top.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetTop(); - if (d->bottom.anchorLine != QFxAnchorLine::Invalid) + if (d->bottom.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetBottom(); - if (d->verticalCenter.anchorLine != QFxAnchorLine::Invalid) + if (d->verticalCenter.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetVerticalCenter(); - if (d->baseline.anchorLine != QFxAnchorLine::Invalid) + if (d->baseline.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetBaseline(); //reset any anchors that were set in the original state - if (d->origLeft.anchorLine != QFxAnchorLine::Invalid) + if (d->origLeft.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetLeft(); - if (d->origRight.anchorLine != QFxAnchorLine::Invalid) + if (d->origRight.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetRight(); - if (d->origHCenter.anchorLine != QFxAnchorLine::Invalid) + if (d->origHCenter.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetHorizontalCenter(); - if (d->origTop.anchorLine != QFxAnchorLine::Invalid) + if (d->origTop.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetTop(); - if (d->origBottom.anchorLine != QFxAnchorLine::Invalid) + if (d->origBottom.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetBottom(); - if (d->origVCenter.anchorLine != QFxAnchorLine::Invalid) + if (d->origVCenter.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetVerticalCenter(); - if (d->origBaseline.anchorLine != QFxAnchorLine::Invalid) + if (d->origBaseline.anchorLine != QmlGraphicsAnchorLine::Invalid) d->target->anchors()->resetBaseline(); } @@ -730,8 +730,8 @@ bool QmlAnchorChanges::override(ActionEvent*other) return false; } -QT_END_NAMESPACE - #include "qmlstateoperations.moc" -#include "moc_qmlstateoperations.cpp" +#include "moc_qmlstateoperations_p.cpp" + +QT_END_NAMESPACE diff --git a/src/declarative/util/qmlstateoperations.h b/src/declarative/util/qmlstateoperations_p.h index 43eca61..2801f2b 100644 --- a/src/declarative/util/qmlstateoperations.h +++ b/src/declarative/util/qmlstateoperations_p.h @@ -42,9 +42,9 @@ #ifndef QMLSTATEOPERATIONS_H #define QMLSTATEOPERATIONS_H -#include <QtDeclarative/qmlstate.h> -#include <QtDeclarative/qfxitem.h> -#include <QtDeclarative/qfxanchors.h> +#include <private/qmlstate_p.h> +#include <QtDeclarative/qmlgraphicsitem.h> +#include <private/qmlgraphicsanchors_p.h> #include <QtDeclarative/qmlscriptstring.h> QT_BEGIN_HEADER @@ -59,17 +59,17 @@ class Q_DECLARATIVE_EXPORT QmlParentChange : public QmlStateOperation, public Ac Q_OBJECT Q_DECLARE_PRIVATE(QmlParentChange) - Q_PROPERTY(QFxItem *target READ object WRITE setObject) - Q_PROPERTY(QFxItem *parent READ parent WRITE setParent) + Q_PROPERTY(QmlGraphicsItem *target READ object WRITE setObject) + Q_PROPERTY(QmlGraphicsItem *parent READ parent WRITE setParent) public: QmlParentChange(QObject *parent=0); ~QmlParentChange(); - QFxItem *object() const; - void setObject(QFxItem *); + QmlGraphicsItem *object() const; + void setObject(QmlGraphicsItem *); - QFxItem *parent() const; - void setParent(QFxItem *); + QmlGraphicsItem *parent() const; + void setParent(QmlGraphicsItem *); virtual ActionList actions(); @@ -111,15 +111,15 @@ class Q_DECLARATIVE_EXPORT QmlAnchorChanges : public QmlStateOperation, public A Q_OBJECT Q_DECLARE_PRIVATE(QmlAnchorChanges) - Q_PROPERTY(QFxItem *target READ object WRITE setObject) + Q_PROPERTY(QmlGraphicsItem *target READ object WRITE setObject) Q_PROPERTY(QString reset READ reset WRITE setReset) - Q_PROPERTY(QFxAnchorLine left READ left WRITE setLeft) - Q_PROPERTY(QFxAnchorLine right READ right WRITE setRight) - Q_PROPERTY(QFxAnchorLine horizontalCenter READ horizontalCenter WRITE setHorizontalCenter) - Q_PROPERTY(QFxAnchorLine top READ top WRITE setTop) - Q_PROPERTY(QFxAnchorLine bottom READ bottom WRITE setBottom) - Q_PROPERTY(QFxAnchorLine verticalCenter READ verticalCenter WRITE setVerticalCenter) - Q_PROPERTY(QFxAnchorLine baseline READ baseline WRITE setBaseline) + Q_PROPERTY(QmlGraphicsAnchorLine left READ left WRITE setLeft) + Q_PROPERTY(QmlGraphicsAnchorLine right READ right WRITE setRight) + Q_PROPERTY(QmlGraphicsAnchorLine horizontalCenter READ horizontalCenter WRITE setHorizontalCenter) + Q_PROPERTY(QmlGraphicsAnchorLine top READ top WRITE setTop) + Q_PROPERTY(QmlGraphicsAnchorLine bottom READ bottom WRITE setBottom) + Q_PROPERTY(QmlGraphicsAnchorLine verticalCenter READ verticalCenter WRITE setVerticalCenter) + Q_PROPERTY(QmlGraphicsAnchorLine baseline READ baseline WRITE setBaseline) public: QmlAnchorChanges(QObject *parent=0); @@ -127,32 +127,32 @@ public: virtual ActionList actions(); - QFxItem *object() const; - void setObject(QFxItem *); + QmlGraphicsItem *object() const; + void setObject(QmlGraphicsItem *); QString reset() const; void setReset(const QString &); - QFxAnchorLine left() const; - void setLeft(const QFxAnchorLine &edge); + QmlGraphicsAnchorLine left() const; + void setLeft(const QmlGraphicsAnchorLine &edge); - QFxAnchorLine right() const; - void setRight(const QFxAnchorLine &edge); + QmlGraphicsAnchorLine right() const; + void setRight(const QmlGraphicsAnchorLine &edge); - QFxAnchorLine horizontalCenter() const; - void setHorizontalCenter(const QFxAnchorLine &edge); + QmlGraphicsAnchorLine horizontalCenter() const; + void setHorizontalCenter(const QmlGraphicsAnchorLine &edge); - QFxAnchorLine top() const; - void setTop(const QFxAnchorLine &edge); + QmlGraphicsAnchorLine top() const; + void setTop(const QmlGraphicsAnchorLine &edge); - QFxAnchorLine bottom() const; - void setBottom(const QFxAnchorLine &edge); + QmlGraphicsAnchorLine bottom() const; + void setBottom(const QmlGraphicsAnchorLine &edge); - QFxAnchorLine verticalCenter() const; - void setVerticalCenter(const QFxAnchorLine &edge); + QmlGraphicsAnchorLine verticalCenter() const; + void setVerticalCenter(const QmlGraphicsAnchorLine &edge); - QFxAnchorLine baseline() const; - void setBaseline(const QFxAnchorLine &edge); + QmlGraphicsAnchorLine baseline() const; + void setBaseline(const QmlGraphicsAnchorLine &edge); virtual void execute(); virtual bool isReversable(); diff --git a/src/declarative/util/qmlsystempalette.cpp b/src/declarative/util/qmlsystempalette.cpp index ba4f04b..32cb4cf 100644 --- a/src/declarative/util/qmlsystempalette.cpp +++ b/src/declarative/util/qmlsystempalette.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "private/qobject_p.h" -#include "qmlsystempalette.h" +#include "qmlsystempalette_p.h" #include <QApplication> QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmlsystempalette.h b/src/declarative/util/qmlsystempalette_p.h index e87534e..e87534e 100644 --- a/src/declarative/util/qmlsystempalette.h +++ b/src/declarative/util/qmlsystempalette_p.h diff --git a/src/declarative/util/qmltimeline.cpp b/src/declarative/util/qmltimeline.cpp index 56fa203..e8695de 100644 --- a/src/declarative/util/qmltimeline.cpp +++ b/src/declarative/util/qmltimeline.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qmltimeline_p.h" +#include "qmltimeline_p_p.h" #include <QDebug> #include <QMutex> #include <QThread> diff --git a/src/declarative/util/qmltimeline_p.h b/src/declarative/util/qmltimeline_p_p.h index f1e716c..f1e716c 100644 --- a/src/declarative/util/qmltimeline_p.h +++ b/src/declarative/util/qmltimeline_p_p.h diff --git a/src/declarative/util/qmltimer.cpp b/src/declarative/util/qmltimer.cpp index 5c963b8..268d5ec 100644 --- a/src/declarative/util/qmltimer.cpp +++ b/src/declarative/util/qmltimer.cpp @@ -42,7 +42,7 @@ #include "QtCore/qcoreapplication.h" #include "QtCore/qpauseanimation.h" #include "private/qobject_p.h" -#include "qmltimer.h" +#include "qmltimer_p.h" #include "qdebug.h" QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmltimer.h b/src/declarative/util/qmltimer_p.h index 7d40d5a..7d40d5a 100644 --- a/src/declarative/util/qmltimer.h +++ b/src/declarative/util/qmltimer_p.h diff --git a/src/declarative/util/qmltransition.cpp b/src/declarative/util/qmltransition.cpp index 328d5ca..a5f4b67 100644 --- a/src/declarative/util/qmltransition.cpp +++ b/src/declarative/util/qmltransition.cpp @@ -39,13 +39,13 @@ ** ****************************************************************************/ -#include "qmlstate.h" -#include "qmlstategroup.h" #include "qmlstate_p.h" -#include "qmlstateoperations.h" -#include "qmlanimation.h" +#include "qmlstategroup_p.h" +#include "qmlstate_p_p.h" +#include "qmlstateoperations_p.h" #include "qmlanimation_p.h" -#include "qmltransitionmanager_p.h" +#include "qmlanimation_p_p.h" +#include "qmltransitionmanager_p_p.h" #include <QParallelAnimationGroup> QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmltransition.h b/src/declarative/util/qmltransition_p.h index 27c4ec7..de1d3e8 100644 --- a/src/declarative/util/qmltransition.h +++ b/src/declarative/util/qmltransition_p.h @@ -44,7 +44,7 @@ #include <QtCore/qobject.h> #include <QtDeclarative/qfxglobal.h> -#include <QtDeclarative/qmlstate.h> +#include <private/qmlstate_p.h> #include <QtDeclarative/qml.h> QT_BEGIN_HEADER diff --git a/src/declarative/util/qmltransitionmanager.cpp b/src/declarative/util/qmltransitionmanager.cpp index eae812d..2cfc6ee 100644 --- a/src/declarative/util/qmltransitionmanager.cpp +++ b/src/declarative/util/qmltransitionmanager.cpp @@ -40,8 +40,8 @@ ****************************************************************************/ #include <QtDeclarative/qmlbinding.h> -#include <private/qmltransitionmanager_p.h> -#include <private/qmlstate_p.h> +#include <private/qmltransitionmanager_p_p.h> +#include <private/qmlstate_p_p.h> QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmltransitionmanager_p.h b/src/declarative/util/qmltransitionmanager_p_p.h index 4b7052a..9a05684 100644 --- a/src/declarative/util/qmltransitionmanager_p.h +++ b/src/declarative/util/qmltransitionmanager_p_p.h @@ -53,7 +53,7 @@ // We mean it. // -#include <QtDeclarative/qmlstateoperations.h> +#include <private/qmlstateoperations_p.h> QT_BEGIN_NAMESPACE diff --git a/src/declarative/util/qmlview.cpp b/src/declarative/util/qmlview.cpp index 095ee4c..27a4bba 100644 --- a/src/declarative/util/qmlview.cpp +++ b/src/declarative/util/qmlview.cpp @@ -52,15 +52,15 @@ #include "qbasictimer.h" #include "qml.h" -#include "qfxitem.h" -#include "private/qperformancelog_p.h" -#include "private/qfxperf_p.h" +#include "qmlgraphicsitem.h" +#include "private/qperformancelog_p_p.h" +#include "private/qfxperf_p_p.h" #include "qmlview.h" #include <QtDeclarative/qmlengine.h> #include <QtDeclarative/qmlcontext.h> -#include <QtDeclarative/qmldebug.h> -#include <QtDeclarative/qmldebugservice.h> +#include <private/qmldebug_p.h> +#include <private/qmldebugservice_p.h> #include <QtCore/qabstractanimation.h> QT_BEGIN_NAMESPACE @@ -136,7 +136,7 @@ public: : q(w), root(0), component(0), resizable(false) {} QmlView *q; - QFxItem *root; + QmlGraphicsItem *root; QUrl source; QString qml; @@ -193,7 +193,7 @@ void QmlViewPrivate::init() QmlMetaType::registerCustomStringConverter(QVariant::KeySequence, &stringToKeySequence); #ifdef Q_ENABLE_PERFORMANCE_LOG - QFxPerfTimer<QFxPerf::FontDatabase> perf; + QmlPerfTimer<QmlPerf::FontDatabase> perf; #endif QFontDatabase database; @@ -213,7 +213,7 @@ void QmlViewPrivate::init() } /*! - The destructor clears the view's \l {QFxItem} {items} and + The destructor clears the view's \l {QmlGraphicsItem} {items} and deletes the internal representation. \sa clearItems() @@ -337,7 +337,7 @@ void QmlView::continueExecute() } if (obj) { - if (QFxItem *item = qobject_cast<QFxItem *>(obj)) { + if (QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem *>(obj)) { d->scene.addItem(item); @@ -476,11 +476,11 @@ QSize QmlView::sizeHint() const /*! Creates a \l{QmlComponent} {component} from the \a qml - string, and returns it as an \l {QFxItem} {item}. If the + string, and returns it as an \l {QmlGraphicsItem} {item}. If the \a parent item is provided, it becomes the new item's parent. \a parent should be in this view's item hierarchy. */ -QFxItem* QmlView::addItem(const QString &qml, QFxItem* parent) +QmlGraphicsItem* QmlView::addItem(const QString &qml, QmlGraphicsItem* parent) { if (!d->root) return 0; @@ -508,7 +508,7 @@ QFxItem* QmlView::addItem(const QString &qml, QFxItem* parent) } if (obj){ - QFxItem *item = static_cast<QFxItem *>(obj); + QmlGraphicsItem *item = static_cast<QmlGraphicsItem *>(obj); if (!parent) parent = d->root; @@ -519,7 +519,7 @@ QFxItem* QmlView::addItem(const QString &qml, QFxItem* parent) } /*! - Deletes the view's \l {QFxItem} {items} and the \l {QmlEngine} + Deletes the view's \l {QmlGraphicsItem} {items} and the \l {QmlEngine} {QML engine's} Component cache. */ void QmlView::reset() @@ -530,7 +530,7 @@ void QmlView::reset() } /*! - Deletes the view's \l {QFxItem} {items}. + Deletes the view's \l {QmlGraphicsItem} {items}. */ void QmlView::clearItems() { @@ -541,9 +541,9 @@ void QmlView::clearItems() } /*! - Returns the view's root \l {QFxItem} {item}. + Returns the view's root \l {QmlGraphicsItem} {item}. */ -QFxItem *QmlView::root() const +QmlGraphicsItem *QmlView::root() const { return d->root; } diff --git a/src/declarative/util/qmlview.h b/src/declarative/util/qmlview.h index 3a9e4bf..08c036d 100644 --- a/src/declarative/util/qmlview.h +++ b/src/declarative/util/qmlview.h @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QFxItem; +class QmlGraphicsItem; class QmlEngine; class QmlContext; class QmlError; @@ -78,10 +78,10 @@ public: virtual void execute(); virtual void reset(); - virtual QFxItem* addItem(const QString &qml, QFxItem* parent=0); + virtual QmlGraphicsItem* addItem(const QString &qml, QmlGraphicsItem* parent=0); virtual void clearItems(); - virtual QFxItem *root() const; + virtual QmlGraphicsItem *root() const; void setContentResizable(bool); bool contentResizable() const; diff --git a/src/declarative/util/qperformancelog.cpp b/src/declarative/util/qperformancelog.cpp index e1cc9ab..ff2f42e 100644 --- a/src/declarative/util/qperformancelog.cpp +++ b/src/declarative/util/qperformancelog.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qperformancelog_p.h" +#include "qperformancelog_p_p.h" #include <QHash> #include <QDebug> diff --git a/src/declarative/util/qperformancelog_p.h b/src/declarative/util/qperformancelog_p_p.h index e7a3b5e..e7a3b5e 100644 --- a/src/declarative/util/qperformancelog_p.h +++ b/src/declarative/util/qperformancelog_p_p.h diff --git a/src/declarative/util/util.pri b/src/declarative/util/util.pri index 01ad898..a60613e 100644 --- a/src/declarative/util/util.pri +++ b/src/declarative/util/util.pri @@ -24,28 +24,28 @@ SOURCES += \ HEADERS += \ util/qmlview.h \ - util/qfxperf_p.h \ + util/qfxperf_p_p.h \ util/qfxglobal.h \ - util/qperformancelog_p.h \ - util/qmlconnection.h \ - util/qmlpackage.h \ - util/qmlanimation.h \ + util/qperformancelog_p_p.h \ + util/qmlconnection_p.h \ + util/qmlpackage_p.h \ util/qmlanimation_p.h \ - util/qmlsystempalette.h \ - util/qmlspringfollow.h \ - util/qmleasefollow.h \ - util/qmlstate.h\ - util/qmlstateoperations.h \ - util/qmlpropertychanges.h \ + util/qmlanimation_p_p.h \ + util/qmlsystempalette_p.h \ + util/qmlspringfollow_p.h \ + util/qmleasefollow_p.h \ util/qmlstate_p.h\ - util/qmltransitionmanager_p.h \ - util/qmlstategroup.h \ - util/qmltransition.h \ - util/qmllistmodel.h\ - util/qmllistaccessor.h \ - util/qmlopenmetaobject.h \ - util/qmlnullablevalue_p.h \ - util/qmltimeline_p.h \ - util/qmltimer.h \ - util/qmlbind.h \ - util/qmlpropertymap.h + util/qmlstateoperations_p.h \ + util/qmlpropertychanges_p.h \ + util/qmlstate_p_p.h\ + util/qmltransitionmanager_p_p.h \ + util/qmlstategroup_p.h \ + util/qmltransition_p.h \ + util/qmllistmodel_p.h\ + util/qmllistaccessor_p.h \ + util/qmlopenmetaobject_p.h \ + util/qmlnullablevalue_p_p.h \ + util/qmltimeline_p_p.h \ + util/qmltimer_p.h \ + util/qmlbind_p.h \ + util/qmlpropertymap_p.h |