Commit 11a75f69 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

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

parent 74d2582a
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <QSpinBox> #include <QSpinBox>
#include <QMenu> #include <QMenu>
#include <QWidgetAction> #include <QWidgetAction>
#include <QMouseEvent>
SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf, SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf,
bool b_shiny, bool b_special ) bool b_shiny, bool b_special )
...@@ -66,7 +67,7 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf, ...@@ -66,7 +67,7 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf,
/* Special view, click on button shows the slider */ /* Special view, click on button shows the slider */
b_shiny = false; b_shiny = false;
setContextMenuPolicy ( Qt::CustomContextMenu ); volMuteLabel->installEventFilter( this );
QFrame *volumeControlWidget = new QFrame; QFrame *volumeControlWidget = new QFrame;
subLayout = new QVBoxLayout( volumeControlWidget ); subLayout = new QVBoxLayout( volumeControlWidget );
...@@ -77,11 +78,6 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf, ...@@ -77,11 +78,6 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf,
widgetAction->setDefaultWidget( volumeControlWidget ); widgetAction->setDefaultWidget( volumeControlWidget );
volumeMenu->addAction( widgetAction ); volumeMenu->addAction( widgetAction );
/* Speed Label behaviour:
- right click gives the vertical speed slider */
CONNECT( this, customContextMenuRequested( QPoint ),
this, showVolumeMenu( QPoint ) );
} }
/* And add the label */ /* And add the label */
...@@ -138,9 +134,17 @@ bool SoundWidget::eventFilter( QObject *obj, QEvent *e ) ...@@ -138,9 +134,17 @@ bool SoundWidget::eventFilter( QObject *obj, QEvent *e )
VLC_UNUSED( obj ); VLC_UNUSED( obj );
if (e->type() == QEvent::MouseButtonPress ) if (e->type() == QEvent::MouseButtonPress )
{ {
aout_VolumeMute( p_intf, NULL ); if( volumeSlider->orientation() == Qt::Vertical )
audio_volume_t i_volume; {
aout_VolumeGet( p_intf, &i_volume ); 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(); e->accept();
return true; return true;
} }
......
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