Commit 9314309f authored by Francois Cartegnie's avatar Francois Cartegnie Committed by Jean-Baptiste Kempf

Qt: SeekPoints / Input Slider: fix behaviour for 0 timed seekpoint

(cherry picked from commit 76ab0c709e6cd45ffe8e0b6d12f437501c58b67c)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 4f2a571e
......@@ -53,10 +53,15 @@ void SeekPoints::update()
/* lock here too, as update event is triggered by an external thread */
if ( !access() ) return;
pointsList.clear();
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++ )
if ( p_title->seekpoint[i]->i_time_offset > 0 )
pointsList << SeekPoint( p_title->seekpoint[i] );
}
}
vlc_input_title_Delete( p_title );
release();
}
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment