[vlc-commits] Qt: fix seekpoint bar when first chapter does not start at 0

Jean-Baptiste Kempf git at videolan.org
Wed Feb 4 16:04:57 CET 2015


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Feb  4 16:04:16 2015 +0100| [4e0b6089d3c10e625501983f6feed1f95179107d] | committer: Jean-Baptiste Kempf

Qt: fix seekpoint bar when first chapter does not start at 0

Close #12416

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

 modules/gui/qt4/util/input_slider.cpp |   27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/modules/gui/qt4/util/input_slider.cpp b/modules/gui/qt4/util/input_slider.cpp
index ee37a1c..d67f2b8 100644
--- a/modules/gui/qt4/util/input_slider.cpp
+++ b/modules/gui/qt4/util/input_slider.cpp
@@ -348,23 +348,22 @@ void SeekSlider::mouseMoveEvent( QMouseEvent *event )
 
         if ( orientation() == Qt::Horizontal ) /* TODO: vertical */
         {
-                QList<SeekPoint> points = chapters->getPoints();
-                int i_selected = -1;
-                bool b_startsnonzero = false;
-                if ( points.count() > 0 )
-                    b_startsnonzero = ( points.at(0).time > 0 );
-                for( int i = 0 ; i < points.count() ; i++ )
-                {
-                    int x = points.at(i).time / 1000000.0 / inputLength * size().width();
-                    if ( event->x() >= x )
-                        i_selected = i + ( ( b_startsnonzero )? 1 : 0 );
-                }
-                if ( i_selected >= 0 && i_selected < points.size() )
-                    chapterLabel = points.at( i_selected ).name;
+            QList<SeekPoint> points = chapters->getPoints();
+            int i_selected = -1;
+            for( int i = 0 ; i < points.count() ; i++ )
+            {
+                int x = points.at(i).time / 1000000.0 / inputLength * size().width();
+                if ( event->x() >= x )
+                    i_selected = i;
+            }
+            if ( i_selected >= 0 && i_selected < points.size() )
+            {
+                chapterLabel = points.at( i_selected ).name;
+            }
         }
 
         QPoint target( event->globalX() - ( event->x() - posX ),
-                  QWidget::mapToGlobal( QPoint( 0, 0 ) ).y() );
+                QWidget::mapToGlobal( QPoint( 0, 0 ) ).y() );
         if( likely( size().width() > handleLength() ) ) {
             secstotimestr( psz_length, ( ( posX - margin ) * inputLength ) / ( size().width() - handleLength() ) );
             mTimeTooltip->setTip( target, psz_length, chapterLabel );



More information about the vlc-commits mailing list