|
|
|
@ -105,7 +105,7 @@ Amarok::TrayIcon::event( TQEvent *e )
|
|
|
|
|
void Amarok::TrayIcon::resizeEvent ( TQResizeEvent * )
|
|
|
|
|
{
|
|
|
|
|
// Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
|
|
|
|
|
baseIcon = KSystemTray::loadSizedIcon( "amarok", width() );
|
|
|
|
|
baseIcon = KSystemTray::loadSizedIcon( "amarok", width() );
|
|
|
|
|
if (overlay == &pauseOverlay) {
|
|
|
|
|
pauseOverlay = Amarok::loadOverlay( "pause", width() );
|
|
|
|
|
overlay = &pauseOverlay;
|
|
|
|
@ -187,12 +187,14 @@ Amarok::TrayIcon::paintIcon( int mergePixels, bool force )
|
|
|
|
|
{
|
|
|
|
|
// skip redrawing the same pixmap
|
|
|
|
|
static int mergePixelsCache = 0;
|
|
|
|
|
if ( mergePixels == mergePixelsCache && !force )
|
|
|
|
|
return;
|
|
|
|
|
if ( mergePixels == mergePixelsCache && !force ) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
mergePixelsCache = mergePixels;
|
|
|
|
|
|
|
|
|
|
if ( mergePixels < 0 )
|
|
|
|
|
if ( mergePixels < 0 ) {
|
|
|
|
|
return blendOverlay( baseIcon );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// make up the grayed icon
|
|
|
|
|
if ( grayedIcon.isNull() )
|
|
|
|
@ -202,7 +204,7 @@ Amarok::TrayIcon::paintIcon( int mergePixels, bool force )
|
|
|
|
|
grayedIcon = tmpTrayIcon;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// make up the alternate icon (use hilight color but more saturated)
|
|
|
|
|
// make up the alternate icon (use highlight color but more saturated)
|
|
|
|
|
if ( alternateIcon.isNull() )
|
|
|
|
|
{
|
|
|
|
|
TQImage tmpTrayIcon = baseIcon.convertToImage();
|
|
|
|
@ -217,10 +219,12 @@ Amarok::TrayIcon::paintIcon( int mergePixels, bool force )
|
|
|
|
|
alternateIcon = tmpTrayIcon;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( mergePixels >= alternateIcon.height() )
|
|
|
|
|
if ( mergePixels >= alternateIcon.height() ) {
|
|
|
|
|
return blendOverlay( grayedIcon );
|
|
|
|
|
if ( mergePixels == 0 )
|
|
|
|
|
}
|
|
|
|
|
if ( mergePixels == 0 ) {
|
|
|
|
|
return blendOverlay( alternateIcon );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// mix [ grayed <-> colored ] icons
|
|
|
|
|
TQPixmap tmpTrayPixmap = alternateIcon;
|
|
|
|
@ -232,8 +236,9 @@ Amarok::TrayIcon::paintIcon( int mergePixels, bool force )
|
|
|
|
|
void
|
|
|
|
|
Amarok::TrayIcon::blendOverlay( TQPixmap &sourcePixmap )
|
|
|
|
|
{
|
|
|
|
|
if ( !overlayVisible || !overlay || overlay->isNull() )
|
|
|
|
|
if ( !overlayVisible || !overlay || overlay->isNull() ) {
|
|
|
|
|
return setPixmap( sourcePixmap ); // @since 3.2
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// here comes the tricky part.. no tdefx functions are helping here.. :-(
|
|
|
|
|
// we have to blend pixmaps with different sizes (blending will be done in
|
|
|
|
@ -248,9 +253,10 @@ Amarok::TrayIcon::blendOverlay( TQPixmap &sourcePixmap )
|
|
|
|
|
copyBlt( &sourceCropped, 0,0, &sourcePixmap, opX,opY, opW,opH );
|
|
|
|
|
|
|
|
|
|
//speculative fix for a bactrace we received
|
|
|
|
|
//crash was in covertToImage() somewhere in this function
|
|
|
|
|
if( sourceCropped.isNull() )
|
|
|
|
|
//crash was in convertToImage() somewhere in this function
|
|
|
|
|
if( sourceCropped.isNull() ) {
|
|
|
|
|
return setPixmap( sourcePixmap );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// blend the overlay image over the cropped rectangle
|
|
|
|
|
TQImage blendedImage = sourceCropped.convertToImage();
|
|
|
|
|