]> git.sesse.net Git - vlc/commitdiff
Qt4 - take care of the volume-step value from the preferences.
authorJean-Baptiste Kempf <jb@videolan.org>
Fri, 23 Nov 2007 07:44:20 +0000 (07:44 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Fri, 23 Nov 2007 07:44:20 +0000 (07:44 +0000)
modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/util/input_slider.cpp
modules/gui/qt4/util/input_slider.hpp

index 6ab38a191442a85df9c9f631b134f17e3e5f3ebc..d3e17ff0952f6479ebbda9abaf600c287e17ed6b 100644 (file)
@@ -495,12 +495,14 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i, bool b_advControls ) :
     volMuteLabel->installEventFilter( hVolLabel );
     controlLayout->addWidget( volMuteLabel, 3, 15 );
 
-    volumeSlider = new SoundSlider( this, config_GetInt( p_intf, "qt-volume-complete" ) );
+    volumeSlider = new SoundSlider( this,
+            config_GetInt( p_intf, "volume-step" ),
+            config_GetInt( p_intf, "qt-volume-complete" ) );
     volumeSlider->setMaximumSize( QSize( 200, 40 ) );
     volumeSlider->setMinimumSize( QSize( 80, 20 ) );
     volumeSlider->setFocusPolicy( Qt::NoFocus );
     controlLayout->addWidget( volumeSlider, 3, 16, 1, 2 );
-    
+
     /* Set the volume from the config */
     volumeSlider->setValue( (config_GetInt( p_intf, "volume" ) )*  VOLUME_MAX / (AOUT_VOLUME_MAX/2) );
 
index ff3dbdfb594990bf2809abf4357929c5f19f4308..f6f299ba9fe64da9f505e4e303a1069debaa0f50 100644 (file)
@@ -78,11 +78,12 @@ void InputSlider::mouseMoveEvent(QMouseEvent *event)
 #define WHEIGHT   25  // px
 #define SOUNDMIN  0   // %
 #define SOUNDMAX  200 // % OR 400 ?
-#define SOUNDSTEP 5   // %
 
-SoundSlider::SoundSlider( QWidget *_parent, bool b_hard ) : QAbstractSlider( _parent )
+SoundSlider::SoundSlider( QWidget *_parent, int _i_step, bool b_hard )
+                        : QAbstractSlider( _parent )
 {
     padding = 5;
+    f_step = ( _i_step * 100 ) / AOUT_VOLUME_MAX ;
     setRange( SOUNDMIN, b_hard ? (2 * SOUNDMAX) : SOUNDMAX  );
 
     pixGradient = QPixmap( QSize( WLENGTH, WHEIGHT ) );
@@ -108,7 +109,7 @@ SoundSlider::SoundSlider( QWidget *_parent, bool b_hard ) : QAbstractSlider( _pa
 
 void SoundSlider::wheelEvent( QWheelEvent *event )
 {
-    int newvalue = value() + event->delta() / ( 8 * 15 ) * SOUNDSTEP;
+    int newvalue = value() + event->delta() / ( 8 * 15 ) * f_step;
     setValue( __MIN( __MAX( minimum(), newvalue ), maximum() ) );
 
     emit sliderReleased();
index cc7c5d5368aae145f7c113389c0584bac61ecc1f..6fb8c55c3b902fc153c185b0050cc07c1eb8d8c7 100644 (file)
@@ -54,7 +54,7 @@ class SoundSlider : public QAbstractSlider
 {
     Q_OBJECT
 public:
-    SoundSlider( QWidget *_parent, bool b_softamp );
+    SoundSlider( QWidget *_parent, int _i_step, bool b_softamp );
     virtual ~SoundSlider() {};
 protected:
     int padding;
@@ -67,6 +67,7 @@ private:
     bool b_sliding;
     bool b_outside;
     int i_oldvalue;
+    float f_step;
     void changeValue( int x );
     QPixmap pixGradient;
     QPixmap pixLimit;