summaryrefslogtreecommitdiffstats
path: root/amarok/src/systray.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'amarok/src/systray.cpp')
-rw-r--r--amarok/src/systray.cpp30
1 files changed, 25 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*/ )
{