don't duplicate what QAbstractAnimation already does for us
svn path=/trunk/KDE/kdelibs/; revision=1058152
This commit is contained in:
parent
31704d2e6b
commit
c0da94c928
@ -33,9 +33,7 @@ namespace Plasma
|
|||||||
|
|
||||||
|
|
||||||
AnimationPrivate::AnimationPrivate()
|
AnimationPrivate::AnimationPrivate()
|
||||||
: dirtyFlag(false),
|
: easingCurve(QEasingCurve::Linear),
|
||||||
easingCurve(QEasingCurve::Linear),
|
|
||||||
forwards(QAbstractAnimation::Forward),
|
|
||||||
duration(250)
|
duration(250)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -81,41 +79,9 @@ QEasingCurve::Type Animation::easingCurveType() const
|
|||||||
return d->easingCurve;
|
return d->easingCurve;
|
||||||
}
|
}
|
||||||
|
|
||||||
QAbstractAnimation::Direction Animation::direction() const
|
|
||||||
{
|
|
||||||
return d->forwards;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Animation::updateDirection(QAbstractAnimation::Direction direction)
|
|
||||||
{
|
|
||||||
d->forwards = direction;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Animation::updateCurrentTime(int currentTime)
|
void Animation::updateCurrentTime(int currentTime)
|
||||||
{
|
{
|
||||||
/**
|
Q_UNUSED(currentTime)
|
||||||
* XXX: not sure if is a bug in my code or Qt, but 'start()' is not being
|
|
||||||
* called when the animation is inside of an animatin group.
|
|
||||||
* The solution for while is to explicitly call it in 'updateCurrentTime'
|
|
||||||
* and use this flag for control.
|
|
||||||
*/
|
|
||||||
if (!d->dirtyFlag) {
|
|
||||||
d->dirtyFlag = true;
|
|
||||||
start();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (d->forwards == QAbstractAnimation::Forward) {
|
|
||||||
if (currentTime == duration()) {
|
|
||||||
d->dirtyFlag = false;
|
|
||||||
emit finished();
|
|
||||||
}
|
|
||||||
} else if (d->forwards == QAbstractAnimation::Backward) {
|
|
||||||
if (currentTime == 0) {
|
|
||||||
d->dirtyFlag = false;
|
|
||||||
emit finished();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} //namespace Plasma
|
} //namespace Plasma
|
||||||
|
@ -50,9 +50,6 @@ class PLASMA_EXPORT Animation : public QAbstractAnimation
|
|||||||
Q_PROPERTY(QGraphicsWidget *widgetToAnimate READ widgetToAnimate WRITE setWidgetToAnimate)
|
Q_PROPERTY(QGraphicsWidget *widgetToAnimate READ widgetToAnimate WRITE setWidgetToAnimate)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
QAbstractAnimation::Direction direction() const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the animation duration.
|
* Get the animation duration.
|
||||||
* @return duration in ms.
|
* @return duration in ms.
|
||||||
@ -97,16 +94,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool isVisible() const;
|
bool isVisible() const;
|
||||||
|
|
||||||
public Q_SLOTS:
|
|
||||||
/**
|
|
||||||
* Each individual class must override this function to place their main
|
|
||||||
* functionality. This function must take the values from the constructor,
|
|
||||||
* do the appropriate calculations, and return a corresponding
|
|
||||||
* QPropertyAnimation initialized with the given parent.
|
|
||||||
*/
|
|
||||||
virtual QAbstractAnimation* render(QObject* parent = 0) = 0;
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -115,8 +102,6 @@ protected:
|
|||||||
*/
|
*/
|
||||||
virtual void setDuration(int duration = 250);
|
virtual void setDuration(int duration = 250);
|
||||||
|
|
||||||
void updateDirection(QAbstractAnimation::Direction direction);
|
|
||||||
|
|
||||||
void updateCurrentTime(int currentTime);
|
void updateCurrentTime(int currentTime);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user