mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-08 23:26:40 +02:00
Cleanup and move center of spinner down by 1 px
This commit is contained in:
@@ -35,11 +35,6 @@ AnimatedSpinner::AnimatedSpinner( QWidget *parent )
|
|||||||
, m_currentIndex( -1 )
|
, m_currentIndex( -1 )
|
||||||
{
|
{
|
||||||
init();
|
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();
|
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 )
|
if ( autoStart )
|
||||||
fadeIn();
|
fadeIn();
|
||||||
}
|
}
|
||||||
@@ -102,6 +80,28 @@ AnimatedSpinner::init()
|
|||||||
|
|
||||||
m_colors.resize( segmentCount() );
|
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();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ AnimatedSpinner::drawFrame( QPainter* p, const QRect& rect )
|
|||||||
|
|
||||||
p->setRenderHint(QPainter::Antialiasing, true);
|
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();
|
const qreal stepRadius = (360 + 2*m_armWidth) / segmentCount();
|
||||||
p->rotate( stepRadius );
|
p->rotate( stepRadius );
|
||||||
|
Reference in New Issue
Block a user