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