From ae36ce956a4d8fcd4098f419395fe754e6caca89 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Fri, 22 Apr 2011 02:08:58 +0200 Subject: [PATCH] * Always show source's current friendly name, not a cached copy of it. --- src/sourcetree/sourcetreeview.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sourcetree/sourcetreeview.cpp b/src/sourcetree/sourcetreeview.cpp index 716d2cd18..16697299b 100644 --- a/src/sourcetree/sourcetreeview.cpp +++ b/src/sourcetree/sourcetreeview.cpp @@ -539,12 +539,15 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co bool status = !( !sti || sti->source().isNull() || !sti->source()->isOnline() ); QPixmap avatar( RESPATH "images/user-avatar.png" ); QString tracks; + QString name = index.data().toString(); int figWidth = 0; if ( status && sti && !sti->source().isNull() ) { tracks = QString::number( sti->source()->trackCount() ); figWidth = painter->fontMetrics().width( tracks ); + + name = sti->source()->friendlyName(); if ( !sti->source()->avatar().isNull() ) avatar = sti->source()->avatar(); } @@ -560,7 +563,7 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co QRect textRect = option.rect.adjusted( iconRect.width() + 8, 6, -figWidth - 24, 0 ); if ( status || sti->source().isNull() ) painter->setFont( bold ); - QString text = painter->fontMetrics().elidedText( index.data().toString(), Qt::ElideRight, textRect.width() ); + QString text = painter->fontMetrics().elidedText( name, Qt::ElideRight, textRect.width() ); painter->drawText( textRect, text ); QString desc = status ? sti->source()->textStatus() : tr( "Offline" );