Add OSD API for media player's volume changes

Reviewed-by: Marco Martin
This commit is contained in:
Martin Klapetek 2014-01-28 15:07:59 +01:00
parent 605ab0f130
commit a4c4fc05af
2 changed files with 9 additions and 2 deletions

View File

@ -75,6 +75,11 @@ void Osd::volumeChanged(int percent)
showProgress(icon, percent); showProgress(icon, percent);
} }
void Osd::mediaPlayerVolumeChanged(int percent, const QString &playerName, const QString &playerIconName)
{
showProgress(playerIconName, percent, playerName);
}
void Osd::kbdLayoutChanged(const QString &layoutName) void Osd::kbdLayoutChanged(const QString &layoutName)
{ {
//FIXME: need a kbd icon //FIXME: need a kbd icon
@ -87,9 +92,10 @@ void Osd::virtualDesktopChanged(const QString &currentVirtualDesktopName)
showText(QString(), currentVirtualDesktopName); showText(QString(), currentVirtualDesktopName);
} }
void Osd::showProgress(const QString &icon, const int percent) void Osd::showProgress(const QString &icon, const int percent, const QString &additionalText)
{ {
m_osdObject->rootObject()->setProperty("osdValue", percent); m_osdObject->rootObject()->setProperty("osdValue", percent);
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);

View File

@ -42,6 +42,7 @@ public:
public Q_SLOTS: public Q_SLOTS:
void brightnessChanged(int percent); void brightnessChanged(int percent);
void volumeChanged(int percent); void volumeChanged(int percent);
void mediaPlayerVolumeChanged(int percent, const QString &playerName, const QString &playerIconName);
void kbdLayoutChanged(const QString &layoutName); void kbdLayoutChanged(const QString &layoutName);
void virtualDesktopChanged(const QString &currentVirtualDesktopName); void virtualDesktopChanged(const QString &currentVirtualDesktopName);
@ -49,7 +50,7 @@ private Q_SLOTS:
void hideOsd(); void hideOsd();
private: private:
void showProgress(const QString &icon, const int percent); void showProgress(const QString &icon, const int percent, const QString &additionalText = QString());
void showText(const QString &icon, const QString &text); void showText(const QString &icon, const QString &text);
void showOsd(); void showOsd();