]> git.sesse.net Git - vlc/commitdiff
Qt: listView, fix and optimize artist and album display
authorJakob Leben <jleben@videolan.org>
Tue, 6 Apr 2010 00:40:41 +0000 (02:40 +0200)
committerJakob Leben <jleben@videolan.org>
Tue, 6 Apr 2010 00:46:04 +0000 (02:46 +0200)
Do not show ":" separator if album missing.
Show album even if artist missing.
Optimize a little bit.

modules/gui/qt4/components/playlist/icon_view.cpp

index c76c2d140de1be881cd48b4afff63d2d02668999..850b39beeefaeed54694f9f9a99c1c2516fcb987 100644 (file)
@@ -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 ) );