From e431b453b64aa5c9511fbdf54dd1a8e31f4bc14e Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Tue, 19 Oct 2021 21:19:23 +0200 Subject: [PATCH] Port away from KPluginLoader::findPlugins --- autotests/test_plugin_effectloader.cpp | 2 +- src/composite.cpp | 2 +- src/effectloader.cpp | 4 ++-- src/kcmkwin/common/effectsmodel.cpp | 4 ++-- .../kwindecoration/declarative-plugin/previewbridge.cpp | 2 +- src/kcmkwin/kwinoptions/kwinoptions_settings.kcfg | 2 +- src/kcmkwin/kwintabbox/main.cpp | 2 +- src/main_wayland.cpp | 2 +- src/pluginmanager.cpp | 4 ++-- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/autotests/test_plugin_effectloader.cpp b/autotests/test_plugin_effectloader.cpp index fd63279bc0..eea5110325 100644 --- a/autotests/test_plugin_effectloader.cpp +++ b/autotests/test_plugin_effectloader.cpp @@ -282,7 +282,7 @@ void TestPluginEffectLoader::testLoadPluginEffect() KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig); loader.setConfig(config); - const auto plugins = KPluginLoader::findPlugins(QString(), + const auto plugins = KPluginMetaData::findPlugins(QString(), [name] (const KPluginMetaData &data) { return data.pluginId().compare(name, Qt::CaseInsensitive) == 0 && data.serviceTypes().contains(QStringLiteral("KWin/Effect")); } diff --git a/src/composite.cpp b/src/composite.cpp index 2317ad9ff7..5d42c8a54f 100644 --- a/src/composite.cpp +++ b/src/composite.cpp @@ -196,7 +196,7 @@ bool Compositor::setupStart() << "Configured compositor not supported by Platform. Falling back to defaults"; } - const auto availablePlugins = KPluginLoader::findPlugins(QStringLiteral("org.kde.kwin.scenes")); + const auto availablePlugins = KPluginMetaData::findPlugins(QStringLiteral("org.kde.kwin.scenes")); for (const KPluginMetaData &pluginMetaData : availablePlugins) { qCDebug(KWIN_CORE) << "Available scene plugin:" << pluginMetaData.fileName(); diff --git a/src/effectloader.cpp b/src/effectloader.cpp index 2f5adc1e9f..eca1f07275 100644 --- a/src/effectloader.cpp +++ b/src/effectloader.cpp @@ -357,7 +357,7 @@ bool PluginEffectLoader::hasEffect(const QString &name) const KPluginMetaData PluginEffectLoader::findEffect(const QString &name) const { - const auto plugins = KPluginLoader::findPlugins(m_pluginSubDirectory, + const auto plugins = KPluginMetaData::findPlugins(m_pluginSubDirectory, [name] (const KPluginMetaData &data) { return data.pluginId().compare(name, Qt::CaseInsensitive) == 0 && data.serviceTypes().contains(s_serviceType); } @@ -493,7 +493,7 @@ void PluginEffectLoader::queryAndLoadAll() QVector PluginEffectLoader::findAllEffects() const { - return KPluginLoader::findPlugins(m_pluginSubDirectory, [] (const KPluginMetaData &data) { return data.serviceTypes().contains(s_serviceType); }); + return KPluginMetaData::findPlugins(m_pluginSubDirectory, [] (const KPluginMetaData &data) { return data.serviceTypes().contains(s_serviceType); }); } void PluginEffectLoader::setPluginSubDirectory(const QString &directory) diff --git a/src/kcmkwin/common/effectsmodel.cpp b/src/kcmkwin/common/effectsmodel.cpp index 12e56ce087..eb6cffea76 100644 --- a/src/kcmkwin/common/effectsmodel.cpp +++ b/src/kcmkwin/common/effectsmodel.cpp @@ -332,7 +332,7 @@ void EffectsModel::loadJavascriptEffects(const KConfigGroup &kwinConfig) void EffectsModel::loadPluginEffects(const KConfigGroup &kwinConfig) { - const auto pluginEffects = KPluginLoader::findPlugins( + const auto pluginEffects = KPluginMetaData::findPlugins( QStringLiteral("kwin/effects/plugins/"), [](const KPluginMetaData &data) { return data.serviceTypes().contains(QStringLiteral("KWin/Effect")); @@ -368,7 +368,7 @@ void EffectsModel::loadPluginEffects(const KConfigGroup &kwinConfig) return parentComponents.contains(pluginEffect.pluginId()); }; - const QVector plugins = KPluginLoader::findPlugins(QStringLiteral("kwin/effects/configs/"), filter); + const QVector plugins = KPluginMetaData::findPlugins(QStringLiteral("kwin/effects/configs/"), filter); if (!plugins.isEmpty()) { effect.configModule = plugins.first().pluginId(); diff --git a/src/kcmkwin/kwindecoration/declarative-plugin/previewbridge.cpp b/src/kcmkwin/kwindecoration/declarative-plugin/previewbridge.cpp index fd5569578d..d702e33e66 100644 --- a/src/kcmkwin/kwindecoration/declarative-plugin/previewbridge.cpp +++ b/src/kcmkwin/kwindecoration/declarative-plugin/previewbridge.cpp @@ -108,7 +108,7 @@ void PreviewBridge::createFactory() return; } - const auto offers = KPluginLoader::findPlugins(s_pluginName); + const auto offers = KPluginMetaData::findPlugins(s_pluginName); auto item = std::find_if(offers.constBegin(), offers.constEnd(), [this](const auto &plugin) { return plugin.pluginId() == m_plugin; }); if (item != offers.constEnd()) { KPluginLoader loader(item->fileName()); diff --git a/src/kcmkwin/kwinoptions/kwinoptions_settings.kcfg b/src/kcmkwin/kwinoptions/kwinoptions_settings.kcfg index c4fe5ea9f0..6144c97f7b 100644 --- a/src/kcmkwin/kwinoptions/kwinoptions_settings.kcfg +++ b/src/kcmkwin/kwinoptions/kwinoptions_settings.kcfg @@ -225,7 +225,7 @@ Nothing - + diff --git a/src/kcmkwin/kwintabbox/main.cpp b/src/kcmkwin/kwintabbox/main.cpp index 3cd16746f4..97ff04e789 100644 --- a/src/kcmkwin/kwintabbox/main.cpp +++ b/src/kcmkwin/kwintabbox/main.cpp @@ -391,7 +391,7 @@ void KWinTabBoxConfig::configureEffectClicked() return parentComponents.contains(name); }; - const QVector plugins = KPluginLoader::findPlugins(QStringLiteral("kwin/effects/configs/"), filter); + const QVector plugins = KPluginMetaData::findPlugins(QStringLiteral("kwin/effects/configs/"), filter); if (plugins.isEmpty()) { delete configDialog; diff --git a/src/main_wayland.cpp b/src/main_wayland.cpp index 2e18f6350b..3e49fa0f2d 100644 --- a/src/main_wayland.cpp +++ b/src/main_wayland.cpp @@ -408,7 +408,7 @@ int main(int argc, char * argv[]) KWin::Application::createAboutData(); KQuickAddons::QtQuickSettings::init(); - const auto availablePlugins = KPluginLoader::findPlugins(QStringLiteral("org.kde.kwin.waylandbackends")); + const auto availablePlugins = KPluginMetaData::findPlugins(QStringLiteral("org.kde.kwin.waylandbackends")); auto hasPlugin = [&availablePlugins] (const QString &name) { return std::any_of(availablePlugins.begin(), availablePlugins.end(), [name] (const KPluginMetaData &plugin) { diff --git a/src/pluginmanager.cpp b/src/pluginmanager.cpp index 0b4e3ae5b2..961fdc7325 100644 --- a/src/pluginmanager.cpp +++ b/src/pluginmanager.cpp @@ -64,7 +64,7 @@ PluginManager::PluginManager(QObject *parent) } } - const QVector plugins = KPluginLoader::findPlugins(s_pluginDirectory); + const QVector plugins = KPluginMetaData::findPlugins(s_pluginDirectory); for (const KPluginMetaData &metadata : plugins) { if (m_plugins.contains(metadata.pluginId())) { qCWarning(KWIN_CORE) << "Conflicting plugin id" << metadata.pluginId(); @@ -92,7 +92,7 @@ QStringList PluginManager::availablePlugins() const { QStringList ret = m_staticPlugins.keys(); - const QVector plugins = KPluginLoader::findPlugins(s_pluginDirectory); + const QVector plugins = KPluginMetaData::findPlugins(s_pluginDirectory); for (const KPluginMetaData &metadata : plugins) { ret.append(metadata.pluginId()); }