* don't flicker the handle when we leave before its started showing

* take the z value of the applet to preserve stacking order

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=774328
This commit is contained in:
Aaron J. Seigo 2008-02-13 00:49:07 +00:00
parent e27b0ca4d0
commit 5e39408689

View File

@ -89,13 +89,15 @@ AppletHandle::AppletHandle(Containment *parent, Applet *applet)
setTransform(matrix); setTransform(matrix);
m_hoverTimer = new QTimer(this); m_hoverTimer = new QTimer(this);
m_hoverTimer->setSingleShot(true); m_hoverTimer->setSingleShot(true);
m_hoverTimer->setInterval(300); m_hoverTimer->setInterval(333);
connect(m_hoverTimer, SIGNAL(timeout()), this, SLOT(fadeIn())); connect(m_hoverTimer, SIGNAL(timeout()), this, SLOT(fadeIn()));
connect(m_applet, SIGNAL(destroyed(QObject*)), this, SLOT(appletDestroyed())); connect(m_applet, SIGNAL(destroyed(QObject*)), this, SLOT(appletDestroyed()));
setAcceptsHoverEvents(true); setAcceptsHoverEvents(true);
m_hoverTimer->start(); m_hoverTimer->start();
setZValue(m_applet->zValue());
} }
AppletHandle::~AppletHandle() AppletHandle::~AppletHandle()
@ -615,8 +617,15 @@ void AppletHandle::startFading(FadeType anim)
Phase::self()->stopCustomAnimation(m_animId); Phase::self()->stopCustomAnimation(m_animId);
} }
m_anim = anim;
qreal time = 250; qreal time = 250;
if (anim == FadeOut && m_hoverTimer->isActive()) {
// fading out before we've started fading in
m_hoverTimer->stop(); m_hoverTimer->stop();
fadeAnimation(1.0);
return;
}
if (m_applet) { if (m_applet) {
m_applet->removeSceneEventFilter(this); m_applet->removeSceneEventFilter(this);
@ -625,11 +634,9 @@ void AppletHandle::startFading(FadeType anim)
if (anim == FadeIn) { if (anim == FadeIn) {
time *= 1.0 - m_opacity; time *= 1.0 - m_opacity;
} else { } else {
m_hoverTimer->stop();
time *= m_opacity; time *= m_opacity;
} }
m_anim = anim;
m_animId = Phase::self()->customAnimation(40, (int)time, Phase::EaseInOutCurve, this, "fadeAnimation"); m_animId = Phase::self()->customAnimation(40, (int)time, Phase::EaseInOutCurve, this, "fadeAnimation");
} }