--- last.fm-1.3.0.62.orig/src/iconshack.cpp +++ last.fm-1.3.0.62/src/iconshack.cpp @@ -73,6 +73,48 @@ } +#ifdef Q_WS_X11 +QPixmap +IconShack::GetTrayIcon( + UserIconColour eColour) +{ + if (!mbIconsLoaded) + { + LoadIcons(); + } + + if (maTrayIcons[eColour].isNull()) + { + return QPixmap(22, 22); + } + else + { + return maTrayIcons[eColour]; + } +} + + +QPixmap +IconShack::GetDisabledTrayIcon( + UserIconColour eColour) +{ + if (!mbIconsLoaded) + { + LoadIcons(); + } + + if (maDisabledTrayIcons[eColour].isNull()) + { + return QPixmap(22, 22); + } + else + { + return maDisabledTrayIcons[eColour]; + } +} +#endif + + void IconShack::LoadIcons() { @@ -106,6 +148,20 @@ maDisabledIcons[eOrange].load( dataPath( "icons/user_disabled.png" ) ); maDisabledIcons[eBlack].load( dataPath( "icons/user_disabled.png" ) ); +#ifdef Q_WS_X11 + maTrayIcons[eRed].load( dataPath( "icons/user_red22.png" ) ); + maTrayIcons[eBlue].load( dataPath( "icons/user_blue22.png" ) ); + maTrayIcons[eGreen].load( dataPath( "icons/user_green22.png" ) ); + maTrayIcons[eOrange].load( dataPath( "icons/user_orange22.png" ) ); + maTrayIcons[eBlack].load( dataPath( "icons/user_black22.png" ) ); + + maDisabledTrayIcons[eRed].load( dataPath( "icons/user_disabled22.png" ) ); + maDisabledTrayIcons[eBlue].load( dataPath( "icons/user_disabled22.png" ) ); + maDisabledTrayIcons[eGreen].load( dataPath( "icons/user_disabled22.png" ) ); + maDisabledTrayIcons[eOrange].load( dataPath( "icons/user_disabled22.png" ) ); + maDisabledTrayIcons[eBlack].load( dataPath( "icons/user_disabled22.png" ) ); +#endif + mbIconsLoaded = true; LOG( 4, "Icons loaded\n" ); --- last.fm-1.3.0.62.orig/src/iconshack.h +++ last.fm-1.3.0.62/src/iconshack.h @@ -74,6 +74,14 @@ **************************************************************************/ QPixmap GetDisabledUserIcon( UserIconColour eColour); +#ifdef Q_WS_X11 + QPixmap + GetTrayIcon( UserIconColour eColour ); + + QPixmap + GetDisabledTrayIcon( UserIconColour eColour ); +#endif + private: /*********************************************************************/ /** @@ -88,6 +96,10 @@ QPixmap maGoodIconsExpanded[5]; QPixmap maExclIcons[5]; QPixmap maDisabledIcons[5]; +#ifdef Q_WS_X11 + QPixmap maTrayIcons[5]; + QPixmap maDisabledTrayIcons[5]; +#endif bool mbIconsLoaded; }; --- last.fm-1.3.0.62.orig/src/systray.cpp +++ last.fm-1.3.0.62/src/systray.cpp @@ -101,6 +101,8 @@ //connect( m_trayMenu, SIGNAL(aboutToHide()), SLOT(aboutToHideMenu()) ); //connect( m_trayMenu, SIGNAL( triggered( QAction* )), SLOT( aboutToHideMenu()) ); + #elif defined(Q_WS_X11) + m_trayIcon->setIcon( IconShack::instance().GetTrayIcon( eRed ) ); #else if (The::currentUser().isNull()) m_trayIcon->setIcon( IconShack::instance().GetGoodUserIcon( eRed ) ); @@ -134,6 +136,8 @@ { #ifdef Q_WS_MAC icon = m_pixmap; + #elif defined(Q_WS_X11) + icon = IconShack::instance().GetTrayIcon( iconColour ); #else icon = IconShack::instance().GetGoodUserIcon( iconColour ); #endif @@ -142,6 +146,8 @@ { #ifdef Q_WS_MAC icon = QIcon(m_pixmap).pixmap( 19, 12, QIcon::Disabled ); + #elif defined(Q_WS_X11) + icon = IconShack::instance().GetDisabledTrayIcon( iconColour ); #else icon = IconShack::instance().GetDisabledUserIcon( iconColour ); #endif