Commit ca802f69 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: simplify volume management

parent fa240c0b
...@@ -151,7 +151,7 @@ void SoundWidget::userUpdateVolume( int i_sliderVolume ) ...@@ -151,7 +151,7 @@ void SoundWidget::userUpdateVolume( int i_sliderVolume )
/* Only if volume is set by user action on slider */ /* Only if volume is set by user action on slider */
setMuted( false ); setMuted( false );
playlist_t *p_playlist = pl_Get( p_intf ); playlist_t *p_playlist = pl_Get( p_intf );
int i_res = i_sliderVolume * QT_VOLUME_MAX / VOLUME_MAX; int i_res = i_sliderVolume * (AOUT_VOLUME_DEFAULT * 2) / VOLUME_MAX;
aout_VolumeSet( p_playlist, i_res ); aout_VolumeSet( p_playlist, i_res );
refreshLabels(); refreshLabels();
} }
...@@ -164,7 +164,7 @@ void SoundWidget::libUpdateVolume() ...@@ -164,7 +164,7 @@ void SoundWidget::libUpdateVolume()
playlist_t *p_playlist = pl_Get( p_intf ); playlist_t *p_playlist = pl_Get( p_intf );
i_volume = aout_VolumeGet( p_playlist ); i_volume = aout_VolumeGet( p_playlist );
i_volume = ((i_volume + 1) * VOLUME_MAX ) / QT_VOLUME_MAX; i_volume = ((i_volume + 1) * VOLUME_MAX ) / (AOUT_VOLUME_DEFAULT * 2);
if ( i_volume - volumeSlider->value() != 0 ) if ( i_volume - volumeSlider->value() != 0 )
{ {
......
...@@ -67,7 +67,7 @@ private slots: ...@@ -67,7 +67,7 @@ private slots:
void updateButtonIcons( bool, bool ); void updateButtonIcons( bool, bool );
}; };
#define VOLUME_MAX (QT_VOLUME_MAX * 100 / QT_VOLUME_DEFAULT) #define VOLUME_MAX 200
class SoundWidget : public QWidget class SoundWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
......
...@@ -314,7 +314,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -314,7 +314,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
#undef audioCommon #undef audioCommon
/* Audio Options */ /* Audio Options */
ui.volumeValue->setMaximum( QT_VOLUME_MAX / QT_VOLUME_DEFAULT * 100 ); ui.volumeValue->setMaximum( (AOUT_VOLUME_DEFAULT * 2) / AOUT_VOLUME_DEFAULT * 100 );
CONFIG_GENERIC_NO_BOOL( "volume" , IntegerRangeSlider, NULL, CONFIG_GENERIC_NO_BOOL( "volume" , IntegerRangeSlider, NULL,
defaultVolume ); defaultVolume );
CONNECT( ui.defaultVolume, valueChanged( int ), CONNECT( ui.defaultVolume, valueChanged( int ),
...@@ -738,7 +738,7 @@ SPrefsPanel::~SPrefsPanel() ...@@ -738,7 +738,7 @@ SPrefsPanel::~SPrefsPanel()
void SPrefsPanel::updateAudioVolume( int volume ) void SPrefsPanel::updateAudioVolume( int volume )
{ {
qobject_cast<QSpinBox *>(optionWidgets[volLW]) qobject_cast<QSpinBox *>(optionWidgets[volLW])
->setValue( volume * 100 / QT_VOLUME_DEFAULT ); ->setValue( volume * 100 / AOUT_VOLUME_DEFAULT );
} }
......
...@@ -122,9 +122,6 @@ struct intf_sys_t ...@@ -122,9 +122,6 @@ struct intf_sys_t
#define getSettings() p_intf->p_sys->mainSettings #define getSettings() p_intf->p_sys->mainSettings
#define QT_VOLUME_DEFAULT AOUT_VOLUME_DEFAULT
#define QT_VOLUME_MAX (AOUT_VOLUME_DEFAULT * 2)
static inline QString QVLCUserDir( vlc_userdir_t type ) static inline QString QVLCUserDir( vlc_userdir_t type )
{ {
char *dir = config_GetUserDir( type ); char *dir = config_GetUserDir( type );
......
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