Do not show OSD for invalid values of percentage like -1 or 200

REVIEW: 115712
This commit is contained in:
Bhushan Shah 2014-02-13 18:15:36 +05:30
parent 664fd4167c
commit 334e818af0

View File

@ -98,7 +98,8 @@ void Osd::virtualDesktopChanged(const QString &currentVirtualDesktopName)
void Osd::showProgress(const QString &icon, const int percent, const QString &additionalText) void Osd::showProgress(const QString &icon, const int percent, const QString &additionalText)
{ {
m_osdObject->rootObject()->setProperty("osdValue", percent); int value = qBound(0, percent, 100);
m_osdObject->rootObject()->setProperty("osdValue", value);
m_osdObject->rootObject()->setProperty("osdAdditionalText", additionalText); m_osdObject->rootObject()->setProperty("osdAdditionalText", additionalText);
m_osdObject->rootObject()->setProperty("showingProgress", true); m_osdObject->rootObject()->setProperty("showingProgress", true);
m_osdObject->rootObject()->setProperty("icon", icon); m_osdObject->rootObject()->setProperty("icon", icon);