Qt: code simplification and usage simplification for SpeedLabel
authorJean-Baptiste Kempf <jb@videolan.org>
Wed, 11 Feb 2009 19:18:33 +0000 (20:18 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Wed, 11 Feb 2009 19:18:33 +0000 (20:18 +0100)
Clicking on it brings the adjustable slider.
DoubleClicking doesn't do anything anymore.

This way the behaviour is more usable and less complex <joke>(don't be too KDEish!)</joke>

modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.hpp

index a57cae1..7249022 100644 (file)
@@ -284,8 +284,7 @@ SpeedLabel::SpeedLabel( intf_thread_t *_p_intf, const QString& text,
                         QWidget *parent )
            : QLabel( text, parent ), p_intf( _p_intf )
 {
-    setToolTip( qtr( "Current playback speed.\nRight click to adjust" ) );
-    setContextMenuPolicy ( Qt::CustomContextMenu );
+    setToolTip( qtr( "Current playback speed.\nClick to adjust" ) );
 
     /* Create the Speed Control Widget */
     speedControl = new SpeedControlWidget( p_intf, this );
@@ -295,16 +294,12 @@ SpeedLabel::SpeedLabel( intf_thread_t *_p_intf, const QString& text,
     widgetAction->setDefaultWidget( speedControl );
     speedControlMenu->addAction( widgetAction );
 
-    /* Speed Label behaviour:
-       - right click gives the vertical speed slider */
-    CONNECT( this, customContextMenuRequested( QPoint ),
-             this, showSpeedMenu( QPoint ) );
-
     /* Change the SpeedRate in the Status Bar */
     CONNECT( THEMIM->getIM(), rateChanged( int ), this, setRate( int ) );
 
     CONNECT( THEMIM, inputChanged( input_thread_t * ),
              speedControl, activateOnState() );
+
 }
 SpeedLabel::~SpeedLabel()
 {
index 206c579..3b7d01b 100644 (file)
@@ -160,10 +160,9 @@ public:
     virtual ~SpeedLabel();
 
 protected:
-    virtual void mouseDoubleClickEvent ( QMouseEvent * event )
+    virtual void mousePressEvent ( QMouseEvent * event )
     {
-        event->accept();
-        THEMIM->getIM()->setRate( INPUT_RATE_DEFAULT );
+        showSpeedMenu( event->pos() );
     }
 private slots:
     void showSpeedMenu( QPoint );