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()
|
||||
: dirtyFlag(false),
|
||||
easingCurve(QEasingCurve::Linear),
|
||||
forwards(QAbstractAnimation::Forward),
|
||||
: easingCurve(QEasingCurve::Linear),
|
||||
duration(250)
|
||||
{
|
||||
}
|
||||
@ -81,41 +79,9 @@ QEasingCurve::Type Animation::easingCurveType() const
|
||||
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)
|
||||
{
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
}
|
||||
|
||||
Q_UNUSED(currentTime)
|
||||
}
|
||||
|
||||
} //namespace Plasma
|
||||
|
@ -50,9 +50,6 @@ class PLASMA_EXPORT Animation : public QAbstractAnimation
|
||||
Q_PROPERTY(QGraphicsWidget *widgetToAnimate READ widgetToAnimate WRITE setWidgetToAnimate)
|
||||
|
||||
public:
|
||||
|
||||
QAbstractAnimation::Direction direction() const;
|
||||
|
||||
/**
|
||||
* Get the animation duration.
|
||||
* @return duration in ms.
|
||||
@ -97,16 +94,6 @@ public:
|
||||
*/
|
||||
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:
|
||||
|
||||
/**
|
||||
@ -115,8 +102,6 @@ protected:
|
||||
*/
|
||||
virtual void setDuration(int duration = 250);
|
||||
|
||||
void updateDirection(QAbstractAnimation::Direction direction);
|
||||
|
||||
void updateCurrentTime(int currentTime);
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user