1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-23 14:13:57 +02:00

Make track title primary info in track charts and top loved and lighten text of secondary info. Muesli, like?

This commit is contained in:
Jason Herskowitz
2012-03-18 18:30:13 -04:00
parent 44a1adb922
commit 5b1aa81d1d
2 changed files with 7 additions and 6 deletions

View File

@@ -187,7 +187,7 @@ PlaylistChartItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
QFont smallBoldFont = opt.font; QFont smallBoldFont = opt.font;
smallBoldFont.setPixelSize( 12 ); smallBoldFont.setPixelSize( 12 );
smallBoldFont.setWeight( 80 ); smallBoldFont.setWeight( 60 );
QFont durationFont = opt.font; QFont durationFont = opt.font;
durationFont.setPixelSize( 12 ); durationFont.setPixelSize( 12 );
@@ -236,11 +236,11 @@ PlaylistChartItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
QRect rightRect = r.adjusted( r.width() - 40, 0, 0, 0 ); QRect rightRect = r.adjusted( r.width() - 40, 0, 0, 0 );
painter->setFont( boldFont ); painter->setFont( boldFont );
QString text = painter->fontMetrics().elidedText( artist, Qt::ElideRight, leftRect.width() ); QString text = painter->fontMetrics().elidedText( track, Qt::ElideRight, leftRect.width() );
painter->drawText( leftRect, text, m_topOption ); painter->drawText( leftRect, text, m_topOption );
painter->setFont( smallBoldFont ); painter->setFont( smallBoldFont );
text = painter->fontMetrics().elidedText( track, Qt::ElideRight, leftRect.width() ); text = painter->fontMetrics().elidedText( artist, Qt::ElideRight, leftRect.width() );
painter->drawText( index.row() >= 10 ? leftRect : leftRect.adjusted( 0, painter->fontMetrics().height() + 6, 0, 0 ), text, index.row() >= 10 ? m_bottomOption : m_topOption ); painter->drawText( index.row() >= 10 ? leftRect : leftRect.adjusted( 0, painter->fontMetrics().height() + 6, 0, 0 ), text, index.row() >= 10 ? m_bottomOption : m_topOption );
if ( duration > 0 ) if ( duration > 0 )

View File

@@ -223,7 +223,7 @@ PlaylistLargeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
QFont smallBoldFont = opt.font; QFont smallBoldFont = opt.font;
smallBoldFont.setPixelSize( 12 ); smallBoldFont.setPixelSize( 12 );
smallBoldFont.setBold( true ); smallBoldFont.setBold( true );
smallBoldFont.setWeight( 80 ); smallBoldFont.setWeight( 60 );
QFont smallFont = opt.font; QFont smallFont = opt.font;
smallFont.setPixelSize( 10 ); smallFont.setPixelSize( 10 );
@@ -233,14 +233,15 @@ PlaylistLargeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
QRect rightRect = r.adjusted( r.width() - 40, 0, 0, 0 ); QRect rightRect = r.adjusted( r.width() - 40, 0, 0, 0 );
painter->setFont( boldFont ); painter->setFont( boldFont );
QString text = painter->fontMetrics().elidedText( artist, Qt::ElideRight, leftRect.width() ); QString text = painter->fontMetrics().elidedText( track, Qt::ElideRight, leftRect.width() );
painter->drawText( leftRect, text, m_topOption ); painter->drawText( leftRect, text, m_topOption );
painter->setFont( smallBoldFont ); painter->setFont( smallBoldFont );
text = painter->fontMetrics().elidedText( track, Qt::ElideRight, leftRect.width() ); text = painter->fontMetrics().elidedText( artist, Qt::ElideRight, leftRect.width() );
painter->drawText( leftRect.adjusted( 0, 19, 0, 0 ), text, m_topOption ); painter->drawText( leftRect.adjusted( 0, 19, 0, 0 ), text, m_topOption );
painter->setFont( smallFont ); painter->setFont( smallFont );
painter->setPen( Qt::gray );
QTextDocument textDoc; QTextDocument textDoc;
textDoc.setHtml( lowerText ); textDoc.setHtml( lowerText );
textDoc.setDocumentMargin( 0 ); textDoc.setDocumentMargin( 0 );