1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-11 08:34:34 +02:00

* Source now returns (even cached) avatars in requested size.

This commit is contained in:
Christian Muehlhaeuser
2014-08-13 01:17:25 +02:00
parent a306f9a2d4
commit 198b44c03f

View File

@@ -292,16 +292,10 @@ Source::avatar( TomahawkUtils::ImageMode style, const QSize& size )
}
}
if ( d->avatarLoaded )
{
if ( d->avatar )
return *d->avatar;
else
return QPixmap();
}
// Try to get the avatar from the cache
// Hint: We store the avatar for each xmpp peer using its contactId, the dbFriendlyName is a contactId of a peer
if ( !d->avatarLoaded )
{
d->avatarLoaded = true;
QByteArray avatarBuffer = TomahawkUtils::Cache::instance()->getData( "Sources", dbFriendlyName() ).toByteArray();
if ( !avatarBuffer.isNull() )
@@ -312,7 +306,13 @@ Source::avatar( TomahawkUtils::ImageMode style, const QSize& size )
avatarBuffer.clear();
d->avatar = new QPixmap( TomahawkUtils::createRoundedImage( avatar, QSize( 0, 0 ) ) );
return *d->avatar;
}
}
if ( d->avatarLoaded )
{
if ( d->avatar )
return d->avatar->scaled( size, Qt::KeepAspectRatio, Qt::SmoothTransformation );
}
return QPixmap();