Port away from KPluginLoader::factory.
This commit is contained in:
parent
c31eabc842
commit
d7912e21d8
|
@ -62,26 +62,23 @@ bool CoreBackendManager::load(const QString& name)
|
||||||
QString path = QStringLiteral("kpmcore/") + name;
|
QString path = QStringLiteral("kpmcore/") + name;
|
||||||
KPluginLoader loader(path);
|
KPluginLoader loader(path);
|
||||||
|
|
||||||
KPluginFactory* factory = loader.factory();
|
|
||||||
KPluginMetaData metadata(path);
|
KPluginMetaData metadata(path);
|
||||||
|
d->m_Backend = KPluginFactory::instantiatePlugin<CoreBackend>(metadata).plugin;
|
||||||
|
|
||||||
if (factory != nullptr) {
|
if (!backend()) {
|
||||||
d->m_Backend = factory->create<CoreBackend>(nullptr);
|
qWarning() << "Could not create instance of plugin " << name;
|
||||||
|
return false;
|
||||||
QString id = metadata.pluginId();
|
|
||||||
QString version = metadata.version();
|
|
||||||
if (id.isEmpty())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
backend()->setId(id);
|
|
||||||
backend()->setVersion(version);
|
|
||||||
qDebug() << "Loaded backend plugin: " << backend()->id();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qWarning() << "Could not load plugin for core backend " << name << ": " << loader.errorString();
|
QString id = metadata.pluginId();
|
||||||
return false;
|
QString version = metadata.version();
|
||||||
|
if (id.isEmpty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
backend()->setId(id);
|
||||||
|
backend()->setVersion(version);
|
||||||
|
qDebug() << "Loaded backend plugin: " << backend()->id();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CoreBackendManager::unload()
|
void CoreBackendManager::unload()
|
||||||
|
|
Loading…
Reference in New Issue