summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-05-10 03:04:43 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-05-10 03:04:43 +0000
commit13c0220b028523ea859b1522a13421f3a4b96574 (patch)
tree0e32ca310c2c88a5d7f5581219227dd47e27bd62
parentba91edcc600a84fb3d3fc00f68454d2b0fc5063f (diff)
downloadtdemultimedia-13c0220b028523ea859b1522a13421f3a4b96574.tar.gz
tdemultimedia-13c0220b028523ea859b1522a13421f3a4b96574.zip
Part of batch commit to enable true tasktray resize support for Trinity applications
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1124758 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
-rw-r--r--kmix/kmixdockwidget.cpp38
-rw-r--r--kmix/kmixdockwidget.h4
2 files changed, 30 insertions, 12 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();
diff --git a/kmix/kmixdockwidget.h b/kmix/kmixdockwidget.h
index fd94119a..680d3115 100644
--- a/kmix/kmixdockwidget.h
+++ b/kmix/kmixdockwidget.h
@@ -56,7 +56,8 @@ class KMixDockWidget : public KSystemTray {
public slots:
void setVolumeTip();
- void updatePixmap();
+ void updatePixmap(bool force);
+ void slotUpdatePixmap();
protected:
void createMasterVolWidget();
@@ -66,6 +67,7 @@ class KMixDockWidget : public KSystemTray {
void wheelEvent(QWheelEvent *);
void contextMenuAboutToShow( KPopupMenu* menu );
void toggleMinimizeRestore();
+ void resizeEvent ( QResizeEvent * );
private:
bool _playBeepOnVolumeChange;