summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--amarok/src/systray.cpp30
-rw-r--r--amarok/src/systray.h1
2 files changed, 26 insertions, 5 deletions
diff --git a/amarok/src/systray.cpp b/amarok/src/systray.cpp
index 57ee47c2..996c39cb 100644
--- a/amarok/src/systray.cpp
+++ b/amarok/src/systray.cpp
@@ -3,6 +3,7 @@
//
// Contributors: Stanislav Karchebny <berkus@users.sf.net>, (C) 2003
// berkus, mxcl, eros, eean
+// Timothy Pearson <kb9vqf@pearsoncomputing.net> (c) 2010
//
// Copyright: like rest of Amarok
//
@@ -23,9 +24,9 @@
namespace Amarok
{
static QPixmap
- loadOverlay( const char *iconName )
+ loadOverlay( const char *iconName, int iconWidth )
{
- return QImage( locate( "data", QString( "amarok/images/b_%1.png" ).arg( iconName ) ), "PNG" ).smoothScale( 10, 10 );
+ return QImage( locate( "data", QString( "amarok/images/b_%1.png" ).arg( iconName ) ), "PNG" ).smoothScale( ((iconWidth/2)-(iconWidth/20)), ((iconWidth/2)-(iconWidth/20)) );
}
}
@@ -54,9 +55,9 @@ Amarok::TrayIcon::TrayIcon( QWidget *playerWidget )
quit->disconnect();
connect( quit, SIGNAL(activated()), kapp, SLOT(quit()) );
- baseIcon = KSystemTray::loadIcon( "amarok" );
- playOverlay = Amarok::loadOverlay( "play" );
- pauseOverlay = Amarok::loadOverlay( "pause" );
+ baseIcon = KSystemTray::loadSizedIcon( "amarok", width() );
+ playOverlay = Amarok::loadOverlay( "play", width() );
+ pauseOverlay = Amarok::loadOverlay( "pause", width() );
overlayVisible = false;
//paintIcon();
@@ -101,6 +102,25 @@ Amarok::TrayIcon::event( QEvent *e )
}
}
+void Amarok::TrayIcon::resizeEvent ( QResizeEvent * )
+{
+ // Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
+ baseIcon = KSystemTray::loadSizedIcon( "amarok", width() );
+ if (overlay == &pauseOverlay) {
+ pauseOverlay = Amarok::loadOverlay( "pause", width() );
+ overlay = &pauseOverlay;
+ }
+ if (overlay == &playOverlay) {
+ playOverlay = Amarok::loadOverlay( "play", width() );
+ overlay = &playOverlay;
+ }
+ playOverlay = Amarok::loadOverlay( "play", width() );
+ pauseOverlay = Amarok::loadOverlay( "pause", width() );
+ grayedIcon = QPixmap();
+ alternateIcon = QPixmap();
+ paintIcon( -1, true );
+}
+
void
Amarok::TrayIcon::engineStateChanged( Engine::State state, Engine::State /*oldState*/ )
{
diff --git a/amarok/src/systray.h b/amarok/src/systray.h
index 9f07c6b2..bd26eb28 100644
--- a/amarok/src/systray.h
+++ b/amarok/src/systray.h
@@ -30,6 +30,7 @@ protected:
virtual void engineTrackPositionChanged( long position, bool /*userSeek*/ );
// get notified of 'highlight' color change
virtual void paletteChange( const QPalette & oldPalette );
+ void resizeEvent ( QResizeEvent * );
private:
bool event( QEvent* );