[vlc-commits] Qt: SeekSlider: don't show buffering < 1s

Francois Cartegnie git at videolan.org
Mon Mar 10 20:46:05 CET 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Mar 10 20:41:05 2014 +0100| [0be748f9e267451e90370d0553e4cb4528d2e919] | committer: Francois Cartegnie

Qt: SeekSlider: don't show buffering < 1s

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

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

diff --git a/modules/gui/qt4/util/input_slider.cpp b/modules/gui/qt4/util/input_slider.cpp
index fd2f24e..505b8a1 100644
--- a/modules/gui/qt4/util/input_slider.cpp
+++ b/modules/gui/qt4/util/input_slider.cpp
@@ -197,6 +197,8 @@ void SeekSlider::updatePos()
 
 void SeekSlider::updateBuffering( float f_buffering_ )
 {
+    if ( f_buffering_ < f_buffering )
+        bufferingStart = QTime::currentTime();
     f_buffering = f_buffering_;
     repaint();
 }
@@ -386,7 +388,10 @@ void SeekSlider::paintEvent( QPaintEvent *ev )
     {
         SeekStyle::SeekStyleOption option;
         option.initFrom( this );
-        option.buffering = f_buffering;
+        if ( QTime::currentTime() > bufferingStart.addSecs( 1 ) )
+            option.buffering = f_buffering;
+        else
+            option.buffering = 1.0;
         option.length = inputLength;
         option.animate = ( animHandle->state() == QAbstractAnimation::Running
                            || hideHandleTimer->isActive() );
diff --git a/modules/gui/qt4/util/input_slider.hpp b/modules/gui/qt4/util/input_slider.hpp
index 3f42bb3..c8e48fe 100644
--- a/modules/gui/qt4/util/input_slider.hpp
+++ b/modules/gui/qt4/util/input_slider.hpp
@@ -36,6 +36,7 @@
 
 #include <QSlider>
 #include <QPainter>
+#include <QTime>
 
 #define MSTRTIME_MAX_SIZE 22
 
@@ -85,6 +86,7 @@ private:
     QTimer *seekLimitTimer;
     TimeTooltip *mTimeTooltip;
     float f_buffering;
+    QTime bufferingStart;
     SeekPoints* chapters;
     bool b_classic;
     bool b_seekable;



More information about the vlc-commits mailing list