[vlc-commits] Qt: simplify volume management

Jean-Baptiste Kempf git at videolan.org
Sat Sep 24 16:09:46 CEST 2011


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sat Sep 24 15:53:04 2011 +0200| [ca802f6969613e6b8f335d675aaf1af8a7a8f7b6] | committer: Jean-Baptiste Kempf

Qt: simplify volume management

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

 modules/gui/qt4/components/controller_widget.cpp  |    4 ++--
 modules/gui/qt4/components/controller_widget.hpp  |    2 +-
 modules/gui/qt4/components/simple_preferences.cpp |    4 ++--
 modules/gui/qt4/qt4.hpp                           |    3 ---
 4 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/modules/gui/qt4/components/controller_widget.cpp b/modules/gui/qt4/components/controller_widget.cpp
index 967d50b..c5e3d22 100644
--- a/modules/gui/qt4/components/controller_widget.cpp
+++ b/modules/gui/qt4/components/controller_widget.cpp
@@ -151,7 +151,7 @@ void SoundWidget::userUpdateVolume( int i_sliderVolume )
     /* Only if volume is set by user action on slider */
     setMuted( false );
     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 );
     refreshLabels();
 }
@@ -164,7 +164,7 @@ void SoundWidget::libUpdateVolume()
     playlist_t *p_playlist = pl_Get( p_intf );
 
     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 )
     {
diff --git a/modules/gui/qt4/components/controller_widget.hpp b/modules/gui/qt4/components/controller_widget.hpp
index 623af09..c5d6b88 100644
--- a/modules/gui/qt4/components/controller_widget.hpp
+++ b/modules/gui/qt4/components/controller_widget.hpp
@@ -67,7 +67,7 @@ private slots:
     void updateButtonIcons( bool, bool );
 };
 
-#define VOLUME_MAX (QT_VOLUME_MAX * 100 / QT_VOLUME_DEFAULT)
+#define VOLUME_MAX 200
 class SoundWidget : public QWidget
 {
     Q_OBJECT
diff --git a/modules/gui/qt4/components/simple_preferences.cpp b/modules/gui/qt4/components/simple_preferences.cpp
index 3b9beb7..a669a00 100644
--- a/modules/gui/qt4/components/simple_preferences.cpp
+++ b/modules/gui/qt4/components/simple_preferences.cpp
@@ -314,7 +314,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
 #undef audioCommon
 
             /* 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,
                                      defaultVolume );
             CONNECT( ui.defaultVolume, valueChanged( int ),
@@ -738,7 +738,7 @@ SPrefsPanel::~SPrefsPanel()
 void SPrefsPanel::updateAudioVolume( int volume )
 {
     qobject_cast<QSpinBox *>(optionWidgets[volLW])
-        ->setValue( volume * 100 / QT_VOLUME_DEFAULT );
+        ->setValue( volume * 100 / AOUT_VOLUME_DEFAULT );
 }
 
 
diff --git a/modules/gui/qt4/qt4.hpp b/modules/gui/qt4/qt4.hpp
index 8ea99e0..495468e 100644
--- a/modules/gui/qt4/qt4.hpp
+++ b/modules/gui/qt4/qt4.hpp
@@ -122,9 +122,6 @@ struct intf_sys_t
 
 #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 )
 {
     char *dir = config_GetUserDir( type );



More information about the vlc-commits mailing list