[vlc-devel] commit: Qt: simplification of the special volume slider. Any click will show it. (Jean-Baptiste Kempf )

git version control git at videolan.org
Sat Feb 7 20:59:32 CET 2009


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sat Feb  7 20:56:15 2009 +0100| [11a75f694fdfb57bd8fbc1c73046153be1c6287d] | committer: Jean-Baptiste Kempf 

Qt: simplification of the special volume slider. Any click will show it.

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

 modules/gui/qt4/components/controller_widget.cpp |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/modules/gui/qt4/components/controller_widget.cpp b/modules/gui/qt4/components/controller_widget.cpp
index 5073fe1..7aa960c 100644
--- a/modules/gui/qt4/components/controller_widget.cpp
+++ b/modules/gui/qt4/components/controller_widget.cpp
@@ -37,6 +37,7 @@
 #include <QSpinBox>
 #include <QMenu>
 #include <QWidgetAction>
+#include <QMouseEvent>
 
 SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf,
                           bool b_shiny, bool b_special )
@@ -66,7 +67,7 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf,
         /* Special view, click on button shows the slider */
         b_shiny = false;
 
-        setContextMenuPolicy ( Qt::CustomContextMenu );
+        volMuteLabel->installEventFilter( this );
 
         QFrame *volumeControlWidget = new QFrame;
         subLayout = new QVBoxLayout( volumeControlWidget );
@@ -77,11 +78,6 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf,
         widgetAction->setDefaultWidget( volumeControlWidget );
         volumeMenu->addAction( widgetAction );
 
-        /* Speed Label behaviour:
-           - right click gives the vertical speed slider */
-        CONNECT( this, customContextMenuRequested( QPoint ),
-                this, showVolumeMenu( QPoint ) );
-
     }
 
     /* And add the label */
@@ -138,9 +134,17 @@ bool SoundWidget::eventFilter( QObject *obj, QEvent *e )
     VLC_UNUSED( obj );
     if (e->type() == QEvent::MouseButtonPress  )
     {
-        aout_VolumeMute( p_intf, NULL );
-        audio_volume_t i_volume;
-        aout_VolumeGet( p_intf, &i_volume );
+        if( volumeSlider->orientation() ==  Qt::Vertical )
+        {
+            QMouseEvent *event = static_cast<QMouseEvent*>(e);
+            showVolumeMenu( event->pos() );
+        }
+        else
+        {
+            aout_VolumeMute( p_intf, NULL );
+            audio_volume_t i_volume;
+            aout_VolumeGet( p_intf, &i_volume );
+        }
         e->accept();
         return true;
     }




More information about the vlc-devel mailing list