From 807ae19b2de1e1144a076d2c5c2d8cb7f7b19431 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sat, 23 Aug 2014 13:11:44 +0200 Subject: [PATCH] * Simplify sidebar delegate code. --- src/tomahawk/sourcetree/SourceDelegate.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/tomahawk/sourcetree/SourceDelegate.cpp b/src/tomahawk/sourcetree/SourceDelegate.cpp index 81c791e0f..db3d52caf 100644 --- a/src/tomahawk/sourcetree/SourceDelegate.cpp +++ b/src/tomahawk/sourcetree/SourceDelegate.cpp @@ -242,14 +242,11 @@ SourceDelegate::paintCollection( QPainter* painter, const QStyleOptionViewItem& SourceItem* colItem = qobject_cast< SourceItem* >( item ); Q_ASSERT( colItem ); - bool status = !( !colItem || colItem->source().isNull() || !colItem->source()->isOnline() ); + bool status = !( !colItem->source() || !colItem->source()->isOnline() ); - if ( !colItem->source()->isLocal() ) + if ( colItem->source() && !colItem->source()->isLocal() ) { - if ( !colItem->source().isNull() && colItem->source()->isLocal() ) - shouldDrawDropHint = false; //can't send tracks to our own inbox - - if ( status && colItem && !colItem->source().isNull() ) + if ( status ) { tracks = QString::number( colItem->source()->trackCount() ); figWidth = painter->fontMetrics().width( tracks ); @@ -414,10 +411,8 @@ SourceDelegate::paintCollection( QPainter* painter, const QStyleOptionViewItem& else { QRect figRect = option.rect.adjusted( option.rect.width() - figWidth - 16, 0, -14, -option.rect.height() + option.fontMetrics.height() * 1.1 ); - int hd = ( option.rect.height() - figRect.height() ) / 2; figRect.adjust( 0, hd, 0, hd ); - painter->drawText( figRect, tracks, QTextOption( Qt::AlignVCenter | Qt::AlignRight ) ); } }