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 {
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<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);
pulse->setTargetWidget(applet);
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);
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())

View File

@ -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