mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-24 01:39:42 +01:00
Be safer and don't create albums in the for charts browsing
This commit is contained in:
parent
ceffbb6a77
commit
a19eb9c447
@ -112,7 +112,11 @@ AlbumItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
|
||||
QRect textRect = option.rect.adjusted( 0, option.rect.height() - 32, 0, -2 );
|
||||
|
||||
bool oneLiner = ( textRect.height() / 2 < painter->fontMetrics().boundingRect( item->album()->name() ).height() ||
|
||||
bool oneLiner = false;
|
||||
if ( item->album()->artist().isNull() )
|
||||
oneLiner = true;
|
||||
else
|
||||
oneLiner = ( textRect.height() / 2 < painter->fontMetrics().boundingRect( item->album()->name() ).height() ||
|
||||
textRect.height() / 2 < painter->fontMetrics().boundingRect( item->album()->artist()->name() ).height() );
|
||||
|
||||
if ( oneLiner )
|
||||
|
@ -330,7 +330,8 @@ AlbumModel::getCover( const QModelIndex& index )
|
||||
return false;
|
||||
|
||||
Tomahawk::InfoSystem::InfoCriteriaHash trackInfo;
|
||||
trackInfo["artist"] = item->album()->artist()->name();
|
||||
if ( !item->album()->artist().isNull() )
|
||||
trackInfo["artist"] = item->album()->artist()->name();
|
||||
trackInfo["album"] = item->album()->name();
|
||||
trackInfo["pptr"] = QString::number( (qlonglong)item );
|
||||
m_coverHash.insert( (qlonglong)item, index );
|
||||
|
@ -123,6 +123,12 @@ AlbumProxyModel::lessThan( const QModelIndex& left, const QModelIndex& right ) c
|
||||
if ( !p2 )
|
||||
return false;
|
||||
|
||||
if ( p1->album().isNull() || p1->album()->artist().isNull() )
|
||||
return true;
|
||||
|
||||
if ( p2->album().isNull() || p2->album()->artist().isNull() )
|
||||
return false;
|
||||
|
||||
if ( p1->album()->artist()->name() == p2->album()->artist()->name() )
|
||||
{
|
||||
return QString::localeAwareCompare( p1->album()->name(), p2->album()->name() ) < 0;
|
||||
|
@ -184,7 +184,12 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
|
||||
TreeModel* artistsModel = new TreeModel( ui->artistsViewLeft );
|
||||
artistsModel->setColumnStyle( TreeModel::TrackOnly );
|
||||
foreach ( const QString& artist, artists )
|
||||
artistsModel->addArtists( Artist::get( artist ) );
|
||||
{
|
||||
artist_ptr artistPtr = Artist::get( artist );
|
||||
if ( artistPtr.isNull() )
|
||||
artistPtr = Artist::get( 0, artist );
|
||||
artistsModel->addArtists( artistPtr );
|
||||
}
|
||||
const QString chartId = requestData.input.value< Tomahawk::InfoSystem::InfoCriteriaHash >().value( "chart_id" );
|
||||
m_artistModels[ chartId ] = artistsModel;
|
||||
|
||||
@ -200,7 +205,10 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
|
||||
foreach ( const Tomahawk::InfoSystem::ArtistAlbumPair& album, albums )
|
||||
{
|
||||
qDebug() << "Getting album" << album.album << "By" << album.artist;
|
||||
album_ptr albumPtr = Album::get( Artist::get( album.artist, true ), album.album );
|
||||
artist_ptr artistPtr = Artist::get( album.artist );
|
||||
if ( artistPtr.isNull() )
|
||||
artistPtr = Artist::get( 0, album.artist );
|
||||
album_ptr albumPtr = Album::get( 0, album.album, artistPtr );
|
||||
|
||||
if( !albumPtr.isNull() )
|
||||
al << albumPtr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user