[vlc-devel] [PATCH] Qt: Fix the bug where the volume was losing 1% at each start
Ludovic Fauvet
etix at l0cal.com
Tue Aug 11 01:29:17 CEST 2009
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.
---
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 839dec6..8b7a922 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() );
--
1.6.4
More information about the vlc-devel
mailing list