diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-05-10 03:07:37 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-05-10 03:07:37 +0000 |
commit | 448423a4cacf41b606e7218162e5cd0689a593e1 (patch) | |
tree | 846ce7183bdd099b1adbf5b226e27aebfce27b8c | |
parent | 2dc0d603b8d9ab07129a4ef199bef145acbbefbf (diff) | |
download | amarok-448423a4cacf41b606e7218162e5cd0689a593e1.tar.gz amarok-448423a4cacf41b606e7218162e5cd0689a593e1.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/applications/amarok@1124763 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
-rw-r--r-- | amarok/src/systray.cpp | 30 | ||||
-rw-r--r-- | amarok/src/systray.h | 1 |
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* ); |