qtmobility/src/multimedia/qmediapluginloader.cpp
changeset 8 71781823f776
parent 5 453da2cfceef
child 11 06b8e2af4411
--- a/qtmobility/src/multimedia/qmediapluginloader.cpp	Fri May 14 16:41:33 2010 +0300
+++ b/qtmobility/src/multimedia/qmediapluginloader.cpp	Thu May 27 13:42:11 2010 +0300
@@ -39,7 +39,6 @@
 **
 ****************************************************************************/
 
-#include <src/global/qbuildcfg.h>
 #include "qmediapluginloader_p.h"
 #include <QtCore/qcoreapplication.h>
 #include <QtCore/qpluginloader.h>
@@ -47,10 +46,10 @@
 #include <QtCore/qdebug.h>
 
 #include "qmediaserviceproviderplugin.h"
+#include "qmobilitypluginsearch.h"
 
 QT_BEGIN_NAMESPACE
 
-
 typedef QMap<QString,QObjectList> ObjectListMap;
 Q_GLOBAL_STATIC(ObjectListMap, staticMediaPlugins);
 
@@ -98,43 +97,23 @@
             }
         }
     } else {
-        QStringList     paths = QCoreApplication::libraryPaths();
-        QString val = qt_mobility_configure_prefix_path_str;
-        if(val.length() > 0){
-            val += "/plugins";
-            paths << val;
-        }
-
-
-#ifdef QTM_PLUGIN_PATH
-        paths << QTM_PLUGIN_PATH;
-#endif
-
-        foreach (QString const &path, paths) {
-            QString     pluginPathName(path + m_location);
-            QDir        pluginDir(pluginPathName);
-
-            if (!pluginDir.exists())
-                continue;
+        QStringList plugins = QTM_PREPEND_NAMESPACE(mobilityPlugins)(m_location);
+        for (int i=0; i < plugins.count(); i++) {
+            QPluginLoader   loader(plugins.at(i));
+            QObject *o = loader.instance();
+            if (o != 0 && o->qt_metacast(m_iid) != 0) {
+                QFactoryInterface* p = qobject_cast<QFactoryInterface*>(o);
+                if (p != 0) {
+                    foreach (QString const &key, p->keys())
+                        m_instances.insertMulti(key, o);
+                }
 
-            foreach (QString pluginLib, pluginDir.entryList(QDir::Files)) {
-                QPluginLoader   loader(pluginPathName + pluginLib);
-
-                QObject *o = loader.instance();
-                if (o != 0 && o->qt_metacast(m_iid) != 0) {
-                    QFactoryInterface* p = qobject_cast<QFactoryInterface*>(o);
-                    if (p != 0) {
-                        foreach (QString const &key, p->keys())
-                            m_instances.insertMulti(key, o);
-                    }
-
-                    continue;
-                } else {
-                    qWarning() << "QMediaPluginLoader: Failed to load plugin: " << pluginLib << loader.errorString();
-                }
-                delete o;
-                loader.unload();
+                continue;
+            } else {
+                qWarning() << "QMediaPluginLoader: Failed to load plugin: " << plugins.at(i) << loader.errorString();
             }
+            delete o;
+            loader.unload();
         }
     }
 }