kwin/src/pluginmanager.h

52 lines
1.1 KiB
C
Raw Normal View History

/*
SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include "kwinglobals.h"
#include <QHash>
#include <QObject>
#include <QStaticPlugin>
#include <KPluginMetaData>
namespace KWin
{
class Plugin;
class PluginFactory;
/**
* The PluginManager class loads and unloads binary compositor extensions.
*/
class KWIN_EXPORT PluginManager : public QObject
{
Q_OBJECT
public:
~PluginManager() override;
QStringList loadedPlugins() const;
QStringList availablePlugins() const;
public Q_SLOTS:
bool loadPlugin(const QString &pluginId);
void unloadPlugin(const QString &pluginId);
private:
bool loadStaticPlugin(const QString &pluginId);
bool loadDynamicPlugin(const KPluginMetaData &metadata);
bool loadDynamicPlugin(const QString &pluginId);
bool instantiatePlugin(const QString &pluginId, PluginFactory *factory);
QHash<QString, Plugin *> m_plugins;
QHash<QString, QStaticPlugin> m_staticPlugins;
KWIN_SINGLETON(PluginManager)
};
} // namespace KWin