Commit bb38dc45 authored by Alexander Lohnau's avatar Alexander Lohnau 💬 Committed by Volker Krause
Browse files

Port away from deprecated KPluginLoader

parent 687cb850
......@@ -13,7 +13,6 @@
#include <KDecoration2/Private/DecoratedClientPrivate>
#include <KDecoration2/Private/DecorationSettingsPrivate>
#include <KPluginFactory>
#include <KPluginLoader>
#include <KPluginMetaData>
#include <KSharedConfig>
......@@ -27,7 +26,6 @@ namespace KDecoration2
DummyDecorationBridge::DummyDecorationBridge(const QString &decorationTheme, QObject *parent)
: DecorationBridge(parent)
, m_decorationsConfigFileName()
, m_loader()
, m_factory()
, m_decoration()
, m_client()
......@@ -45,14 +43,15 @@ DummyDecorationBridge::DummyDecorationBridge(const QString &decorationTheme, QOb
m_decorationsConfigFileName = QStringLiteral("breezerc");
}
const QString pluginPath = windowDecorationPluginPath(decorationTheme);
m_loader = std::unique_ptr<KPluginLoader>(new KPluginLoader{pluginPath});
m_factory = m_loader->factory();
m_pluginPath = windowDecorationPluginPath(decorationTheme);
disableAnimations();
QVariantMap args({{QStringLiteral("bridge"), QVariant::fromValue(this)}});
m_decoration = m_factory->create<KDecoration2::Decoration>(m_factory, QVariantList({args}));
m_factory = KPluginFactory::loadFactory(KPluginMetaData(m_pluginPath)).plugin;
if (m_factory) {
m_decoration = m_factory->create<KDecoration2::Decoration>(m_factory, QVariantList({args}));
}
auto decorationSettings = QSharedPointer<KDecoration2::DecorationSettings>::create(this);
m_decoration->setSettings(decorationSettings);
......@@ -67,7 +66,7 @@ DummyDecorationBridge::DummyDecorationBridge(const QString &decorationTheme, QOb
DummyDecorationBridge::~DummyDecorationBridge()
{
m_loader->unload();
QPluginLoader(m_pluginPath).unload();
}
std::unique_ptr<KDecoration2::DecorationSettingsPrivate> DummyDecorationBridge::settings(KDecoration2::DecorationSettings *parent)
......
......@@ -12,10 +12,8 @@
#include <KDecoration2/Private/DecorationBridge>
#include <kdecoration2/decorationdefines.h>
#include <memory>
class KPluginFactory;
class KPluginLoader;
namespace KDecoration2
{
......@@ -50,11 +48,11 @@ private:
QString m_decorationsConfigFileName;
double globalAnimationEntryValue;
std::unique_ptr<KPluginLoader> m_loader;
KPluginFactory *m_factory;
KDecoration2::Decoration *m_decoration;
KDecoration2::DecoratedClientPrivate *m_client;
KDecoration2::DummyDecorationSettings *m_settings;
QString m_pluginPath;
};
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment