mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 11:20:22 +02:00
* Always show source's current friendly name, not a cached copy of it.
This commit is contained in:
@@ -539,12 +539,15 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
|
|||||||
bool status = !( !sti || sti->source().isNull() || !sti->source()->isOnline() );
|
bool status = !( !sti || sti->source().isNull() || !sti->source()->isOnline() );
|
||||||
QPixmap avatar( RESPATH "images/user-avatar.png" );
|
QPixmap avatar( RESPATH "images/user-avatar.png" );
|
||||||
QString tracks;
|
QString tracks;
|
||||||
|
QString name = index.data().toString();
|
||||||
int figWidth = 0;
|
int figWidth = 0;
|
||||||
|
|
||||||
if ( status && sti && !sti->source().isNull() )
|
if ( status && sti && !sti->source().isNull() )
|
||||||
{
|
{
|
||||||
tracks = QString::number( sti->source()->trackCount() );
|
tracks = QString::number( sti->source()->trackCount() );
|
||||||
figWidth = painter->fontMetrics().width( tracks );
|
figWidth = painter->fontMetrics().width( tracks );
|
||||||
|
|
||||||
|
name = sti->source()->friendlyName();
|
||||||
if ( !sti->source()->avatar().isNull() )
|
if ( !sti->source()->avatar().isNull() )
|
||||||
avatar = sti->source()->avatar();
|
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 );
|
QRect textRect = option.rect.adjusted( iconRect.width() + 8, 6, -figWidth - 24, 0 );
|
||||||
if ( status || sti->source().isNull() )
|
if ( status || sti->source().isNull() )
|
||||||
painter->setFont( bold );
|
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 );
|
painter->drawText( textRect, text );
|
||||||
|
|
||||||
QString desc = status ? sti->source()->textStatus() : tr( "Offline" );
|
QString desc = status ? sti->source()->textStatus() : tr( "Offline" );
|
||||||
|
Reference in New Issue
Block a user