zoom anim doesn't need to be a member, and this way it doesn't mess up when lots of applets are added at the same time

svn path=/trunk/KDE/kdelibs/; revision=1070142
This commit is contained in:
Aaron J. Seigo 2010-01-04 23:45:38 +00:00
parent 5c9fdd4af3
commit c4ed36ca0e
3 changed files with 18 additions and 10 deletions

View File

@ -960,11 +960,11 @@ void Containment::addApplet(Applet *applet, const QPointF &pos, bool delayInit)
} else { } else {
applet->init(); applet->init();
applet->setScale(0); applet->setScale(0);
d->zoomAnim = Plasma::Animator::create(Plasma::Animator::ZoomAnimation); Plasma::Animation *zoomAnim = Plasma::Animator::create(Plasma::Animator::ZoomAnimation);
connect(d->zoomAnim, SIGNAL(finished()), this, SLOT(containmentAppletAnimationComplete())); connect(zoomAnim, SIGNAL(finished()), this, SLOT(appletAppearAnimationComplete()));
d->zoomAnim->setTargetWidget(applet); zoomAnim->setTargetWidget(applet);
d->zoomAnim->setProperty("zoom", 1.0); zoomAnim->setProperty("zoom", 1.0);
d->zoomAnim->start(); zoomAnim->start(QAbstractAnimation::DeleteWhenStopped);
} }
applet->updateConstraints(Plasma::AllConstraints); applet->updateConstraints(Plasma::AllConstraints);
@ -2313,9 +2313,18 @@ void ContainmentPrivate::appletDestroyed(Plasma::Applet *applet)
emit q->configNeedsSaving(); emit q->configNeedsSaving();
} }
void ContainmentPrivate::containmentAppletAnimationComplete() void ContainmentPrivate::appletAppearAnimationComplete()
{ {
Applet *applet = qgraphicsitem_cast<Applet*>(zoomAnim->targetWidget()); Animation *anim = qobject_cast<Animation *>(q->sender());
if (!anim) {
return;
}
Applet *applet = qobject_cast<Applet*>(anim->targetWidget());
if (!applet) {
return;
}
Animation *pulse = Plasma::Animator::create(Plasma::Animator::PulseAnimation); Animation *pulse = Plasma::Animator::create(Plasma::Animator::PulseAnimation);
pulse->setTargetWidget(applet); pulse->setTargetWidget(applet);
pulse->setProperty("duration", 300); pulse->setProperty("duration", 300);

View File

@ -604,7 +604,7 @@ class PLASMA_EXPORT Containment : public Applet
Containment(const QString &packagePath, uint appletId, const QVariantList &args); Containment(const QString &packagePath, uint appletId, const QVariantList &args);
Q_PRIVATE_SLOT(d, void appletDestroyed(Plasma::Applet*)) Q_PRIVATE_SLOT(d, void appletDestroyed(Plasma::Applet*))
Q_PRIVATE_SLOT(d, void containmentAppletAnimationComplete()) Q_PRIVATE_SLOT(d, void appletAppearAnimationComplete())
Q_PRIVATE_SLOT(d, void triggerShowAddWidgets()) Q_PRIVATE_SLOT(d, void triggerShowAddWidgets())
Q_PRIVATE_SLOT(d, void handleDisappeared(AppletHandle *handle)) Q_PRIVATE_SLOT(d, void handleDisappeared(AppletHandle *handle))
Q_PRIVATE_SLOT(d, void positionToolBox()) Q_PRIVATE_SLOT(d, void positionToolBox())

View File

@ -84,7 +84,7 @@ public:
void setLockToolText(); void setLockToolText();
void handleDisappeared(AppletHandle *handle); void handleDisappeared(AppletHandle *handle);
void appletDestroyed(Plasma::Applet*); void appletDestroyed(Plasma::Applet*);
void containmentAppletAnimationComplete(); void appletAppearAnimationComplete();
void zoomIn(); void zoomIn();
void zoomOut(); void zoomOut();
void clearDataForMimeJob(KIO::Job *job); void clearDataForMimeJob(KIO::Job *job);
@ -165,7 +165,6 @@ public:
QTimer *showDropZoneDelayTimer; QTimer *showDropZoneDelayTimer;
bool drawWallpaper : 1; bool drawWallpaper : 1;
bool dropZoneStarted : 1; bool dropZoneStarted : 1;
Animation *zoomAnim;
}; };
} // Plasma namespace } // Plasma namespace