[vlc-devel] commit: Qt: Fix the bug where the volume was losing 1% at each start ( Ludovic Fauvet )

git version control git at videolan.org
Fri Aug 14 15:46:53 CEST 2009


vlc | branch: master | Ludovic Fauvet <etix at l0cal.com> | Tue Aug 11 01:29:17 2009 +0200| [5eb13a62c115a7a45331c6af1f02b5cc118c9228] | committer: Jean-Baptiste Kempf 

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 <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5eb13a62c115a7a45331c6af1f02b5cc118c9228
---

 modules/gui/qt4/components/controller_widget.cpp |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt4/components/controller_widget.cpp b/modules/gui/qt4/components/controller_widget.cpp
index fbb19be..db29542 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() );




More information about the vlc-devel mailing list