src/3rdparty/phonon/mmf/backend.cpp
branchRCL_3
changeset 4 3b1da2848fc7
parent 3 41300fa6a67c
child 8 3f74d0d4af4c
--- a/src/3rdparty/phonon/mmf/backend.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/src/3rdparty/phonon/mmf/backend.cpp	Fri Feb 19 23:40:16 2010 +0200
@@ -45,6 +45,7 @@
 Backend::Backend(QObject *parent)
     : QObject(parent)
     , m_ancestorMoveMonitor(new AncestorMoveMonitor(this))
+    , m_effectFactory(new EffectFactory(this))
 {
     TRACE_CONTEXT(Backend::Backend, EBackend);
     TRACE_ENTRY_0();
@@ -81,9 +82,9 @@
     {
         Q_ASSERT(args.count() == 1);
         Q_ASSERT(args.first().type() == QVariant::Int);
-        const AbstractAudioEffect::Type effect = AbstractAudioEffect::Type(args.first().toInt());
-
-        return EffectFactory::createAudioEffect(effect, parent);
+        const EffectFactory::Type type =
+            static_cast<EffectFactory::Type>(args.first().toInt());
+        return m_effectFactory->createAudioEffect(type, parent);
     }
     case VideoWidgetClass:
         result = new VideoWidget(m_ancestorMoveMonitor.data(), qobject_cast<QWidget *>(parent));
@@ -105,7 +106,7 @@
     switch(type)
     {
         case EffectType:
-            retval.append(EffectFactory::effectIndexes());
+            retval.append(m_effectFactory->effectIndexes());
             break;
         case AudioOutputDeviceType:
             // We only have one possible output device, but we need at least
@@ -126,7 +127,7 @@
 
     switch (type) {
         case EffectType:
-            return EffectFactory::audioEffectDescriptions(AbstractAudioEffect::Type(index));
+            return m_effectFactory->audioEffectDescriptions(EffectFactory::Type(index));
         case AudioOutputDeviceType:
             return AudioOutput::audioOutputDescription(index);
         default:
@@ -139,29 +140,32 @@
     return true;
 }
 
-bool Backend::connectNodes(QObject *source, QObject *target)
+bool Backend::connectNodes(QObject *sourceObject, QObject *targetObject)
 {
     TRACE_CONTEXT(Backend::connectNodes, EBackend);
-    TRACE_ENTRY("source 0x%08x target 0x%08x", source, target);
-    Q_ASSERT(qobject_cast<MediaNode *>(source));
-    Q_ASSERT(qobject_cast<MediaNode *>(target));
+    TRACE_ENTRY("source 0x%08x target 0x%08x", sourceObject, targetObject);
+
+    MediaNode *const source = qobject_cast<MediaNode *>(sourceObject);
+    MediaNode *const target = qobject_cast<MediaNode *>(targetObject);
 
-    MediaNode *const mediaSource = static_cast<MediaNode *>(source);
-    MediaNode *const mediaTarget = static_cast<MediaNode *>(target);
+    Q_ASSERT_X(source, Q_FUNC_INFO, "source is not a MediaNode");
+    Q_ASSERT_X(target, Q_FUNC_INFO, "target is not a MediaNode");
 
-    return mediaSource->connectMediaNode(mediaTarget);
+    return source->connectOutput(target);
 }
 
-bool Backend::disconnectNodes(QObject *source, QObject *target)
+bool Backend::disconnectNodes(QObject *sourceObject, QObject *targetObject)
 {
     TRACE_CONTEXT(Backend::disconnectNodes, EBackend);
-    TRACE_ENTRY("source 0x%08x target 0x%08x", source, target);
-    Q_ASSERT(qobject_cast<MediaNode *>(source));
-    Q_ASSERT(qobject_cast<MediaNode *>(target));
+    TRACE_ENTRY("source 0x%08x target 0x%08x", sourceObject, targetObject);
+
+    MediaNode *const source = qobject_cast<MediaNode *>(sourceObject);
+    MediaNode *const target = qobject_cast<MediaNode *>(targetObject);
 
-    const bool result = static_cast<MediaNode *>(source)->disconnectMediaNode(static_cast<MediaNode *>(target));
+    Q_ASSERT_X(source, Q_FUNC_INFO, "source is not a MediaNode");
+    Q_ASSERT_X(target, Q_FUNC_INFO, "target is not a MediaNode");
 
-    TRACE_RETURN("%d", result);
+    return source->disconnectOutput(target);
 }
 
 bool Backend::endConnectionChange(QSet<QObject *>)