From c4ed36ca0e54f8342a673e186f5d3f9dc478d8fc Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Mon, 4 Jan 2010 23:45:38 +0000 Subject: [PATCH] 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 --- containment.cpp | 23 ++++++++++++++++------- containment.h | 2 +- private/containment_p.h | 3 +-- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/containment.cpp b/containment.cpp index 83a245db6..e1c4931f8 100644 --- a/containment.cpp +++ b/containment.cpp @@ -960,11 +960,11 @@ void Containment::addApplet(Applet *applet, const QPointF &pos, bool delayInit) } else { applet->init(); applet->setScale(0); - d->zoomAnim = Plasma::Animator::create(Plasma::Animator::ZoomAnimation); - connect(d->zoomAnim, SIGNAL(finished()), this, SLOT(containmentAppletAnimationComplete())); - d->zoomAnim->setTargetWidget(applet); - d->zoomAnim->setProperty("zoom", 1.0); - d->zoomAnim->start(); + Plasma::Animation *zoomAnim = Plasma::Animator::create(Plasma::Animator::ZoomAnimation); + connect(zoomAnim, SIGNAL(finished()), this, SLOT(appletAppearAnimationComplete())); + zoomAnim->setTargetWidget(applet); + zoomAnim->setProperty("zoom", 1.0); + zoomAnim->start(QAbstractAnimation::DeleteWhenStopped); } applet->updateConstraints(Plasma::AllConstraints); @@ -2313,9 +2313,18 @@ void ContainmentPrivate::appletDestroyed(Plasma::Applet *applet) emit q->configNeedsSaving(); } -void ContainmentPrivate::containmentAppletAnimationComplete() +void ContainmentPrivate::appletAppearAnimationComplete() { - Applet *applet = qgraphicsitem_cast(zoomAnim->targetWidget()); + Animation *anim = qobject_cast(q->sender()); + if (!anim) { + return; + } + + Applet *applet = qobject_cast(anim->targetWidget()); + if (!applet) { + return; + } + Animation *pulse = Plasma::Animator::create(Plasma::Animator::PulseAnimation); pulse->setTargetWidget(applet); pulse->setProperty("duration", 300); diff --git a/containment.h b/containment.h index 003d1d2ed..f6b71d4c8 100644 --- a/containment.h +++ b/containment.h @@ -604,7 +604,7 @@ class PLASMA_EXPORT Containment : public Applet Containment(const QString &packagePath, uint appletId, const QVariantList &args); 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 handleDisappeared(AppletHandle *handle)) Q_PRIVATE_SLOT(d, void positionToolBox()) diff --git a/private/containment_p.h b/private/containment_p.h index 9672adb6f..ac821dd55 100644 --- a/private/containment_p.h +++ b/private/containment_p.h @@ -84,7 +84,7 @@ public: void setLockToolText(); void handleDisappeared(AppletHandle *handle); void appletDestroyed(Plasma::Applet*); - void containmentAppletAnimationComplete(); + void appletAppearAnimationComplete(); void zoomIn(); void zoomOut(); void clearDataForMimeJob(KIO::Job *job); @@ -165,7 +165,6 @@ public: QTimer *showDropZoneDelayTimer; bool drawWallpaper : 1; bool dropZoneStarted : 1; - Animation *zoomAnim; }; } // Plasma namespace