From 320f7a400ea79044cc4a23627b8b88c5fd41388f Mon Sep 17 00:00:00 2001 From: Mavridis Philippe Date: Sun, 12 Dec 2021 17:14:08 +0200 Subject: [PATCH] Updated icon names in tray widget. Signed-off-by: Mavridis Philippe --- kmix/kmixdockwidget.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/kmix/kmixdockwidget.cpp b/kmix/kmixdockwidget.cpp index ed6fee4d..04b2f0af 100644 --- a/kmix/kmixdockwidget.cpp +++ b/kmix/kmixdockwidget.cpp @@ -265,7 +265,6 @@ KMixDockWidget::getAvgVolume() if ( md == 0 || md->maxVolume() == 0 ) return -1; - kdDebug() << "Volume % is " << (md->getVolume().getAvgVolume(Volume::MMAIN)*100 )/( md->maxVolume() ) << endl; return (md->getVolume().getAvgVolume(Volume::MMAIN)*100 )/( md->maxVolume() ); } @@ -329,7 +328,13 @@ KMixDockWidget::updatePixmap(bool force) } else { - newPixmapType = 'd'; + long avgVol = getAvgVolume(); + if ( avgVol <= 35 ) + newPixmapType = 'L'; + else if ( avgVol <= 70 ) + newPixmapType = 'M'; + else + newPixmapType = 'H'; } if (( newPixmapType != _oldPixmapType ) || (force == true)) { @@ -339,9 +344,12 @@ KMixDockWidget::updatePixmap(bool force) TQPixmap scaledpixmap; TQImage newIcon; switch ( newPixmapType ) { - case 'e': origpixmap = isShown() ? loadSizedIcon( "kmixdocked_error", width() ) : loadIcon( "kmixdocked_error"); break; - case 'm': origpixmap = isShown() ? loadSizedIcon( "kmixdocked_mute" , width() ) : loadIcon( "kmixdocked_mute"); break; - case 'd': origpixmap = isShown() ? loadSizedIcon( "kmixdocked" , width() ) : loadIcon( "kmixdocked "); break; + // AFAIK no icon theme has an icon analogous to kmixdocked_error + case 'e': origpixmap = isShown() ? loadSizedIcon( "kmixdocked_error" , width() ) : loadIcon( "kmixdocked_error" ); break; + case 'm': origpixmap = isShown() ? loadSizedIcon( "audio-volume-muted" , width() ) : loadIcon( "audio-volume-muted" ); break; + case 'L': origpixmap = isShown() ? loadSizedIcon( "audio-volume-low" , width() ) : loadIcon( "audio-volume-low" ); break; + case 'M': origpixmap = isShown() ? loadSizedIcon( "audio-volume-medium", width() ) : loadIcon( "audio-volume-medium" ); break; + case 'H': origpixmap = isShown() ? loadSizedIcon( "audio-volume-high" , width() ) : loadIcon( "audio-volume-high" ); break; } newIcon = origpixmap; if (isShown()) {