Migrating Plasma::Containment appear animation to ZoomAnimation (it works
smoother and the code is simpler). svn path=/trunk/KDE/kdelibs/; revision=1063088
This commit is contained in:
parent
92383665fc
commit
32121a4bdf
@ -67,6 +67,9 @@
|
||||
#include "private/extenderitemmimedata_p.h"
|
||||
#include "private/paneltoolbox_p.h"
|
||||
|
||||
#include "plasma/plasma.h"
|
||||
#include "animations/animation.h"
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
@ -154,10 +157,6 @@ void Containment::init()
|
||||
setAcceptDrops(true);
|
||||
setAcceptsHoverEvents(true);
|
||||
|
||||
//TODO: would be nice to not do this on init, as it causes Animator to init
|
||||
connect(Animator::self(), SIGNAL(animationFinished(QGraphicsItem*,Plasma::Animator::Animation)),
|
||||
this, SLOT(containmentAppletAnimationComplete(QGraphicsItem*,Plasma::Animator::Animation)));
|
||||
|
||||
if (d->type == NoContainmentType) {
|
||||
setContainmentType(DesktopContainment);
|
||||
}
|
||||
@ -953,17 +952,21 @@ void Containment::addApplet(Applet *applet, const QPointF &pos, bool delayInit)
|
||||
applet->installSceneEventFilter(this);
|
||||
//applet->setWindowFlags(Qt::Window);
|
||||
}
|
||||
|
||||
} else {
|
||||
applet->init();
|
||||
Animator::self()->animateItem(applet, Animator::AppearAnimation);
|
||||
applet->setScale(0);
|
||||
d->zoomAnim = Plasma::Animator::create(Plasma::Animator::ZoomAnimation);
|
||||
connect(d->zoomAnim, SIGNAL(finished()), this, SLOT(containmentAppletAnimationComplete()));
|
||||
d->zoomAnim->setWidgetToAnimate(applet);
|
||||
d->zoomAnim->setProperty("zoom", 1.0);
|
||||
d->zoomAnim->start();
|
||||
}
|
||||
|
||||
applet->updateConstraints(Plasma::AllConstraints);
|
||||
|
||||
if (!delayInit) {
|
||||
applet->flushPendingConstraintsEvents();
|
||||
}
|
||||
|
||||
emit appletAdded(applet, pos);
|
||||
|
||||
if (!currentContainment) {
|
||||
@ -972,7 +975,6 @@ void Containment::addApplet(Applet *applet, const QPointF &pos, bool delayInit)
|
||||
applet->flushPendingConstraintsEvents();
|
||||
}
|
||||
}
|
||||
|
||||
if (!delayInit) {
|
||||
applet->d->scheduleModificationNotification();
|
||||
}
|
||||
@ -2307,22 +2309,17 @@ void ContainmentPrivate::appletDestroyed(Plasma::Applet *applet)
|
||||
emit q->configNeedsSaving();
|
||||
}
|
||||
|
||||
void ContainmentPrivate::containmentAppletAnimationComplete(QGraphicsItem *item, Plasma::Animator::Animation anim)
|
||||
void ContainmentPrivate::containmentAppletAnimationComplete()
|
||||
{
|
||||
if (anim == Animator::AppearAnimation &&
|
||||
item->parentItem() == q) {
|
||||
Applet *applet = qgraphicsitem_cast<Applet*>(item);
|
||||
|
||||
if (applet) {
|
||||
if (type == Containment::DesktopContainment) {
|
||||
applet->installSceneEventFilter(q);
|
||||
}
|
||||
|
||||
KConfigGroup *cg = applet->d->mainConfigGroup();
|
||||
applet->save(*cg);
|
||||
emit q->configNeedsSaving();
|
||||
//applet->setWindowFlags(Qt::Window);
|
||||
Applet *applet = qgraphicsitem_cast<Applet*>(zoomAnim->widgetToAnimate());
|
||||
if (applet->parentItem() == q) {
|
||||
if (type == Containment::DesktopContainment) {
|
||||
applet->installSceneEventFilter(q);
|
||||
}
|
||||
|
||||
KConfigGroup *cg = applet->d->mainConfigGroup();
|
||||
applet->save(*cg);
|
||||
emit q->configNeedsSaving();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -604,8 +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(QGraphicsItem *,
|
||||
Plasma::Animator::Animation anim))
|
||||
Q_PRIVATE_SLOT(d, void containmentAppletAnimationComplete())
|
||||
Q_PRIVATE_SLOT(d, void triggerShowAddWidgets())
|
||||
Q_PRIVATE_SLOT(d, void handleDisappeared(AppletHandle *handle))
|
||||
Q_PRIVATE_SLOT(d, void positionToolBox())
|
||||
|
@ -36,6 +36,7 @@ namespace Plasma
|
||||
class AccessAppletJob;
|
||||
class Containment;
|
||||
class AbstractToolBox;
|
||||
class Animation;
|
||||
|
||||
class ContainmentPrivate
|
||||
{
|
||||
@ -83,7 +84,7 @@ public:
|
||||
void setLockToolText();
|
||||
void handleDisappeared(AppletHandle *handle);
|
||||
void appletDestroyed(Plasma::Applet*);
|
||||
void containmentAppletAnimationComplete(QGraphicsItem *item, Plasma::Animator::Animation anim);
|
||||
void containmentAppletAnimationComplete();
|
||||
void zoomIn();
|
||||
void zoomOut();
|
||||
void clearDataForMimeJob(KIO::Job *job);
|
||||
@ -164,6 +165,7 @@ public:
|
||||
QTimer *showDropZoneDelayTimer;
|
||||
bool drawWallpaper : 1;
|
||||
bool dropZoneStarted : 1;
|
||||
Animation *zoomAnim;
|
||||
};
|
||||
|
||||
} // Plasma namespace
|
||||
|
Loading…
Reference in New Issue
Block a user