Commit fdd60326 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

qt4: input_slider: Delay the loading slider animation start

In order to avoid flickering on local content
parent 98a4529f
...@@ -153,10 +153,15 @@ SeekSlider::SeekSlider( Qt::Orientation q, QWidget *_parent, bool _static ) ...@@ -153,10 +153,15 @@ SeekSlider::SeekSlider( Qt::Orientation q, QWidget *_parent, bool _static )
hideHandleTimer->setSingleShot( true ); hideHandleTimer->setSingleShot( true );
hideHandleTimer->setInterval( FADEOUTDELAY ); hideHandleTimer->setInterval( FADEOUTDELAY );
startAnimLoadingTimer = new QTimer( this );
startAnimLoadingTimer->setSingleShot( true );
startAnimLoadingTimer->setInterval( 500 );
CONNECT( MainInputManager::getInstance(), inputChanged( bool ), this , inputUpdated( bool ) ); CONNECT( MainInputManager::getInstance(), inputChanged( bool ), this , inputUpdated( bool ) );
CONNECT( this, sliderMoved( int ), this, startSeekTimer() ); CONNECT( this, sliderMoved( int ), this, startSeekTimer() );
CONNECT( seekLimitTimer, timeout(), this, updatePos() ); CONNECT( seekLimitTimer, timeout(), this, updatePos() );
CONNECT( hideHandleTimer, timeout(), this, hideHandle() ); CONNECT( hideHandleTimer, timeout(), this, hideHandle() );
CONNECT( startAnimLoadingTimer, timeout(), this, startAnimLoading() );
mTimeTooltip->installEventFilter( this ); mTimeTooltip->installEventFilter( this );
} }
...@@ -232,6 +237,7 @@ void SeekSlider::updateBuffering( float f_buffering_ ) ...@@ -232,6 +237,7 @@ void SeekSlider::updateBuffering( float f_buffering_ )
f_buffering = f_buffering_; f_buffering = f_buffering_;
if ( f_buffering > 0.0 || isEnabled() ) { if ( f_buffering > 0.0 || isEnabled() ) {
animLoading->stop(); animLoading->stop();
startAnimLoadingTimer->stop();
mLoading = 0.0; mLoading = 0.0;
} }
repaint(); repaint();
...@@ -241,11 +247,12 @@ void SeekSlider::inputUpdated( bool b_has_input ) ...@@ -241,11 +247,12 @@ void SeekSlider::inputUpdated( bool b_has_input )
{ {
if ( b_has_input == false ) { if ( b_has_input == false ) {
animLoading->stop(); animLoading->stop();
startAnimLoadingTimer->stop();
mLoading = 0.0; mLoading = 0.0;
repaint(); repaint();
} }
else if ( f_buffering == 0.0 && !isEnabled() ) else if ( f_buffering == 0.0 && !isEnabled() )
animLoading->start(); startAnimLoadingTimer->start();
} }
void SeekSlider::processReleasedButton() void SeekSlider::processReleasedButton()
...@@ -530,6 +537,10 @@ void SeekSlider::hideHandle() ...@@ -530,6 +537,10 @@ void SeekSlider::hideHandle()
animHandle->start(); animHandle->start();
} }
void SeekSlider::startAnimLoading()
{
animLoading->start();
}
/* This work is derived from Amarok's work under GPLv2+ /* This work is derived from Amarok's work under GPLv2+
- Mark Kretschmann - Mark Kretschmann
......
...@@ -110,6 +110,7 @@ private: ...@@ -110,6 +110,7 @@ private:
QPropertyAnimation *animHandle; QPropertyAnimation *animHandle;
QSequentialAnimationGroup *animLoading; QSequentialAnimationGroup *animLoading;
QTimer *hideHandleTimer; QTimer *hideHandleTimer;
QTimer *startAnimLoadingTimer;
public slots: public slots:
void setPosition( float, int64_t, int ); void setPosition( float, int64_t, int );
...@@ -121,6 +122,7 @@ private slots: ...@@ -121,6 +122,7 @@ private slots:
void startSeekTimer(); void startSeekTimer();
void updatePos(); void updatePos();
void inputUpdated( bool ); void inputUpdated( bool );
void startAnimLoading();
signals: signals:
void sliderDragged( float ); void sliderDragged( float );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment