use appear/disappear anims, not hardcoded stuff

svn path=/trunk/KDE/kdelibs/; revision=1120243
This commit is contained in:
Aaron J. Seigo 2010-04-28 17:42:12 +00:00
parent 34a0cf1719
commit dbd43adad7
3 changed files with 33 additions and 34 deletions

View File

@ -2920,10 +2920,14 @@ AppletOverlayWidget::AppletOverlayWidget(QGraphicsWidget *parent)
void AppletOverlayWidget::destroy() void AppletOverlayWidget::destroy()
{ {
Animation *zoomAnim = Plasma::Animator::create(Plasma::Animator::ZoomAnimation); Animation *anim = Plasma::Animator::create(Plasma::Animator::DisappearAnimation);
connect(zoomAnim, SIGNAL(finished()), this, SLOT(overlayAnimationComplete())); if (anim) {
zoomAnim->setTargetWidget(this); connect(anim, SIGNAL(finished()), this, SLOT(overlayAnimationComplete()));
zoomAnim->start(); anim->setTargetWidget(this);
anim->start();
} else {
overlayAnimationComplete();
}
} }
void AppletOverlayWidget::overlayAnimationComplete() void AppletOverlayWidget::overlayAnimationComplete()

View File

@ -936,15 +936,15 @@ void Containment::addApplet(Applet *applet, const QPointF &pos, bool delayInit)
applet->installSceneEventFilter(this); applet->installSceneEventFilter(this);
//applet->setWindowFlags(Qt::Window); //applet->setWindowFlags(Qt::Window);
} }
} else { } else {
applet->init(); applet->init();
applet->setScale(0); Plasma::Animation *anim = Plasma::Animator::create(Plasma::Animator::AppearAnimation);
Plasma::Animation *zoomAnim = Plasma::Animator::create(Plasma::Animator::ZoomAnimation); if (anim) {
connect(zoomAnim, SIGNAL(finished()), this, SLOT(appletAppearAnimationComplete())); connect(anim, SIGNAL(finished()), this, SLOT(appletAppearAnimationComplete()));
zoomAnim->setTargetWidget(applet); anim->start(QAbstractAnimation::DeleteWhenStopped);
zoomAnim->setProperty("zoom", 1.0); } else {
zoomAnim->start(QAbstractAnimation::DeleteWhenStopped); d->appletAppeared(applet);
}
} }
applet->updateConstraints(Plasma::AllConstraints); applet->updateConstraints(Plasma::AllConstraints);
@ -2276,32 +2276,26 @@ void ContainmentPrivate::appletDestroyed(Plasma::Applet *applet)
void ContainmentPrivate::appletAppearAnimationComplete() void ContainmentPrivate::appletAppearAnimationComplete()
{ {
Animation *anim = qobject_cast<Animation *>(q->sender()); Animation *anim = qobject_cast<Animation *>(q->sender());
if (!anim) { if (anim) {
return; Applet *applet = qobject_cast<Applet*>(anim->targetWidget());
} if (applet) {
appletAppeared(applet);
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);
pulse->setProperty("targetScale", 1.3);
pulse->start(QAbstractAnimation::DeleteWhenStopped);
if (applet->parentItem() == q) {
if (type == Containment::DesktopContainment) {
applet->installSceneEventFilter(q);
} }
KConfigGroup *cg = applet->d->mainConfigGroup();
applet->save(*cg);
emit q->configNeedsSaving();
} }
} }
void ContainmentPrivate::appletAppeared(Applet *applet)
{
kDebug() << type << Containment::DesktopContainment;
if (type == Containment::DesktopContainment) {
applet->installSceneEventFilter(q);
}
KConfigGroup *cg = applet->d->mainConfigGroup();
applet->save(*cg);
emit q->configNeedsSaving();
}
void ContainmentPrivate::positionPanel(bool force) void ContainmentPrivate::positionPanel(bool force)
{ {
if (!q->scene()) { if (!q->scene()) {

View File

@ -86,8 +86,9 @@ public:
QPointF preferredPanelPos(Corona *corona) const; QPointF preferredPanelPos(Corona *corona) const;
void setLockToolText(); void setLockToolText();
void handleDisappeared(AppletHandle *handle); void handleDisappeared(AppletHandle *handle);
void appletDestroyed(Plasma::Applet*); void appletDestroyed(Applet*);
void appletAppearAnimationComplete(); void appletAppearAnimationComplete();
void appletAppeared(Applet*);
void clearDataForMimeJob(KIO::Job *job); void clearDataForMimeJob(KIO::Job *job);
void remoteAppletReady(Plasma::AccessAppletJob *job); void remoteAppletReady(Plasma::AccessAppletJob *job);
void mimeTypeRetrieved(KIO::Job *job, const QString &mimetype); void mimeTypeRetrieved(KIO::Job *job, const QString &mimetype);