Making pulse animation work again with new design. It is still
using an internal animation group (got to try to fix this later). svn path=/trunk/KDE/kdelibs/; revision=1059906
This commit is contained in:
parent
438abba607
commit
831bd97941
@ -58,10 +58,18 @@ public :
|
||||
|
||||
void PulseAnimation::setWidgetToAnimate(QGraphicsWidget *widget)
|
||||
{
|
||||
if (widget == widgetToAnimate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Animation::setWidgetToAnimate(widget);
|
||||
if (d->animation.data()) {
|
||||
delete d->animation.data();
|
||||
d->animation.clear();
|
||||
if (widget) {
|
||||
if (d->under) {
|
||||
delete d->under;
|
||||
d->under = 0;
|
||||
}
|
||||
|
||||
createAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,7 +143,14 @@ void PulseAnimation::createAnimation(qreal duration, qreal scale)
|
||||
/* The group takes ownership of all animations */
|
||||
group->addAnimation(d->scaleAnimation);
|
||||
d->animation = group;
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
void PulseAnimation::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
|
||||
{
|
||||
|
||||
if (oldState == Stopped && newState == Running) {
|
||||
QParallelAnimationGroup *anim = d->animation.data();
|
||||
QAbstractAnimation::State temp = anim->state();
|
||||
if (temp == QAbstractAnimation::Running) {
|
||||
anim->stop();
|
||||
@ -146,19 +161,23 @@ void PulseAnimation::createAnimation(qreal duration, qreal scale)
|
||||
if (d->under->size() != widgetToAnimate()->size()) {
|
||||
setCopy();
|
||||
}
|
||||
|
||||
d->opacityAnimation->setEndValue(0);
|
||||
d->scaleAnimation->setEndValue(scale);
|
||||
}
|
||||
}
|
||||
/* TODO: save the scale factor somewhere */
|
||||
d->scaleAnimation->setEndValue(1.5);
|
||||
}
|
||||
|
||||
QAbstractAnimation* PulseAnimation::render(QObject* parent)
|
||||
d->animation.data()->start();
|
||||
|
||||
} else if (newState == Stopped) {
|
||||
//d->animation.data()->stop();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PulseAnimation::updateCurrentTime(int currentTime)
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
|
||||
createAnimation(duration());
|
||||
return d->animation.data();
|
||||
qDebug() << "\t: " << currentTime;
|
||||
}
|
||||
|
||||
} //namespace Plasma
|
||||
|
@ -42,7 +42,8 @@ public Q_SLOTS:
|
||||
void resetPulser();
|
||||
|
||||
protected:
|
||||
virtual QAbstractAnimation* render(QObject* parent = 0);
|
||||
void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
|
||||
void updateCurrentTime(int currentTime);
|
||||
void setCopy();
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user