Commit 74d2582a authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt: Remove VolumeClickHandler Class... I never understood why zorglub did that in a separate class.

This removes some friends attribute. Can't be a bad thing.
parent 41b266bf
...@@ -57,8 +57,7 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf, ...@@ -57,8 +57,7 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf,
/* Normal View, click on icon mutes */ /* Normal View, click on icon mutes */
if( !b_special ) if( !b_special )
{ {
hVolLabel = new VolumeClickHandler( p_intf, this ); volMuteLabel->installEventFilter( this );
volMuteLabel->installEventFilter( hVolLabel );
volumeMenu = NULL; volumeMenu = NULL;
subLayout = NULL; subLayout = NULL;
} }
...@@ -134,6 +133,24 @@ void SoundWidget::showVolumeMenu( QPoint pos ) ...@@ -134,6 +133,24 @@ void SoundWidget::showVolumeMenu( QPoint pos )
+ QPoint( width(), height() /2) ); + QPoint( width(), height() /2) );
} }
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 );
e->accept();
return true;
}
else
{
e->ignore();
return false;
}
}
void SoundWidget::updateVolume( int i_sliderVolume ) void SoundWidget::updateVolume( int i_sliderVolume )
{ {
if( !b_my_volume ) if( !b_my_volume )
...@@ -206,22 +223,4 @@ void AtoB_Button::setIcons( bool timeA, bool timeB ) ...@@ -206,22 +223,4 @@ void AtoB_Button::setIcons( bool timeA, bool timeB )
} }
} }
bool VolumeClickHandler::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 );
// m->updateVolume( i_volume * VOLUME_MAX / (AOUT_VOLUME_MAX/2) );
e->accept();
return true;
}
else
{
e->ignore();
return false;
}
}
...@@ -80,7 +80,6 @@ class VolumeClickHandler; ...@@ -80,7 +80,6 @@ class VolumeClickHandler;
class SoundWidget : public QWidget class SoundWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
friend class VolumeClickHandler;
public: public:
SoundWidget( QWidget *parent, intf_thread_t *_p_i, bool, SoundWidget( QWidget *parent, intf_thread_t *_p_i, bool,
...@@ -90,26 +89,13 @@ private: ...@@ -90,26 +89,13 @@ private:
intf_thread_t *p_intf; intf_thread_t *p_intf;
QLabel *volMuteLabel; QLabel *volMuteLabel;
QAbstractSlider *volumeSlider; QAbstractSlider *volumeSlider;
VolumeClickHandler *hVolLabel;
bool b_my_volume; bool b_my_volume;
QMenu *volumeMenu; QMenu *volumeMenu;
virtual bool eventFilter( QObject *obj, QEvent *e );
protected slots: protected slots:
void updateVolume( int ); void updateVolume( int );
void updateVolume( void ); void updateVolume( void );
void showVolumeMenu( QPoint pos ); void showVolumeMenu( QPoint pos );
}; };
class VolumeClickHandler : public QObject
{
public:
VolumeClickHandler( intf_thread_t *_p_intf, SoundWidget *_m ) : QObject(_m)
{m = _m; p_intf = _p_intf; }
virtual ~VolumeClickHandler() {};
virtual bool eventFilter( QObject *obj, QEvent *e );
private:
SoundWidget *m;
intf_thread_t *p_intf;
};
#endif #endif
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