diff options
Diffstat (limited to 'kmix/kmixdockwidget.cpp')
-rw-r--r-- | kmix/kmixdockwidget.cpp | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/kmix/kmixdockwidget.cpp b/kmix/kmixdockwidget.cpp index 642a98fa..19ef03e9 100644 --- a/kmix/kmixdockwidget.cpp +++ b/kmix/kmixdockwidget.cpp @@ -112,7 +112,7 @@ KMixDockWidget::createMasterVolWidget() // In case that there is no mixer installed, there will be no newVolumeLevels() signal's // Thus we prepare the dock areas manually setVolumeTip(); - updatePixmap(); + updatePixmap(false); return; } // create devices @@ -126,7 +126,7 @@ KMixDockWidget::createMasterVolWidget() The call to m_mixer->readSetFromHWforceUpdate() is most likely superfluous, even if we don't use QSocketNotifier (e.g. in backends OSS, Solaris, ...) */ setVolumeTip(); - updatePixmap(); + updatePixmap(false); /* We are setting up 3 connections: * Refreshig the _dockAreaPopup (not anymore neccesary, because ViewBase already does it) * Refreshing the Tooltip @@ -135,9 +135,13 @@ KMixDockWidget::createMasterVolWidget() */ // connect( m_mixer, SIGNAL(newVolumeLevels()), _dockAreaPopup, SLOT(refreshVolumeLevels()) ); connect( m_mixer, SIGNAL(newVolumeLevels()), this, SLOT(setVolumeTip() ) ); - connect( m_mixer, SIGNAL(newVolumeLevels()), this, SLOT(updatePixmap() ) ); + connect( m_mixer, SIGNAL(newVolumeLevels()), this, SLOT(slotUpdatePixmap() ) ); } +void KMixDockWidget::slotUpdatePixmap() +{ + updatePixmap(false); +} void KMixDockWidget::selectMaster() { @@ -208,7 +212,7 @@ KMixDockWidget::setVolumeTip() } void -KMixDockWidget::updatePixmap() +KMixDockWidget::updatePixmap(bool force) { MixDevice *md = 0; if ( _dockAreaPopup != 0 ) { @@ -228,17 +232,29 @@ KMixDockWidget::updatePixmap() newPixmapType = 'd'; } - - if ( newPixmapType != _oldPixmapType ) { + if (( newPixmapType != _oldPixmapType ) || (force == true)) { // Pixmap must be changed => do so + // Honor Free Desktop specifications that allow for arbitrary system tray icon sizes + QPixmap origpixmap; + QPixmap scaledpixmap; + QImage newIcon; switch ( newPixmapType ) { - case 'e': setPixmap( loadIcon( "kmixdocked_error" ) ); break; - case 'm': setPixmap( loadIcon( "kmixdocked_mute" ) ); break; - case 'd': setPixmap( loadIcon( "kmixdocked" ) ); break; + case 'e': origpixmap = loadSizedIcon( "kmixdocked_error", width() ); break; + case 'm': origpixmap = loadSizedIcon( "kmixdocked_mute" , width() ); break; + case 'd': origpixmap = loadSizedIcon( "kmixdocked" , width() ); break; } + newIcon = origpixmap; + newIcon = newIcon.smoothScale(width(), height()); + scaledpixmap = newIcon; + setPixmap(scaledpixmap); + + _oldPixmapType = newPixmapType; } +} - _oldPixmapType = newPixmapType; +void KMixDockWidget::resizeEvent ( QResizeEvent * ) +{ + updatePixmap(true); } void @@ -260,7 +276,7 @@ KMixDockWidget::mousePressEvent(QMouseEvent *me) // Case 2: User wants to show volume popup if ( _dockAreaPopup->justHidden() ) return; - + if ( _dockAreaPopup->isVisible() ) { _dockAreaPopup->hide(); |