]> git.sesse.net Git - vlc/commitdiff
Qt: Remove VolumeClickHandler Class... I never understood why zorglub did that in...
authorJean-Baptiste Kempf <jb@videolan.org>
Sat, 7 Feb 2009 19:19:56 +0000 (20:19 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Sat, 7 Feb 2009 19:57:53 +0000 (20:57 +0100)
This removes some friends attribute. Can't be a bad thing.

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

index 48f71a5cb358ec269fc57ec8d8ed31902081ff2e..5073fe115ba8ad6a977b74ebc7b5e9cb6a6c6d77 100644 (file)
@@ -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;
-    }
-}
 
index 608b321018ea9307113150e34253751580eaf9bc..8741b6921baeb3b722b9ed54ac50c24d119a54a0 100644 (file)
@@ -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