Commit 5eb13a62 authored by Ludovic Fauvet's avatar Ludovic Fauvet Committed by 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: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 8cc18957
......@@ -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() );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment