Commit 40352944 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: code simplification and usage simplification for SpeedLabel

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