Commit a1395fa1 authored by Jakob Leben's avatar Jakob Leben

Qt: listView, fix and optimize artist and album display

Do not show ":" separator if album missing.
Show album even if artist missing.
Optimize a little bit.
parent d139be2b
......@@ -231,11 +231,13 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
QString artist = getMeta( index, COLUMN_ARTIST );
QString album = getMeta( index, COLUMN_ALBUM );
QString trackNum = getMeta( index, COLUMN_TRACK_NUMBER );
QString artistAlbum = artist
+ ( artist.isEmpty() ? QString() : QString( ": " ) )
+ album
+ ( album.isEmpty() || trackNum.isEmpty() ?
QString() : QString( " [#%1]" ).arg( trackNum ) );
QString artistAlbum = artist;
if( !album.isEmpty() )
{
if( !artist.isEmpty() ) artistAlbum += ": ";
artistAlbum += album;
if( !trackNum.isEmpty() ) artistAlbum += QString( " [#%1]" ).arg( trackNum );
}
QPixmap artPix = getArtPixmap( index, QSize( LISTVIEW_ART_SIZE, LISTVIEW_ART_SIZE ) );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment