Commit 18addd46 authored by Francois Cartegnie's avatar Francois Cartegnie Committed by Rémi Denis-Courmont

Qt: remove the b_mybutton hack. Connect the appropriate events.

Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
parent 1a4bb059
......@@ -43,7 +43,7 @@
SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf,
bool b_shiny, bool b_special )
: QWidget( _parent ), p_intf( _p_intf),
b_my_volume( false ), b_is_muted( false )
b_is_muted( false )
{
/* We need a layout for this widget */
QHBoxLayout *layout = new QHBoxLayout( this );
......@@ -118,7 +118,8 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf,
updateVolume( volumeSlider->value() );
/* Volume control connection */
CONNECT( volumeSlider, valueChanged( int ), this, updateVolume( int ) );
CONNECT( volumeSlider, valueChanged( int ), this, refreshLabels( void ) );
CONNECT( volumeSlider, sliderMoved( int ), this, updateVolume( int ) );
CONNECT( THEMIM, volumeChanged( void ), this, updateVolume( void ) );
CONNECT( THEMIM, soundMuteChanged( void ), this, updateMuteStatus( void ) );
}
......@@ -151,15 +152,12 @@ void SoundWidget::refreshLabels()
/* volumeSlider changed value event slot */
void SoundWidget::updateVolume( int i_sliderVolume )
{
if( !b_my_volume ) /* Only if volume is set by user action on slider */
{
setMuted( false );
playlist_t *p_playlist = pl_Hold( p_intf );
int i_res = i_sliderVolume * (AOUT_VOLUME_MAX / 2) / VOLUME_MAX;
aout_VolumeSet( p_playlist, i_res );
pl_Release( p_intf );
}
refreshLabels();
/* Only if volume is set by user action on slider */
setMuted( false );
playlist_t *p_playlist = pl_Hold( p_intf );
int i_res = i_sliderVolume * (AOUT_VOLUME_MAX / 2) / VOLUME_MAX;
aout_VolumeSet( p_playlist, i_res );
pl_Release( p_intf );
}
/* libvlc changed value event slot */
......@@ -173,14 +171,11 @@ void SoundWidget::updateVolume()
pl_Release( p_intf );
i_volume = ( ( i_volume + 1 ) * VOLUME_MAX )/ (AOUT_VOLUME_MAX/2);
int i_gauge = volumeSlider->value();
b_my_volume = false;
if ( !b_is_muted && /* do not show mute effect on volume (set to 0) */
( i_volume - i_gauge > 1 || i_gauge - i_volume > 1 )
)
{
b_my_volume = true;
volumeSlider->setValue( i_volume );
b_my_volume = false;
}
}
......
......@@ -83,7 +83,6 @@ private:
QLabel *volMuteLabel;
QAbstractSlider *volumeSlider;
QFrame *volumeControlWidget;
bool b_my_volume;
QMenu *volumeMenu;
virtual bool eventFilter( QObject *obj, QEvent *e );
bool b_is_muted;
......
......@@ -235,6 +235,7 @@ void SoundSlider::wheelEvent( QWheelEvent *event )
setValue( __MIN( __MAX( minimum(), newvalue ), maximum() ) );
emit sliderReleased();
emit sliderMoved( value() );
}
void SoundSlider::mousePressEvent( QMouseEvent *event )
......@@ -246,6 +247,7 @@ void SoundSlider::mousePressEvent( QMouseEvent *event )
i_oldvalue = value();
emit sliderPressed();
changeValue( event->x() - paddingL );
emit sliderMoved( value() );
}
}
......@@ -257,6 +259,7 @@ void SoundSlider::mouseReleaseEvent( QMouseEvent *event )
{
emit sliderReleased();
setValue( value() );
emit sliderMoved( value() );
}
b_isSliding = false;
b_mouseOutside = false;
......
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