1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-07 22:56:42 +02:00

* Fixed cover retrieval via DeclarativeCoverArtProvider.

This commit is contained in:
Christian Muehlhaeuser
2012-07-20 13:42:14 +02:00
parent c1df1387f0
commit d16ed39dbe
4 changed files with 26 additions and 12 deletions

View File

@@ -356,8 +356,12 @@ Query::coverId() const
if ( m_albumPtr->coverLoaded() ) if ( m_albumPtr->coverLoaded() )
{ {
if ( !m_albumPtr->cover( QSize( 0, 0 ) ).isNull() ) if ( !m_albumPtr->cover( QSize( 0, 0 ) ).isNull() )
{
tDebug() << "Returning cover from album:" << m_albumPtr->coverId();
return m_albumPtr->coverId(); return m_albumPtr->coverId();
}
tDebug() << "Returning cover from artist:" << m_artistPtr->uniqueId();
return m_artistPtr->uniqueId(); return m_artistPtr->uniqueId();
} }
return QString(); return QString();

View File

@@ -152,13 +152,18 @@ PlayableItem::init( PlayableItem* parent, int row )
void void
PlayableItem::onResultsChanged() PlayableItem::onResultsChanged()
{ {
if ( !m_query->results().isEmpty() ) { if ( !m_query->results().isEmpty() )
{
m_result = m_query->results().first(); m_result = m_query->results().first();
if ( m_query->displayQuery()->coverLoaded() ) { if ( m_query->displayQuery()->coverLoaded() )
{
emit coverChanged(); emit coverChanged();
} }
connect( m_query->displayQuery().data(), SIGNAL( coverChanged() ), SIGNAL( dataChanged() ) );
connect( m_query->displayQuery().data(), SIGNAL( coverChanged() ), SIGNAL( coverChanged() ) ); connect( m_query->displayQuery().data(), SIGNAL( coverChanged() ), SIGNAL( coverChanged() ) );
} else }
else
m_result = result_ptr(); m_result = result_ptr();
emit dataChanged(); emit dataChanged();

View File

@@ -169,7 +169,8 @@ PlayableModel::queryData( const query_ptr& query, int column, int role ) const
if ( role == CoverIDRole ) if ( role == CoverIDRole )
{ {
tDebug() << "Cover role for:" << query->toString(); tDebug() << "Cover role for:" << query->toString();
return query->displayQuery()->id(); query->displayQuery()->cover( QSize( 0, 0 ) );
return query->displayQuery()->coverId();
} }
if ( role != Qt::DisplayRole ) // && role != Qt::ToolTipRole ) if ( role != Qt::DisplayRole ) // && role != Qt::ToolTipRole )

View File

@@ -42,17 +42,21 @@ QPixmap DeclarativeCoverArtProvider::requestPixmap(const QString &id, QSize *siz
// } // }
tDebug() << "Getting by id:" << id; tDebug() << "Getting by id:" << id;
album_ptr album = Album::getByCoverId(id); album_ptr album = Album::getByCoverId( id );
if ( !album.isNull() ) { if ( !album.isNull() )
return album->cover(requestedSize); {
tDebug() << "Returning album cover:" << album->cover( requestedSize ).isNull();
return album->cover( requestedSize );
} }
artist_ptr artist = Artist::getByUniqueId(id); artist_ptr artist = Artist::getByUniqueId( id );
if ( !artist.isNull() ) { if ( !artist.isNull() )
return artist->cover(requestedSize); {
tDebug() << "Returning artist cover:" << artist->cover( requestedSize ).isNull();
return artist->cover( requestedSize );
} }
/* query_ptr query = Query::getByCoverId(id); /* query_ptr query = Query::getByCoverId( id );
if ( !query.isNull() ) { if ( !query.isNull() ) {
return query->cover(requestedSize); return query->cover( requestedSize );
}*/ }*/
// TODO: create default cover art image // TODO: create default cover art image