mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-22 21:54:00 +02:00
Don't load covers till scrolling stops in the treeview
This commit is contained in:
@@ -157,13 +157,13 @@ TreeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
|||||||
{
|
{
|
||||||
if ( !item->album().isNull() )
|
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<TreeItemDelegate*>(this), SLOT( doUpdateIndex( const QPersistentModelIndex& ) ), QPersistentModelIndex( index ) );
|
_detail::Closure* closure = NewClosure( m_pixmaps[ index ], SIGNAL( repaintRequest() ), const_cast<TreeItemDelegate*>(this), SLOT( doUpdateIndex( const QPersistentModelIndex& ) ), QPersistentModelIndex( index ) );
|
||||||
closure->setAutoDelete( false );
|
closure->setAutoDelete( false );
|
||||||
}
|
}
|
||||||
else if ( !item->artist().isNull() )
|
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<TreeItemDelegate*>(this), SLOT( doUpdateIndex( const QPersistentModelIndex& ) ), QPersistentModelIndex( index ) );
|
_detail::Closure* closure = NewClosure( m_pixmaps[ index ], SIGNAL( repaintRequest() ), const_cast<TreeItemDelegate*>(this), SLOT( doUpdateIndex( const QPersistentModelIndex& ) ), QPersistentModelIndex( index ) );
|
||||||
closure->setAutoDelete( false );
|
closure->setAutoDelete( false );
|
||||||
}
|
}
|
||||||
|
@@ -26,27 +26,27 @@ using namespace Tomahawk;
|
|||||||
|
|
||||||
#define COVER_FADEIN 1000
|
#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_artist( artist )
|
||||||
, m_size( size )
|
, m_size( size )
|
||||||
{
|
{
|
||||||
if ( !m_artist.isNull() )
|
if ( !m_artist.isNull() )
|
||||||
{
|
{
|
||||||
connect( m_artist.data(), SIGNAL( coverChanged() ), this, SLOT( artistChanged() ) );
|
connect( m_artist.data(), SIGNAL( coverChanged() ), this, SLOT( artistChanged() ) );
|
||||||
m_currentReference = m_artist->cover( size );
|
m_currentReference = m_artist->cover( size, forceLoad );
|
||||||
}
|
}
|
||||||
|
|
||||||
init();
|
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_album( album )
|
||||||
, m_size( size )
|
, m_size( size )
|
||||||
{
|
{
|
||||||
if ( !m_album.isNull() )
|
if ( !m_album.isNull() )
|
||||||
{
|
{
|
||||||
connect( m_album.data(), SIGNAL( coverChanged() ), this, SLOT( albumChanged() ) );
|
connect( m_album.data(), SIGNAL( coverChanged() ), this, SLOT( albumChanged() ) );
|
||||||
m_currentReference = m_album->cover( size );
|
m_currentReference = m_album->cover( size, forceLoad );
|
||||||
}
|
}
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
@@ -39,8 +39,8 @@ class PixmapDelegateFader : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
PixmapDelegateFader( const artist_ptr& artist, const QSize& size );
|
PixmapDelegateFader( const artist_ptr& artist, const QSize& size, bool forceLoad = true );
|
||||||
PixmapDelegateFader( const album_ptr& album, const QSize& size );
|
PixmapDelegateFader( const album_ptr& album, const QSize& size, bool forceLoad = true );
|
||||||
|
|
||||||
virtual ~PixmapDelegateFader();
|
virtual ~PixmapDelegateFader();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user