Commit 9b0bfc02 authored by Francois Cartegnie's avatar Francois Cartegnie

Qt: adv options: fix RTL handling for synchronization

parent 553fa2da
...@@ -1463,25 +1463,36 @@ void Spatializer::addCallbacks( vlc_object_t *p_aout ) ...@@ -1463,25 +1463,36 @@ void Spatializer::addCallbacks( vlc_object_t *p_aout )
#define SUBSDELAY_MODE_RELATIVE_SOURCE_DELAY 1 #define SUBSDELAY_MODE_RELATIVE_SOURCE_DELAY 1
#define SUBSDELAY_MODE_RELATIVE_SOURCE_CONTENT 2 #define SUBSDELAY_MODE_RELATIVE_SOURCE_CONTENT 2
SyncWidget::SyncWidget( QWidget *_parent ) : QDoubleSpinBox( _parent ) SyncWidget::SyncWidget( QWidget *_parent ) : QWidget( _parent )
{ {
setAlignment( Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter ); QHBoxLayout *layout = new QHBoxLayout;
setDecimals( 3 ); spinBox.setAlignment( Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter );
setMinimum( -600.0 ); spinBox.setDecimals( 3 );
setMaximum( 600.0 ); spinBox.setMinimum( -600.0 );
setSingleStep( 0.1 ); spinBox.setMaximum( 600.0 );
setButtonSymbols( QDoubleSpinBox::PlusMinus ); spinBox.setSingleStep( 0.1 );
CONNECT( this, valueChanged( double ), this, valueChangedHandler( double ) ); spinBox.setSuffix( " s" );
spinBox.setButtonSymbols( QDoubleSpinBox::PlusMinus );
CONNECT( &spinBox, valueChanged( double ), this, valueChangedHandler( double ) );
layout->addWidget( &spinBox );
layout->addWidget( &spinLabel );
layout->setContentsMargins( 0, 0, 0, 0 );
setLayout( layout );
} }
void SyncWidget::valueChangedHandler( double d ) void SyncWidget::valueChangedHandler( double d )
{ {
if ( d < 0 ) if ( d < 0 )
setPrefix( qtr("Hastened by ") ); spinLabel.setText( qtr("(Hastened)") );
else if ( d > 0 ) else if ( d > 0 )
setPrefix( qtr("Delayed by ") ); spinLabel.setText( qtr("(Delayed)") );
else else
setPrefix( "" ); spinLabel.setText( "" );
}
void SyncWidget::setValue( double d )
{
spinBox.setValue( d );
} }
SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) : SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
...@@ -1503,7 +1514,6 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -1503,7 +1514,6 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
AVLayout->addWidget( AVLabel, 0, 0, 1, 1 ); AVLayout->addWidget( AVLabel, 0, 0, 1, 1 );
AVSpin = new SyncWidget( this ); AVSpin = new SyncWidget( this );
AVSpin->setSuffix( " s" );
AVLayout->addWidget( AVSpin, 0, 2, 1, 1 ); AVLayout->addWidget( AVSpin, 0, 2, 1, 1 );
mainLayout->addWidget( AVBox, 1, 0, 1, 5 ); mainLayout->addWidget( AVBox, 1, 0, 1, 5 );
...@@ -1516,7 +1526,6 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -1516,7 +1526,6 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
subsLayout->addWidget( subsLabel, 0, 0, 1, 1 ); subsLayout->addWidget( subsLabel, 0, 0, 1, 1 );
subsSpin = new SyncWidget( this ); subsSpin = new SyncWidget( this );
subsSpin->setSuffix( " s" );
subsLayout->addWidget( subsSpin, 0, 2, 1, 1 ); subsLayout->addWidget( subsSpin, 0, 2, 1, 1 );
QLabel *subSpeedLabel = new QLabel; QLabel *subSpeedLabel = new QLabel;
......
...@@ -168,13 +168,19 @@ private slots: ...@@ -168,13 +168,19 @@ private slots:
void setInitValues(); void setInitValues();
}; };
class SyncWidget : public QDoubleSpinBox class SyncWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
SyncWidget( QWidget * ); SyncWidget( QWidget * );
void setValue( double d );
signals:
void valueChanged( double );
private slots: private slots:
void valueChangedHandler( double d ); void valueChangedHandler( double d );
private:
QDoubleSpinBox spinBox;
QLabel spinLabel;
}; };
class SyncControls : public QWidget class SyncControls : public QWidget
...@@ -186,8 +192,8 @@ public: ...@@ -186,8 +192,8 @@ public:
virtual ~SyncControls(); virtual ~SyncControls();
private: private:
intf_thread_t *p_intf; intf_thread_t *p_intf;
QDoubleSpinBox *AVSpin; SyncWidget *AVSpin;
QDoubleSpinBox *subsSpin; SyncWidget *subsSpin;
QDoubleSpinBox *subSpeedSpin; QDoubleSpinBox *subSpeedSpin;
QDoubleSpinBox *subDurationSpin; QDoubleSpinBox *subDurationSpin;
......
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