[vlc-commits] Qt: SeekPoints / Input Slider: fix behaviour for 0 timed seekpoint
Francois Cartegnie
git at videolan.org
Fri Dec 9 23:14:45 CET 2011
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Dec 9 21:49:28 2011 +0100| [76ab0c709e6cd45ffe8e0b6d12f437501c58b67c] | committer: Francois Cartegnie
Qt: SeekPoints / Input Slider: fix behaviour for 0 timed seekpoint
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=76ab0c709e6cd45ffe8e0b6d12f437501c58b67c
---
modules/gui/qt4/adapters/seekpoints.cpp | 13 +++++++++----
modules/gui/qt4/util/input_slider.cpp | 10 ++++++++--
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/modules/gui/qt4/adapters/seekpoints.cpp b/modules/gui/qt4/adapters/seekpoints.cpp
index 481d89e..81400e5 100644
--- a/modules/gui/qt4/adapters/seekpoints.cpp
+++ b/modules/gui/qt4/adapters/seekpoints.cpp
@@ -53,10 +53,15 @@ void SeekPoints::update()
/* lock here too, as update event is triggered by an external thread */
if ( !access() ) return;
pointsList.clear();
- for ( int i=0; i<p_title->i_seekpoint ; i++ )
- if ( p_title->seekpoint[i]->i_time_offset > 0 )
- pointsList << SeekPoint( p_title->seekpoint[i] );
-
+ if ( p_title->i_seekpoint > 0 )
+ {
+ /* first check the last point to see if we have filled time offsets (> 0) */
+ if ( p_title->seekpoint[p_title->i_seekpoint - 1]->i_time_offset > 0 )
+ {
+ for ( int i=0; i<p_title->i_seekpoint ; i++ )
+ pointsList << SeekPoint( p_title->seekpoint[i] );
+ }
+ }
vlc_input_title_Delete( p_title );
release();
}
diff --git a/modules/gui/qt4/util/input_slider.cpp b/modules/gui/qt4/util/input_slider.cpp
index 382cfb4..ff64014 100644
--- a/modules/gui/qt4/util/input_slider.cpp
+++ b/modules/gui/qt4/util/input_slider.cpp
@@ -200,6 +200,9 @@ void SeekSlider::mousePressEvent( QMouseEvent* event )
{
QList<SeekPoint> points = chapters->getPoints();
int i_selected = -1;
+ bool b_startsnonzero = false; /* as we always starts at 1 */
+ if ( points.count() > 0 ) /* do we need an extra offset ? */
+ b_startsnonzero = ( points.at(0).time > 0 );
int i_min_diff = i_width + 1;
for( int i = 0 ; i < points.count() ; i++ )
{
@@ -208,7 +211,7 @@ void SeekSlider::mousePressEvent( QMouseEvent* event )
if ( diff_x < i_min_diff )
{
i_min_diff = diff_x;
- i_selected = i;
+ i_selected = i + ( ( b_startsnonzero )? 1 : 0 );
} else break;
}
if ( i_selected && i_min_diff < 4 ) // max 4px around mark
@@ -248,11 +251,14 @@ void SeekSlider::mouseMoveEvent( QMouseEvent *event )
{
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;
+ i_selected = i + ( ( b_startsnonzero )? 1 : 0 );
}
if ( i_selected >= 0 )
chapterLabel = points.at( i_selected ).name;
More information about the vlc-commits
mailing list