]> git.sesse.net Git - vlc/commitdiff
Qt: adv options: fix RTL handling for synchronization
authorFrancois Cartegnie <fcvlcdev@free.fr>
Sat, 17 Sep 2011 15:42:31 +0000 (17:42 +0200)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Sat, 17 Sep 2011 23:32:26 +0000 (01:32 +0200)
modules/gui/qt4/components/extended_panels.cpp
modules/gui/qt4/components/extended_panels.hpp

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