]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/extended_panels.cpp
Fix network panel (start with deactivated checkboxes)
[vlc] / modules / gui / qt4 / components / extended_panels.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 9638e6b..b7adeb7
 #include "qt4.hpp"
 #include "input_manager.hpp"
 
-#include "../../audio_filter/equalizer_presets.h"
 #include <vlc_aout.h>
 #include <vlc_intf_strings.h>
 #include <vlc_vout.h>
 #include <vlc_osd.h>
 
-#include <iostream>
-#include <string.h>
 
 #if 0
 class ConfClickHandler : public QObject
@@ -207,15 +204,36 @@ ExtVideo::ExtVideo( intf_thread_t *_p_intf, QTabWidget *_parent ) :
 
 #undef SETUP_VFILTER
 #undef SETUP_VFILTER_OPTION
+
+    CONNECT( ui.cropTopPx, valueChanged( int ), this, cropChange() );
+    CONNECT( ui.cropBotPx, valueChanged( int ), this, cropChange() );
+    CONNECT( ui.cropLeftPx, valueChanged( int ), this, cropChange() );
+    CONNECT( ui.cropRightPx, valueChanged( int ), this, cropChange() );
+    CONNECT( ui.topBotCropSync, toggled( bool ),
+             ui.cropBotPx, setDisabled( bool ) );
+    CONNECT( ui.leftRightCropSync, toggled( bool ),
+             ui.cropRightPx, setDisabled( bool ) );
 }
 
 ExtVideo::~ExtVideo()
 {
 }
 
-void ExtVideo::ChangeVFiltersString( char *psz_name, vlc_bool_t b_add )
+void ExtVideo::cropChange()
+{
+    p_vout = ( vout_thread_t * )vlc_object_find( p_intf,
+                                VLC_OBJECT_VOUT, FIND_CHILD );
+    if( p_vout )
+    {
+        var_SetInteger( p_vout, "crop-top", ui.cropTopPx->value() );
+        var_SetInteger( p_vout, "crop-bottom", ui.cropBotPx->value() );
+        var_SetInteger( p_vout, "crop-left", ui.cropLeftPx->value() );
+        var_SetInteger( p_vout, "crop-right", ui.cropRightPx->value() );
+    }
+}
+
+void ExtVideo::ChangeVFiltersString( char *psz_name, bool b_add )
 {
-    vout_thread_t *p_vout;
     char *psz_parser, *psz_string;
     const char *psz_filter_type;
 
@@ -605,7 +623,6 @@ void ExtV4l2::Refresh( void )
     }
     if( p_obj )
     {
-        msg_Dbg( p_intf, "Found v4l2 instance" );
         vlc_value_t val, text, name;
         int i_ret = var_Change( p_obj, "controls", VLC_VAR_GETCHOICES,
                                 &val, &text );
@@ -729,7 +746,6 @@ void ExtV4l2::Refresh( void )
         msg_Dbg( p_intf, "Couldn't find v4l2 instance" );
         ui.help->show();
     }
-
 }
 
 void ExtV4l2::ValueChange( bool value )
@@ -858,11 +874,11 @@ void Equalizer::enable()
 {
     bool en = ui.enableCheck->isChecked();
     aout_EnableFilter( VLC_OBJECT( p_intf ), "equalizer",
-                       en ? VLC_TRUE : VLC_FALSE );
+                       en ? true : false );
 //    aout_EnableFilter( VLC_OBJECT( p_intf ), "upmixer",
-//                       en ? VLC_TRUE : VLC_FALSE );
+//                       en ? true : false );
 //     aout_EnableFilter( VLC_OBJECT( p_intf ), "vsurround",
-//                       en ? VLC_TRUE : VLC_FALSE );
+//                       en ? true : false );
      enable( en );
 }
 
@@ -881,7 +897,7 @@ void Equalizer::set2Pass()
 {
     aout_instance_t *p_aout= ( aout_instance_t * )vlc_object_find( p_intf,
                                  VLC_OBJECT_AOUT, FIND_ANYWHERE );
-    vlc_bool_t b_2p = ui.eq2PassCheck->isChecked();
+    bool b_2p = ui.eq2PassCheck->isChecked();
 
     if( p_aout == NULL )
         config_PutInt( p_intf, "equalizer-2pass", b_2p );
@@ -891,7 +907,7 @@ void Equalizer::set2Pass()
         config_PutInt( p_intf, "equalizer-2pass", b_2p );
         for( int i = 0; i < p_aout->i_nb_inputs; i++ )
         {
-            p_aout->pp_inputs[i]->b_restart = VLC_TRUE;
+            p_aout->pp_inputs[i]->b_restart = true;
         }
         vlc_object_release( p_aout );
     }
@@ -924,7 +940,7 @@ void Equalizer::setBand()
 
     for( int i = 0 ; i< BANDS ; i++ )
     {
-        char psz_val[5];
+        char psz_val[8];
         float f_val = ( float )(  bands[i]->value() ) / 10 - 20 ;
         sprintf( psz_values, "%s %f", psz_values, f_val );
         sprintf( psz_val, "% 5.1f", f_val );
@@ -945,9 +961,9 @@ void Equalizer::setValues( char *psz_bands, float f_preamp )
     char *p = psz_bands;
     if ( p )
     {
-        for( int i = 0; i < 10; i++ )
+        for( int i = 0; i < BANDS; i++ )
         {
-            char psz_val[5];
+            char psz_val[8];
             float f = strtof( p, &p );
             int  i_val= ( int )( ( f + 20 ) * 10 );
             bands[i]->setValue(  i_val );
@@ -972,9 +988,14 @@ void Equalizer::setPreset( int preset )
                                                 VLC_OBJECT_AOUT, FIND_ANYWHERE );
 
     char psz_values[102]; memset( psz_values, 0, 102 );
-    for( int i = 0 ; i< 10 ;i++ )
-        sprintf( psz_values, "%s %.1f", psz_values,
-                                        eqz_preset_10b[preset]->f_amp[i] );
+    char psz_values2[102];memset( psz_values2, 0, 102 );
+    for( int i = 0 ; i< BANDS ;i++ )
+    {
+        strcpy( psz_values2, psz_values );
+
+        sprintf( psz_values, "%s %5.1f",
+                 psz_values2, eqz_preset_10b[preset]->f_amp[i] );
+    }
 
     if( p_aout )
     {
@@ -1103,7 +1124,7 @@ void Spatializer::enable()
 {
     bool en = enableCheck->isChecked();
     aout_EnableFilter( VLC_OBJECT( p_intf ), "spatializer",
-            en ? VLC_TRUE : VLC_FALSE );
+            en ? true : false );
     enable( en );
 }
 
@@ -1273,7 +1294,7 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) :
     updateButton = new QToolButton;
     updateButton->setAutoRaise( true );
     updateButton->setText( "u" );
-    updateButton->setToolTip( qtr( "Force update of the values in this dialog" ) );
+    updateButton->setToolTip( qtr( "Force update of this dialog's values" ) );
     mainLayout->addWidget( updateButton, 0, 4, 1, 1 );