summaryrefslogtreecommitdiffstats
path: root/src/declarative/util
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-10-30 06:12:18 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-10-30 06:12:18 (GMT)
commit564894627debad93433f16506ccf32afeb23d004 (patch)
treea96a4c6cc7cf4f8032bb915e08bbd0092a890e9c /src/declarative/util
parent44a0c19eae2099e6cdb44825123a4b8ee9a5bf20 (diff)
downloadQt-564894627debad93433f16506ccf32afeb23d004.zip
Qt-564894627debad93433f16506ccf32afeb23d004.tar.gz
Qt-564894627debad93433f16506ccf32afeb23d004.tar.bz2
Make private headers _p
Diffstat (limited to 'src/declarative/util')
-rw-r--r--src/declarative/util/qfxperf.cpp2
-rw-r--r--src/declarative/util/qfxperf_p_p.h (renamed from src/declarative/util/qfxperf_p.h)2
-rw-r--r--src/declarative/util/qmlanimation.cpp8
-rw-r--r--src/declarative/util/qmlanimation.h407
-rw-r--r--src/declarative/util/qmlanimation_p.h539
-rw-r--r--src/declarative/util/qmlanimation_p_p.h362
-rw-r--r--src/declarative/util/qmlbind.cpp4
-rw-r--r--src/declarative/util/qmlbind_p.h (renamed from src/declarative/util/qmlbind.h)0
-rw-r--r--src/declarative/util/qmlconnection.cpp2
-rw-r--r--src/declarative/util/qmlconnection_p.h (renamed from src/declarative/util/qmlconnection.h)0
-rw-r--r--src/declarative/util/qmleasefollow.cpp4
-rw-r--r--src/declarative/util/qmleasefollow_p.h (renamed from src/declarative/util/qmleasefollow.h)0
-rw-r--r--src/declarative/util/qmllistaccessor.cpp2
-rw-r--r--src/declarative/util/qmllistaccessor_p.h (renamed from src/declarative/util/qmllistaccessor.h)0
-rw-r--r--src/declarative/util/qmllistmodel.cpp4
-rw-r--r--src/declarative/util/qmllistmodel_p.h (renamed from src/declarative/util/qmllistmodel.h)2
-rw-r--r--src/declarative/util/qmlnullablevalue_p_p.h (renamed from src/declarative/util/qmlnullablevalue_p.h)0
-rw-r--r--src/declarative/util/qmlopenmetaobject.cpp2
-rw-r--r--src/declarative/util/qmlopenmetaobject_p.h (renamed from src/declarative/util/qmlopenmetaobject.h)0
-rw-r--r--src/declarative/util/qmlpackage.cpp2
-rw-r--r--src/declarative/util/qmlpackage_p.h (renamed from src/declarative/util/qmlpackage.h)0
-rw-r--r--src/declarative/util/qmlpropertychanges.cpp4
-rw-r--r--src/declarative/util/qmlpropertychanges_p.h (renamed from src/declarative/util/qmlpropertychanges.h)2
-rw-r--r--src/declarative/util/qmlpropertymap.cpp4
-rw-r--r--src/declarative/util/qmlpropertymap_p.h (renamed from src/declarative/util/qmlpropertymap.h)0
-rw-r--r--src/declarative/util/qmlspringfollow.cpp4
-rw-r--r--src/declarative/util/qmlspringfollow_p.h (renamed from src/declarative/util/qmlspringfollow.h)0
-rw-r--r--src/declarative/util/qmlstate.cpp12
-rw-r--r--src/declarative/util/qmlstate.h174
-rw-r--r--src/declarative/util/qmlstate_p.h167
-rw-r--r--src/declarative/util/qmlstate_p_p.h121
-rw-r--r--src/declarative/util/qmlstategroup.cpp4
-rw-r--r--src/declarative/util/qmlstategroup_p.h (renamed from src/declarative/util/qmlstategroup.h)2
-rw-r--r--src/declarative/util/qmlstateoperations.cpp10
-rw-r--r--src/declarative/util/qmlstateoperations_p.h (renamed from src/declarative/util/qmlstateoperations.h)4
-rw-r--r--src/declarative/util/qmlsystempalette.cpp2
-rw-r--r--src/declarative/util/qmlsystempalette_p.h (renamed from src/declarative/util/qmlsystempalette.h)0
-rw-r--r--src/declarative/util/qmltimeline.cpp2
-rw-r--r--src/declarative/util/qmltimeline_p_p.h (renamed from src/declarative/util/qmltimeline_p.h)0
-rw-r--r--src/declarative/util/qmltimer.cpp2
-rw-r--r--src/declarative/util/qmltimer_p.h (renamed from src/declarative/util/qmltimer.h)0
-rw-r--r--src/declarative/util/qmltransition.cpp10
-rw-r--r--src/declarative/util/qmltransition_p.h (renamed from src/declarative/util/qmltransition.h)2
-rw-r--r--src/declarative/util/qmltransitionmanager.cpp4
-rw-r--r--src/declarative/util/qmltransitionmanager_p_p.h (renamed from src/declarative/util/qmltransitionmanager_p.h)2
-rw-r--r--src/declarative/util/qmlview.cpp8
-rw-r--r--src/declarative/util/qperformancelog.cpp2
-rw-r--r--src/declarative/util/qperformancelog_p_p.h (renamed from src/declarative/util/qperformancelog_p.h)0
-rw-r--r--src/declarative/util/util.pri44
49 files changed, 964 insertions, 964 deletions
diff --git a/src/declarative/util/qfxperf.cpp b/src/declarative/util/qfxperf.cpp
index 97f195b..a21f2ed 100644
--- a/src/declarative/util/qfxperf.cpp
+++ b/src/declarative/util/qfxperf.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "private/qfxperf_p.h"
+#include "private/qfxperf_p_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/declarative/util/qfxperf_p.h b/src/declarative/util/qfxperf_p_p.h
index 37bfc32..e4424b0 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
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index e00a1c8..cc46a9c 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>
diff --git a/src/declarative/util/qmlanimation.h b/src/declarative/util/qmlanimation.h
deleted file mode 100644
index 4e94aa0..0000000
--- a/src/declarative/util/qmlanimation.h
+++ /dev/null
@@ -1,407 +0,0 @@
-/****************************************************************************
-**
-** 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_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 QmlGraphicsItem;
-class QmlParentActionPrivate;
-class QmlParentAction : public QmlAbstractAnimation
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QmlParentAction)
-
- Q_PROPERTY(QmlGraphicsItem *target READ object WRITE setObject)
- Q_PROPERTY(QmlGraphicsItem *parent READ parent WRITE setParent)
-
-public:
- QmlParentAction(QObject *parent=0);
- virtual ~QmlParentAction();
-
- QmlGraphicsItem *object() const;
- void setObject(QmlGraphicsItem *);
-
- QmlGraphicsItem *parent() const;
- void setParent(QmlGraphicsItem *);
-
-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 38b92ae..5f9f907 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();
- QmlGraphicsItem *pcTarget;
- QmlGraphicsItem *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 d18ef47..98ec7cf 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 731cdf8..731cdf8 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 5475fb2..c52732f 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 3d69c6f..3d69c6f 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 9d17d25..96654c6 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 a653ea6..a653ea6 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 3e4cb64..80709f1 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 c3ff632..c3ff632 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 9c9fa6a..d5202c5 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 7bb94cf..b376e59 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 6455642..6455642 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 11648f6..c348ced 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 be0490d..be0490d 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 7df8453..05b6cbc 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 7cceaa7..7cceaa7 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 0ac168b..57db897 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 2931cdb..cb93eb3 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 a587af3..c54135c 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 24b4395..24b4395 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 3b2526b..354110e 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 1b77861..1b77861 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 425480c..6908175 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 50128c0..0000000
--- a/src/declarative/util/qmlstate.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/****************************************************************************
-**
-** 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 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 63fc6da..50128c0 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..2b62213
--- /dev/null
+++ b/src/declarative/util/qmlstate_p_p.h
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** 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 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 b07def1..6ef8dce 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>
diff --git a/src/declarative/util/qmlstategroup.h b/src/declarative/util/qmlstategroup_p.h
index cf79eb4..3136b1e 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 5c328cf..af8ba63 100644
--- a/src/declarative/util/qmlstateoperations.cpp
+++ b/src/declarative/util/qmlstateoperations.cpp
@@ -43,10 +43,10 @@
#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/qmlgraphicsanchors_p.h>
+#include <private/qmlgraphicsanchors_p_p.h>
#include <private/qmlgraphicsitem_p.h>
#include <QtGui/qgraphicsitem.h>
#include <QtCore/qmath.h>
@@ -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 f2bcd49..04ea781 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 <private/qmlstate_p.h>
#include <QtDeclarative/qmlgraphicsitem.h>
-#include <QtDeclarative/qmlgraphicsanchors.h>
+#include <private/qmlgraphicsanchors_p.h>
#include <QtDeclarative/qmlscriptstring.h>
QT_BEGIN_HEADER
diff --git a/src/declarative/util/qmlsystempalette.cpp b/src/declarative/util/qmlsystempalette.cpp
index 014eca8..c5a0986 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 6558c7e..6558c7e 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 5ba310d..55d9490 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 abed80a..abed80a 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 1d90051..ff4c912 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 22478cb..22478cb 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 97a3b74..d752d1b 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 b09341d..092cde9 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 7eaccac..b33cae3 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 74a3950..ab435aa 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 91d443a..f19ac98 100644
--- a/src/declarative/util/qmlview.cpp
+++ b/src/declarative/util/qmlview.cpp
@@ -53,14 +53,14 @@
#include "qml.h"
#include "qmlgraphicsitem.h"
-#include "private/qperformancelog_p.h"
-#include "private/qfxperf_p.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
diff --git a/src/declarative/util/qperformancelog.cpp b/src/declarative/util/qperformancelog.cpp
index 8e11997..1a9be90 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 6655a8d..6655a8d 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