1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 06:07:37 +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->cover( QSize( 0, 0 ) ).isNull() )
{
tDebug() << "Returning cover from album:" << m_albumPtr->coverId();
return m_albumPtr->coverId();
}
tDebug() << "Returning cover from artist:" << m_artistPtr->uniqueId();
return m_artistPtr->uniqueId();
}
return QString();

View File

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

View File

@@ -169,7 +169,8 @@ PlayableModel::queryData( const query_ptr& query, int column, int role ) const
if ( role == CoverIDRole )
{
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 )

View File

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