1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-23 17:29:42 +01:00

Revert "* QueryLabel now draws a fancier text in the AudioControls."

This reverts commit 452c5b7ccedd686fd5d5d559c778fe9f1bf11231.
This commit is contained in:
Christian Muehlhaeuser 2012-12-08 21:08:21 +01:00
parent c6c5007ab4
commit 8d6b4d1cd3
2 changed files with 6 additions and 40 deletions

View File

@ -365,36 +365,6 @@ QueryLabel::minimumSizeHint() const
}
void
QueryLabel::drawFancyText( QPainter* painter, const QRect& rect, const QString& text )
{
if ( m_align & Qt::AlignLeft )
{
painter->save();
QFont fnt = painter->font();
fnt.setStyleStrategy( QFont::ForceOutline );
QFontMetrics fm( fnt );
QPainterPath textPath;
textPath.addText( rect.topLeft() + QPoint( 0, fm.ascent() ), fnt, text );
QLinearGradient gradient( 0, 0, 0, 1 );
gradient.setCoordinateMode( QGradient::ObjectBoundingMode );
gradient.setColorAt( 0, painter->pen().color() );
gradient.setColorAt( 1, painter->pen().color().lighter() );
painter->setPen( QPen( gradient, 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin ) );
painter->setBrush( gradient );
painter->drawPath( textPath );
painter->restore();
}
else
painter->drawText( rect, m_align, text );
}
void
QueryLabel::paintEvent( QPaintEvent* event )
{
@ -407,7 +377,6 @@ QueryLabel::paintEvent( QPaintEvent* event )
p.save();
p.setRenderHint( QPainter::Antialiasing );
p.setRenderHint( QPainter::TextAntialiasing );
if ( m_hoverArea.width() )
{
@ -433,8 +402,7 @@ QueryLabel::paintEvent( QPaintEvent* event )
p.setBrush( palette().window() );
p.setPen( palette().color( foregroundRole() ) );
}
drawFancyText( &p, r, elidedText );
p.drawText( r, m_align, elidedText );
}
else
{
@ -458,7 +426,7 @@ QueryLabel::paintEvent( QPaintEvent* event )
p.setBrush( palette().highlight() );
}
drawFancyText( &p, r, artist()->name() );
p.drawText( r, m_align, artist()->name() );
r.adjust( artistX, 0, 0, 0 );
}
if ( m_type & Album )
@ -469,7 +437,7 @@ QueryLabel::paintEvent( QPaintEvent* event )
if ( m_type & Artist )
{
drawFancyText( &p, r, DASH );
p.drawText( r, m_align, DASH );
r.adjust( dashX, 0, 0, 0 );
}
if ( m_hoverType == Album )
@ -478,7 +446,7 @@ QueryLabel::paintEvent( QPaintEvent* event )
p.setBrush( palette().highlight() );
}
drawFancyText( &p, r, album()->name() );
p.drawText( r, m_align, album()->name() );
r.adjust( albumX, 0, 0, 0 );
}
if ( m_type & Track )
@ -489,7 +457,7 @@ QueryLabel::paintEvent( QPaintEvent* event )
if ( m_type & Artist || m_type & Album )
{
drawFancyText( &p, r, DASH );
p.drawText( r, m_align, DASH );
r.adjust( dashX, 0, 0, 0 );
}
if ( m_hoverType == Track )
@ -498,7 +466,7 @@ QueryLabel::paintEvent( QPaintEvent* event )
p.setBrush( palette().highlight() );
}
drawFancyText( &p, r, track() );
p.drawText( r, m_align, track() );
r.adjust( trackX, 0, 0, 0 );
}

View File

@ -104,8 +104,6 @@ signals:
void queryChanged( const Tomahawk::query_ptr& query );
protected:
void drawFancyText( QPainter* painter, const QRect& rect, const QString& text );
virtual void contextMenuEvent( QContextMenuEvent* event );
virtual void mousePressEvent( QMouseEvent* event );