X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fqt4%2Fcomponents%2Fextended_panels.cpp;h=d848d908009b026b6aaeb10cbf95c3dbf058be37;hb=0f400aa1cd6dfaeff62d17d788e538137390973b;hp=41fed07c38885ad15b814688636d7debdc68d7ae;hpb=b0b4694b61f1da491cd09a24bf56017a2ba1cca6;p=vlc diff --git a/modules/gui/qt4/components/extended_panels.cpp b/modules/gui/qt4/components/extended_panels.cpp index 41fed07c38..d848d90800 100644 --- a/modules/gui/qt4/components/extended_panels.cpp +++ b/modules/gui/qt4/components/extended_panels.cpp @@ -109,8 +109,7 @@ ExtVideo::ExtVideo( intf_thread_t *_p_intf, QTabWidget *_parent ) : { \ vlc_object_t *p_obj = ( vlc_object_t * ) \ vlc_object_find_name( p_intf->p_libvlc, \ - #widget, \ - FIND_CHILD ); \ + #widget ); \ QCheckBox *checkbox = qobject_cast( ui.widget##Enable ); \ QGroupBox *groupbox = qobject_cast( ui.widget##Enable ); \ if( p_obj ) \ @@ -456,9 +455,7 @@ void ExtVideo::setWidgetValue( QObject *widget ) //std::cout << "Option name: " << option.toStdString() << std::endl; vlc_object_t *p_obj = ( vlc_object_t * ) - vlc_object_find_name( p_intf->p_libvlc, - qtu( module ), - FIND_CHILD ); + vlc_object_find_name( p_intf->p_libvlc, qtu( module ) ); int i_type; vlc_value_t val; @@ -549,9 +546,7 @@ void ExtVideo::updateFilterOptions() //std::cout << "Option name: " << option.toStdString() << std::endl; vlc_object_t *p_obj = ( vlc_object_t * ) - vlc_object_find_name( p_intf->p_libvlc, - qtu( module ), - FIND_CHILD ); + vlc_object_find_name( p_intf->p_libvlc, qtu( module ) ); int i_type; bool b_is_command; if( !p_obj ) @@ -620,15 +615,16 @@ void ExtVideo::updateFilterOptions() } else if( i_type == VLC_VAR_STRING ) { - char *psz_string = NULL; - if( lineedit ) psz_string = strdup( qtu( lineedit->text() ) ); - else if( combobox ) psz_string = strdup( qtu( combobox->itemData( - combobox->currentIndex() ).toString() ) ); - else msg_Warn( p_intf, "Oops %s %s %d", __FILE__, __func__, __LINE__ ); - config_PutPsz( p_intf, qtu( option ), psz_string ); + QString val; + if( lineedit ) + val = lineedit->text(); + else if( combobox ) + val = combobox->itemData( combobox->currentIndex() ).toString(); + else + msg_Warn( p_intf, "Oops %s %s %d", __FILE__, __func__, __LINE__ ); + config_PutPsz( p_intf, qtu( option ), qtu( val ) ); if( b_is_command ) - var_SetString( p_obj, qtu( option ), psz_string ); - free( psz_string ); + var_SetString( p_obj, qtu( option ), qtu( val ) ); } else msg_Err( p_intf, @@ -686,7 +682,7 @@ void ExtV4l2::showEvent( QShowEvent *event ) void ExtV4l2::Refresh( void ) { - vlc_object_t *p_obj = (vlc_object_t*)vlc_object_find_name( pl_Get(p_intf), "v4l2", FIND_CHILD ); + vlc_object_t *p_obj = (vlc_object_t*)vlc_object_find_name( pl_Get(p_intf), "v4l2" ); help->hide(); if( box ) { @@ -830,11 +826,11 @@ void ExtV4l2::ValueChange( bool value ) void ExtV4l2::ValueChange( int value ) { QObject *s = sender(); - vlc_object_t *p_obj = (vlc_object_t*)vlc_object_find_name( pl_Get(p_intf), "v4l2", FIND_CHILD ); + vlc_object_t *p_obj = (vlc_object_t*)vlc_object_find_name( pl_Get(p_intf), "v4l2" ); if( p_obj ) { - char *psz_var = strdup( qtu( s->objectName() ) ); - int i_type = var_Type( p_obj, psz_var ); + QString var = s->objectName(); + int i_type = var_Type( p_obj, qtu( var ) ); switch( i_type & VLC_VAR_TYPE ) { case VLC_VAR_INTEGER: @@ -843,16 +839,15 @@ void ExtV4l2::ValueChange( int value ) QComboBox *combobox = qobject_cast( s ); value = combobox->itemData( value ).toInt(); } - var_SetInteger( p_obj, psz_var, value ); + var_SetInteger( p_obj, qtu( var ), value ); break; case VLC_VAR_BOOL: - var_SetBool( p_obj, psz_var, value ); + var_SetBool( p_obj, qtu( var ), value ); break; case VLC_VAR_VOID: - var_TriggerCallback( p_obj, psz_var ); + var_TriggerCallback( p_obj, qtu( var ) ); break; } - free( psz_var ); vlc_object_release( p_obj ); } else @@ -1046,13 +1041,12 @@ void Equalizer::setCoreBands() band_texts[i]->setText( band_frequencies[i] + "\n" + val + "dB" ); values += " " + val; } - const char *psz_values = values.toAscii().constData(); aout_instance_t *p_aout = THEMIM->getAout(); if( p_aout ) { //delCallbacks( p_aout ); - var_SetString( p_aout, "equalizer-bands", psz_values ); + var_SetString( p_aout, "equalizer-bands", qtu( values ) ); //addCallbacks( p_aout ); vlc_object_release( p_aout ); } @@ -1064,7 +1058,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] ); + values += QString( " %1" ).arg( eqz_preset_10b[i_preset]->f_amp[i], 5, 'f', 1 ); /* Convert it to char * */ return strdup( values.toAscii().constData() ); @@ -1622,9 +1616,10 @@ SyncControls::SyncControls( intf_thread_t *_p_intf, QWidget *_parent ) : BUTTON_SET_ACT_I( updateButton, "", update, qtr( "Force update of this dialog's values" ), update() ); + initSubsDuration(); + /* Set it */ update(); - updateSubsDuration(); } SyncControls::~SyncControls() @@ -1639,7 +1634,6 @@ void SyncControls::clean() subsSpin->setValue( 0.0 ); subSpeedSpin->setValue( 1.0 ); subsdelayClean(); - updateSubsDuration(); b_userAction = true; } @@ -1655,6 +1649,7 @@ void SyncControls::update() i_delay = var_GetTime( THEMIM->getInput(), "spu-delay" ); subsSpin->setValue( ( (double)i_delay ) / 1000000 ); subSpeedSpin->setValue( var_GetFloat( THEMIM->getInput(), "sub-fps" ) ); + subDurationSpin->setValue( var_InheritFloat( p_intf, SUBSDELAY_CFG_FACTOR ) ); } b_userAction = true; } @@ -1694,7 +1689,7 @@ void SyncControls::adjustSubsDuration( double f_factor ) } } -void SyncControls::updateSubsDuration() +void SyncControls::initSubsDuration() { int i_mode = var_InheritInteger( p_intf, SUBSDELAY_CFG_MODE ); @@ -1718,8 +1713,6 @@ void SyncControls::updateSubsDuration() subDurationSpin->setSuffix( "" ); break; } - - subDurationSpin->setValue( var_InheritFloat( p_intf, SUBSDELAY_CFG_FACTOR ) ); } void SyncControls::subsdelayClean() @@ -1734,7 +1727,7 @@ void SyncControls::subsdelaySetFactor( double f_factor ) config_PutFloat( p_intf, SUBSDELAY_CFG_FACTOR, f_factor ); /* Try to find an instance of subsdelay, and set its factor */ - vlc_object_t *p_obj = ( vlc_object_t * ) vlc_object_find_name( p_intf->p_libvlc, "subsdelay", FIND_CHILD ); + vlc_object_t *p_obj = ( vlc_object_t * ) vlc_object_find_name( p_intf->p_libvlc, "subsdelay" ); if( p_obj ) { var_SetFloat( p_obj, SUBSDELAY_CFG_FACTOR, f_factor );