From 265c1277fb52806403086b43cad3bce9a4d05081 Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Mon, 22 Oct 2012 11:23:30 +0200 Subject: [PATCH] Make playlist description text nicer. --- src/libtomahawk/playlist/PlaylistModel.cpp | 27 +++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/libtomahawk/playlist/PlaylistModel.cpp b/src/libtomahawk/playlist/PlaylistModel.cpp index 9047cbf25..e59d43268 100644 --- a/src/libtomahawk/playlist/PlaylistModel.cpp +++ b/src/libtomahawk/playlist/PlaylistModel.cpp @@ -81,9 +81,30 @@ PlaylistModel::loadPlaylist( const Tomahawk::playlist_ptr& playlist, bool loadEn setReadOnly( !m_playlist->author()->isLocal() ); setTitle( playlist->title() ); - setDescription( tr( "A playlist by %1, created %2" ) - .arg( playlist->creator().isEmpty() ? ( playlist->author()->isLocal() ? tr( "you" ) : playlist->author()->friendlyName() ) : playlist->creator() ) - .arg( TomahawkUtils::ageToString( QDateTime::fromTime_t( playlist->createdOn() ), true ) ) ); + + QString age = TomahawkUtils::ageToString( QDateTime::fromTime_t( playlist->createdOn() ), true ); + QString desc; + if ( playlist->creator().isEmpty() ) + { + if ( playlist->author()->isLocal() ) + { + desc = tr( "A playlist you created %1." ) + .arg( age ); + } + else + { + desc = tr( "A playlist by %1, created %2." ) + .arg( playlist->author()->friendlyName() ) + .arg( age ); + } + } + else + { + desc = tr( "A playlist by %1, created %2." ) + .arg( playlist->creator() ) + .arg( age ); + } + setDescription( desc ); m_isTemporary = false; emit playlistChanged();