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/extenderitemmimedata_p.h"
|
||||||
#include "private/paneltoolbox_p.h"
|
#include "private/paneltoolbox_p.h"
|
||||||
|
|
||||||
|
#include "plasma/plasma.h"
|
||||||
|
#include "animations/animation.h"
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -154,10 +157,6 @@ void Containment::init()
|
|||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
setAcceptsHoverEvents(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) {
|
if (d->type == NoContainmentType) {
|
||||||
setContainmentType(DesktopContainment);
|
setContainmentType(DesktopContainment);
|
||||||
}
|
}
|
||||||
@ -953,17 +952,21 @@ 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();
|
||||||
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);
|
applet->updateConstraints(Plasma::AllConstraints);
|
||||||
|
|
||||||
if (!delayInit) {
|
if (!delayInit) {
|
||||||
applet->flushPendingConstraintsEvents();
|
applet->flushPendingConstraintsEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
emit appletAdded(applet, pos);
|
emit appletAdded(applet, pos);
|
||||||
|
|
||||||
if (!currentContainment) {
|
if (!currentContainment) {
|
||||||
@ -972,7 +975,6 @@ void Containment::addApplet(Applet *applet, const QPointF &pos, bool delayInit)
|
|||||||
applet->flushPendingConstraintsEvents();
|
applet->flushPendingConstraintsEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!delayInit) {
|
if (!delayInit) {
|
||||||
applet->d->scheduleModificationNotification();
|
applet->d->scheduleModificationNotification();
|
||||||
}
|
}
|
||||||
@ -2307,13 +2309,10 @@ void ContainmentPrivate::appletDestroyed(Plasma::Applet *applet)
|
|||||||
emit q->configNeedsSaving();
|
emit q->configNeedsSaving();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContainmentPrivate::containmentAppletAnimationComplete(QGraphicsItem *item, Plasma::Animator::Animation anim)
|
void ContainmentPrivate::containmentAppletAnimationComplete()
|
||||||
{
|
{
|
||||||
if (anim == Animator::AppearAnimation &&
|
Applet *applet = qgraphicsitem_cast<Applet*>(zoomAnim->widgetToAnimate());
|
||||||
item->parentItem() == q) {
|
if (applet->parentItem() == q) {
|
||||||
Applet *applet = qgraphicsitem_cast<Applet*>(item);
|
|
||||||
|
|
||||||
if (applet) {
|
|
||||||
if (type == Containment::DesktopContainment) {
|
if (type == Containment::DesktopContainment) {
|
||||||
applet->installSceneEventFilter(q);
|
applet->installSceneEventFilter(q);
|
||||||
}
|
}
|
||||||
@ -2321,8 +2320,6 @@ void ContainmentPrivate::containmentAppletAnimationComplete(QGraphicsItem *item,
|
|||||||
KConfigGroup *cg = applet->d->mainConfigGroup();
|
KConfigGroup *cg = applet->d->mainConfigGroup();
|
||||||
applet->save(*cg);
|
applet->save(*cg);
|
||||||
emit q->configNeedsSaving();
|
emit q->configNeedsSaving();
|
||||||
//applet->setWindowFlags(Qt::Window);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -604,8 +604,7 @@ class PLASMA_EXPORT Containment : public Applet
|
|||||||
Containment(const QString &packagePath, uint appletId, const QVariantList &args);
|
Containment(const QString &packagePath, uint appletId, const QVariantList &args);
|
||||||
|
|
||||||
Q_PRIVATE_SLOT(d, void appletDestroyed(Plasma::Applet*))
|
Q_PRIVATE_SLOT(d, void appletDestroyed(Plasma::Applet*))
|
||||||
Q_PRIVATE_SLOT(d, void containmentAppletAnimationComplete(QGraphicsItem *,
|
Q_PRIVATE_SLOT(d, void containmentAppletAnimationComplete())
|
||||||
Plasma::Animator::Animation anim))
|
|
||||||
Q_PRIVATE_SLOT(d, void triggerShowAddWidgets())
|
Q_PRIVATE_SLOT(d, void triggerShowAddWidgets())
|
||||||
Q_PRIVATE_SLOT(d, void handleDisappeared(AppletHandle *handle))
|
Q_PRIVATE_SLOT(d, void handleDisappeared(AppletHandle *handle))
|
||||||
Q_PRIVATE_SLOT(d, void positionToolBox())
|
Q_PRIVATE_SLOT(d, void positionToolBox())
|
||||||
|
@ -36,6 +36,7 @@ namespace Plasma
|
|||||||
class AccessAppletJob;
|
class AccessAppletJob;
|
||||||
class Containment;
|
class Containment;
|
||||||
class AbstractToolBox;
|
class AbstractToolBox;
|
||||||
|
class Animation;
|
||||||
|
|
||||||
class ContainmentPrivate
|
class ContainmentPrivate
|
||||||
{
|
{
|
||||||
@ -83,7 +84,7 @@ public:
|
|||||||
void setLockToolText();
|
void setLockToolText();
|
||||||
void handleDisappeared(AppletHandle *handle);
|
void handleDisappeared(AppletHandle *handle);
|
||||||
void appletDestroyed(Plasma::Applet*);
|
void appletDestroyed(Plasma::Applet*);
|
||||||
void containmentAppletAnimationComplete(QGraphicsItem *item, Plasma::Animator::Animation anim);
|
void containmentAppletAnimationComplete();
|
||||||
void zoomIn();
|
void zoomIn();
|
||||||
void zoomOut();
|
void zoomOut();
|
||||||
void clearDataForMimeJob(KIO::Job *job);
|
void clearDataForMimeJob(KIO::Job *job);
|
||||||
@ -164,6 +165,7 @@ public:
|
|||||||
QTimer *showDropZoneDelayTimer;
|
QTimer *showDropZoneDelayTimer;
|
||||||
bool drawWallpaper : 1;
|
bool drawWallpaper : 1;
|
||||||
bool dropZoneStarted : 1;
|
bool dropZoneStarted : 1;
|
||||||
|
Animation *zoomAnim;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Plasma namespace
|
} // Plasma namespace
|
||||||
|
Loading…
x
Reference in New Issue
Block a user