From: Ludovic Fauvet Date: Mon, 10 Aug 2009 23:29:17 +0000 (+0200) Subject: Qt: Fix the bug where the volume was losing 1% at each start X-Git-Tag: 1.1.0-ff~4379 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=5eb13a62c115a7a45331c6af1f02b5cc118c9228;p=vlc Qt: Fix the bug where the volume was losing 1% at each start The bug originates from an implicit conversion to int. This commit explicitly convert the value to qreal then use qRound to take the nearest integer. Signed-off-by: Jean-Baptiste Kempf --- diff --git a/modules/gui/qt4/components/controller_widget.cpp b/modules/gui/qt4/components/controller_widget.cpp index fbb19becad..db295423b6 100644 --- a/modules/gui/qt4/components/controller_widget.cpp +++ b/modules/gui/qt4/components/controller_widget.cpp @@ -111,8 +111,8 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf, layout->addWidget( volumeSlider, 0, Qt::AlignBottom ); /* Set the volume from the config */ - volumeSlider->setValue( ( config_GetInt( p_intf, "volume" ) ) * - VOLUME_MAX / (AOUT_VOLUME_MAX/2) ); + volumeSlider->setValue( qRound( ( (qreal)config_GetInt( p_intf, "volume" ) ) * + VOLUME_MAX / (AOUT_VOLUME_MAX/2) ) ); /* Force the update at build time in order to have a muted icon if needed */ updateVolume( volumeSlider->value() );