[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/phonon
From:       Matthias Kretz <kretz () kde ! org>
Date:       2008-04-22 8:58:16
Message-ID: 1208854696.695347.1274.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 799761 by mkretz:

- a bit nicer flow in platformPlugin
- connect to objectDescriptionChanged from the platform plugin

 M  +37 -35    factory.cpp  


--- trunk/KDE/kdelibs/phonon/factory.cpp #799760:799761
@@ -289,48 +289,50 @@
 
 PlatformPlugin *FactoryPrivate::platformPlugin()
 {
-    if (!m_platformPlugin) {
-        if (m_noPlatformPlugin) {
-            return 0;
-        }
+    if (m_platformPlugin) {
+        return m_platformPlugin;
+    }
+    if (m_noPlatformPlugin) {
+        return 0;
+    }
 #ifndef QT_NO_DBUS
-        if (!QCoreApplication::instance() || \
                QCoreApplication::applicationName().isEmpty()) {
-            pWarning() << "Phonon needs QCoreApplication::applicationName to be set \
to export audio output names through the DBUS interface"; +    if \
(!QCoreApplication::instance() || QCoreApplication::applicationName().isEmpty()) { +  \
pWarning() << "Phonon needs QCoreApplication::applicationName to be set to export \
audio output names through the DBUS interface"; +    }
+#endif
+    const QString suffix(QLatin1String("/phonon_platform/"));
+    Q_ASSERT(QCoreApplication::instance());
+    foreach (QString libPath, QCoreApplication::libraryPaths()) {
+        libPath += suffix;
+        const QDir dir(libPath);
+        if (!dir.exists()) {
+            pDebug() << Q_FUNC_INFO << dir.absolutePath() << "does not exist";
+            continue;
         }
-#endif
-        const QString suffix(QLatin1String("/phonon_platform/"));
-        Q_ASSERT(QCoreApplication::instance());
-        foreach (QString libPath, QCoreApplication::libraryPaths()) {
-            libPath += suffix;
-            const QDir dir(libPath);
-            if (!dir.exists()) {
-                pDebug() << Q_FUNC_INFO << dir.absolutePath() << "does not exist";
+        foreach (const QString &pluginName, dir.entryList(QDir::Files)) {
+            QPluginLoader pluginLoader(libPath + pluginName);
+            if (!pluginLoader.load()) {
+                pDebug() << Q_FUNC_INFO << "  platform plugin load failed:"
+                    << pluginLoader.errorString();
                 continue;
             }
-            foreach (const QString &pluginName, dir.entryList(QDir::Files)) {
-                QPluginLoader pluginLoader(libPath + pluginName);
-                if (!pluginLoader.load()) {
-                    pDebug() << Q_FUNC_INFO << "  platform plugin load failed:"
-                        << pluginLoader.errorString();
-                    continue;
-                }
-                pDebug() << pluginLoader.instance();
-                m_platformPlugin = qobject_cast<PlatformPlugin \
                *>(pluginLoader.instance());
-                pDebug() << m_platformPlugin;
-                if (m_platformPlugin) {
-                    return m_platformPlugin;
-                } else {
-                    pDebug() << Q_FUNC_INFO << dir.absolutePath() << "exists but the \
                platform plugin was not loadable:" << pluginLoader.errorString();
-                    pluginLoader.unload();
-                }
+            pDebug() << pluginLoader.instance();
+            QObject *qobj = pluginLoader.instance();
+            m_platformPlugin = qobject_cast<PlatformPlugin *>(qobj);
+            pDebug() << m_platformPlugin;
+            if (m_platformPlugin) {
+                connect(qobj, \
SIGNAL(objectDescriptionChanged(ObjectDescriptionType)), +                        \
SLOT(objectDescriptionChanged(ObjectDescriptionType))); +                return \
m_platformPlugin; +            } else {
+                pDebug() << Q_FUNC_INFO << dir.absolutePath() << "exists but the \
platform plugin was not loadable:" << pluginLoader.errorString(); +                \
pluginLoader.unload();  }
         }
-        if (!m_platformPlugin) {
-            pDebug() << Q_FUNC_INFO << "phonon_platform/kde plugin could not be \
                loaded";
-            m_noPlatformPlugin = true;
-        }
     }
-    return m_platformPlugin;
+    pDebug() << Q_FUNC_INFO << "phonon_platform/kde plugin could not be loaded";
+    m_noPlatformPlugin = true;
+    return 0;
 }
 
 PlatformPlugin *Factory::platformPlugin()


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic