[vlc-devel] commit: Qt: Remove VolumeClickHandler Class... I never understood why zorglub did that in a separate class. ( 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:19:56 2009 +0100| [74d2582a3de1afc854245c2e4f8d79375d30cc90] | committer: 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.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=74d2582a3de1afc854245c2e4f8d79375d30cc90
---
modules/gui/qt4/components/controller_widget.cpp | 39 ++++++++++-----------
modules/gui/qt4/components/controller_widget.hpp | 16 +--------
2 files changed, 20 insertions(+), 35 deletions(-)
diff --git a/modules/gui/qt4/components/controller_widget.cpp b/modules/gui/qt4/components/controller_widget.cpp
index 48f71a5..5073fe1 100644
--- a/modules/gui/qt4/components/controller_widget.cpp
+++ b/modules/gui/qt4/components/controller_widget.cpp
@@ -57,8 +57,7 @@ SoundWidget::SoundWidget( QWidget *_parent, intf_thread_t * _p_intf,
/* Normal View, click on icon mutes */
if( !b_special )
{
- hVolLabel = new VolumeClickHandler( p_intf, this );
- volMuteLabel->installEventFilter( hVolLabel );
+ volMuteLabel->installEventFilter( this );
volumeMenu = NULL;
subLayout = NULL;
}
@@ -134,6 +133,24 @@ void SoundWidget::showVolumeMenu( QPoint pos )
+ 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 )
{
if( !b_my_volume )
@@ -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;
- }
-}
diff --git a/modules/gui/qt4/components/controller_widget.hpp b/modules/gui/qt4/components/controller_widget.hpp
index 608b321..8741b69 100644
--- a/modules/gui/qt4/components/controller_widget.hpp
+++ b/modules/gui/qt4/components/controller_widget.hpp
@@ -80,7 +80,6 @@ class VolumeClickHandler;
class SoundWidget : public QWidget
{
Q_OBJECT
- friend class VolumeClickHandler;
public:
SoundWidget( QWidget *parent, intf_thread_t *_p_i, bool,
@@ -90,26 +89,13 @@ private:
intf_thread_t *p_intf;
QLabel *volMuteLabel;
QAbstractSlider *volumeSlider;
- VolumeClickHandler *hVolLabel;
bool b_my_volume;
QMenu *volumeMenu;
-
+ virtual bool eventFilter( QObject *obj, QEvent *e );
protected slots:
void updateVolume( int );
void updateVolume( void );
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
More information about the vlc-devel
mailing list