proposal: better track display for compilations

Christopher Schwartz christopher.schwartz at hoov.de
Fri Apr 24 12:20:58 UTC 2009


Hello everyone,

let me first introduce myself and state that I am a huge fan of amarok,
since I have a big music collection and amarok helps me to manage and
enjoy all my music.

However, with amarok 2 (SVN Revision 958235) I found the support for
compilations ("various artists") to be insufficient.
Neither in the collection view nor in the albums applet it was possible
to see what's the track's artist if the album is listed as a
compilation.

Thus I propose the following two patches:

Index: src/context/applets/albums/TrackItem.cpp
===================================================================
--- src/context/applets/albums/TrackItem.cpp   (Revision 958235)
+++ src/context/applets/albums/TrackItem.cpp   (Arbeitskopie)
@@ -38,13 +38,18 @@
 {
     int trackNumber = track->trackNumber();
     QString trackName = track->prettyName();
+
+    //display the artist if album is a compilation
+    QString artist = "";
+    if ( track->album()->isCompilation() )
+        artist = track->artist()->prettyName() + " - ";

     QString text;

     if( trackNumber > 0 )
-        text = QString( "%1\t%2" ).arg( QString::number( trackNumber ),
trackName );
+        text = QString( "%1 - %3%2" ).arg( QString::number( trackNumber
), trackName, artist );
     else
-        text = QString( "\t%1" ).arg( trackName );
+        text = QString( "%2%1" ).arg( trackName, artist );

     setText( text );
 }


Index: src/browsers/CollectionTreeItem.cpp
===================================================================
--- src/browsers/CollectionTreeItem.cpp   (Revision 958235)
+++ src/browsers/CollectionTreeItem.cpp   (Arbeitskopie)
@@ -128,8 +128,12 @@
                 {
                     if( !track.isNull() )
                     {
+                        //if album is in various artists, show the
track's artist in front of the track name
+         QString artist = "";
+         if ( track->album()->isCompilation() ) artist =
track->artist()->fixedName() + " - ";
+
                         if ( track->trackNumber() > 0 )
-                            name = QString::number(
track->trackNumber() ) + " - " + track->fixedName();
+                            name = QString::number(
track->trackNumber() ) + " - " + artist + track->fixedName();
                         else
                             name = track->fixedName();
                     }


The first patch also includes changes to let the displayed tracks in the
album applet have a similar appearance as the tracks in the collection
browser.

With best regards,
Christopher Schwartz



More information about the Amarok mailing list