]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/extended_panels.cpp
Qt: PLModel: move zoom value out of model
[vlc] / modules / gui / qt4 / components / extended_panels.cpp
index 9db76282e52b72b1efc55c38d96d28fe22148b07..7bc89986225c6c389270fd3132a45cfa1f743153 100644 (file)
@@ -1,11 +1,12 @@
 /*****************************************************************************
  * extended_panels.cpp : Extended controls panels
  ****************************************************************************
- * Copyright (C) 2006-2008 the VideoLAN team
+ * Copyright (C) 2006-2012 the VideoLAN team
  * $Id$
  *
  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
  *          Antoine Cellerier <dionoea .t videolan d@t org>
+ *          Jean-Baptiste Kempf <jb@videolan.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -33,7 +34,6 @@
 #include <QString>
 #include <QFont>
 #include <QGridLayout>
-#include <QSignalMapper>
 #include <QComboBox>
 #include <QTimer>
 #include <QFileDialog>
@@ -50,6 +50,7 @@
 #include <vlc_vout.h>
 #include <vlc_osd.h>
 #include <vlc_modules.h>
+#include <vlc_plugin.h>
 
 #include <vlc_charset.h> /* us_strtod */
 
@@ -116,15 +117,17 @@ ExtVideo::ExtVideo( intf_thread_t *_p_intf, QTabWidget *_parent ) :
         { \
             vlc_object_release( p_obj ); \
             if( checkbox ) checkbox->setChecked( true ); \
-            else groupbox->setChecked( true ); \
+            else if (groupbox) groupbox->setChecked( true ); \
         } \
         else \
         { \
             if( checkbox ) checkbox->setChecked( false ); \
-            else groupbox->setChecked( false ); \
+            else if (groupbox)  groupbox->setChecked( false ); \
         } \
     } \
     CONNECT( ui.widget##Enable, clicked(), this, updateFilters() );
+
+
 #define SETUP_VFILTER_OPTION( widget, signal ) \
     initComboBoxItems( ui.widget ); \
     setWidgetValue( ui.widget ); \
@@ -142,7 +145,6 @@ ExtVideo::ExtVideo( intf_thread_t *_p_intf, QTabWidget *_parent ) :
     SETUP_VFILTER_OPTION( extractComponentText, textChanged( const QString& ) )
 
     SETUP_VFILTER( posterize )
-    SETUP_VFILTER_OPTION( posterizeLevelSpin, valueChanged( int ) )
 
     SETUP_VFILTER( colorthres )
     SETUP_VFILTER_OPTION( colorthresColorText, textChanged( const QString& ) )
@@ -164,8 +166,6 @@ ExtVideo::ExtVideo( intf_thread_t *_p_intf, QTabWidget *_parent ) :
 
     SETUP_VFILTER( motiondetect )
 
-//    SETUP_VFILTER( noise )
-
     SETUP_VFILTER( psychedelic )
 
     SETUP_VFILTER( sharpen )
@@ -197,10 +197,6 @@ ExtVideo::ExtVideo( intf_thread_t *_p_intf, QTabWidget *_parent ) :
     SETUP_VFILTER_OPTION( wallRowsSpin, valueChanged( int ) )
     SETUP_VFILTER_OPTION( wallColsSpin, valueChanged( int ) )
 
-    SETUP_VFILTER( panoramix )
-    SETUP_VFILTER_OPTION( panoramixRowsSpin, valueChanged( int ) )
-    SETUP_VFILTER_OPTION( panoramixColsSpin, valueChanged( int ) )
-
 
     SETUP_VFILTER( erase )
     SETUP_VFILTER_OPTION( eraseMaskText, editingFinished() )
@@ -225,6 +221,15 @@ ExtVideo::ExtVideo( intf_thread_t *_p_intf, QTabWidget *_parent ) :
     SETUP_VFILTER( grain )
     SETUP_VFILTER_OPTION( grainVarianceSlider, valueChanged( int ) )
 
+    SETUP_VFILTER( mirror )
+
+    SETUP_VFILTER( gaussianblur )
+    SETUP_VFILTER_OPTION( gaussianbluSigmaSlider, valueChanged( int ) )
+
+    SETUP_VFILTER( antiflicker )
+    SETUP_VFILTER_OPTION( antiflickerSofteningSizeSlider, valueChanged( int ) )
+
+
     if( module_exists( "atmo" ) )
     {
         SETUP_VFILTER( atmo )
@@ -313,11 +318,9 @@ static void ChangeVFiltersString( struct intf_thread_t *p_intf, const char *psz_
     }
     else
     {
-        module_release (p_obj);
         msg_Err( p_intf, "Unknown video filter type." );
         return;
     }
-    module_release (p_obj);
 
     psz_string = config_GetPsz( p_intf, psz_filter_type );
 
@@ -340,6 +343,7 @@ static void ChangeVFiltersString( struct intf_thread_t *p_intf, const char *psz_
         }
         else
         {
+            free( psz_string );
             return;
         }
     }
@@ -358,10 +362,10 @@ static void ChangeVFiltersString( struct intf_thread_t *p_intf, const char *psz_
             }
 
             /* Remove trailing : : */
-            if( strlen( psz_string ) > 0 &&
-                *( psz_string + strlen( psz_string ) -1 ) == ':' )
+            size_t i_len = strlen( psz_string );
+            if( i_len > 0 && *( psz_string + i_len - 1 ) == ':' )
             {
-                *( psz_string + strlen( psz_string ) -1 ) = '\0';
+                *( psz_string + i_len - 1 ) = '\0';
             }
         }
         else
@@ -404,20 +408,30 @@ void ExtVideo::updateFilters()
                                    : groupbox->isChecked() );
 }
 
+#define UPDATE_AND_APPLY_TEXT( widget, file ) \
+    CONNECT( ui.widget, textChanged( const QString& ), \
+             this, updateFilterOptions() ); \
+    ui.widget->setText( toNativeSeparators( file ) ); \
+    ui.widget->disconnect( SIGNAL( textChanged( const QString& ) ) );
+
 void ExtVideo::browseLogo()
 {
     QString file = QFileDialog::getOpenFileName( NULL, qtr( "Logo filenames" ),
                    p_intf->p_sys->filepath, "Images (*.png *.jpg);;All (*)" );
-    ui.logoFileText->setText( toNativeSeparators( file ) );
+
+    UPDATE_AND_APPLY_TEXT( logoFileText, file );
 }
 
 void ExtVideo::browseEraseFile()
 {
     QString file = QFileDialog::getOpenFileName( NULL, qtr( "Image mask" ),
                    p_intf->p_sys->filepath, "Images (*.png *.jpg);;All (*)" );
-    ui.eraseMaskText->setText( toNativeSeparators( file ) );
+
+    UPDATE_AND_APPLY_TEXT( eraseMaskText, file );
 }
 
+#undef UPDATE_AND_APPLY_TEXT
+
 void ExtVideo::initComboBoxItems( QObject *widget )
 {
     QComboBox *combobox = qobject_cast<QComboBox*>( widget );
@@ -442,8 +456,7 @@ void ExtVideo::initComboBoxItems( QObject *widget )
     }
     else
     {
-        msg_Err( p_intf, "Couldn't find option \"%s\".",
-                 qtu( option ) );
+        msg_Err( p_intf, "Couldn't find option \"%s\".", qtu( option ) );
     }
 }
 
@@ -513,20 +526,20 @@ void ExtVideo::setWidgetValue( QObject *widget )
         }
         else if( combobox ) combobox->setCurrentIndex(
                             combobox->findData( qlonglong(val.i_int) ) );
-        else msg_Warn( p_intf, "Oops %s %s %d", __FILE__, __func__, __LINE__ );
+        else msg_Warn( p_intf, "Could not find the correct Integer widget" );
     }
     else if( i_type == VLC_VAR_FLOAT )
     {
         if( slider ) slider->setValue( ( int )( val.f_float*( double )slider->tickInterval() ) ); /* hack alert! */
         else if( doublespinbox ) doublespinbox->setValue( val.f_float );
-        else msg_Warn( p_intf, "Oops %s %s %d", __FILE__, __func__, __LINE__ );
+        else msg_Warn( p_intf, "Could not find the correct Float widget" );
     }
     else if( i_type == VLC_VAR_STRING )
     {
         if( lineedit ) lineedit->setText( qfu( val.psz_string ) );
         else if( combobox ) combobox->setCurrentIndex(
                             combobox->findData( qfu( val.psz_string ) ) );
-        else msg_Warn( p_intf, "Oops %s %s %d", __FILE__, __func__, __LINE__ );
+        else msg_Warn( p_intf, "Could not find the correct String widget" );
         free( val.psz_string );
     }
     else
@@ -563,14 +576,6 @@ void ExtVideo::updateFilterOptions()
         b_is_command = ( i_type & VLC_VAR_ISCOMMAND );
     }
 
-    if( !b_is_command )
-    {
-        msg_Warn( p_intf, "Module %s's %s variable isn't a command. You'll need to restart the filter to take change into account.",
-                 qtu( module ),
-                 qtu( option ) );
-        /* FIXME: restart automatically somewhere near the end of this function */
-    }
-
     /* Try to cast to all the widgets we're likely to encounter. Only
      * one of the casts is expected to work. */
     QSlider        *slider        = qobject_cast<QSlider*>       ( sender() );
@@ -591,7 +596,7 @@ void ExtVideo::updateFilterOptions()
         else if( dial )     i_int = ( 540-dial->value() )%360;
         else if( lineedit ) i_int = lineedit->text().toInt( NULL,16 );
         else if( combobox ) i_int = combobox->itemData( combobox->currentIndex() ).toInt();
-        else msg_Warn( p_intf, "Oops %s %s %d", __FILE__, __func__, __LINE__ );
+        else msg_Warn( p_intf, "Could not find the correct Integer widget" );
         config_PutInt( p_intf, qtu( option ), i_int );
         if( b_is_command )
         {
@@ -608,7 +613,7 @@ void ExtVideo::updateFilterOptions()
                                          / ( double )slider->tickInterval(); /* hack alert! */
         else if( doublespinbox ) f_float = doublespinbox->value();
         else if( lineedit ) f_float = lineedit->text().toDouble();
-        else msg_Warn( p_intf, "Oops %s %s %d", __FILE__, __func__, __LINE__ );
+        else msg_Warn( p_intf, "Could not find the correct Float widget" );
         config_PutFloat( p_intf, qtu( option ), f_float );
         if( b_is_command )
             var_SetFloat( p_obj, qtu( option ), f_float );
@@ -621,7 +626,7 @@ void ExtVideo::updateFilterOptions()
         else if( combobox )
             val = combobox->itemData( combobox->currentIndex() ).toString();
         else
-            msg_Warn( p_intf, "Oops %s %s %d", __FILE__, __func__, __LINE__ );
+            msg_Warn( p_intf, "Could not find the correct String widget" );
         config_PutPsz( p_intf, qtu( option ), qtu( val ) );
         if( b_is_command )
             var_SetString( p_obj, qtu( option ), qtu( val ) );
@@ -633,6 +638,15 @@ void ExtVideo::updateFilterOptions()
                  qtu( option ),
                  i_type );
 
+    if( !b_is_command )
+    {
+        msg_Warn( p_intf, "Module %s's %s variable isn't a command. Brute-restarting the filter.",
+                 qtu( module ),
+                 qtu( option ) );
+        ChangeVFiltersString( p_intf, qtu( module ), false );
+        ChangeVFiltersString( p_intf, qtu( module ), true );
+    }
+
     if( p_obj ) vlc_object_release( p_obj );
 }
 
@@ -692,7 +706,7 @@ void ExtV4l2::Refresh( void )
     }
     if( p_obj )
     {
-        vlc_value_t val, text, name;
+        vlc_value_t val, text;
         int i_ret = var_Change( p_obj, "controls", VLC_VAR_GETCHOICES,
                                 &val, &text );
         if( i_ret < 0 )
@@ -710,25 +724,30 @@ void ExtV4l2::Refresh( void )
 
         for( int i = 0; i < val.p_list->i_count; i++ )
         {
+            vlc_value_t vartext;
             const char *psz_var = text.p_list->p_values[i].psz_string;
-            var_Change( p_obj, psz_var, VLC_VAR_GETTEXT, &name, NULL );
-            const char *psz_label = name.psz_string;
+
+            if( var_Change( p_obj, psz_var, VLC_VAR_GETTEXT, &vartext, NULL ) )
+                continue;
+
+            QString name = qtr( vartext.psz_string );
+            free( vartext.psz_string );
             msg_Dbg( p_intf, "v4l2 control \"%"PRIx64"\": %s (%s)",
-                     val.p_list->p_values[i].i_int, psz_var, name.psz_string );
+                     val.p_list->p_values[i].i_int, psz_var, qtu( name ) );
 
             int i_type = var_Type( p_obj, psz_var );
             switch( i_type & VLC_VAR_TYPE )
             {
                 case VLC_VAR_INTEGER:
                 {
-                    QLabel *label = new QLabel( qtr( psz_label ), box );
+                    QLabel *label = new QLabel( name, box );
                     QHBoxLayout *hlayout = new QHBoxLayout();
                     hlayout->addWidget( label );
                     int i_val = var_GetInteger( p_obj, psz_var );
                     if( i_type & VLC_VAR_HASCHOICE )
                     {
                         QComboBox *combobox = new QComboBox( box );
-                        combobox->setObjectName( qtr( psz_var ) );
+                        combobox->setObjectName( qfu( psz_var ) );
 
                         vlc_value_t val2, text2;
                         var_Change( p_obj, psz_var, VLC_VAR_GETCHOICES,
@@ -748,33 +767,48 @@ void ExtV4l2::Refresh( void )
                         hlayout->addWidget( combobox );
                     }
                     else
+                    if( (i_type & VLC_VAR_HASMIN) && (i_type & VLC_VAR_HASMAX) )
                     {
                         QSlider *slider = new QSlider( box );
-                        slider->setObjectName( qtr( psz_var ) );
+                        slider->setObjectName( qfu( psz_var ) );
                         slider->setOrientation( Qt::Horizontal );
                         vlc_value_t val2;
                         var_Change( p_obj, psz_var, VLC_VAR_GETMIN,
                                     &val2, NULL );
+                        if( val2.i_int < INT_MIN )
+                            val2.i_int = INT_MIN; /* FIXME */
                         slider->setMinimum( val2.i_int );
                         var_Change( p_obj, psz_var, VLC_VAR_GETMAX,
                                     &val2, NULL );
+                        if( val2.i_int > INT_MAX )
+                            val2.i_int = INT_MAX; /* FIXME */
                         slider->setMaximum( val2.i_int );
-                        var_Change( p_obj, psz_var, VLC_VAR_GETSTEP,
-                                    &val2, NULL );
-                        slider->setSingleStep( val2.i_int );
+                        if( !var_Change( p_obj, psz_var, VLC_VAR_GETSTEP,
+                                         &val2, NULL ) )
+                            slider->setSingleStep( val2.i_int );
                         slider->setValue( i_val );
-
                         CONNECT( slider, valueChanged( int ), this,
                                  ValueChange( int ) );
                         hlayout->addWidget( slider );
                     }
+                    else
+                    {
+                        QSpinBox *spinBox = new QSpinBox( box );
+                        spinBox->setObjectName( qfu( psz_var ) );
+                        spinBox->setMinimum( INT_MIN );
+                        spinBox->setMaximum( INT_MAX );
+                        spinBox->setValue( i_val );
+                        CONNECT( spinBox, valueChanged( int ), this,
+                                 ValueChange( int ) );
+                        hlayout->addWidget( spinBox );
+                    }
                     layout->addLayout( hlayout );
                     break;
                 }
                 case VLC_VAR_BOOL:
                 {
-                    QCheckBox *button = new QCheckBox( qtr( psz_label ), box );
-                    button->setObjectName( qtr( psz_var ) );
+                    QCheckBox *button = new QCheckBox( name, box );
+                    button->setObjectName( qfu( psz_var ) );
                     button->setChecked( var_GetBool( p_obj, psz_var ) );
 
                     CONNECT( button, clicked( bool ), this,
@@ -786,8 +820,8 @@ void ExtV4l2::Refresh( void )
                 {
                     if( i_type & VLC_VAR_ISCOMMAND )
                     {
-                        QPushButton *button = new QPushButton( qtr( psz_label ), box );
-                        button->setObjectName( qtr( psz_var ) );
+                        QPushButton *button = new QPushButton( name, box );
+                        button->setObjectName( qfu( psz_var ) );
 
                         CONNECT( button, clicked( bool ), this,
                                  ValueChange( bool ) );
@@ -795,7 +829,7 @@ void ExtV4l2::Refresh( void )
                     }
                     else
                     {
-                        QLabel *label = new QLabel( qtr( psz_label ), box );
+                        QLabel *label = new QLabel( name, box );
                         layout->addWidget( label );
                     }
                     break;
@@ -804,7 +838,6 @@ void ExtV4l2::Refresh( void )
                     msg_Warn( p_intf, "Unhandled var type for %s", psz_var );
                     break;
             }
-            free( name.psz_string );
         }
         var_FreeList( &val, &text );
         vlc_object_release( p_obj );
@@ -861,12 +894,18 @@ void ExtV4l2::ValueChange( int value )
  * Equalizer
  **********************************************************************/
 
-static const QString band_frequencies[] =
+static const QString vlc_band_frequencies[] =
 {
     "  60 Hz  ", " 170 Hz ", " 310 Hz ", " 600 Hz ", "  1 kHz ",
     "  3 kHz  ", "  6 kHz ", " 12 kHz ", " 14 kHz ", " 16 kHz "
 };
 
+static const QString iso_band_frequencies[] =
+{
+    " 31.25 Hz ", " 62.5 Hz ", " 125 Hz ", " 250 Hz ", " 500 Hz ",
+    "    1 kHz ", "   2 kHz ", "  4 kHz ", "  8 kHz ", " 16 kHz "
+};
+
 Equalizer::Equalizer( intf_thread_t *_p_intf, QWidget *_parent ) :
                             QWidget( _parent ) , p_intf( _p_intf )
 {
@@ -880,6 +919,8 @@ Equalizer::Equalizer( intf_thread_t *_p_intf, QWidget *_parent ) :
     presetsComboBox = ui.presetsCombo;
     CONNECT( presetsComboBox, activated( int ), this, setCorePreset( int ) );
 
+    b_vlcBands = var_InheritBool( p_intf, "equalizer-vlcfreqs" );
+
     /* Add the sliders for the Bands */
     QGridLayout *grid = new QGridLayout( ui.frame );
     grid->setMargin( 0 );
@@ -888,9 +929,12 @@ Equalizer::Equalizer( intf_thread_t *_p_intf, QWidget *_parent ) :
         bands[i] = new QSlider( Qt::Vertical );
         bands[i]->setMaximum( 400 );
         bands[i]->setValue( 200 );
+        bands[i]->setMinimumWidth(36);
         CONNECT( bands[i], valueChanged( int ), this, setCoreBands() );
 
-        band_texts[i] = new QLabel( band_frequencies[i] + "\n0.0dB" );
+        QString val = QString("%1").arg( 0.0, 5, 'f', 1 );
+        band_texts[i] = new QLabel( (b_vlcBands ? vlc_band_frequencies[i]
+                                               : iso_band_frequencies[i]) + "\n" + val + "dB" );
         band_texts[i]->setFont( smallFont );
 
         grid->addWidget( bands[i], 0, i );
@@ -969,7 +1013,23 @@ void Equalizer::updateUIFromCore()
     free( psz_pres );
 }
 
-/* Functin called when enableButton is toggled */
+void Equalizer::changeFreqLabels( bool b_useVlcBands )
+{
+    b_vlcBands = b_useVlcBands;
+
+    const QString *band_frequencies = b_vlcBands
+                                    ? vlc_band_frequencies
+                                    : iso_band_frequencies;
+
+    for( int i = 0; i < BANDS; i++ )
+    {
+        const float f_val = (float)( bands[i]->value() ) / 10 - 20;
+        QString val = QString("%1").arg( f_val, 5, 'f', 1 );
+        band_texts[i]->setText( band_frequencies[i] + "\n" + val + "dB" );
+    }
+}
+
+/* Function called when enableButton is toggled */
 void Equalizer::enable()
 {
     bool en = ui.enableCheck->isChecked();
@@ -1032,6 +1092,10 @@ void Equalizer::setCoreBands()
 {
     /**\todo smoothing */
 
+    const QString *band_frequencies = b_vlcBands
+                                    ? vlc_band_frequencies
+                                    : iso_band_frequencies;
+
     QString values;
     for( int i = 0; i < BANDS; i++ )
     {
@@ -1058,7 +1122,7 @@ char * Equalizer::createValuesFromPreset( int i_preset )
 
     /* Create the QString in Qt */
     for( int i = 0 ; i< BANDS ;i++ )
-        values += QString( " %1" ).arg( eqz_preset_10b[i_preset]->f_amp[i], 5, 'f', 1 );
+        values += QString( " %1" ).arg( eqz_preset_10b[i_preset].f_amp[i], 5, 'f', 1 );
 
     /* Convert it to char * */
     return strdup( values.toAscii().constData() );
@@ -1070,7 +1134,7 @@ void Equalizer::setCorePreset( int i_preset )
         return;
 
     /* Update pre-amplification in the UI */
-    float f_preamp = eqz_preset_10b[i_preset]->f_preamp;
+    float f_preamp = eqz_preset_10b[i_preset].f_preamp;
     ui.preampSlider->setValue( (int)( ( f_preamp + 20 ) * 10 ) );
     ui.preampLabel->setText( qtr( "Preamp\n" )
                    + QString::number( f_preamp, 'f', 1 ) + qtr( "dB" ) );
@@ -1078,6 +1142,10 @@ void Equalizer::setCorePreset( int i_preset )
     char *psz_values = createValuesFromPreset( i_preset );
     if( !psz_values ) return ;
 
+    const QString *band_frequencies = b_vlcBands
+                                    ? vlc_band_frequencies
+                                    : iso_band_frequencies;
+
     char *p = psz_values;
     for( int i = 0; i < BANDS && *p; i++ )
     {
@@ -1098,13 +1166,13 @@ void Equalizer::setCorePreset( int i_preset )
 
         var_SetString( p_aout, "equalizer-bands", psz_values );
         var_SetFloat( p_aout, "equalizer-preamp",
-                      eqz_preset_10b[i_preset]->f_preamp );
+                      eqz_preset_10b[i_preset].f_preamp );
         vlc_object_release( p_aout );
     }
     config_PutPsz( p_intf, "equalizer-bands", psz_values );
     config_PutPsz( p_intf, "equalizer-preset", preset_list[i_preset] );
     config_PutFloat( p_intf, "equalizer-preamp",
-                    eqz_preset_10b[i_preset]->f_preamp );
+                    eqz_preset_10b[i_preset].f_preamp );
     free( psz_values );
 }
 
@@ -1258,14 +1326,14 @@ void Compressor::enable( bool en )
     }
 }
 
-void Compressor::updateSliders( float * controlVars )
+void Compressor::updateSliders( float * p_controlVars )
 {
     for( int i = 0 ; i < NUM_CP_CTRL ; i++ )
     {
-        if( oldControlVars[i] != controlVars[i] )
+        if( oldControlVars[i] != p_controlVars[i] )
         {
             compCtrl[i]->setValue(
-                    (int)( controlVars[i] / comp_controls[i].f_resolution ) );
+                    (int)( p_controlVars[i] / comp_controls[i].f_resolution ) );
         }
     }
 }
@@ -1322,7 +1390,7 @@ Spatializer::Spatializer( intf_thread_t *_p_intf, QWidget *_parent )
             : QWidget( _parent ) , p_intf( _p_intf )
 {
     QFont smallFont = QApplication::font();
-    smallFont.setPointSize( smallFont.pointSize() - 2 );
+    smallFont.setPointSize( smallFont.pointSize() - 1 );
 
     QGridLayout *layout = new QGridLayout( this );
 
@@ -1332,18 +1400,7 @@ Spatializer::Spatializer( intf_thread_t *_p_intf, QWidget *_parent )
     for( int i = 0 ; i < NUM_SP_CTRL ; i++ )
     {
         spatCtrl[i] = new QSlider( Qt::Vertical );
-        if( i < 2 )
-        {
-            spatCtrl[i]->setMaximum( 10 );
-            spatCtrl[i]->setValue( 2 );
-        }
-        else
-        {
-            spatCtrl[i]->setMaximum( 10 );
-            spatCtrl[i]->setValue( 0 );
-            spatCtrl[i]->setMinimum( -10 );
-        }
-
+        spatCtrl[i]->setValue( (int)var_InheritFloat( p_intf, spat_controls[i].psz_name ) * 10. );
         oldControlVars[i] = spatCtrl[i]->value();
 
         CONNECT( spatCtrl[i], valueChanged( int ), this, setInitValues() );
@@ -1357,7 +1414,9 @@ Spatializer::Spatializer( intf_thread_t *_p_intf, QWidget *_parent )
         layout->addWidget( spatCtrl[i],     1, i, Qt::AlignHCenter );
         layout->addWidget( ctrl_readout[i], 2, i, Qt::AlignHCenter );
         layout->addWidget( ctrl_texts[i],   3, i, Qt::AlignHCenter );
+        spatCtrl[i]->setRange( 0, 10 );
     }
+    spatCtrl[0]->setRange( 0, 11 );
 
     BUTTONACT( enableCheck, enable() );
 
@@ -1416,20 +1475,20 @@ void Spatializer::setValues()
 
     for( int i = 0 ; i < NUM_SP_CTRL ; i++ )
     {
-        float f = (float)(  spatCtrl[i]->value() );
+        float f = (float)( spatCtrl[i]->value() ) / 10;
         ctrl_readout[i]->setText( QString::number( f, 'f',  1 ) );
     }
+
     if( p_aout )
     {
         for( int i = 0 ; i < NUM_SP_CTRL ; i++ )
         {
+            float f = (float)( spatCtrl[i]->value() ) / 10 ;
             if( oldControlVars[i] != spatCtrl[i]->value() )
             {
-                var_SetFloat( p_aout, spat_controls[i].psz_name,
-                        ( float )spatCtrl[i]->value() );
-                config_PutFloat( p_intf, spat_controls[i].psz_name,
-                        ( float ) spatCtrl[i]->value() );
-                oldControlVars[i] = ( float ) spatCtrl[i]->value();
+                var_SetFloat( p_aout, spat_controls[i].psz_name, f );
+                config_PutFloat( p_intf, spat_controls[i].psz_name, f );
+                oldControlVars[i] = spatCtrl[i]->value();
             }
         }
         vlc_object_release( p_aout );
@@ -1459,16 +1518,43 @@ 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 ) : QWidget( _parent )
+{
+    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 )
+        spinLabel.setText( qtr("(Hastened)") );
+    else if ( d > 0 )
+        spinLabel.setText( qtr("(Delayed)") );
+    else
+        spinLabel.setText( "" );
+    emit valueChanged( d );
+}
+
+void SyncWidget::setValue( double d )
+{
+    spinBox.setValue( d );
+}
+
 SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
                             QWidget( _parent ) , p_intf( _p_intf )
 {
     QGroupBox *AVBox, *subsBox;
-
-    QToolButton *moinsAV, *plusAV;
-    QToolButton *moinssubs, *plussubs;
-    QToolButton *moinssubSpeed, *plussubSpeed;
-    QToolButton *moinssubDuration, *plussubDuration;
-
     QToolButton *updateButton;
 
     b_userAction = true;
@@ -1479,81 +1565,27 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
     AVBox = new QGroupBox( qtr( "Audio/Video" ) );
     QGridLayout *AVLayout = new QGridLayout( AVBox );
 
-    moinsAV = new QToolButton;
-    moinsAV->setToolButtonStyle( Qt::ToolButtonTextOnly );
-    moinsAV->setAutoRaise( true );
-    moinsAV->setText( "-" );
-    AVLayout->addWidget( moinsAV, 0, 1, 1, 1 );
-
-    plusAV = new QToolButton;
-    plusAV->setToolButtonStyle( Qt::ToolButtonTextOnly );
-    plusAV->setAutoRaise( true );
-    plusAV->setText( "+" );
-    AVLayout->addWidget( plusAV, 0, 3, 1, 1 );
-
     QLabel *AVLabel = new QLabel;
-    AVLabel->setText( qtr( "Advance of audio over video:" ) );
+    AVLabel->setText( qtr( "Audio track synchronization:" ) );
     AVLayout->addWidget( AVLabel, 0, 0, 1, 1 );
 
-    AVSpin = new QDoubleSpinBox;
-    AVSpin->setAlignment( Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter );
-    AVSpin->setDecimals( 3 );
-    AVSpin->setMinimum( -600.0 );
-    AVSpin->setMaximum( 600.0 );
-    AVSpin->setSingleStep( 0.1 );
-    AVSpin->setToolTip( qtr( "A positive value means that\n"
-                             "the audio is ahead of the video" ) );
-    AVSpin->setSuffix( " s" );
+    AVSpin = new SyncWidget( this );
     AVLayout->addWidget( AVSpin, 0, 2, 1, 1 );
     mainLayout->addWidget( AVBox, 1, 0, 1, 5 );
 
-
     /* Subs */
     subsBox = new QGroupBox( qtr( "Subtitles/Video" ) );
     QGridLayout *subsLayout = new QGridLayout( subsBox );
 
-    moinssubs = new QToolButton;
-    moinssubs->setToolButtonStyle( Qt::ToolButtonTextOnly );
-    moinssubs->setAutoRaise( true );
-    moinssubs->setText( "-" );
-    subsLayout->addWidget( moinssubs, 0, 1, 1, 1 );
-
-    plussubs = new QToolButton;
-    plussubs->setToolButtonStyle( Qt::ToolButtonTextOnly );
-    plussubs->setAutoRaise( true );
-    plussubs->setText( "+" );
-    subsLayout->addWidget( plussubs, 0, 3, 1, 1 );
-
     QLabel *subsLabel = new QLabel;
-    subsLabel->setText( qtr( "Advance of subtitles over video:" ) );
+    subsLabel->setText( qtr( "Subtitle track syncronization:" ) );
     subsLayout->addWidget( subsLabel, 0, 0, 1, 1 );
 
-    subsSpin = new QDoubleSpinBox;
-    subsSpin->setAlignment( Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter );
-    subsSpin->setDecimals( 3 );
-    subsSpin->setMinimum( -600.0 );
-    subsSpin->setMaximum( 600.0 );
-    subsSpin->setSingleStep( 0.1 );
-    subsSpin->setToolTip( qtr( "A positive value means that\n"
-                             "the subtitles are ahead of the video" ) );
-    subsSpin->setSuffix( " s" );
+    subsSpin = new SyncWidget( this );
     subsLayout->addWidget( subsSpin, 0, 2, 1, 1 );
 
-
-    moinssubSpeed = new QToolButton;
-    moinssubSpeed->setToolButtonStyle( Qt::ToolButtonTextOnly );
-    moinssubSpeed->setAutoRaise( true );
-    moinssubSpeed->setText( "-" );
-    subsLayout->addWidget( moinssubSpeed, 1, 1, 1, 1 );
-
-    plussubSpeed = new QToolButton;
-    plussubSpeed->setToolButtonStyle( Qt::ToolButtonTextOnly );
-    plussubSpeed->setAutoRaise( true );
-    plussubSpeed->setText( "+" );
-    subsLayout->addWidget( plussubSpeed, 1, 3, 1, 1 );
-
     QLabel *subSpeedLabel = new QLabel;
-    subSpeedLabel->setText( qtr( "Speed of the subtitles:" ) );
+    subSpeedLabel->setText( qtr( "Subtitles speed:" ) );
     subsLayout->addWidget( subSpeedLabel, 1, 0, 1, 1 );
 
     subSpeedSpin = new QDoubleSpinBox;
@@ -1563,20 +1595,9 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
     subSpeedSpin->setMaximum( 100 );
     subSpeedSpin->setSingleStep( 0.2 );
     subSpeedSpin->setSuffix( " fps" );
+    subSpeedSpin->setButtonSymbols( QDoubleSpinBox::PlusMinus );
     subsLayout->addWidget( subSpeedSpin, 1, 2, 1, 1 );
 
-    moinssubDuration = new QToolButton;
-    moinssubDuration->setToolButtonStyle( Qt::ToolButtonTextOnly );
-    moinssubDuration->setAutoRaise( true );
-    moinssubDuration->setText( "-" );
-    subsLayout->addWidget( moinssubDuration, 2, 1, 1, 1 );
-
-    plussubDuration = new QToolButton;
-    plussubDuration->setToolButtonStyle( Qt::ToolButtonTextOnly );
-    plussubDuration->setAutoRaise( true );
-    plussubDuration->setText( "+" );
-    subsLayout->addWidget( plussubDuration, 2, 3, 1, 1 );
-
     QLabel *subDurationLabel = new QLabel;
     subDurationLabel->setText( qtr( "Subtitles duration factor:" ) );
     subsLayout->addWidget( subDurationLabel, 2, 0, 1, 1 );
@@ -1587,6 +1608,7 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
     subDurationSpin->setMinimum( 0 );
     subDurationSpin->setMaximum( 20 );
     subDurationSpin->setSingleStep( 0.2 );
+    subDurationSpin->setButtonSymbols( QDoubleSpinBox::PlusMinus );
     subsLayout->addWidget( subDurationSpin, 2, 2, 1, 1 );
 
     mainLayout->addWidget( subsBox, 2, 0, 2, 5 );
@@ -1595,16 +1617,7 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
     updateButton->setAutoRaise( true );
     mainLayout->addWidget( updateButton, 0, 4, 1, 1 );
 
-
     /* Various Connects */
-    CONNECT( moinsAV, clicked(), AVSpin, stepDown () );
-    CONNECT( plusAV, clicked(), AVSpin, stepUp () );
-    CONNECT( moinssubs, clicked(), subsSpin, stepDown () );
-    CONNECT( plussubs, clicked(), subsSpin, stepUp () );
-    CONNECT( moinssubSpeed, clicked(), subSpeedSpin, stepDown () );
-    CONNECT( plussubSpeed, clicked(), subSpeedSpin, stepUp () );
-    CONNECT( moinssubDuration, clicked(), subDurationSpin, stepDown () );
-    CONNECT( plussubDuration, clicked(), subDurationSpin, stepUp () );
     CONNECT( AVSpin, valueChanged ( double ), this, advanceAudio( double ) ) ;
     CONNECT( subsSpin, valueChanged ( double ), this, advanceSubs( double ) ) ;
     CONNECT( subSpeedSpin, valueChanged ( double ),