[vlc-devel] commit: Qt: fix a sticking slider issue. (Jean-Baptiste Kempf )

git version control git at videolan.org
Sun Jan 10 00:12:45 CET 2010


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun Jan 10 00:12:09 2010 +0100| [d14bb18c4a794844b52c746a02b721f852855ccb] | committer: Jean-Baptiste Kempf 

Qt: fix a sticking slider issue.

Close #3105

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

 modules/gui/qt4/util/input_slider.cpp |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/modules/gui/qt4/util/input_slider.cpp b/modules/gui/qt4/util/input_slider.cpp
index c2d861c..ed37c94 100644
--- a/modules/gui/qt4/util/input_slider.cpp
+++ b/modules/gui/qt4/util/input_slider.cpp
@@ -41,18 +41,23 @@ InputSlider::InputSlider( Qt::Orientation q, QWidget *_parent ) :
                                  QSlider( q, _parent )
 {
     b_isSliding = false;
-    lastSeeked = 0;
+    lastSeeked  = 0;
+
     timer = new QTimer(this);
     timer->setSingleShot(true);
-    setMinimum( 0 );
-    setMouseTracking(true);
-    setMaximum( 1000 );
+
+    /* Properties */
+    setRange( 0, 1000 );
     setSingleStep( 2 );
     setPageStep( 10 );
+    setMouseTracking(true);
     setTracking( true );
+    setFocusPolicy( Qt::NoFocus );
+
+    /* Init to 0 */
     setPosition( -1.0, 0, 0 );
     secstotimestr( psz_length, 0 );
-    setFocusPolicy( Qt::NoFocus );
+
     CONNECT( this, valueChanged(int), this, userDrag( int ) );
     CONNECT( timer, timeout(), this, seekTick() );
 }
@@ -60,7 +65,10 @@ InputSlider::InputSlider( Qt::Orientation q, QWidget *_parent ) :
 void InputSlider::setPosition( float pos, int a, int b )
 {
     if( pos == -1.0 )
+    {
         setEnabled( false );
+        b_isSliding = false;
+    }
     else
         setEnabled( true );
 
@@ -73,12 +81,13 @@ void InputSlider::setPosition( float pos, int a, int b )
 void InputSlider::userDrag( int new_value )
 {
     if( b_isSliding && !timer->isActive() )
-            timer->start( 150 );
+        timer->start( 150 );
 }
 
 void InputSlider::seekTick()
 {
-    if( value() != lastSeeked ) {
+    if( value() != lastSeeked )
+    {
         lastSeeked = value();
         float f_pos = (float)(lastSeeked)/1000.0;
         emit sliderDragged( f_pos );




More information about the vlc-devel mailing list