From: Jean-Baptiste Kempf Date: Fri, 23 Nov 2007 07:15:53 +0000 (+0000) Subject: Qt4 - Add an option to have the volume slider from 0 to 400 %. Close #952 Close ... X-Git-Tag: 0.9.0-test0~4434 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=72f13c9d9548e84e49e57f3ee707ad641854ac15;p=vlc Qt4 - Add an option to have the volume slider from 0 to 400 %. Close #952 Close #1317 Also the soundSlider takes it first value from the preferences... --- diff --git a/modules/gui/qt4/components/interface_widgets.cpp b/modules/gui/qt4/components/interface_widgets.cpp index f95b3785bb..6ab38a1914 100644 --- a/modules/gui/qt4/components/interface_widgets.cpp +++ b/modules/gui/qt4/components/interface_widgets.cpp @@ -495,12 +495,14 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, bool b_advControls ) : volMuteLabel->installEventFilter( hVolLabel ); controlLayout->addWidget( volMuteLabel, 3, 15 ); - volumeSlider = new SoundSlider( this ); + volumeSlider = new SoundSlider( this, config_GetInt( p_intf, "qt-volume-complete" ) ); volumeSlider->setMaximumSize( QSize( 200, 40 ) ); volumeSlider->setMinimumSize( QSize( 80, 20 ) ); - controlLayout->addWidget( volumeSlider, 3, 16, 1, 2 ); - volumeSlider->setMaximum( VOLUME_MAX ); volumeSlider->setFocusPolicy( Qt::NoFocus ); + controlLayout->addWidget( volumeSlider, 3, 16, 1, 2 ); + + /* Set the volume from the config */ + volumeSlider->setValue( (config_GetInt( p_intf, "volume" ) )* VOLUME_MAX / (AOUT_VOLUME_MAX/2) ); /* Volume control connection */ CONNECT( volumeSlider, valueChanged( int ), this, updateVolume( int ) ); diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp index a51427c8db..d00c4b9f4f 100644 --- a/modules/gui/qt4/qt4.cpp +++ b/modules/gui/qt4/qt4.cpp @@ -98,6 +98,12 @@ static void ShowDialog ( intf_thread_t *, int, int, intf_dialog_args_t * ); #define UPDATER_TEXT N_("Activate the new updates notification") #define UPDATER_LONGTEXT N_("Activate the automatic notification of new " \ "versions of the software. It runs once a week." ) + +#define COMPLETEVOL_TEXT N_("Allow the volume to be set to 400%" ) +#define COMPLETEVOL_LONGTEXT N_("Allow the volume to have range from 0% to " \ + "400%, instead of 0% to 200%. This option " \ + "can distort the audio, since it uses " \ + "software amplification.") vlc_module_begin(); set_shortname( (char *)"Qt" ); @@ -123,6 +129,8 @@ vlc_module_begin(); add_bool( "qt-minimal-view", VLC_FALSE, NULL, MINIMAL_TEXT, MINIMAL_TEXT, VLC_TRUE ); + add_bool( "qt-volume-complete", VLC_FALSE, NULL, COMPLETEVOL_TEXT, + COMPLETEVOL_LONGTEXT, VLC_TRUE); add_bool( "qt-name-in-title", VLC_TRUE, NULL, TITLE_TEXT, TITLE_LONGTEXT, VLC_FALSE ); add_string( "qt-filedialog-path", NULL, NULL, FILEDIALOG_PATH_TEXT, diff --git a/modules/gui/qt4/util/input_slider.cpp b/modules/gui/qt4/util/input_slider.cpp index 85e1d6ba27..ff3dbdfb59 100644 --- a/modules/gui/qt4/util/input_slider.cpp +++ b/modules/gui/qt4/util/input_slider.cpp @@ -80,10 +80,10 @@ void InputSlider::mouseMoveEvent(QMouseEvent *event) #define SOUNDMAX 200 // % OR 400 ? #define SOUNDSTEP 5 // % -SoundSlider::SoundSlider( QWidget *_parent ) : QAbstractSlider( _parent ) +SoundSlider::SoundSlider( QWidget *_parent, bool b_hard ) : QAbstractSlider( _parent ) { padding = 5; - setRange( SOUNDMIN, SOUNDMAX ); + setRange( SOUNDMIN, b_hard ? (2 * SOUNDMAX) : SOUNDMAX ); pixGradient = QPixmap( QSize( WLENGTH, WHEIGHT ) ); // QBixmap mask = QBitmap( QPixmap ); diff --git a/modules/gui/qt4/util/input_slider.hpp b/modules/gui/qt4/util/input_slider.hpp index fc07341f4e..cc7c5d5368 100644 --- a/modules/gui/qt4/util/input_slider.hpp +++ b/modules/gui/qt4/util/input_slider.hpp @@ -54,7 +54,7 @@ class SoundSlider : public QAbstractSlider { Q_OBJECT public: - SoundSlider( QWidget *_parent ); + SoundSlider( QWidget *_parent, bool b_softamp ); virtual ~SoundSlider() {}; protected: int padding;