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 )
hideHandleTimer->setSingleShot( true );
hideHandleTimer->setInterval( FADEOUTDELAY );
startAnimLoadingTimer = new QTimer( this );
startAnimLoadingTimer->setSingleShot( true );
startAnimLoadingTimer->setInterval( 500 );
CONNECT( MainInputManager::getInstance(), inputChanged( bool ), this , inputUpdated( bool ) );
CONNECT( this, sliderMoved( int ), this, startSeekTimer() );
CONNECT( seekLimitTimer, timeout(), this, updatePos() );
CONNECT( hideHandleTimer, timeout(), this, hideHandle() );
CONNECT( startAnimLoadingTimer, timeout(), this, startAnimLoading() );
mTimeTooltip->installEventFilter( this );
}
......@@ -232,6 +237,7 @@ void SeekSlider::updateBuffering( float f_buffering_ )
f_buffering = f_buffering_;
if ( f_buffering > 0.0 || isEnabled() ) {
animLoading->stop();
startAnimLoadingTimer->stop();
mLoading = 0.0;
}
repaint();
......@@ -241,11 +247,12 @@ void SeekSlider::inputUpdated( bool b_has_input )
{
if ( b_has_input == false ) {
animLoading->stop();
startAnimLoadingTimer->stop();
mLoading = 0.0;
repaint();
}
else if ( f_buffering == 0.0 && !isEnabled() )
animLoading->start();
startAnimLoadingTimer->start();
}
void SeekSlider::processReleasedButton()
......@@ -530,6 +537,10 @@ void SeekSlider::hideHandle()
animHandle->start();
}
void SeekSlider::startAnimLoading()
{
animLoading->start();
}
/* This work is derived from Amarok's work under GPLv2+
- Mark Kretschmann
......
......@@ -110,6 +110,7 @@ private:
QPropertyAnimation *animHandle;
QSequentialAnimationGroup *animLoading;
QTimer *hideHandleTimer;
QTimer *startAnimLoadingTimer;
public slots:
void setPosition( float, int64_t, int );
......@@ -121,6 +122,7 @@ private slots:
void startSeekTimer();
void updatePos();
void inputUpdated( bool );
void startAnimLoading();
signals:
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