summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp2
-rw-r--r--src/declarative/util/qdeclarativesmoothedfollow.cpp299
-rw-r--r--src/declarative/util/qdeclarativesmoothedfollow_p.h113
-rw-r--r--src/declarative/util/qdeclarativespringfollow.cpp464
-rw-r--r--src/declarative/util/qdeclarativespringfollow_p.h120
-rw-r--r--src/declarative/util/qdeclarativeutilmodule.cpp4
-rw-r--r--src/declarative/util/util.pri4
8 files changed, 2 insertions, 1006 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 078d034..14a4f08 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -1390,7 +1390,7 @@ void QDeclarativeGridView::setHighlight(QDeclarativeComponent *highlight)
highlight is not moved by the view, and any movement must be implemented
by the highlight.
- Here is a highlight with its motion defined by a \l {SpringFollow} item:
+ Here is a highlight with its motion defined by a \l {SpringAnimation} item:
\snippet doc/src/snippets/declarative/gridview/gridview.qml highlightFollowsCurrentItem
*/
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 42b953c..110c970 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -1732,7 +1732,7 @@ void QDeclarativeListView::setHighlight(QDeclarativeComponent *highlight)
highlight is not moved by the view, and any movement must be implemented
by the highlight.
- Here is a highlight with its motion defined by a \l {SpringFollow} item:
+ Here is a highlight with its motion defined by a \l {SpringAniamtion} item:
\snippet doc/src/snippets/declarative/listview/listview.qml highlightFollowsCurrentItem
diff --git a/src/declarative/util/qdeclarativesmoothedfollow.cpp b/src/declarative/util/qdeclarativesmoothedfollow.cpp
deleted file mode 100644
index f70df9d..0000000
--- a/src/declarative/util/qdeclarativesmoothedfollow.cpp
+++ /dev/null
@@ -1,299 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 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$
-**
-****************************************************************************/
-
-#include "qdeclarativesmoothedfollow_p.h"
-#include "qdeclarativesmoothedanimation_p_p.h"
-
-#include <private/qobject_p.h>
-#include <QtCore/qnumeric.h>
-
-#include "qdeclarativeglobal_p.h"
-
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeSmoothedFollowPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QDeclarativeSmoothedFollow)
-public:
- QDeclarativeSmoothedFollowPrivate();
-
- bool enabled;
- QSmoothedAnimation *anim;
-};
-
-/*!
- \qmlclass SmoothedFollow QDeclarativeSmoothedFollow
- \since 4.7
- \inherits NumberAnimation
- \brief The SmoothedFollow element allows a property to smoothly track a value.
-
- The SmoothedFollow animates a property's value to a set target value
- using an ease in/out quad easing curve. If the animation is restarted
- with a different target value, the easing curves used to animate to the old
- and the new target values are smoothly spliced together to avoid any obvious
- visual glitches by maintaining the current velocity.
-
- The property animation is configured by setting the velocity at which the
- animation should occur, or the duration that the animation should take.
- If both a velocity and a duration are specified, the one that results in
- the quickest animation is chosen for each change in the target value.
-
- For example, animating from 0 to 800 will take 4 seconds if a velocity
- of 200 is set, will take 8 seconds with a duration of 8000 set, and will
- take 4 seconds with both a velocity of 200 and a duration of 8000 set.
- Animating from 0 to 20000 will take 10 seconds if a velocity of 200 is set,
- will take 8 seconds with a duration of 8000 set, and will take 8 seconds
- with both a velocity of 200 and a duration of 8000 set.
-
- The follow example shows one rectangle tracking the position of another.
-\code
-import Qt 4.7
-
-Rectangle {
- width: 800; height: 600; color: "blue"
-
- Rectangle {
- color: "green"
- width: 60; height: 60;
- SmoothedFollow on x { to: rect1.x - 5; velocity: 200 }
- SmoothedFollow on y { to: rect1.y - 5; velocity: 200 }
- }
-
- Rectangle {
- id: rect1
- color: "red"
- width: 50; height: 50;
- }
-
- focus: true
- Keys.onRightPressed: rect1.x = rect1.x + 100
- Keys.onLeftPressed: rect1.x = rect1.x - 100
- Keys.onUpPressed: rect1.y = rect1.y - 100
- Keys.onDownPressed: rect1.y = rect1.y + 100
-}
-\endcode
-
- The default velocity of SmoothedFollow is 200 units/second. Note that if the range of the
- value being animated is small, then the velocity will need to be adjusted
- appropriately. For example, the opacity of an item ranges from 0 - 1.0.
- To enable a smooth animation in this range the velocity will need to be
- set to a value such as 0.5 units/second. Animating from 0 to 1.0 with a velocity
- of 0.5 will take 2000 ms to complete.
-
- \sa SpringFollow
-*/
-
-QDeclarativeSmoothedFollow::QDeclarativeSmoothedFollow(QObject *parent)
- : QObject(*(new QDeclarativeSmoothedFollowPrivate), parent)
-{
-}
-
-QDeclarativeSmoothedFollow::~QDeclarativeSmoothedFollow()
-{
-}
-
-QDeclarativeSmoothedFollowPrivate::QDeclarativeSmoothedFollowPrivate()
- : enabled(true), anim(new QSmoothedAnimation)
-{
- Q_Q(QDeclarativeSmoothedFollow);
- QDeclarative_setParent_noEvent(anim, q);
-}
-
-/*!
- \qmlproperty enumeration SmoothedFollow::reversingMode
-
- Sets how the SmoothedFollow behaves if an animation direction is reversed.
-
- If reversing mode is \c SmoothedFollow.Eased, the animation will smoothly decelerate, and
- then reverse direction. If the reversing mode is \c SmoothedFollow.Immediate, the
- animation will immediately begin accelerating in the reverse direction,
- begining with a velocity of 0. If the reversing mode is \c SmoothedFollow.Sync, the
- property is immediately set to the target value.
-*/
-QDeclarativeSmoothedFollow::ReversingMode QDeclarativeSmoothedFollow::reversingMode() const
-{
- Q_D(const QDeclarativeSmoothedFollow);
- return (ReversingMode) d->anim->reversingMode;
-}
-
-void QDeclarativeSmoothedFollow::setReversingMode(ReversingMode m)
-{
- Q_D(QDeclarativeSmoothedFollow);
- if (d->anim->reversingMode == (QDeclarativeSmoothedAnimation::ReversingMode) m)
- return;
-
- d->anim->reversingMode = (QDeclarativeSmoothedAnimation::ReversingMode) m;
- emit reversingModeChanged();
-}
-
-/*!
- \qmlproperty int SmoothedFollow::duration
-
- This property holds the animation duration, in msecs, used when tracking the source.
-
- Setting this to -1 (the default) disables the duration value.
-*/
-int QDeclarativeSmoothedFollow::duration() const
-{
- Q_D(const QDeclarativeSmoothedFollow);
- return d->anim->userDuration;
-}
-
-void QDeclarativeSmoothedFollow::setDuration(int duration)
-{
- Q_D(QDeclarativeSmoothedFollow);
- if (duration == d->anim->duration())
- return;
-
- d->anim->userDuration = duration;
- emit durationChanged();
-}
-
-qreal QDeclarativeSmoothedFollow::velocity() const
-{
- Q_D(const QDeclarativeSmoothedFollow);
- return d->anim->velocity;
-}
-
-/*!
- \qmlproperty real SmoothedFollow::velocity
-
- This property holds the average velocity allowed when tracking the 'to' value.
-
- The default velocity of SmoothedFollow is 200 units/second.
-
- Setting this to -1 disables the velocity value.
-*/
-void QDeclarativeSmoothedFollow::setVelocity(qreal v)
-{
- Q_D(QDeclarativeSmoothedFollow);
- if (d->anim->velocity == v)
- return;
-
- d->anim->velocity = v;
- emit velocityChanged();
-}
-
-/*!
- \qmlproperty int SmoothedFollow::maximumEasingTime
-
- This property specifies the maximum time, in msecs, an "eases" during the follow should take.
- Setting this property causes the velocity to "level out" after at a time. Setting
- a negative value reverts to the normal mode of easing over the entire animation
- duration.
-
- The default value is -1.
-*/
-int QDeclarativeSmoothedFollow::maximumEasingTime() const
-{
- Q_D(const QDeclarativeSmoothedFollow);
- return d->anim->maximumEasingTime;
-}
-
-void QDeclarativeSmoothedFollow::setMaximumEasingTime(int v)
-{
- Q_D(QDeclarativeSmoothedFollow);
- d->anim->maximumEasingTime = v;
- emit maximumEasingTimeChanged();
-}
-
-/*!
- \qmlproperty real SmoothedFollow::to
- This property holds the ending value.
- If not set, then the value defined in the end state of the transition or Behavior.
-*/
-qreal QDeclarativeSmoothedFollow::to() const
-{
- Q_D(const QDeclarativeSmoothedFollow);
- return d->anim->to;
-}
-
-void QDeclarativeSmoothedFollow::setTo(qreal t)
-{
- Q_D(QDeclarativeSmoothedFollow);
-
- if (qIsNaN(t))
- return;
-
- if (d->anim->to == t)
- return;
-
- d->anim->to = t;
-
- if (d->enabled)
- d->anim->restart();
-}
-
-/*!
- \qmlproperty bool SmoothedFollow::enabled
- This property whether this animation should automatically restart when
- the 'to' property is upated.
-
- The default value of this property is 'true'.
-*/
-bool QDeclarativeSmoothedFollow::enabled() const
-{
- Q_D(const QDeclarativeSmoothedFollow);
- return d->enabled;
-}
-
-void QDeclarativeSmoothedFollow::setEnabled(bool e)
-{
- Q_D(QDeclarativeSmoothedFollow);
- if (d->enabled == e)
- return;
- d->enabled = e;
-
- if (d->enabled)
- d->anim->restart();
- else
- d->anim->stop();
- emit enabledChanged();
-}
-
-void QDeclarativeSmoothedFollow::setTarget(const QDeclarativeProperty &t)
-{
- Q_D(QDeclarativeSmoothedFollow);
- d->anim->target = t;
-}
-
-QT_END_NAMESPACE
diff --git a/src/declarative/util/qdeclarativesmoothedfollow_p.h b/src/declarative/util/qdeclarativesmoothedfollow_p.h
deleted file mode 100644
index f852311..0000000
--- a/src/declarative/util/qdeclarativesmoothedfollow_p.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 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 QDECLARATIVESMOOTHEDFOLLOW_H
-#define QDECLARATIVESMOOTHEDFOLLOW_H
-
-#include <qdeclarative.h>
-#include <qdeclarativepropertyvaluesource.h>
-
-#include <QtCore/qobject.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-class QDeclarativeProperty;
-class QDeclarativeSmoothedFollowPrivate;
-class Q_AUTOTEST_EXPORT QDeclarativeSmoothedFollow : public QObject,
- public QDeclarativePropertyValueSource
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QDeclarativeSmoothedFollow)
- Q_INTERFACES(QDeclarativePropertyValueSource)
- Q_ENUMS(ReversingMode)
-
- Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged)
- Q_PROPERTY(qreal velocity READ velocity WRITE setVelocity NOTIFY velocityChanged)
- Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged)
- Q_PROPERTY(ReversingMode reversingMode READ reversingMode WRITE setReversingMode NOTIFY reversingModeChanged)
- Q_PROPERTY(qreal maximumEasingTime READ maximumEasingTime WRITE setMaximumEasingTime NOTIFY maximumEasingTimeChanged)
- Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
-
-public:
- enum ReversingMode { Eased, Immediate, Sync };
-
- QDeclarativeSmoothedFollow(QObject *parent = 0);
- ~QDeclarativeSmoothedFollow();
-
- qreal to() const;
- void setTo(qreal);
-
- ReversingMode reversingMode() const;
- void setReversingMode(ReversingMode);
-
- int duration() const;
- void setDuration(int);
-
- qreal velocity() const;
- void setVelocity(qreal);
-
- int maximumEasingTime() const;
- void setMaximumEasingTime(int);
-
- bool enabled() const;
- void setEnabled(bool);
-
- virtual void setTarget(const QDeclarativeProperty &);
-
-Q_SIGNALS:
- void velocityChanged();
- void durationChanged();
- void reversingModeChanged();
- void maximumEasingTimeChanged();
- void enabledChanged();
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QDeclarativeSmoothedFollow)
-
-QT_END_HEADER
-
-#endif // QDECLARATIVESMOOTHEDFOLLOW_H
diff --git a/src/declarative/util/qdeclarativespringfollow.cpp b/src/declarative/util/qdeclarativespringfollow.cpp
deleted file mode 100644
index aae66ac..0000000
--- a/src/declarative/util/qdeclarativespringfollow.cpp
+++ /dev/null
@@ -1,464 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 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$
-**
-****************************************************************************/
-
-#include "private/qdeclarativespringfollow_p.h"
-
-#include "private/qdeclarativeanimation_p_p.h"
-
-#include <QtCore/qdebug.h>
-
-#include <private/qobject_p.h>
-
-#include <limits.h>
-#include <math.h>
-
-QT_BEGIN_NAMESPACE
-
-
-
-class QDeclarativeSpringFollowPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QDeclarativeSpringFollow)
-public:
- QDeclarativeSpringFollowPrivate()
- : currentValue(0), to(0), maxVelocity(0), lastTime(0)
- , mass(1.0), spring(0.), damping(0.), velocity(0), epsilon(0.01)
- , modulus(0.0), useMass(false), haveModulus(false), enabled(true), mode(Track), clock(this) {}
-
- QDeclarativeProperty property;
- qreal currentValue;
- qreal to;
- qreal maxVelocity;
- qreal velocityms;
- int lastTime;
- qreal mass;
- qreal spring;
- qreal damping;
- qreal velocity;
- qreal epsilon;
- qreal modulus;
-
- bool useMass : 1;
- bool haveModulus : 1;
- bool enabled : 1;
-
- enum Mode {
- Track,
- Velocity,
- Spring
- };
- Mode mode;
-
- void tick(int);
- void updateMode();
- void start();
- void stop();
-
- QTickAnimationProxy<QDeclarativeSpringFollowPrivate, &QDeclarativeSpringFollowPrivate::tick> clock;
-};
-
-void QDeclarativeSpringFollowPrivate::tick(int time)
-{
- Q_Q(QDeclarativeSpringFollow);
-
- int elapsed = time - lastTime;
- if (!elapsed)
- return;
- qreal srcVal = to;
- if (haveModulus) {
- currentValue = fmod(currentValue, modulus);
- srcVal = fmod(srcVal, modulus);
- }
- if (mode == Spring) {
- if (elapsed < 16) // capped at 62fps.
- return;
- // Real men solve the spring DEs using RK4.
- // We'll do something much simpler which gives a result that looks fine.
- int count = elapsed / 16;
- for (int i = 0; i < count; ++i) {
- qreal diff = srcVal - currentValue;
- if (haveModulus && qAbs(diff) > modulus / 2) {
- if (diff < 0)
- diff += modulus;
- else
- diff -= modulus;
- }
- if (useMass)
- velocity = velocity + (spring * diff - damping * velocity) / mass;
- else
- velocity = velocity + spring * diff - damping * velocity;
- if (maxVelocity > 0.) {
- // limit velocity
- if (velocity > maxVelocity)
- velocity = maxVelocity;
- else if (velocity < -maxVelocity)
- velocity = -maxVelocity;
- }
- currentValue += velocity * 16.0 / 1000.0;
- if (haveModulus) {
- currentValue = fmod(currentValue, modulus);
- if (currentValue < 0.0)
- currentValue += modulus;
- }
- }
- if (qAbs(velocity) < epsilon && qAbs(srcVal - currentValue) < epsilon) {
- velocity = 0.0;
- currentValue = srcVal;
- clock.stop();
- }
- lastTime = time - (elapsed - count * 16);
- } else {
- qreal moveBy = elapsed * velocityms;
- qreal diff = srcVal - currentValue;
- if (haveModulus && qAbs(diff) > modulus / 2) {
- if (diff < 0)
- diff += modulus;
- else
- diff -= modulus;
- }
- if (diff > 0) {
- currentValue += moveBy;
- if (haveModulus)
- currentValue = fmod(currentValue, modulus);
- if (currentValue > to) {
- currentValue = to;
- clock.stop();
- }
- } else {
- currentValue -= moveBy;
- if (haveModulus && currentValue < 0.0)
- currentValue = fmod(currentValue, modulus) + modulus;
- if (currentValue < to) {
- currentValue = to;
- clock.stop();
- }
- }
- lastTime = time;
- }
- property.write(currentValue);
- emit q->valueChanged(currentValue);
- if (clock.state() != QAbstractAnimation::Running)
- emit q->syncChanged();
-}
-
-void QDeclarativeSpringFollowPrivate::updateMode()
-{
- if (spring == 0. && maxVelocity == 0.)
- mode = Track;
- else if (spring > 0.)
- mode = Spring;
- else
- mode = Velocity;
-}
-
-void QDeclarativeSpringFollowPrivate::start()
-{
- if (!enabled)
- return;
-
- Q_Q(QDeclarativeSpringFollow);
- if (mode == QDeclarativeSpringFollowPrivate::Track) {
- currentValue = to;
- property.write(currentValue);
- } else if (to != currentValue && clock.state() != QAbstractAnimation::Running) {
- lastTime = 0;
- currentValue = property.read().toReal();
- clock.start(); // infinity??
- emit q->syncChanged();
- }
-}
-
-void QDeclarativeSpringFollowPrivate::stop()
-{
- clock.stop();
-}
-
-/*!
- \qmlclass SpringFollow QDeclarativeSpringFollow
- \since 4.7
- \brief The SpringFollow element allows a property to track a value.
-
- In example below, \e rect2 will follow \e rect1 moving with a velocity of up to 200:
- \code
- Rectangle {
- id: rect1
- width: 20; height: 20
- color: "#00ff00"
- y: 200 // initial value
- SequentialAnimation on y {
- loops: Animation.Infinite
- NumberAnimation {
- to: 200
- easing.type: Easing.OutBounce
- easing.amplitude: 100
- duration: 2000
- }
- PauseAnimation { duration: 1000 }
- }
- }
- Rectangle {
- id: rect2
- x: rect1.width
- width: 20; height: 20
- color: "#ff0000"
- SpringFollow on y { to: rect1.y; velocity: 200 }
- }
- \endcode
-*/
-
-QDeclarativeSpringFollow::QDeclarativeSpringFollow(QObject *parent)
-: QObject(*(new QDeclarativeSpringFollowPrivate),parent)
-{
-}
-
-QDeclarativeSpringFollow::~QDeclarativeSpringFollow()
-{
-}
-
-void QDeclarativeSpringFollow::setTarget(const QDeclarativeProperty &property)
-{
- Q_D(QDeclarativeSpringFollow);
- d->property = property;
- d->currentValue = property.read().toReal();
-}
-
-qreal QDeclarativeSpringFollow::to() const
-{
- Q_D(const QDeclarativeSpringFollow);
- return d->to;
-}
-
-/*!
- \qmlproperty real SpringFollow::to
- This property holds the target value which will be tracked.
-
- Bind to a property in order to track its changes.
-*/
-
-void QDeclarativeSpringFollow::setTo(qreal value)
-{
- Q_D(QDeclarativeSpringFollow);
- if (d->clock.state() == QAbstractAnimation::Running && d->to == value)
- return;
-
- d->to = value;
- d->start();
-}
-
-/*!
- \qmlproperty real SpringFollow::velocity
- This property holds the maximum velocity allowed when tracking the source.
-*/
-
-qreal QDeclarativeSpringFollow::velocity() const
-{
- Q_D(const QDeclarativeSpringFollow);
- return d->maxVelocity;
-}
-
-void QDeclarativeSpringFollow::setVelocity(qreal velocity)
-{
- Q_D(QDeclarativeSpringFollow);
- d->maxVelocity = velocity;
- d->velocityms = velocity / 1000.0;
- d->updateMode();
-}
-
-/*!
- \qmlproperty real SpringFollow::spring
- This property holds the spring constant
-
- The spring constant describes how strongly the target is pulled towards the
- source. Setting spring to 0 turns off spring tracking. Useful values 0 - 5.0
-
- When a spring constant is set and the velocity property is greater than 0,
- velocity limits the maximum speed.
-*/
-qreal QDeclarativeSpringFollow::spring() const
-{
- Q_D(const QDeclarativeSpringFollow);
- return d->spring;
-}
-
-void QDeclarativeSpringFollow::setSpring(qreal spring)
-{
- Q_D(QDeclarativeSpringFollow);
- d->spring = spring;
- d->updateMode();
-}
-
-/*!
- \qmlproperty real SpringFollow::damping
- This property holds the spring damping constant
-
- The damping constant describes how quickly a sprung follower comes to rest.
- Useful range is 0 - 1.0
-*/
-qreal QDeclarativeSpringFollow::damping() const
-{
- Q_D(const QDeclarativeSpringFollow);
- return d->damping;
-}
-
-void QDeclarativeSpringFollow::setDamping(qreal damping)
-{
- Q_D(QDeclarativeSpringFollow);
- if (damping > 1.)
- damping = 1.;
-
- d->damping = damping;
-}
-
-
-/*!
- \qmlproperty real SpringFollow::epsilon
- This property holds the spring epsilon
-
- The epsilon is the rate and amount of change in the value which is close enough
- to 0 to be considered equal to zero. This will depend on the usage of the value.
- For pixel positions, 0.25 would suffice. For scale, 0.005 will suffice.
-
- The default is 0.01. Tuning this value can provide small performance improvements.
-*/
-qreal QDeclarativeSpringFollow::epsilon() const
-{
- Q_D(const QDeclarativeSpringFollow);
- return d->epsilon;
-}
-
-void QDeclarativeSpringFollow::setEpsilon(qreal epsilon)
-{
- Q_D(QDeclarativeSpringFollow);
- d->epsilon = epsilon;
-}
-
-/*!
- \qmlproperty real SpringFollow::modulus
- This property holds the modulus value.
-
- Setting a \a modulus forces the target value to "wrap around" at the modulus.
- For example, setting the modulus to 360 will cause a value of 370 to wrap around to 10.
-*/
-qreal QDeclarativeSpringFollow::modulus() const
-{
- Q_D(const QDeclarativeSpringFollow);
- return d->modulus;
-}
-
-void QDeclarativeSpringFollow::setModulus(qreal modulus)
-{
- Q_D(QDeclarativeSpringFollow);
- if (d->modulus != modulus) {
- d->haveModulus = modulus != 0.0;
- d->modulus = modulus;
- emit modulusChanged();
- }
-}
-
-/*!
- \qmlproperty real SpringFollow::mass
- This property holds the "mass" of the property being moved.
-
- mass is 1.0 by default. Setting a different mass changes the dynamics of
- a \l spring follow.
-*/
-qreal QDeclarativeSpringFollow::mass() const
-{
- Q_D(const QDeclarativeSpringFollow);
- return d->mass;
-}
-
-void QDeclarativeSpringFollow::setMass(qreal mass)
-{
- Q_D(QDeclarativeSpringFollow);
- if (d->mass != mass && mass > 0.0) {
- d->useMass = mass != 1.0;
- d->mass = mass;
- emit massChanged();
- }
-}
-
-/*!
- \qmlproperty bool SpringFollow::enabled
- This property holds whether the target will track the source.
-
- The default value of this property is 'true'.
-*/
-bool QDeclarativeSpringFollow::enabled() const
-{
- Q_D(const QDeclarativeSpringFollow);
- return d->enabled;
-}
-
-void QDeclarativeSpringFollow::setEnabled(bool enabled)
-{
- Q_D(QDeclarativeSpringFollow);
- d->enabled = enabled;
- if (enabled)
- d->start();
- else
- d->stop();
-}
-
-/*!
- \qmlproperty bool SpringFollow::inSync
- This property is true when target is equal to the source; otherwise
- false. If inSync is true the target is not being animated.
-
- If \l enabled is false then inSync will also be false.
-*/
-bool QDeclarativeSpringFollow::inSync() const
-{
- Q_D(const QDeclarativeSpringFollow);
- return d->enabled && d->clock.state() != QAbstractAnimation::Running;
-}
-
-/*!
- \qmlproperty real SpringFollow::value
- The current value.
-*/
-qreal QDeclarativeSpringFollow::value() const
-{
- Q_D(const QDeclarativeSpringFollow);
- return d->currentValue;
-}
-
-QT_END_NAMESPACE
diff --git a/src/declarative/util/qdeclarativespringfollow_p.h b/src/declarative/util/qdeclarativespringfollow_p.h
deleted file mode 100644
index b6277c3..0000000
--- a/src/declarative/util/qdeclarativespringfollow_p.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 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 QDECLARATIVESMOOTHFOLLOW_H
-#define QDECLARATIVESMOOTHFOLLOW_H
-
-#include <qdeclarativepropertyvaluesource.h>
-#include <qdeclarative.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Declarative)
-
-class QDeclarativeSpringFollowPrivate;
-class Q_AUTOTEST_EXPORT QDeclarativeSpringFollow : public QObject,
- public QDeclarativePropertyValueSource
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QDeclarativeSpringFollow)
- Q_INTERFACES(QDeclarativePropertyValueSource)
-
- Q_PROPERTY(qreal to READ to WRITE setTo)
- Q_PROPERTY(qreal velocity READ velocity WRITE setVelocity)
- Q_PROPERTY(qreal spring READ spring WRITE setSpring)
- Q_PROPERTY(qreal damping READ damping WRITE setDamping)
- Q_PROPERTY(qreal epsilon READ epsilon WRITE setEpsilon)
- Q_PROPERTY(bool enabled READ enabled WRITE setEnabled)
- Q_PROPERTY(qreal value READ value NOTIFY valueChanged)
- Q_PROPERTY(qreal modulus READ modulus WRITE setModulus NOTIFY modulusChanged)
- Q_PROPERTY(qreal mass READ mass WRITE setMass NOTIFY massChanged)
- Q_PROPERTY(bool inSync READ inSync NOTIFY syncChanged)
-
-public:
- QDeclarativeSpringFollow(QObject *parent=0);
- ~QDeclarativeSpringFollow();
-
- virtual void setTarget(const QDeclarativeProperty &);
-
- qreal to() const;
- void setTo(qreal value);
-
- qreal velocity() const;
- void setVelocity(qreal velocity);
-
- qreal spring() const;
- void setSpring(qreal spring);
-
- qreal damping() const;
- void setDamping(qreal damping);
-
- qreal epsilon() const;
- void setEpsilon(qreal epsilon);
-
- qreal mass() const;
- void setMass(qreal modulus);
-
- qreal modulus() const;
- void setModulus(qreal modulus);
-
- bool enabled() const;
- void setEnabled(bool enabled);
-
- bool inSync() const;
-
- qreal value() const;
-
-Q_SIGNALS:
- void valueChanged(qreal);
- void modulusChanged();
- void massChanged();
- void syncChanged();
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QDeclarativeSpringFollow)
-
-QT_END_HEADER
-
-#endif // QDECLARATIVESMOOTHFOLLOW_H
diff --git a/src/declarative/util/qdeclarativeutilmodule.cpp b/src/declarative/util/qdeclarativeutilmodule.cpp
index 74fdac6..c5bfebd 100644
--- a/src/declarative/util/qdeclarativeutilmodule.cpp
+++ b/src/declarative/util/qdeclarativeutilmodule.cpp
@@ -46,7 +46,6 @@
#include "private/qdeclarativebind_p.h"
#include "private/qdeclarativeconnections_p.h"
#include "private/qdeclarativesmoothedanimation_p.h"
-#include "private/qdeclarativesmoothedfollow_p.h"
#include "private/qdeclarativefontloader_p.h"
#include "private/qdeclarativelistaccessor_p.h"
#include "private/qdeclarativelistmodel_p.h"
@@ -56,7 +55,6 @@
#include "private/qdeclarativepixmapcache_p.h"
#include "private/qdeclarativepropertychanges_p.h"
#include "qdeclarativepropertymap.h"
-#include "private/qdeclarativespringfollow_p.h"
#include "private/qdeclarativespringanimation_p.h"
#include "private/qdeclarativestategroup_p.h"
#include "private/qdeclarativestateoperations_p.h"
@@ -84,7 +82,6 @@ void QDeclarativeUtilModule::defineModule()
qmlRegisterType<QDeclarativeColorAnimation>("Qt",4,7,"ColorAnimation");
qmlRegisterType<QDeclarativeConnections>("Qt",4,7,"Connections");
qmlRegisterType<QDeclarativeSmoothedAnimation>("Qt",4,7,"SmoothedAnimation");
- qmlRegisterType<QDeclarativeSmoothedFollow>("Qt",4,7,"SmoothedFollow");
qmlRegisterType<QDeclarativeFontLoader>("Qt",4,7,"FontLoader");
qmlRegisterType<QDeclarativeListElement>("Qt",4,7,"ListElement");
qmlRegisterType<QDeclarativeNumberAnimation>("Qt",4,7,"NumberAnimation");
@@ -98,7 +95,6 @@ void QDeclarativeUtilModule::defineModule()
qmlRegisterType<QDeclarativeRotationAnimation>("Qt",4,7,"RotationAnimation");
qmlRegisterType<QDeclarativeScriptAction>("Qt",4,7,"ScriptAction");
qmlRegisterType<QDeclarativeSequentialAnimation>("Qt",4,7,"SequentialAnimation");
- qmlRegisterType<QDeclarativeSpringFollow>("Qt",4,7,"SpringFollow");
qmlRegisterType<QDeclarativeSpringAnimation>("Qt",4,7,"SpringAnimation");
qmlRegisterType<QDeclarativeStateChangeScript>("Qt",4,7,"StateChangeScript");
qmlRegisterType<QDeclarativeStateGroup>("Qt",4,7,"StateGroup");
diff --git a/src/declarative/util/util.pri b/src/declarative/util/util.pri
index 0cbcbd7..fd57144 100644
--- a/src/declarative/util/util.pri
+++ b/src/declarative/util/util.pri
@@ -7,10 +7,8 @@ SOURCES += \
$$PWD/qdeclarativepackage.cpp \
$$PWD/qdeclarativeanimation.cpp \
$$PWD/qdeclarativesystempalette.cpp \
- $$PWD/qdeclarativespringfollow.cpp \
$$PWD/qdeclarativespringanimation.cpp \
$$PWD/qdeclarativesmoothedanimation.cpp \
- $$PWD/qdeclarativesmoothedfollow.cpp \
$$PWD/qdeclarativestate.cpp\
$$PWD/qdeclarativetransitionmanager.cpp \
$$PWD/qdeclarativestateoperations.cpp \
@@ -39,10 +37,8 @@ HEADERS += \
$$PWD/qdeclarativeanimation_p.h \
$$PWD/qdeclarativeanimation_p_p.h \
$$PWD/qdeclarativesystempalette_p.h \
- $$PWD/qdeclarativespringfollow_p.h \
$$PWD/qdeclarativespringanimation_p.h \
$$PWD/qdeclarativesmoothedanimation_p.h \
- $$PWD/qdeclarativesmoothedfollow_p.h \
$$PWD/qdeclarativesmoothedanimation_p_p.h \
$$PWD/qdeclarativestate_p.h\
$$PWD/qdeclarativestateoperations_p.h \