From: Francois Cartegnie Date: Thu, 11 Jun 2009 14:08:25 +0000 (+0200) Subject: UI: Sprefs_audio fixes and enhancements X-Git-Tag: 1.1.0-ff~5483 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=a50bb327b31a378206a17341bbe58baddb51b050;p=vlc UI: Sprefs_audio fixes and enhancements Signed-off-by: Jean-Baptiste Kempf --- diff --git a/modules/gui/qt4/components/preferences_widgets.cpp b/modules/gui/qt4/components/preferences_widgets.cpp index 2b2163d2f1..309cf16612 100644 --- a/modules/gui/qt4/components/preferences_widgets.cpp +++ b/modules/gui/qt4/components/preferences_widgets.cpp @@ -1037,7 +1037,7 @@ BoolConfigControl::BoolConfigControl( vlc_object_t *_p_this, BoolConfigControl::BoolConfigControl( vlc_object_t *_p_this, module_config_t *_p_item, QLabel *_label, - QCheckBox *_checkbox, + QAbstractButton *_checkbox, bool bycat ) : VIntConfigControl( _p_this, _p_item ) { @@ -1048,14 +1048,13 @@ BoolConfigControl::BoolConfigControl( vlc_object_t *_p_this, void BoolConfigControl::finish() { - checkbox->setCheckState( p_item->value.i == true ? Qt::Checked - : Qt::Unchecked ); + checkbox->setChecked( p_item->value.i == true ); checkbox->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); } int BoolConfigControl::getValue() { - return checkbox->checkState() == Qt::Checked ? true : false; + return checkbox->isChecked(); } /************************************************************************** diff --git a/modules/gui/qt4/components/preferences_widgets.hpp b/modules/gui/qt4/components/preferences_widgets.hpp index b42bc0ae51..e007c45ea6 100644 --- a/modules/gui/qt4/components/preferences_widgets.hpp +++ b/modules/gui/qt4/components/preferences_widgets.hpp @@ -201,14 +201,14 @@ public: BoolConfigControl( vlc_object_t *, module_config_t *, QWidget *, QGridLayout *, int& ); BoolConfigControl( vlc_object_t *, module_config_t *, - QLabel *, QCheckBox*, bool ); + QLabel *, QAbstractButton*, bool ); virtual ~BoolConfigControl() {}; virtual int getValue(); virtual void show() { checkbox->show(); } virtual void hide() { checkbox->hide(); } virtual int getType() { return CONFIG_ITEM_BOOL; } -private: - QCheckBox *checkbox; +private: + QAbstractButton *checkbox; void finish(); }; diff --git a/modules/gui/qt4/components/simple_preferences.cpp b/modules/gui/qt4/components/simple_preferences.cpp index 701cc18849..ed8ed6e969 100644 --- a/modules/gui/qt4/components/simple_preferences.cpp +++ b/modules/gui/qt4/components/simple_preferences.cpp @@ -223,6 +223,9 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, START_SPREFS_CAT( Audio, qtr("Audio Settings") ); CONFIG_GENERIC( "audio", Bool, NULL, enableAudio ); + ui.SPrefsAudio_zone->setEnabled( ui.enableAudio->isChecked() ); + CONNECT( ui.enableAudio, toggled( bool ), + ui.SPrefsAudio_zone, setEnabled( bool ) ); #define audioCommon( name ) \ QWidget * name ## Control = new QWidget( ui.outputAudioBox ); \ @@ -230,7 +233,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, name ## Layout->setMargin( 0 ); \ name ## Layout->setSpacing( 0 ); \ QLabel * name ## Label = new QLabel( qtr( "Device:" ), name ## Control ); \ - name ## Label->setMinimumSize(QSize(100, 0)); \ + name ## Label->setMinimumSize(QSize(250, 0)); \ name ## Layout->addWidget( name ## Label ); \ #define audioControl( name) \ @@ -249,12 +252,6 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, name ## Layout->addWidget( name ## Browse ); \ outputAudioLayout->addWidget( name ## Control, outputAudioLayout->rowCount(), 0, 1, -1 ); - /* hide if necessary */ - ui.lastfm_user_edit->hide(); - ui.lastfm_user_label->hide(); - ui.lastfm_pass_edit->hide(); - ui.lastfm_pass_label->hide(); - /* Build if necessary */ QGridLayout * outputAudioLayout = qobject_cast(ui.outputAudioBox->layout()); #ifdef WIN32 @@ -292,13 +289,17 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, CONFIG_GENERIC_NO_BOOL( "volume" , IntegerRangeSlider, NULL, defaultVolume ); CONNECT( ui.defaultVolume, valueChanged( int ), - this, updateAudioVolume( int ) ); + this, updateAudioVolume( int ) ); + + CONFIG_GENERIC( "qt-autosave-volume", Bool, NULL, keepVolumeRadio ); + ui.defaultVolume_zone->setEnabled( ui.resetVolumeRadio->isChecked() ); + CONNECT( ui.resetVolumeRadio, toggled( bool ), + ui.defaultVolume_zone, setEnabled( bool ) ); CONFIG_GENERIC( "audio-language" , String , ui.langLabel, preferredAudioLanguage ); CONFIG_GENERIC( "spdif", Bool, NULL, spdifBox ); - CONFIG_GENERIC( "qt-autosave-volume", Bool, NULL, saveVolBox ); CONFIG_GENERIC( "force-dolby-surround", IntegerList, ui.dolbyLabel, detectionDolby ); @@ -326,6 +327,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ui.volumeValue->setButtonSymbols(QAbstractSpinBox::NoButtons); optionWidgets.append( ui.volumeValue ); optionWidgets.append( ui.headphoneEffect ); + optionWidgets.append( ui.spdifBox ); updateAudioOptions( ui.outputModule->currentIndex() ); /* LastFM */ @@ -340,11 +342,19 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ui.lastfm->setChecked( true ); else ui.lastfm->setChecked( false ); + + ui.lastfm_zone->setEnabled( ui.lastfm->isChecked() ); + + CONNECT( ui.lastfm, toggled( bool ), + ui.lastfm_zone, setEnabled( bool ) ); CONNECT( ui.lastfm, stateChanged( int ), this, lastfm_Changed( int ) ); } else + { ui.lastfm->hide(); + ui.lastfm_zone->hide(); + } /* Normalizer */ CONNECT( ui.volNormBox, toggled( bool ), ui.volNormSpin, @@ -647,6 +657,8 @@ void SPrefsPanel::updateAudioOptions( int number) optionWidgets[alsaW]->setVisible( ( value == "alsa" ) ); #endif optionWidgets[fileW]->setVisible( ( value == "aout_file" ) ); + optionWidgets[spdifChB]->setVisible( ( value != "aout_file" + && value != "dummy" ) ); } diff --git a/modules/gui/qt4/components/simple_preferences.hpp b/modules/gui/qt4/components/simple_preferences.hpp index 754d8adbbc..7e0936e983 100644 --- a/modules/gui/qt4/components/simple_preferences.hpp +++ b/modules/gui/qt4/components/simple_preferences.hpp @@ -75,6 +75,7 @@ enum { normalizerChB, volLW, headphoneB, + spdifChB, }; enum { inputLE, cachingCoB }; enum { skinRB, qtRB }; diff --git a/modules/gui/qt4/ui/sprefs_audio.ui b/modules/gui/qt4/ui/sprefs_audio.ui index a055fbf8ec..bdcb070356 100644 --- a/modules/gui/qt4/ui/sprefs_audio.ui +++ b/modules/gui/qt4/ui/sprefs_audio.ui @@ -1,346 +1,560 @@ - + + Jean-Baptiste Kempf SPrefsAudio - - + + 0 0 643 - 605 + 619 - + Form - + - - + + Enable audio - + true - - - General Audio - - - - - - Default volume - - - - - - - - 0 - 0 - - - - - 140 - 0 - - - - - 200 - 16777215 - - - - Qt::LeftToRight - - - 400 - - - 100 - - - Qt::Horizontal - - - - - - - 256 corresponds to 100%, 1024 to 400% - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - % - - - 400 - - - 100 - - - - - - - Use S/PDIF when available - - - - - - - Save volume on exit - + + + + 9 + + + 0 + + + 0 + + + + + Volume + + + + 0 + + + + + + 250 + 0 + + + + Keep audio level between sessions + + + + + + + + 250 + 0 + + + + Always reset audio start level to: + + + true + + + + + + + + 0 + + + QLayout::SetDefaultConstraint + + + 0 + + + + + + 0 + 0 + + + + + 140 + 0 + + + + Qt::LeftToRight + + + 200 + + + 100 + + + Qt::Horizontal + + + + + + + + 0 + 0 + + + + false + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + true + + + % + + + 200 + + + 100 + + + + + + + - - - - Force detection of Dolby Surround - - - detectionDolby + + + + Output + + + 0 + + + + + + 250 + 0 + + + + Output module: + + + outputModule + + + + + + + true + + + + 0 + 0 + + + + + + + + + 0 + + + 0 + + + + + + 256 + 0 + + + + Destination file: + + + fileName + + + + + + + + + + Browse... + + + + + + + + + + + 0 + 0 + + + + Use S/PDIF when available + + + + - - - - + + + + 0 0 - - - 300 - 16777215 - - - - -1 + + Spatialization - - - - - - Preferred audio language - - - preferredAudioLanguage - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - - - Output - - - - - - - 100 - 0 - - - - Type - - - outputModule + + false + + + 9 + + + 9 + + + 0 + + + 6 + + + + + + 0 + 0 + + + + Headphone surround effect + + + + + + + + 0 + 0 + + + + -1 + + + + + + + + 0 + 0 + + + + + 250 + 0 + + + + + 250 + 16777215 + + + + Dolby Surround: + + + detectionDolby + + + + - - - - true - - - - 0 - 0 - + + + + Processing - - - - - - - 0 - - + + 0 - - - + + + + + 0 + 0 + + + + + + + - 100 + 250 0 - - File + + Visualization: - - fileName + + visualisation - - + + + + + 250 + 0 + + + + Replay gain mode: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + - - - - Browse... + + + + + 0 + 0 + + + + + + + + + 0 + + + + + true + + + Qt::AlignRight + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 0 + 0 + + + + + 250 + 0 + + + + + 250 + 16777215 + + + + Normalize volume to: - - - - - - - Effects - - - - - - - - - Headphone surround effect - - - - - - - Volume normalizer - - - - - - - Visualization - - - visualisation - - - - - - - Replay gain mode - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - Qt::AlignRight - - - - - - - - - - last.fm - - - - - - Enable last.fm submission - - - - - - - Username - - - lastfm_user_edit - - - - - - - - - - Password - - - lastfm_pass_edit - - - - - - - QLineEdit::Password + + + + Tracks + + + 0 + + + + + + 250 + 0 + + + + Preferred audio language: + + + preferredAudioLanguage + + + + + + + + + + true + + + + 0 + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + QLineEdit::Password + + + + + + + + 250 + 16777215 + + + + Password: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + lastfm_pass_edit + + + + + + + + 250 + 16777215 + + + + Username: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + lastfm_user_edit + + + + + + + + + + Submit played tracks stats to Last.fm + + + + @@ -350,88 +564,11 @@ enableAudio - defaultVolume - volumeValue - spdifBox - saveVolBox - detectionDolby - preferredAudioLanguage outputModule fileName fileBrowseButton - headphoneEffect - volNormBox - volNormSpin visualisation - lastfm - lastfm_user_edit - lastfm_pass_edit - - - lastfm - toggled(bool) - lastfm_pass_edit - setVisible(bool) - - - 188 - 619 - - - 360 - 689 - - - - - lastfm - toggled(bool) - lastfm_pass_label - setVisible(bool) - - - 188 - 619 - - - 102 - 689 - - - - - lastfm - toggled(bool) - lastfm_user_edit - setVisible(bool) - - - 188 - 619 - - - 360 - 653 - - - - - lastfm - toggled(bool) - lastfm_user_label - setVisible(bool) - - - 188 - 619 - - - 102 - 653 - - - - +