[vlc-commits] commit: Qt: listView, fix and optimize artist and album display ( Jakob Leben )

git at videolan.org git at videolan.org
Tue Apr 6 02:46:18 CEST 2010


vlc | branch: master | Jakob Leben <jleben at videolan.org> | Tue Apr  6 02:40:41 2010 +0200| [a1395fa1807308f342960ac83be6510330727a18] | committer: 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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a1395fa1807308f342960ac83be6510330727a18
---

 modules/gui/qt4/components/playlist/icon_view.cpp |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/icon_view.cpp b/modules/gui/qt4/components/playlist/icon_view.cpp
index c76c2d1..850b39b 100644
--- a/modules/gui/qt4/components/playlist/icon_view.cpp
+++ b/modules/gui/qt4/components/playlist/icon_view.cpp
@@ -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 ) );
 



More information about the vlc-commits mailing list