Commit 9a706d60 authored by Steven Sheehy's avatar Steven Sheehy Committed by Jean-Baptiste Kempf

Improving the accuracy of the A to B looping in the qt4 interface.

parent cc2b055b
......@@ -289,8 +289,8 @@ QWidget *AbstractController::createWidget( buttonType_e button, int options )
InputSlider *slider = new InputSlider( Qt::Horizontal, NULL );
/* Update the position when the IM has changed */
CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
slider, setPosition( float, int, int ) );
CONNECT( THEMIM->getIM(), positionUpdated( float, int64_t, int ),
slider, setPosition( float, int64_t, int ) );
/* And update the IM, when the position has changed */
CONNECT( slider, sliderDragged( float ),
THEMIM->getIM(), sliderUpdate( float ) );
......
......@@ -601,11 +601,11 @@ TimeLabel::TimeLabel( intf_thread_t *_p_intf ) :QLabel(), p_intf( _p_intf )
CONNECT( THEMIM->getIM(), cachingChanged( float ),
this, setCaching( float ) );
CONNECT( THEMIM->getIM(), positionUpdated( float, int, int ),
this, setDisplayPosition( float, int, int ) );
CONNECT( THEMIM->getIM(), positionUpdated( float, int64_t, int ),
this, setDisplayPosition( float, int64_t, int ) );
}
void TimeLabel::setDisplayPosition( float pos, int time, int length )
void TimeLabel::setDisplayPosition( float pos, int64_t t, int length )
{
if( pos == -1.f )
{
......@@ -613,6 +613,7 @@ void TimeLabel::setDisplayPosition( float pos, int time, int length )
return;
}
int time = t / 1000000;
char psz_length[MSTRTIME_MAX_SIZE], psz_time[MSTRTIME_MAX_SIZE];
secstotimestr( psz_length, length );
secstotimestr( psz_time, ( b_remainingTime && length ) ? length - time
......
......@@ -144,7 +144,7 @@ private:
signals:
void timeLabelDoubleClicked();
private slots:
void setDisplayPosition( float pos, int time, int length );
void setDisplayPosition( float pos, int64_t time, int length );
void setCaching( float );
};
......
......@@ -373,10 +373,11 @@ static int VbiEvent( vlc_object_t *, const char *,
void InputManager::UpdatePosition()
{
/* Update position */
int i_length, i_time; /* Int is enough, since we store seconds */
int i_length;
int64_t i_time;
float f_pos;
i_length = var_GetTime( p_input , "length" ) / 1000000;
i_time = var_GetTime( p_input , "time") / 1000000;
i_time = var_GetTime( p_input , "time");
f_pos = var_GetFloat( p_input , "position" );
emit positionUpdated( f_pos, i_time, i_length );
}
......@@ -861,26 +862,25 @@ void InputManager::setAtoB()
{
timeB = var_GetTime( THEMIM->getInput(), "time" );
var_SetTime( THEMIM->getInput(), "time" , timeA );
CONNECT( this, positionUpdated( float, int, int ),
this, AtoBLoop( float, int, int ) );
CONNECT( this, positionUpdated( float, int64_t, int ),
this, AtoBLoop( float, int64_t, int ) );
}
else
{
timeA = 0;
timeB = 0;
disconnect( this, SIGNAL( positionUpdated( float, int, int ) ),
this, SLOT( AtoBLoop( float, int, int ) ) );
disconnect( this, SIGNAL( positionUpdated( float, int64_t, int ) ),
this, SLOT( AtoBLoop( float, int64_t, int ) ) );
}
emit AtoBchanged( (timeA != 0 ), (timeB != 0 ) );
}
/* Function called regularly when in an AtoB loop */
void InputManager::AtoBLoop( float, int i_time, int )
void InputManager::AtoBLoop( float, int64_t i_time, int )
{
if( timeB )
{
if( ( i_time >= (int)( timeB/1000000 ) )
|| ( i_time < (int)( timeA/1000000 ) ) )
if( i_time >= timeB || i_time < timeA )
var_SetTime( THEMIM->getInput(), "time" , timeA );
}
}
......
......@@ -194,11 +194,11 @@ public slots:
private slots:
void togglePlayPause();
void AtoBLoop( float, int, int );
void AtoBLoop( float, int64_t, int );
signals:
/// Send new position, new time and new length
void positionUpdated( float , int, int );
void positionUpdated( float , int64_t, int );
void rateChanged( int );
void nameChanged( const QString& );
/// Used to signal whether we should show navigation buttons
......
......@@ -62,7 +62,7 @@ InputSlider::InputSlider( Qt::Orientation q, QWidget *_parent ) :
CONNECT( timer, timeout(), this, seekTick() );
}
void InputSlider::setPosition( float pos, int a, int b )
void InputSlider::setPosition( float pos, int64_t a, int b )
{
if( pos == -1.0 )
{
......
......@@ -54,7 +54,7 @@ private:
QTimer *timer;
public slots:
void setPosition( float, int, int );
void setPosition( float, int64_t, int );
private slots:
void userDrag( int );
void seekTick();
......
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