use appear/disappear anims, not hardcoded stuff
svn path=/trunk/KDE/kdelibs/; revision=1120243
This commit is contained in:
parent
34a0cf1719
commit
dbd43adad7
12
applet.cpp
12
applet.cpp
@ -2920,10 +2920,14 @@ AppletOverlayWidget::AppletOverlayWidget(QGraphicsWidget *parent)
|
||||
|
||||
void AppletOverlayWidget::destroy()
|
||||
{
|
||||
Animation *zoomAnim = Plasma::Animator::create(Plasma::Animator::ZoomAnimation);
|
||||
connect(zoomAnim, SIGNAL(finished()), this, SLOT(overlayAnimationComplete()));
|
||||
zoomAnim->setTargetWidget(this);
|
||||
zoomAnim->start();
|
||||
Animation *anim = Plasma::Animator::create(Plasma::Animator::DisappearAnimation);
|
||||
if (anim) {
|
||||
connect(anim, SIGNAL(finished()), this, SLOT(overlayAnimationComplete()));
|
||||
anim->setTargetWidget(this);
|
||||
anim->start();
|
||||
} else {
|
||||
overlayAnimationComplete();
|
||||
}
|
||||
}
|
||||
|
||||
void AppletOverlayWidget::overlayAnimationComplete()
|
||||
|
@ -936,15 +936,15 @@ void Containment::addApplet(Applet *applet, const QPointF &pos, bool delayInit)
|
||||
applet->installSceneEventFilter(this);
|
||||
//applet->setWindowFlags(Qt::Window);
|
||||
}
|
||||
|
||||
} else {
|
||||
applet->init();
|
||||
applet->setScale(0);
|
||||
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);
|
||||
Plasma::Animation *anim = Plasma::Animator::create(Plasma::Animator::AppearAnimation);
|
||||
if (anim) {
|
||||
connect(anim, SIGNAL(finished()), this, SLOT(appletAppearAnimationComplete()));
|
||||
anim->start(QAbstractAnimation::DeleteWhenStopped);
|
||||
} else {
|
||||
d->appletAppeared(applet);
|
||||
}
|
||||
}
|
||||
|
||||
applet->updateConstraints(Plasma::AllConstraints);
|
||||
@ -2276,32 +2276,26 @@ void ContainmentPrivate::appletDestroyed(Plasma::Applet *applet)
|
||||
void ContainmentPrivate::appletAppearAnimationComplete()
|
||||
{
|
||||
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);
|
||||
pulse->setProperty("targetScale", 1.3);
|
||||
pulse->start(QAbstractAnimation::DeleteWhenStopped);
|
||||
|
||||
if (applet->parentItem() == q) {
|
||||
if (type == Containment::DesktopContainment) {
|
||||
applet->installSceneEventFilter(q);
|
||||
if (anim) {
|
||||
Applet *applet = qobject_cast<Applet*>(anim->targetWidget());
|
||||
if (applet) {
|
||||
appletAppeared(applet);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (!q->scene()) {
|
||||
|
@ -86,8 +86,9 @@ public:
|
||||
QPointF preferredPanelPos(Corona *corona) const;
|
||||
void setLockToolText();
|
||||
void handleDisappeared(AppletHandle *handle);
|
||||
void appletDestroyed(Plasma::Applet*);
|
||||
void appletDestroyed(Applet*);
|
||||
void appletAppearAnimationComplete();
|
||||
void appletAppeared(Applet*);
|
||||
void clearDataForMimeJob(KIO::Job *job);
|
||||
void remoteAppletReady(Plasma::AccessAppletJob *job);
|
||||
void mimeTypeRetrieved(KIO::Job *job, const QString &mimetype);
|
||||
|
Loading…
x
Reference in New Issue
Block a user