Begin fading the OSD immediately

REVIEW: 124409
wilder-5.14
Kai Uwe Broulik 11 years ago
parent 218b8d3517
commit ca33e8ee69
  1. 14
      lookandfeel/contents/osd/Osd.qml
  2. 16
      shell/osd.cpp

@ -38,6 +38,20 @@ PlasmaCore.Dialog {
// false for displaying the value as normal text
property bool showingProgress: false
property bool animateOpacity: false
Behavior on opacity {
SequentialAnimation {
// prevent press and hold from flickering
PauseAnimation { duration: 100 }
NumberAnimation {
duration: root.timeout
easing.type: Easing.InQuad
}
}
enabled: root.animateOpacity
}
mainItem: OsdItem {
rootItem: root
}

@ -125,7 +125,21 @@ void Osd::showText(const QString &icon, const QString &text)
void Osd::showOsd()
{
m_osdObject->rootObject()->setProperty("visible", true);
m_osdTimer->stop();
auto *rootObject = m_osdObject->rootObject();
// if our OSD understands animating the opacity, do it;
// otherwise just show it to not break existing lnf packages
if (rootObject->property("animateOpacity").isValid()) {
rootObject->setProperty("animateOpacity", false);
rootObject->setProperty("opacity", 1);
rootObject->setProperty("visible", true);
rootObject->setProperty("animateOpacity", true);
rootObject->setProperty("opacity", 0);
} else {
rootObject->setProperty("visible", true);
}
m_osdTimer->start(m_timeout);
}

Loading…
Cancel
Save