From 30e239c311f10db35b6e32a93fe3717f1f81e647 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Thu, 5 Apr 2012 22:37:15 -0400 Subject: [PATCH] Don't load covers till scrolling stops in the treeview --- src/libtomahawk/playlist/treeitemdelegate.cpp | 4 ++-- src/libtomahawk/utils/PixmapDelegateFader.cpp | 8 ++++---- src/libtomahawk/utils/PixmapDelegateFader.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libtomahawk/playlist/treeitemdelegate.cpp b/src/libtomahawk/playlist/treeitemdelegate.cpp index e1cfc133f..0d1ac25ac 100644 --- a/src/libtomahawk/playlist/treeitemdelegate.cpp +++ b/src/libtomahawk/playlist/treeitemdelegate.cpp @@ -157,13 +157,13 @@ TreeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, { if ( !item->album().isNull() ) { - m_pixmaps.insert( index, QSharedPointer< Tomahawk::PixmapDelegateFader >( new Tomahawk::PixmapDelegateFader( item->album(), r.size() ) ) ); + m_pixmaps.insert( index, QSharedPointer< Tomahawk::PixmapDelegateFader >( new Tomahawk::PixmapDelegateFader( item->album(), r.size(), false ) ) ); _detail::Closure* closure = NewClosure( m_pixmaps[ index ], SIGNAL( repaintRequest() ), const_cast(this), SLOT( doUpdateIndex( const QPersistentModelIndex& ) ), QPersistentModelIndex( index ) ); closure->setAutoDelete( false ); } else if ( !item->artist().isNull() ) { - m_pixmaps.insert( index, QSharedPointer< Tomahawk::PixmapDelegateFader >( new Tomahawk::PixmapDelegateFader( item->artist(), r.size() ) ) ); + m_pixmaps.insert( index, QSharedPointer< Tomahawk::PixmapDelegateFader >( new Tomahawk::PixmapDelegateFader( item->artist(), r.size(), false ) ) ); _detail::Closure* closure = NewClosure( m_pixmaps[ index ], SIGNAL( repaintRequest() ), const_cast(this), SLOT( doUpdateIndex( const QPersistentModelIndex& ) ), QPersistentModelIndex( index ) ); closure->setAutoDelete( false ); } diff --git a/src/libtomahawk/utils/PixmapDelegateFader.cpp b/src/libtomahawk/utils/PixmapDelegateFader.cpp index 34a6837ed..bdca50367 100644 --- a/src/libtomahawk/utils/PixmapDelegateFader.cpp +++ b/src/libtomahawk/utils/PixmapDelegateFader.cpp @@ -26,27 +26,27 @@ using namespace Tomahawk; #define COVER_FADEIN 1000 -PixmapDelegateFader::PixmapDelegateFader( const artist_ptr& artist, const QSize& size ) +PixmapDelegateFader::PixmapDelegateFader( const artist_ptr& artist, const QSize& size, bool forceLoad ) : m_artist( artist ) , m_size( size ) { if ( !m_artist.isNull() ) { connect( m_artist.data(), SIGNAL( coverChanged() ), this, SLOT( artistChanged() ) ); - m_currentReference = m_artist->cover( size ); + m_currentReference = m_artist->cover( size, forceLoad ); } init(); } -PixmapDelegateFader::PixmapDelegateFader( const album_ptr& album, const QSize& size ) +PixmapDelegateFader::PixmapDelegateFader( const album_ptr& album, const QSize& size, bool forceLoad ) : m_album( album ) , m_size( size ) { if ( !m_album.isNull() ) { connect( m_album.data(), SIGNAL( coverChanged() ), this, SLOT( albumChanged() ) ); - m_currentReference = m_album->cover( size ); + m_currentReference = m_album->cover( size, forceLoad ); } init(); diff --git a/src/libtomahawk/utils/PixmapDelegateFader.h b/src/libtomahawk/utils/PixmapDelegateFader.h index 3f6d32f14..65e963f70 100644 --- a/src/libtomahawk/utils/PixmapDelegateFader.h +++ b/src/libtomahawk/utils/PixmapDelegateFader.h @@ -39,8 +39,8 @@ class PixmapDelegateFader : public QObject { Q_OBJECT public: - PixmapDelegateFader( const artist_ptr& artist, const QSize& size ); - PixmapDelegateFader( const album_ptr& album, const QSize& size ); + PixmapDelegateFader( const artist_ptr& artist, const QSize& size, bool forceLoad = true ); + PixmapDelegateFader( const album_ptr& album, const QSize& size, bool forceLoad = true ); virtual ~PixmapDelegateFader();