Commit b96c13d1 authored by Rafaël Carré's avatar Rafaël Carré

qt4 simple preferences: only show the options of the selected audio output module

parent c92f962f
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
* Todo: * Todo:
* - Finish implementation (see WX) * - Finish implementation (see WX)
* - Improvements over WX * - Improvements over WX
* - Password field implementation (through "pwd" bool param
* - Validator for modulelist * - Validator for modulelist
* - Implement update stuff using a general Updated signal * - Implement update stuff using a general Updated signal
*/ */
...@@ -232,6 +231,8 @@ void StringConfigControl::finish() ...@@ -232,6 +231,8 @@ void StringConfigControl::finish()
text->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); text->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
if( label ) if( label )
label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
connect( text, SIGNAL(textChanged( const QString & )), this,
SIGNAL(Updated()) );
} }
/*********** File **************/ /*********** File **************/
...@@ -297,6 +298,8 @@ void FileConfigControl::finish() ...@@ -297,6 +298,8 @@ void FileConfigControl::finish()
text->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); text->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
if( label ) if( label )
label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
connect( text, SIGNAL(textChanged( const QString & )), this,
SIGNAL(Updated()) );
} }
/********* String / Directory **********/ /********* String / Directory **********/
...@@ -392,6 +395,8 @@ void StringListConfigControl::finish( bool bycat ) ...@@ -392,6 +395,8 @@ void StringListConfigControl::finish( bool bycat )
combo->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); combo->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
if( label ) if( label )
label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
connect( combo, SIGNAL(currentIndexChanged( int )), this,
SIGNAL(Updated()) );
} }
QString StringListConfigControl::getValue() QString StringListConfigControl::getValue()
...@@ -473,6 +478,8 @@ void ModuleConfigControl::finish( bool bycat ) ...@@ -473,6 +478,8 @@ void ModuleConfigControl::finish( bool bycat )
combo->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); combo->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
if( label ) if( label )
label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
connect( combo, SIGNAL(currentIndexChanged( int )), this,
SIGNAL(Updated()) );
} }
QString ModuleConfigControl::getValue() QString ModuleConfigControl::getValue()
...@@ -488,6 +495,8 @@ ModuleListConfigControl::ModuleListConfigControl( vlc_object_t *_p_this, ...@@ -488,6 +495,8 @@ ModuleListConfigControl::ModuleListConfigControl( vlc_object_t *_p_this,
{ {
groupBox = new QGroupBox ( qtr(p_item->psz_text) ); groupBox = new QGroupBox ( qtr(p_item->psz_text) );
text = new QLineEdit(); text = new QLineEdit();
connect( text, SIGNAL(textChanged( const QString & )), this,
SIGNAL(Updated()) );
QGridLayout *layoutGroupBox = new QGridLayout( groupBox ); QGridLayout *layoutGroupBox = new QGridLayout( groupBox );
finish( bycat ); finish( bycat );
...@@ -639,6 +648,7 @@ void ModuleListConfigControl::onUpdate( int value ) ...@@ -639,6 +648,7 @@ void ModuleListConfigControl::onUpdate( int value )
} }
} }
} }
emit Updated();
} }
/************************************************************************** /**************************************************************************
...@@ -688,6 +698,8 @@ void IntegerConfigControl::finish() ...@@ -688,6 +698,8 @@ void IntegerConfigControl::finish()
spin->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); spin->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
if( label ) if( label )
label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
connect( spin, SIGNAL(valueChanged( int )), this,
SIGNAL(Updated()) );
} }
int IntegerConfigControl::getValue() int IntegerConfigControl::getValue()
...@@ -785,6 +797,8 @@ void IntegerListConfigControl::finish( bool bycat ) ...@@ -785,6 +797,8 @@ void IntegerListConfigControl::finish( bool bycat )
combo->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); combo->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
if( label ) if( label )
label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
connect( combo, SIGNAL(currentIndexChanged( int )), this,
SIGNAL(Updated()) );
} }
int IntegerListConfigControl::getValue() int IntegerListConfigControl::getValue()
...@@ -829,6 +843,8 @@ void BoolConfigControl::finish() ...@@ -829,6 +843,8 @@ void BoolConfigControl::finish()
checkbox->setCheckState( p_item->value.i == VLC_TRUE ? Qt::Checked checkbox->setCheckState( p_item->value.i == VLC_TRUE ? Qt::Checked
: Qt::Unchecked ); : Qt::Unchecked );
checkbox->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); checkbox->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
connect( checkbox, SIGNAL(stateChanged( int )), this,
SIGNAL(Updated()) );
} }
int BoolConfigControl::getValue() int BoolConfigControl::getValue()
...@@ -886,6 +902,8 @@ void FloatConfigControl::finish() ...@@ -886,6 +902,8 @@ void FloatConfigControl::finish()
spin->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); spin->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
if( label ) if( label )
label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); label->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) );
connect( spin, SIGNAL(valueChanged( double )), this,
SIGNAL(Updated()) );
} }
float FloatConfigControl::getValue() float FloatConfigControl::getValue()
......
...@@ -195,16 +195,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -195,16 +195,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
/* Audio Panel Implementation */ /* Audio Panel Implementation */
START_SPREFS_CAT( Audio, qtr("General audio settings") ); START_SPREFS_CAT( Audio, qtr("General audio settings") );
#ifdef WIN32
ui.OSSBrowse->hide();
ui.OSSDevice->hide();
ui.OSSLabel->hide();
ui.alsaDevice->hide();
ui.alsaLabel->hide();
#else
ui.DirectXLabel->setVisible( false );
ui.DirectXDevice->setVisible( false );
#endif
CONFIG_GENERIC( "audio", Bool, NULL, enableAudio ); CONFIG_GENERIC( "audio", Bool, NULL, enableAudio );
CONFIG_GENERIC_NO_BOOL( "volume" , IntegerRangeSlider, NULL, CONFIG_GENERIC_NO_BOOL( "volume" , IntegerRangeSlider, NULL,
...@@ -217,15 +208,35 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -217,15 +208,35 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
detectionDolby ); detectionDolby );
CONFIG_GENERIC( "aout" , Module , NULL, outputModule ); CONFIG_GENERIC( "aout" , Module , NULL, outputModule );
CONNECT( control, Updated(), this, AudioDeviceChanged() );
QString aout_value = (dynamic_cast<ModuleConfigControl*>(control))->getValue();
#ifndef WIN32 #ifndef WIN32
CONFIG_GENERIC( "alsadev" , StringList , NULL, alsaDevice ); CONFIG_GENERIC( "alsadev" , StringList , ui.alsaLabel, alsaDevice );
CONFIG_GENERIC_FILE( "dspdev" , File , NULL, OSSDevice, OSSBrowse ); alsa_options = control;
CONFIG_GENERIC_FILE( "dspdev" , File , ui.OSSLabel, OSSDevice,
OSSBrowse );
oss_options = control;
#else #else
CONFIG_GENERIC( "directx-audio-device" , IntegerList, NULL, CONFIG_GENERIC( "directx-audio-device" , IntegerList, ui.DirectXLabel,
DirectXDevice ); DirectXDevice );
directx_options = control;
#endif #endif
CONFIG_GENERIC_FILE( "audiofile-file" , File , NULL, FileName, CONFIG_GENERIC_FILE( "audiofile-file" , File , ui.FileLabel, FileName,
fileBrowseButton ); fileBrowseButton );
file_options = control;
#ifdef WIN32
ui.OSSBrowse->hide();
ui.OSSDevice->hide();
ui.OSSLabel->hide();
ui.alsaDevice->hide();
ui.alsaLabel->hide();
#else
ui.DirectXLabel->setVisible( false );
ui.DirectXDevice->setVisible( false );
#endif
updateAudioOptions( aout_value );
CONFIG_GENERIC( "headphone-dolby" , Bool , NULL, headphoneEffect ); CONFIG_GENERIC( "headphone-dolby" , Bool , NULL, headphoneEffect );
// CONFIG_GENERIC( "" , Bool, NULL, ); activation of normalizer //FIXME // CONFIG_GENERIC( "" , Bool, NULL, ); activation of normalizer //FIXME
...@@ -321,6 +332,36 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -321,6 +332,36 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
this->setLayout(panel_layout); this->setLayout(panel_layout);
} }
void SPrefsPanel::AudioDeviceChanged()
{
ModuleConfigControl *module_config =
dynamic_cast<ModuleConfigControl*>( sender() );
updateAudioOptions( module_config->getValue() );
}
void SPrefsPanel::updateAudioOptions( QString value )
{
#ifndef WIN32
alsa_options->hide();
oss_options->hide();
#else
directx_options->hide();
#endif
file_options->hide();
if( value == "aout_file" )
file_options->show();
#ifndef WIN32
else if( value == "alsa" )
alsa_options->show();
else if( value == "oss" )
oss_options->show();
#else
else if( value == "directx" )
directx_options->show();
#endif
}
void SPrefsPanel::apply() void SPrefsPanel::apply()
{ {
QList<ConfigControl *>::Iterator i; QList<ConfigControl *>::Iterator i;
......
...@@ -67,6 +67,21 @@ public: ...@@ -67,6 +67,21 @@ public:
private: private:
intf_thread_t *p_intf; intf_thread_t *p_intf;
QList<ConfigControl *> controls; QList<ConfigControl *> controls;
/* ConfigControl for audio output options */
#ifndef WIN32
ConfigControl *alsa_options;
ConfigControl *oss_options;
#else
ConfigControl *directx_options;
#endif
ConfigControl *file_options;
void updateAudioOptions( QString );
/* Display only the options for the selected audio output */
private slots:
void AudioDeviceChanged();
}; };
#endif #endif
...@@ -141,7 +141,7 @@ ...@@ -141,7 +141,7 @@
</widget> </widget>
</item> </item>
<item row="4" column="0" > <item row="4" column="0" >
<widget class="QLabel" name="label_7" > <widget class="QLabel" name="FileLabel" >
<property name="text" > <property name="text" >
<string>_("File")</string> <string>_("File")</string>
</property> </property>
...@@ -160,14 +160,14 @@ ...@@ -160,14 +160,14 @@
<item row="3" column="0" > <item row="3" column="0" >
<widget class="QLabel" name="OSSLabel" > <widget class="QLabel" name="OSSLabel" >
<property name="text" > <property name="text" >
<string>_("OSS Device")</string> <string>_("Device")</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0" > <item row="2" column="0" >
<widget class="QLabel" name="DirectXLabel" > <widget class="QLabel" name="DirectXLabel" >
<property name="text" > <property name="text" >
<string>_("DirectX Device")</string> <string>_("Device")</string>
</property> </property>
</widget> </widget>
</item> </item>
...@@ -177,7 +177,7 @@ ...@@ -177,7 +177,7 @@
<item row="1" column="0" > <item row="1" column="0" >
<widget class="QLabel" name="alsaLabel" > <widget class="QLabel" name="alsaLabel" >
<property name="text" > <property name="text" >
<string>_("Alsa Device")</string> <string>_("Device")</string>
</property> </property>
</widget> </widget>
</item> </item>
......
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