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) );
#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 ) );
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();
{
Q_OBJECT
public:
- SoundSlider( QWidget *_parent, bool b_softamp );
+ SoundSlider( QWidget *_parent, int _i_step, bool b_softamp );
virtual ~SoundSlider() {};
protected:
int padding;
bool b_sliding;
bool b_outside;
int i_oldvalue;
+ float f_step;
void changeValue( int x );
QPixmap pixGradient;
QPixmap pixLimit;