diff --git a/src/libtomahawk/playlist/AlbumItemDelegate.cpp b/src/libtomahawk/playlist/AlbumItemDelegate.cpp index fa86e6d08..dacb8e9ce 100644 --- a/src/libtomahawk/playlist/AlbumItemDelegate.cpp +++ b/src/libtomahawk/playlist/AlbumItemDelegate.cpp @@ -43,10 +43,11 @@ using namespace Tomahawk; -AlbumItemDelegate::AlbumItemDelegate( TrackView* parent, PlayableProxyModel* proxy ) +AlbumItemDelegate::AlbumItemDelegate( TrackView* parent, PlayableProxyModel* proxy, bool showArtist ) : PlaylistItemDelegate( parent, proxy ) , m_view( parent ) , m_model( proxy ) + , m_showArtist( showArtist ) { } @@ -119,7 +120,12 @@ AlbumItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, leftRect.setWidth( leftRect.width() - rightRect.width() ); } - const QString text = painter->fontMetrics().elidedText( track->track(), Qt::ElideRight, leftRect.width() ); + QString rawText = track->track(); + if ( m_showArtist ) + { + rawText = QString( "%1 - %2" ).arg( track->artist() ).arg( rawText ); + } + const QString text = painter->fontMetrics().elidedText( rawText, Qt::ElideRight, leftRect.width() ); painter->setPen( opt.palette.text().color() ); painter->drawText( leftRect, text, m_centerOption ); diff --git a/src/libtomahawk/playlist/AlbumItemDelegate.h b/src/libtomahawk/playlist/AlbumItemDelegate.h index dccdbc5b8..4d1789424 100644 --- a/src/libtomahawk/playlist/AlbumItemDelegate.h +++ b/src/libtomahawk/playlist/AlbumItemDelegate.h @@ -40,7 +40,7 @@ class DLLEXPORT AlbumItemDelegate : public PlaylistItemDelegate Q_OBJECT public: - AlbumItemDelegate( TrackView* parent = 0, PlayableProxyModel* proxy = 0 ); + AlbumItemDelegate( TrackView* parent = 0, PlayableProxyModel* proxy = 0, bool showArtist = false ); virtual QSize sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const; @@ -50,6 +50,7 @@ protected: private: TrackView* m_view; PlayableProxyModel* m_model; + bool m_showArtist; }; #endif // ALBUMITEMDELEGATE_H