Commit 0ba671da authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: cohenrency for volume between FSC and main Controller. Solve the 1% issue...

Qt: cohenrency for volume between FSC and main Controller. Solve the 1% issue reported by Trax, close #1851.
parent 2099e457
......@@ -120,36 +120,6 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf,
CONNECT( THEMIM, volumeChanged( void ), this, updateVolume( void ) );
}
void SoundWidget::showVolumeMenu( QPoint pos )
{
volumeMenu->exec( QCursor::pos() - pos - QPoint( 0, volumeMenu->height()/2 )
+ QPoint( width(), height() /2) );
}
bool SoundWidget::eventFilter( QObject *obj, QEvent *e )
{
VLC_UNUSED( obj );
if (e->type() == QEvent::MouseButtonPress )
{
if( volumeSlider->orientation() == Qt::Vertical )
{
QMouseEvent *event = static_cast<QMouseEvent*>(e);
showVolumeMenu( event->pos() );
}
else
{
aout_VolumeMute( p_intf, NULL );
}
e->accept();
return true;
}
else
{
e->ignore();
return false;
}
}
void SoundWidget::updateVolume( int i_sliderVolume )
{
if( !b_my_volume )
......@@ -177,7 +147,7 @@ void SoundWidget::updateVolume()
/* Audio part */
audio_volume_t i_volume;
aout_VolumeGet( p_intf, &i_volume );
i_volume = ( i_volume * VOLUME_MAX )/ (AOUT_VOLUME_MAX/2);
i_volume = ( ( i_volume + 1 ) * VOLUME_MAX )/ (AOUT_VOLUME_MAX/2);
int i_gauge = volumeSlider->value();
b_my_volume = false;
if( i_volume - i_gauge > 1 || i_gauge - i_volume > 1 )
......@@ -188,6 +158,39 @@ void SoundWidget::updateVolume()
}
}
void SoundWidget::showVolumeMenu( QPoint pos )
{
volumeMenu->exec( QCursor::pos() - pos - QPoint( 0, volumeMenu->height()/2 )
+ QPoint( width(), height() /2) );
}
bool SoundWidget::eventFilter( QObject *obj, QEvent *e )
{
VLC_UNUSED( obj );
if (e->type() == QEvent::MouseButtonPress )
{
if( volumeSlider->orientation() == Qt::Vertical )
{
QMouseEvent *event = static_cast<QMouseEvent*>(e);
showVolumeMenu( event->pos() );
}
else
{
aout_VolumeMute( p_intf, NULL );
}
e->accept();
return true;
}
else
{
e->ignore();
return false;
}
}
/**
* Play Button
**/
void PlayButton::updateButton( bool b_playing )
{
setIcon( b_playing ? QIcon( ":/pause_b" ) : QIcon( ":/play_b" ) );
......
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