Commit 8970ee9e authored by Thomas Guillem's avatar Thomas Guillem

qt: save effects and filters on user request

Fixes #6873
parent 40420584
...@@ -288,7 +288,7 @@ void ExtVideo::clean() ...@@ -288,7 +288,7 @@ void ExtVideo::clean()
static QString ChangeFiltersString( struct intf_thread_t *p_intf, const char *psz_filter_type, const char *psz_name, bool b_add ) static QString ChangeFiltersString( struct intf_thread_t *p_intf, const char *psz_filter_type, const char *psz_name, bool b_add )
{ {
char* psz_chain = config_GetPsz( p_intf, psz_filter_type ); char* psz_chain = var_GetString( THEPL, psz_filter_type );
QString const chain = QString( psz_chain ? psz_chain : "" ); QString const chain = QString( psz_chain ? psz_chain : "" );
QStringList list = chain.split( ':', QString::SplitBehavior::SkipEmptyParts ); QStringList list = chain.split( ':', QString::SplitBehavior::SkipEmptyParts );
...@@ -326,7 +326,7 @@ void ExtVideo::changeVFiltersString( const char *psz_name, bool b_add ) ...@@ -326,7 +326,7 @@ void ExtVideo::changeVFiltersString( const char *psz_name, bool b_add )
QString result = ChangeFiltersString( p_intf, psz_filter_type, psz_name, b_add ); QString result = ChangeFiltersString( p_intf, psz_filter_type, psz_name, b_add );
config_PutPsz( p_intf, psz_filter_type, qtu( result ) ); emit configChanged( qfu( psz_filter_type ), result );
UpdateVFiltersString( p_intf, psz_filter_type, qtu( result ) ); UpdateVFiltersString( p_intf, psz_filter_type, qtu( result ) );
} }
...@@ -505,7 +505,7 @@ void ExtVideo::setFilterOption( const char *psz_module, const char *psz_option, ...@@ -505,7 +505,7 @@ void ExtVideo::setFilterOption( const char *psz_module, const char *psz_option,
{ {
if( i_int == -1 ) if( i_int == -1 )
msg_Warn( p_intf, "Could not find the correct Integer widget" ); msg_Warn( p_intf, "Could not find the correct Integer widget" );
config_PutInt( p_intf, psz_option, i_int ); emit configChanged( qfu( psz_option ), QVariant( i_int ) );
if( i_type == VLC_VAR_INTEGER ) if( i_type == VLC_VAR_INTEGER )
{ {
val.i_int = i_int; val.i_int = i_int;
...@@ -521,7 +521,7 @@ void ExtVideo::setFilterOption( const char *psz_module, const char *psz_option, ...@@ -521,7 +521,7 @@ void ExtVideo::setFilterOption( const char *psz_module, const char *psz_option,
{ {
if( f_float == -1 ) if( f_float == -1 )
msg_Warn( p_intf, "Could not find the correct Float widget" ); msg_Warn( p_intf, "Could not find the correct Float widget" );
config_PutFloat( p_intf, psz_option, f_float ); emit configChanged( qfu( psz_option ), QVariant( f_float ) );
var_SetFloat( THEPL, psz_option, f_float ); var_SetFloat( THEPL, psz_option, f_float );
val.f_float = f_float; val.f_float = f_float;
} }
...@@ -532,7 +532,7 @@ void ExtVideo::setFilterOption( const char *psz_module, const char *psz_option, ...@@ -532,7 +532,7 @@ void ExtVideo::setFilterOption( const char *psz_module, const char *psz_option,
msg_Warn( p_intf, "Could not find the correct String widget" ); msg_Warn( p_intf, "Could not find the correct String widget" );
psz_string = ""; psz_string = "";
} }
config_PutPsz( p_intf, psz_option, psz_string ); emit configChanged( qfu( psz_option ), QVariant( psz_string ) );
var_SetString( THEPL, psz_option, psz_string ); var_SetString( THEPL, psz_option, psz_string );
val.psz_string = (char *) psz_string; val.psz_string = (char *) psz_string;
} }
...@@ -831,7 +831,6 @@ void ExtV4l2::ValueChange( int value ) ...@@ -831,7 +831,6 @@ void ExtV4l2::ValueChange( int value )
FilterSliderData::FilterSliderData( QObject *parent, QSlider *_slider ) : FilterSliderData::FilterSliderData( QObject *parent, QSlider *_slider ) :
QObject( parent ), slider( _slider ) QObject( parent ), slider( _slider )
{ {
b_save_to_config = false;
} }
FilterSliderData::FilterSliderData( QObject *parent, FilterSliderData::FilterSliderData( QObject *parent,
...@@ -842,7 +841,6 @@ FilterSliderData::FilterSliderData( QObject *parent, ...@@ -842,7 +841,6 @@ FilterSliderData::FilterSliderData( QObject *parent,
QObject( parent ), slider( _slider ), valueLabel( _label ), QObject( parent ), slider( _slider ), valueLabel( _label ),
nameLabel( _nameLabel ), p_data( _p_data ), p_intf( _p_intf ) nameLabel( _nameLabel ), p_data( _p_data ), p_intf( _p_intf )
{ {
b_save_to_config = false;
slider->setMinimum( p_data->f_min / p_data->f_resolution ); slider->setMinimum( p_data->f_min / p_data->f_resolution );
slider->setMaximum( p_data->f_max / p_data->f_resolution ); slider->setMaximum( p_data->f_max / p_data->f_resolution );
nameLabel->setText( p_data->descs ); nameLabel->setText( p_data->descs );
...@@ -894,7 +892,7 @@ float FilterSliderData::initialValue() ...@@ -894,7 +892,7 @@ float FilterSliderData::initialValue()
return f; return f;
} }
void FilterSliderData::onValueChanged( int i ) const void FilterSliderData::onValueChanged( int i )
{ {
float f = ((float) i) * p_data->f_resolution; float f = ((float) i) * p_data->f_resolution;
vlc_object_t *p_aout = (vlc_object_t *) THEMIM->getAout(); vlc_object_t *p_aout = (vlc_object_t *) THEMIM->getAout();
...@@ -906,16 +904,10 @@ void FilterSliderData::onValueChanged( int i ) const ...@@ -906,16 +904,10 @@ void FilterSliderData::onValueChanged( int i ) const
writeToConfig(); writeToConfig();
} }
void FilterSliderData::writeToConfig() const void FilterSliderData::writeToConfig()
{ {
if ( !b_save_to_config ) return;
float f = ((float) slider->value()) * p_data->f_resolution; float f = ((float) slider->value()) * p_data->f_resolution;
config_PutFloat( p_intf, qtu(p_data->name), f ); emit configChanged( p_data->name, QVariant( f ) );
}
void FilterSliderData::setSaveToConfig( bool b )
{
b_save_to_config = b;
} }
AudioFilterControlWidget::AudioFilterControlWidget AudioFilterControlWidget::AudioFilterControlWidget
...@@ -923,6 +915,12 @@ AudioFilterControlWidget::AudioFilterControlWidget ...@@ -923,6 +915,12 @@ AudioFilterControlWidget::AudioFilterControlWidget
QWidget( parent ), p_intf( _p_intf ), name( _name ), i_smallfont(0) QWidget( parent ), p_intf( _p_intf ), name( _name ), i_smallfont(0)
{} {}
void AudioFilterControlWidget::connectConfigChanged( FilterSliderData *slider )
{
connect( slider, SIGNAL( configChanged(QString, QVariant) ),
this, SIGNAL( configChanged(QString, QVariant) ) );
}
void AudioFilterControlWidget::build() void AudioFilterControlWidget::build()
{ {
QFont smallFont = QApplication::font(); QFont smallFont = QApplication::font();
...@@ -953,6 +951,7 @@ void AudioFilterControlWidget::build() ...@@ -953,6 +951,7 @@ void AudioFilterControlWidget::build()
ctrlLayout->addWidget( nameLabel, 2, i, Qt::AlignHCenter ); ctrlLayout->addWidget( nameLabel, 2, i, Qt::AlignHCenter );
i++; i++;
sliderDatas << filter; sliderDatas << filter;
connectConfigChanged( filter );
} }
char *psz_af = var_InheritString( THEPL, "audio-filter" ); char *psz_af = var_InheritString( THEPL, "audio-filter" );
...@@ -966,7 +965,7 @@ void AudioFilterControlWidget::build() ...@@ -966,7 +965,7 @@ void AudioFilterControlWidget::build()
free( psz_af ); free( psz_af );
} }
void AudioFilterControlWidget::enable( bool b_enable ) const void AudioFilterControlWidget::enable( bool b_enable )
{ {
module_t *p_obj = module_find( qtu(name) ); module_t *p_obj = module_find( qtu(name) );
if( !p_obj ) if( !p_obj )
...@@ -977,16 +976,10 @@ void AudioFilterControlWidget::enable( bool b_enable ) const ...@@ -977,16 +976,10 @@ void AudioFilterControlWidget::enable( bool b_enable ) const
QString result = ChangeFiltersString( p_intf, "audio-filter", qtu(name), QString result = ChangeFiltersString( p_intf, "audio-filter", qtu(name),
b_enable ); b_enable );
config_PutPsz( p_intf, "audio-filter", qtu( result ) ); emit configChanged( qfu("audio-filter"), result );
playlist_EnableAudioFilter( THEPL, qtu(name), b_enable ); playlist_EnableAudioFilter( THEPL, qtu(name), b_enable );
} }
void AudioFilterControlWidget::setSaveToConfig( bool b_save )
{
foreach( FilterSliderData *f, sliderDatas )
f->setSaveToConfig( b_save );
}
/********************************************************************** /**********************************************************************
* Equalizer * Equalizer
**********************************************************************/ **********************************************************************/
...@@ -1056,7 +1049,7 @@ float EqualizerSliderData::initialValue() ...@@ -1056,7 +1049,7 @@ float EqualizerSliderData::initialValue()
return f; return f;
} }
void EqualizerSliderData::onValueChanged( int i ) const void EqualizerSliderData::onValueChanged( int i )
{ {
QStringList bands = getBandsFromAout(); QStringList bands = getBandsFromAout();
if ( bands.count() > index ) if ( bands.count() > index )
...@@ -1073,15 +1066,14 @@ void EqualizerSliderData::onValueChanged( int i ) const ...@@ -1073,15 +1066,14 @@ void EqualizerSliderData::onValueChanged( int i ) const
} }
} }
void EqualizerSliderData::writeToConfig() const void EqualizerSliderData::writeToConfig()
{ {
if ( !b_save_to_config ) return;
QStringList bands = getBandsFromAout(); QStringList bands = getBandsFromAout();
if ( bands.count() > index ) if ( bands.count() > index )
{ {
float f = (float) slider->value() * p_data->f_resolution; float f = (float) slider->value() * p_data->f_resolution;
bands[ index ] = QLocale( QLocale::C ).toString( f ); bands[ index ] = QLocale( QLocale::C ).toString( f );
config_PutPsz( p_intf, qtu(p_data->name), qtu(bands.join( " " )) ); emit configChanged( p_data->name, QVariant( bands.join( " " ) ) );
} }
} }
...@@ -1140,6 +1132,7 @@ void Equalizer::build() ...@@ -1140,6 +1132,7 @@ void Equalizer::build()
ui.preampValue->setFont( smallFont ); ui.preampValue->setFont( smallFont );
preamp = new FilterSliderData( this, p_intf, preamp = new FilterSliderData( this, p_intf,
ui.preampSlider, ui.preampValue, ui.preampLabel, & preamp_values ); ui.preampSlider, ui.preampValue, ui.preampLabel, & preamp_values );
connectConfigChanged( preamp );
/* fix sliders spacing accurately */ /* fix sliders spacing accurately */
int i_width = qMax( QFontMetrics( smallFont ).width( "500 Hz" ), int i_width = qMax( QFontMetrics( smallFont ).width( "500 Hz" ),
...@@ -1163,6 +1156,7 @@ void Equalizer::build() ...@@ -1163,6 +1156,7 @@ void Equalizer::build()
ctrlLayout->addWidget( nameLabel, 1, i, Qt::AlignHCenter ); ctrlLayout->addWidget( nameLabel, 1, i, Qt::AlignHCenter );
sliderDatas << filter; /* keep track for applying presets */ sliderDatas << filter; /* keep track for applying presets */
i++; i++;
connectConfigChanged( filter );
} }
/* Add the listed presets */ /* Add the listed presets */
...@@ -1226,12 +1220,6 @@ void Equalizer::build() ...@@ -1226,12 +1220,6 @@ void Equalizer::build()
vlc_object_release( p_aout ); vlc_object_release( p_aout );
} }
void Equalizer::setSaveToConfig( bool b_save )
{
AudioFilterControlWidget::setSaveToConfig( b_save );
preamp->setSaveToConfig( b_save );
}
void Equalizer::setCorePreset( int i_preset ) void Equalizer::setCorePreset( int i_preset )
{ {
if( i_preset < 1 ) if( i_preset < 1 )
...@@ -1250,11 +1238,11 @@ void Equalizer::setCorePreset( int i_preset ) ...@@ -1250,11 +1238,11 @@ void Equalizer::setCorePreset( int i_preset )
var_SetString( p_aout , "equalizer-preset" , preset_list[i_preset] ); var_SetString( p_aout , "equalizer-preset" , preset_list[i_preset] );
vlc_object_release( p_aout ); vlc_object_release( p_aout );
} }
config_PutPsz( p_intf, "equalizer-preset", preset_list[i_preset] ); emit configChanged( qfu( "equalizer-preset" ), QVariant( qfu( preset_list[i_preset] ) ) );
} }
/* Function called when the set2Pass button is activated */ /* Function called when the set2Pass button is activated */
void Equalizer::enable2Pass( bool b_enable ) const void Equalizer::enable2Pass( bool b_enable )
{ {
vlc_object_t *p_aout= (vlc_object_t *)THEMIM->getAout(); vlc_object_t *p_aout= (vlc_object_t *)THEMIM->getAout();
...@@ -1263,7 +1251,7 @@ void Equalizer::enable2Pass( bool b_enable ) const ...@@ -1263,7 +1251,7 @@ void Equalizer::enable2Pass( bool b_enable ) const
var_SetBool( p_aout, "equalizer-2pass", b_enable ); var_SetBool( p_aout, "equalizer-2pass", b_enable );
vlc_object_release( p_aout ); vlc_object_release( p_aout );
} }
config_PutInt( p_intf, "equalizer-2pass", b_enable ); emit configChanged( qfu( "equalizer-2pass" ), QVariant( b_enable ) );
} }
/********************************************************************** /**********************************************************************
......
...@@ -64,6 +64,8 @@ private slots: ...@@ -64,6 +64,8 @@ private slots:
void cropChange(); void cropChange();
void browseLogo(); void browseLogo();
void browseEraseFile(); void browseEraseFile();
signals:
void configChanged( QString name, QVariant value );
}; };
class ExtV4l2 : public QWidget class ExtV4l2 : public QWidget
...@@ -110,18 +112,19 @@ public: ...@@ -110,18 +112,19 @@ public:
protected: protected:
FilterSliderData( QObject *parent, QSlider *slider ); FilterSliderData( QObject *parent, QSlider *slider );
virtual float initialValue(); virtual float initialValue();
virtual void writeToConfig();
QSlider *slider; QSlider *slider;
QLabel *valueLabel; QLabel *valueLabel;
QLabel *nameLabel; QLabel *nameLabel;
const slider_data_t *p_data; const slider_data_t *p_data;
intf_thread_t *p_intf; intf_thread_t *p_intf;
bool b_save_to_config;
public slots: public slots:
virtual void onValueChanged( int i ) const; virtual void onValueChanged( int i );
virtual void updateText( int i ); virtual void updateText( int i );
virtual void writeToConfig() const;
void setSaveToConfig( bool ); signals:
void configChanged( QString name, QVariant value );
}; };
class AudioFilterControlWidget : public QWidget class AudioFilterControlWidget : public QWidget
...@@ -133,6 +136,7 @@ public: ...@@ -133,6 +136,7 @@ public:
protected: protected:
virtual void build(); virtual void build();
void connectConfigChanged( FilterSliderData *slider );
QVector<FilterSliderData::slider_data_t> controls; QVector<FilterSliderData::slider_data_t> controls;
QVector<FilterSliderData *> sliderDatas; QVector<FilterSliderData *> sliderDatas;
QGroupBox *slidersBox; QGroupBox *slidersBox;
...@@ -141,8 +145,10 @@ protected: ...@@ -141,8 +145,10 @@ protected:
int i_smallfont; int i_smallfont;
protected slots: protected slots:
void enable( bool ) const; void enable( bool );
virtual void setSaveToConfig( bool );
signals:
void configChanged( QString name, QVariant value );
}; };
class EqualizerSliderData : public FilterSliderData class EqualizerSliderData : public FilterSliderData
...@@ -159,10 +165,10 @@ protected: ...@@ -159,10 +165,10 @@ protected:
float initialValue() Q_DECL_OVERRIDE; float initialValue() Q_DECL_OVERRIDE;
int index; int index;
QStringList getBandsFromAout() const; QStringList getBandsFromAout() const;
void writeToConfig();
public slots: public slots:
void onValueChanged( int i ) const Q_DECL_OVERRIDE; void onValueChanged( int i ) Q_DECL_OVERRIDE;
void writeToConfig() const Q_DECL_OVERRIDE;
}; };
class Equalizer: public AudioFilterControlWidget class Equalizer: public AudioFilterControlWidget
...@@ -175,16 +181,13 @@ public: ...@@ -175,16 +181,13 @@ public:
protected: protected:
void build() Q_DECL_OVERRIDE; void build() Q_DECL_OVERRIDE;
protected slots:
void setSaveToConfig( bool ) Q_DECL_OVERRIDE;
private: private:
FilterSliderData *preamp; FilterSliderData *preamp;
FilterSliderData::slider_data_t preamp_values; FilterSliderData::slider_data_t preamp_values;
private slots: private slots:
void setCorePreset( int ); void setCorePreset( int );
void enable2Pass( bool ) const; void enable2Pass( bool );
}; };
class Compressor: public AudioFilterControlWidget class Compressor: public AudioFilterControlWidget
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
# include "config.h" # include "config.h"
#endif #endif
#include <assert.h>
#include "dialogs/extended.hpp" #include "dialogs/extended.hpp"
#include "main_interface.hpp" /* Needed for external MI size */ #include "main_interface.hpp" /* Needed for external MI size */
...@@ -61,16 +63,20 @@ ExtendedDialog::ExtendedDialog( intf_thread_t *_p_intf ) ...@@ -61,16 +63,20 @@ ExtendedDialog::ExtendedDialog( intf_thread_t *_p_intf )
QTabWidget *audioTab = new QTabWidget( audioWidget ); QTabWidget *audioTab = new QTabWidget( audioWidget );
equal = new Equalizer( p_intf, audioTab ); equal = new Equalizer( p_intf, audioTab );
CONNECT( equal, configChanged(QString, QVariant), this, putAudioConfig(QString, QVariant) );
audioTab->addTab( equal, qtr( "Equalizer" ) ); audioTab->addTab( equal, qtr( "Equalizer" ) );
Compressor *compres = new Compressor( p_intf, audioTab ); Compressor *compres = new Compressor( p_intf, audioTab );
CONNECT( compres, configChanged(QString, QVariant), this, putAudioConfig(QString, QVariant) );
audioTab->addTab( compres, qtr( "Compressor" ) ); audioTab->addTab( compres, qtr( "Compressor" ) );
Spatializer *spatial = new Spatializer( p_intf, audioTab ); Spatializer *spatial = new Spatializer( p_intf, audioTab );
CONNECT( spatial, configChanged(QString, QVariant), this, putAudioConfig(QString, QVariant) );
audioTab->addTab( spatial, qtr( "Spatializer" ) ); audioTab->addTab( spatial, qtr( "Spatializer" ) );
audioLayout->addWidget( audioTab ); audioLayout->addWidget( audioTab );
StereoWidener *stereowiden = new StereoWidener( p_intf, audioTab ); StereoWidener *stereowiden = new StereoWidener( p_intf, audioTab );
CONNECT( stereowiden, configChanged(QString, QVariant), this, putAudioConfig(QString, QVariant) );
audioTab->addTab( stereowiden, qtr( "Stereo Widener" ) ); audioTab->addTab( stereowiden, qtr( "Stereo Widener" ) );
audioLayout->addWidget( audioTab ); audioLayout->addWidget( audioTab );
...@@ -82,6 +88,7 @@ ExtendedDialog::ExtendedDialog( intf_thread_t *_p_intf ) ...@@ -82,6 +88,7 @@ ExtendedDialog::ExtendedDialog( intf_thread_t *_p_intf )
QTabWidget *videoTab = new QTabWidget( videoWidget ); QTabWidget *videoTab = new QTabWidget( videoWidget );
videoEffect = new ExtVideo( p_intf, videoTab ); videoEffect = new ExtVideo( p_intf, videoTab );
CONNECT( videoEffect, configChanged(QString, QVariant), this, putVideoConfig(QString, QVariant) );
videoLayout->addWidget( videoTab ); videoLayout->addWidget( videoTab );
videoTab->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum ); videoTab->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum );
...@@ -97,24 +104,21 @@ ExtendedDialog::ExtendedDialog( intf_thread_t *_p_intf ) ...@@ -97,24 +104,21 @@ ExtendedDialog::ExtendedDialog( intf_thread_t *_p_intf )
} }
layout->addWidget( mainTabW ); layout->addWidget( mainTabW );
CONNECT( mainTabW, currentChanged(int), this, currentTabChanged(int) );
/* Bottom buttons / checkbox line */ /* Bottom buttons */
QHBoxLayout *buttonsLayout = new QHBoxLayout(); QDialogButtonBox *buttonBox = new QDialogButtonBox( Qt::Horizontal, this );
layout->addLayout( buttonsLayout );
writeChangesBox = new QCheckBox( qtr("&Write changes to config") ); m_applyButton = new QPushButton( qtr("&Save"), this );
buttonsLayout->addWidget( writeChangesBox ); m_applyButton->setEnabled( false );
CONNECT( writeChangesBox, toggled(bool), compres, setSaveToConfig(bool) ); buttonBox->addButton( m_applyButton, QDialogButtonBox::ApplyRole );
CONNECT( writeChangesBox, toggled(bool), spatial, setSaveToConfig(bool) );
CONNECT( writeChangesBox, toggled(bool), equal, setSaveToConfig(bool) );
CONNECT( mainTabW, currentChanged(int), this, currentTabChanged(int) );
QDialogButtonBox *closeButtonBox = new QDialogButtonBox( Qt::Horizontal, this ); buttonBox->addButton(
closeButtonBox->addButton(
new QPushButton( qtr("&Close"), this ), QDialogButtonBox::RejectRole ); new QPushButton( qtr("&Close"), this ), QDialogButtonBox::RejectRole );
buttonsLayout->addWidget( closeButtonBox ); layout->addWidget( buttonBox );
CONNECT( closeButtonBox, rejected(), this, close() ); CONNECT( buttonBox, rejected(), this, close() );
CONNECT( m_applyButton, clicked(), this, saveConfig() );
/* Restore geometry or move this dialog on the left pane of the MI */ /* Restore geometry or move this dialog on the left pane of the MI */
if( !restoreGeometry( getSettings()->value("EPanel/geometry").toByteArray() ) ) if( !restoreGeometry( getSettings()->value("EPanel/geometry").toByteArray() ) )
...@@ -156,5 +160,53 @@ void ExtendedDialog::changedItem( int i_status ) ...@@ -156,5 +160,53 @@ void ExtendedDialog::changedItem( int i_status )
void ExtendedDialog::currentTabChanged( int i ) void ExtendedDialog::currentTabChanged( int i )
{ {
writeChangesBox->setVisible( i == AUDIO_TAB ); if( i == AUDIO_TAB || i == VIDEO_TAB )
{
m_applyButton->setVisible( true );
m_applyButton->setEnabled( !m_hashConfigs[i].isEmpty() );
}
else
m_applyButton->setVisible( false );
}
void ExtendedDialog::putAudioConfig( const QString& name, const QVariant value )
{
m_hashConfigs[AUDIO_TAB].insert( name, value );
m_applyButton->setEnabled( true );
}
void ExtendedDialog::putVideoConfig( const QString& name, const QVariant value )
{
m_hashConfigs[VIDEO_TAB].insert( name, value );
m_applyButton->setEnabled( true );
}
void ExtendedDialog::saveConfig()
{
assert( currentTab() == AUDIO_TAB || currentTab() == VIDEO_TAB );
QHash<QString, QVariant> *hashConfig = &m_hashConfigs[currentTab()];
for( QHash<QString, QVariant>::iterator i = hashConfig->begin();
i != hashConfig->end(); ++i )
{
QVariant &value = i.value();
switch( static_cast<QMetaType::Type>(value.type()) )
{
case QMetaType::QString:
config_PutPsz( p_intf, qtu(i.key()), qtu(value.toString()) );
break;
case QMetaType::Int:
config_PutInt( p_intf, qtu(i.key()), value.toInt() ) ;
break;
case QMetaType::Double:
case QMetaType::Float:
config_PutFloat( p_intf, qtu(i.key()), value.toFloat() ) ;
break;
default:
vlc_assert_unreachable();
}
}
config_SaveConfigFile( p_intf );
hashConfig->clear();
m_applyButton->setEnabled( false );
} }
...@@ -52,10 +52,14 @@ private: ...@@ -52,10 +52,14 @@ private:
ExtVideo *videoEffect; ExtVideo *videoEffect;
Equalizer *equal; Equalizer *equal;
QTabWidget *mainTabW; QTabWidget *mainTabW;
QCheckBox *writeChangesBox; QPushButton *m_applyButton;
QHash<QString, QVariant> m_hashConfigs[2];
private slots: private slots:
void changedItem( int ); void changedItem( int );
void currentTabChanged( int ); void currentTabChanged( int );
void saveConfig();
void putAudioConfig( const QString& name, const QVariant value );
void putVideoConfig( const QString& name, const QVariant value );
friend class Singleton<ExtendedDialog>; friend class Singleton<ExtendedDialog>;
}; };
......
Markdown is supported
0% or