Avoid creating a KPluginInfo from a KPluginMetaData instance

It's not needed, gives a (very) tiny performance boost and is a bit
cleaner.

REVIEW: 128904
This commit is contained in:
David Edmundson 2016-09-14 13:38:56 +01:00 committed by David Edmundson
parent 861f1c982a
commit 820baec72e

View File

@ -198,8 +198,7 @@ Applet *PluginLoader::loadApplet(const QString &name, uint appletId, const QVari
} }
if (!plugins.isEmpty()) { if (!plugins.isEmpty()) {
KPluginInfo::List lst = KPluginInfo::fromMetaData(plugins); KPluginLoader loader(plugins.first().fileName());
KPluginLoader loader(lst.first().libraryPath());
if (!isPluginVersionCompatible(loader)) { if (!isPluginVersionCompatible(loader)) {
return 0; return 0;
} }
@ -264,8 +263,7 @@ DataEngine *PluginLoader::loadDataEngine(const QString &name)
QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(PluginLoaderPrivate::s_dataEnginePluginDir, filter); QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(PluginLoaderPrivate::s_dataEnginePluginDir, filter);
if (!plugins.isEmpty()) { if (!plugins.isEmpty()) {
KPluginInfo::List lst = KPluginInfo::fromMetaData(plugins); KPluginLoader loader(plugins.first().fileName());
KPluginLoader loader(lst.first().libraryPath());
const QVariantList argsWithMetaData = QVariantList() << loader.metaData().toVariantMap(); const QVariantList argsWithMetaData = QVariantList() << loader.metaData().toVariantMap();
KPluginFactory *factory = loader.factory(); KPluginFactory *factory = loader.factory();
if (factory) { if (factory) {
@ -370,8 +368,7 @@ Service *PluginLoader::loadService(const QString &name, const QVariantList &args
QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(PluginLoaderPrivate::s_servicesPluginDir, filter); QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(PluginLoaderPrivate::s_servicesPluginDir, filter);
if (!plugins.isEmpty()) { if (!plugins.isEmpty()) {
KPluginInfo::List lst = KPluginInfo::fromMetaData(plugins); KPluginLoader loader(plugins.first().fileName());
KPluginLoader loader(lst.first().libraryPath());
if (!isPluginVersionCompatible(loader)) { if (!isPluginVersionCompatible(loader)) {
return 0; return 0;
} }
@ -411,8 +408,7 @@ ContainmentActions *PluginLoader::loadContainmentActions(Containment *parent, co
QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(PluginLoaderPrivate::s_containmentActionsPluginDir, filter); QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(PluginLoaderPrivate::s_containmentActionsPluginDir, filter);
if (!plugins.isEmpty()) { if (!plugins.isEmpty()) {
KPluginInfo::List lst = KPluginInfo::fromMetaData(plugins); KPluginLoader loader(plugins.first().fileName());
KPluginLoader loader(lst.first().libraryPath());
const QVariantList argsWithMetaData = QVariantList() << loader.metaData().toVariantMap(); const QVariantList argsWithMetaData = QVariantList() << loader.metaData().toVariantMap();
KPluginFactory *factory = loader.factory(); KPluginFactory *factory = loader.factory();
if (factory) { if (factory) {