src/3rdparty/phonon/mmf/audiooutput.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
--- a/src/3rdparty/phonon/mmf/audiooutput.cpp	Tue Jan 26 12:42:25 2010 +0200
+++ b/src/3rdparty/phonon/mmf/audiooutput.cpp	Tue Feb 02 00:43:10 2010 +0200
@@ -24,7 +24,6 @@
 #include "defs.h"
 #include "mediaobject.h"
 #include "utils.h"
-#include "volumeobserver.h"
 
 QT_BEGIN_NAMESPACE
 
@@ -41,7 +40,6 @@
 
 MMF::AudioOutput::AudioOutput(Backend *, QObject *parent) : MediaNode(parent)
         , m_volume(InitialVolume)
-        , m_observer(0)
 {
 
 }
@@ -59,12 +57,9 @@
 void MMF::AudioOutput::setVolume(qreal volume)
 {
     TRACE_CONTEXT(AudioOutput::setVolume, EAudioApi);
-    TRACE_ENTRY("observer 0x%08x volume %f", m_observer, volume);
+    TRACE_ENTRY("volume %f", volume);
 
     if (volume != m_volume) {
-        if (m_observer) {
-            m_observer->volumeChanged(volume);
-        }
 
         m_volume = volume;
         TRACE("emit volumeChanged(%f)", volume)
@@ -86,17 +81,12 @@
     return true;
 }
 
-void MMF::AudioOutput::setVolumeObserver(VolumeObserver* observer)
-{
-    m_observer = observer;
-    if (m_observer) {
-        m_observer->volumeChanged(m_volume);
-    }
-}
-
 bool MMF::AudioOutput::activateOnMediaObject(MediaObject *mo)
 {
-    setVolumeObserver(mo);
+    // Ensure that the MediaObject has the correct initial volume
+    mo->volumeChanged(m_volume);
+    // Connect MediaObject to receive future volume changes
+    connect(this, SIGNAL(volumeChanged(qreal)), mo, SLOT(volumeChanged(qreal)));
     return true;
 }