]> git.sesse.net Git - vlc/commitdiff
Qt: Fix the bug where the volume was losing 1% at each start
authorLudovic Fauvet <etix@l0cal.com>
Mon, 10 Aug 2009 23:29:17 +0000 (01:29 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Fri, 14 Aug 2009 13:44:16 +0000 (15:44 +0200)
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@videolan.org>
modules/gui/qt4/components/controller_widget.cpp

index fbb19becad3f92a97783ab8a360064a1259475f6..db295423b69f3765db64d7a4ba4eff79ca71cb45 100644 (file)
@@ -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() );