Support new-style plugins without a "Keys" json property
As per discussion with Lars, intent here was to allow plugins without a "Keys" property to still function correctly, but this particular if statement was blocking any such plugins from being detected. Change-Id: Icb343ca8bd95a508d62565cd816fe2a57a4f82bd Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
parent
95550c8f12
commit
9c75d0a913
@ -128,6 +128,7 @@ void QFactoryLoader::update()
|
||||
QLibraryPrivate *library = 0;
|
||||
for (int j = 0; j < plugins.count(); ++j) {
|
||||
QString fileName = QDir::cleanPath(path + QLatin1Char('/') + plugins.at(j));
|
||||
|
||||
if (qt_debug_component()) {
|
||||
qDebug() << "QFactoryLoader::QFactoryLoader() looking at" << fileName;
|
||||
}
|
||||
@ -140,7 +141,9 @@ void QFactoryLoader::update()
|
||||
library->release();
|
||||
continue;
|
||||
}
|
||||
|
||||
QStringList keys;
|
||||
bool metaDataOk = false;
|
||||
if (library->compatPlugin) {
|
||||
qWarning("Qt plugin loader: Compatibility plugin '%s', need to load for accessing meta data.",
|
||||
qPrintable(QDir::toNativeSeparators(fileName)));
|
||||
@ -164,10 +167,17 @@ void QFactoryLoader::update()
|
||||
QFactoryInterface *factory = qobject_cast<QFactoryInterface*>(instance);
|
||||
if (instance && factory && instance->qt_metacast(d->iid))
|
||||
keys = factory->keys();
|
||||
|
||||
if (!keys.isEmpty())
|
||||
metaDataOk = true;
|
||||
|
||||
} else {
|
||||
QString iid = library->metaData.value(QLatin1String("IID")).toString();
|
||||
if (iid == QLatin1String(d->iid.constData(), d->iid.size())) {
|
||||
QJsonObject object = library->metaData.value(QLatin1String("MetaData")).toObject();
|
||||
if (!object.isEmpty())
|
||||
metaDataOk = true;
|
||||
|
||||
QJsonArray k = object.value(QLatin1String("Keys")).toArray();
|
||||
for (int i = 0; i < k.size(); ++i) {
|
||||
QString s = k.at(i).toString();
|
||||
@ -178,11 +188,12 @@ void QFactoryLoader::update()
|
||||
qDebug() << "Got keys from plugin meta data" << keys;
|
||||
}
|
||||
|
||||
if (keys.isEmpty()) {
|
||||
if (!metaDataOk) {
|
||||
library->unload();
|
||||
library->release();
|
||||
continue;
|
||||
}
|
||||
|
||||
d->libraryList += library;
|
||||
for (int k = 0; k < keys.count(); ++k) {
|
||||
// first come first serve, unless the first
|
||||
|
Loading…
Reference in New Issue
Block a user