[vlc-commits] qt4: input_slider: Delay the loading slider animation start

Hugo Beauzée-Luyssen git at videolan.org
Tue Dec 8 11:01:47 CET 2015


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Dec  7 16:47:14 2015 +0100| [fdd603268352a1adda07ece95ab82c65f43899d2] | committer: Hugo Beauzée-Luyssen

qt4: input_slider: Delay the loading slider animation start

In order to avoid flickering on local content

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fdd603268352a1adda07ece95ab82c65f43899d2
---

 modules/gui/qt4/util/input_slider.cpp |   13 ++++++++++++-
 modules/gui/qt4/util/input_slider.hpp |    2 ++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/modules/gui/qt4/util/input_slider.cpp b/modules/gui/qt4/util/input_slider.cpp
index 7935982..2edb423 100644
--- a/modules/gui/qt4/util/input_slider.cpp
+++ b/modules/gui/qt4/util/input_slider.cpp
@@ -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
diff --git a/modules/gui/qt4/util/input_slider.hpp b/modules/gui/qt4/util/input_slider.hpp
index 5e4b203..50d8586 100644
--- a/modules/gui/qt4/util/input_slider.hpp
+++ b/modules/gui/qt4/util/input_slider.hpp
@@ -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 );



More information about the vlc-commits mailing list