From d6418e15514dae6c1889e3682fa32c1de3072511 Mon Sep 17 00:00:00 2001 From: Kaarlo Raiha Date: Sat, 7 Nov 2009 21:02:11 +0200 Subject: [PATCH] qt4 equalizer load core bands and preamp to extended panel Signed-off-by: Ilkka Ollakka --- .../gui/qt4/components/extended_panels.cpp | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/modules/gui/qt4/components/extended_panels.cpp b/modules/gui/qt4/components/extended_panels.cpp index 240878480c..34a4c8b0e7 100644 --- a/modules/gui/qt4/components/extended_panels.cpp +++ b/modules/gui/qt4/components/extended_panels.cpp @@ -885,7 +885,7 @@ void Equalizer::clean() /* Write down initial values */ void Equalizer::updateUIFromCore() { - char *psz_af, *psz_pres; + char *psz_af, *psz_pres, *psz_bands; float f_preamp; int i_preset; @@ -897,6 +897,7 @@ void Equalizer::updateUIFromCore() if( var_GetBool( p_aout, "equalizer-2pass" ) ) ui.eq2PassCheck->setChecked( true ); f_preamp = var_GetFloat( p_aout, "equalizer-preamp" ); + psz_bands = var_GetNonEmptyString( p_aout, "equalizer-bands" ); i_preset = presetsComboBox->findData( QVariant( psz_pres ) ); vlc_object_release( p_aout ); } @@ -907,6 +908,7 @@ void Equalizer::updateUIFromCore() if( config_GetInt( p_intf, "equalizer-2pass" ) ) ui.eq2PassCheck->setChecked( true ); f_preamp = config_GetFloat( p_intf, "equalizer-preamp" ); + psz_bands = config_GetPsz( p_intf, "equalizer-bands" ); i_preset = presetsComboBox->findData( QVariant( psz_pres ) ); } if( psz_af && strstr( psz_af, "equalizer" ) != NULL ) @@ -915,6 +917,23 @@ void Equalizer::updateUIFromCore() presetsComboBox->setCurrentIndex( i_preset ); + ui.preampSlider->setValue( (int)( ( f_preamp + 20 ) * 10 ) ); + + if( psz_bands && strlen( psz_bands ) > 1 ) + { + char *psz_bands_orig = psz_bands; + for( int i = 0; i < BANDS; i++ ) + { + const float f = us_strtod(psz_bands, &psz_bands ); + bands[i]->setValue( (int)( ( f + 20 ) * 10 ) ); + if( psz_bands == NULL || *psz_bands == '\0' ) break; + psz_bands++; + if( *psz_bands == '\0' ) break; + } + free( psz_bands_orig ); + } + else free( psz_bands ); + free( psz_af ); free( psz_pres ); } -- 2.39.2