diff --git a/src/libtomahawk-widgets/PlaylistDelegate.cpp b/src/libtomahawk-widgets/PlaylistDelegate.cpp index e7dfc008f..d9cfccfbe 100644 --- a/src/libtomahawk-widgets/PlaylistDelegate.cpp +++ b/src/libtomahawk-widgets/PlaylistDelegate.cpp @@ -91,9 +91,7 @@ PlaylistDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, figFont.setPointSize( TomahawkUtils::defaultFontSize() - 1 ); QRect pixmapRect = option.rect.adjusted( 12, 12, -option.rect.width() + option.rect.height() - 12, -12 ); - QPixmap avatar = index.data( RecentlyPlayedPlaylistsModel::PlaylistRole ).value< Tomahawk::playlist_ptr >()->author()->avatar( TomahawkUtils::RoundedCorners, pixmapRect.size() ); - if ( avatar.isNull() ) - avatar = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultSourceAvatar, TomahawkUtils::RoundedCorners, pixmapRect.size() ); + QPixmap avatar = index.data( RecentlyPlayedPlaylistsModel::PlaylistRole ).value< Tomahawk::playlist_ptr >()->author()->avatar( TomahawkUtils::RoundedCorners, pixmapRect.size(), true ); painter->drawPixmap( pixmapRect, avatar ); pixmapRect = QRect( option.rect.width() - option.fontMetrics.height() * 2.5 - 10, option.rect.top() + option.rect.height() / 4, option.fontMetrics.height() * 2.5, option.fontMetrics.height() * 2.5 ); diff --git a/src/libtomahawk/Result.cpp b/src/libtomahawk/Result.cpp index d67d53ca8..1c5dd9d30 100644 --- a/src/libtomahawk/Result.cpp +++ b/src/libtomahawk/Result.cpp @@ -422,11 +422,7 @@ Result::sourceIcon( TomahawkUtils::ImageMode style, const QSize& desiredSize ) c } else { - QPixmap avatar = collection()->source()->avatar( TomahawkUtils::RoundedCorners, desiredSize ); - if ( !avatar ) - { - avatar = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultSourceAvatar, TomahawkUtils::RoundedCorners, desiredSize ); - } + QPixmap avatar = collection()->source()->avatar( TomahawkUtils::RoundedCorners, desiredSize, true ); return avatar; } } diff --git a/src/libtomahawk/playlist/PlaylistItemDelegate.cpp b/src/libtomahawk/playlist/PlaylistItemDelegate.cpp index d8756e0ad..6f2356c74 100644 --- a/src/libtomahawk/playlist/PlaylistItemDelegate.cpp +++ b/src/libtomahawk/playlist/PlaylistItemDelegate.cpp @@ -463,11 +463,8 @@ PlaylistItemDelegate::drawAvatarsForBox( QPainter* painter, QRect r = avatarsRect.adjusted( ( avatarSize + avatarMargin ) * i, 0, 0, 0 ); r.setWidth( avatarSize + avatarMargin ); - QPixmap pixmap = s->avatar( TomahawkUtils::Original, QSize( avatarSize, avatarSize ) ); - - if ( pixmap.isNull() ) - pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultSourceAvatar, TomahawkUtils::Original, QSize( r.height(), r.height() ) ); - painter->drawPixmap( r.adjusted( avatarMargin/2, 0, -(avatarMargin/2), 0 ), pixmap ); + QPixmap pixmap = s->avatar( TomahawkUtils::Original, QSize( avatarSize, avatarSize ), true ); + painter->drawPixmap( r.adjusted( avatarMargin / 2, 0, -( avatarMargin / 2 ), 0 ), pixmap ); rectsToSave.insert( s, r ); @@ -536,11 +533,7 @@ PlaylistItemDelegate::drawSource( QPainter* painter, const QStyleOptionViewItem& QRect textRect = avatarRect.adjusted( avatarRect.height() + 32, 0, -32, 0 ); avatarRect.setWidth( avatarRect.height() ); - QPixmap avatar = item->source()->avatar( TomahawkUtils::RoundedCorners, avatarRect.size() ) ; - if ( avatar.isNull() ) - { - avatar = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultSourceAvatar, TomahawkUtils::RoundedCorners, avatarRect.size() ); - } + QPixmap avatar = item->source()->avatar( TomahawkUtils::RoundedCorners, avatarRect.size(), true ) ; painter->drawPixmap( avatarRect, avatar ); QTextOption to = QTextOption( Qt::AlignVCenter ); diff --git a/src/tomahawk/sourcetree/items/SourceItem.cpp b/src/tomahawk/sourcetree/items/SourceItem.cpp index 7c0a7d870..7e84b63b4 100644 --- a/src/tomahawk/sourcetree/items/SourceItem.cpp +++ b/src/tomahawk/sourcetree/items/SourceItem.cpp @@ -234,16 +234,13 @@ SourceItem::icon() const QPixmap SourceItem::pixmap( const QSize& size ) const { - if ( m_source.isNull() ) + if ( !m_source ) { - return TomahawkUtils::defaultPixmap( TomahawkUtils::SuperCollection, TomahawkUtils::Original, size ); + return TomahawkUtils::defaultPixmap( TomahawkUtils::SuperCollection, TomahawkUtils::Original, size ); } else { - if ( m_source->avatar().isNull() ) - return TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultSourceAvatar, TomahawkUtils::RoundedCorners ); - else - return m_source->avatar( TomahawkUtils::RoundedCorners, size ); + return m_source->avatar( TomahawkUtils::RoundedCorners, size, true ); } }