[vlc-devel] commit: Qt: cohenrency for volume between FSC and main Controller. Solve the 1% issue reported by Trax, close #1851. (Jean-Baptiste Kempf )

git version control git at videolan.org
Fri Feb 27 23:53:21 CET 2009


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Feb 27 23:51:52 2009 +0100| [0ba671da3b5f22732d67bbaf10d2fb3758d0a773] | committer: Jean-Baptiste Kempf 

Qt: cohenrency for volume between FSC and main Controller. Solve the 1% issue reported by Trax, close #1851.

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

 modules/gui/qt4/components/controller_widget.cpp |   65 +++++++++++----------
 1 files changed, 34 insertions(+), 31 deletions(-)

diff --git a/modules/gui/qt4/components/controller_widget.cpp b/modules/gui/qt4/components/controller_widget.cpp
index 4b95784..1b907ff 100644
--- a/modules/gui/qt4/components/controller_widget.cpp
+++ b/modules/gui/qt4/components/controller_widget.cpp
@@ -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" ) );




More information about the vlc-devel mailing list