mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-25 02:09:48 +01:00
Cleanup and move center of spinner down by 1 px
This commit is contained in:
parent
7b901c18a9
commit
82240ff6c1
@ -35,11 +35,6 @@ AnimatedSpinner::AnimatedSpinner( QWidget *parent )
|
||||
, m_currentIndex( -1 )
|
||||
{
|
||||
init();
|
||||
m_radius = 10;
|
||||
m_armLength = sizeHint().width()/2 - m_radius;
|
||||
m_armWidth = 5;
|
||||
m_border = 3;
|
||||
m_armRect = QRect( m_radius, 0, m_armLength, m_armWidth );
|
||||
}
|
||||
|
||||
|
||||
@ -54,23 +49,6 @@ AnimatedSpinner::AnimatedSpinner( const QSize size, bool autoStart )
|
||||
|
||||
init();
|
||||
|
||||
if ( size.width() < 30 )
|
||||
{
|
||||
m_radius = 4;
|
||||
m_armLength = size.width()/2 - m_radius;
|
||||
m_armWidth = 2;
|
||||
m_border = 2;
|
||||
m_armRect = QRect( m_radius, 0, m_armLength, m_armWidth );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_radius = 10;
|
||||
m_armLength = size.width()/2 - m_radius;
|
||||
m_armWidth = 5;
|
||||
m_border = 3;
|
||||
m_armRect = QRect( m_radius, 0, m_armLength, m_armWidth );
|
||||
}
|
||||
|
||||
if ( autoStart )
|
||||
fadeIn();
|
||||
}
|
||||
@ -102,6 +80,28 @@ AnimatedSpinner::init()
|
||||
|
||||
m_colors.resize( segmentCount() );
|
||||
|
||||
QSize size;
|
||||
if ( parentWidget() )
|
||||
size = sizeHint();
|
||||
else
|
||||
size = m_pixmap.size();
|
||||
if ( size.width() < 30 )
|
||||
{
|
||||
m_radius = 4;
|
||||
m_armLength = size.width()/2 - m_radius;
|
||||
m_armWidth = 2;
|
||||
m_border = 2;
|
||||
m_armRect = QRect( m_radius, 0, m_armLength, m_armWidth );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_radius = 10;
|
||||
m_armLength = size.width()/2 - m_radius;
|
||||
m_armWidth = 5;
|
||||
m_border = 3;
|
||||
m_armRect = QRect( m_radius, 0, m_armLength, m_armWidth );
|
||||
}
|
||||
|
||||
hide();
|
||||
}
|
||||
|
||||
@ -150,7 +150,7 @@ AnimatedSpinner::drawFrame( QPainter* p, const QRect& rect )
|
||||
|
||||
p->setRenderHint(QPainter::Antialiasing, true);
|
||||
|
||||
p->translate( rect.center() ); // center
|
||||
p->translate( rect.center() + QPoint( 0, 1 ) ); // center
|
||||
|
||||
const qreal stepRadius = (360 + 2*m_armWidth) / segmentCount();
|
||||
p->rotate( stepRadius );
|
||||
|
Loading…
x
Reference in New Issue
Block a user