Commit 20dc6ced authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Qt4: use QString or QByteArray instead of strdup()/free()

parent 00eb305f
...@@ -615,15 +615,16 @@ void ExtVideo::updateFilterOptions() ...@@ -615,15 +615,16 @@ void ExtVideo::updateFilterOptions()
} }
else if( i_type == VLC_VAR_STRING ) else if( i_type == VLC_VAR_STRING )
{ {
char *psz_string = NULL; QString val;
if( lineedit ) psz_string = strdup( qtu( lineedit->text() ) ); if( lineedit )
else if( combobox ) psz_string = strdup( qtu( combobox->itemData( val = lineedit->text();
combobox->currentIndex() ).toString() ) ); else if( combobox )
else msg_Warn( p_intf, "Oops %s %s %d", __FILE__, __func__, __LINE__ ); val = combobox->itemData( combobox->currentIndex() ).toString();
config_PutPsz( p_intf, qtu( option ), psz_string ); else
msg_Warn( p_intf, "Oops %s %s %d", __FILE__, __func__, __LINE__ );
config_PutPsz( p_intf, qtu( option ), qtu( val ) );
if( b_is_command ) if( b_is_command )
var_SetString( p_obj, qtu( option ), psz_string ); var_SetString( p_obj, qtu( option ), qtu( val ) );
free( psz_string );
} }
else else
msg_Err( p_intf, msg_Err( p_intf,
...@@ -828,8 +829,8 @@ void ExtV4l2::ValueChange( int value ) ...@@ -828,8 +829,8 @@ void ExtV4l2::ValueChange( int value )
vlc_object_t *p_obj = (vlc_object_t*)vlc_object_find_name( pl_Get(p_intf), "v4l2" ); vlc_object_t *p_obj = (vlc_object_t*)vlc_object_find_name( pl_Get(p_intf), "v4l2" );
if( p_obj ) if( p_obj )
{ {
char *psz_var = strdup( qtu( s->objectName() ) ); QString var = s->objectName();
int i_type = var_Type( p_obj, psz_var ); int i_type = var_Type( p_obj, qtu( var ) );
switch( i_type & VLC_VAR_TYPE ) switch( i_type & VLC_VAR_TYPE )
{ {
case VLC_VAR_INTEGER: case VLC_VAR_INTEGER:
...@@ -838,16 +839,15 @@ void ExtV4l2::ValueChange( int value ) ...@@ -838,16 +839,15 @@ void ExtV4l2::ValueChange( int value )
QComboBox *combobox = qobject_cast<QComboBox*>( s ); QComboBox *combobox = qobject_cast<QComboBox*>( s );
value = combobox->itemData( value ).toInt(); value = combobox->itemData( value ).toInt();
} }
var_SetInteger( p_obj, psz_var, value ); var_SetInteger( p_obj, qtu( var ), value );
break; break;
case VLC_VAR_BOOL: case VLC_VAR_BOOL:
var_SetBool( p_obj, psz_var, value ); var_SetBool( p_obj, qtu( var ), value );
break; break;
case VLC_VAR_VOID: case VLC_VAR_VOID:
var_TriggerCallback( p_obj, psz_var ); var_TriggerCallback( p_obj, qtu( var ) );
break; break;
} }
free( psz_var );
vlc_object_release( p_obj ); vlc_object_release( p_obj );
} }
else else
......
...@@ -782,14 +782,13 @@ void SPrefsPanel::apply() ...@@ -782,14 +782,13 @@ void SPrefsPanel::apply()
case SPrefsInputAndCodecs: case SPrefsInputAndCodecs:
{ {
/* Device default selection */ /* Device default selection */
char *psz_devicepath = QByteArray devicepath =
strdup( qtu( qobject_cast<QComboBox *>(optionWidgets[inputLE])->currentText() ) ); qobject_cast<QComboBox *>(optionWidgets[inputLE])->currentText().toUtf8();
if( !EMPTY_STR( psz_devicepath ) ) if( devicepath.size() > 0 )
{ {
config_PutPsz( p_intf, "dvd", psz_devicepath ); config_PutPsz( p_intf, "dvd", devicepath );
config_PutPsz( p_intf, "vcd", psz_devicepath ); config_PutPsz( p_intf, "vcd", devicepath );
config_PutPsz( p_intf, "cd-audio", psz_devicepath ); config_PutPsz( p_intf, "cd-audio", devicepath );
free( psz_devicepath );
} }
#define CaCi( name, int ) config_PutInt( p_intf, name, int * i_comboValue ) #define CaCi( name, int ) config_PutInt( p_intf, name, int * i_comboValue )
......
...@@ -726,12 +726,10 @@ void DialogsProvider::menuUpdateAction( QObject *data ) ...@@ -726,12 +726,10 @@ void DialogsProvider::menuUpdateAction( QObject *data )
void DialogsProvider::SDMenuAction( const QString& data ) void DialogsProvider::SDMenuAction( const QString& data )
{ {
char *psz_sd = strdup( qtu( data ) ); if( !playlist_IsServicesDiscoveryLoaded( THEPL, qtu( data ) ) )
if( !playlist_IsServicesDiscoveryLoaded( THEPL, psz_sd ) ) playlist_ServicesDiscoveryAdd( THEPL, qtu( data ) );
playlist_ServicesDiscoveryAdd( THEPL, psz_sd );
else else
playlist_ServicesDiscoveryRemove( THEPL, psz_sd ); playlist_ServicesDiscoveryRemove( THEPL, qtu( data ) );
free( psz_sd );
} }
/** /**
......
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