File indexing completed on 2024-12-08 13:21:59
0001 /* 0002 SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "kwinglobals.h" 0010 0011 #include <QHash> 0012 #include <QObject> 0013 #include <QStaticPlugin> 0014 0015 #include <KPluginMetaData> 0016 0017 namespace KWin 0018 { 0019 0020 class Plugin; 0021 class PluginFactory; 0022 0023 /** 0024 * The PluginManager class loads and unloads binary compositor extensions. 0025 */ 0026 class KWIN_EXPORT PluginManager : public QObject 0027 { 0028 Q_OBJECT 0029 0030 public: 0031 PluginManager(); 0032 ~PluginManager() override; 0033 0034 QStringList loadedPlugins() const; 0035 QStringList availablePlugins() const; 0036 0037 public Q_SLOTS: 0038 bool loadPlugin(const QString &pluginId); 0039 void unloadPlugin(const QString &pluginId); 0040 0041 private: 0042 bool loadStaticPlugin(const QString &pluginId); 0043 bool loadDynamicPlugin(const KPluginMetaData &metadata); 0044 bool loadDynamicPlugin(const QString &pluginId); 0045 bool instantiatePlugin(const QString &pluginId, PluginFactory *factory); 0046 0047 std::map<QString, std::unique_ptr<Plugin>> m_plugins; 0048 QHash<QString, QStaticPlugin> m_staticPlugins; 0049 }; 0050 0051 } // namespace KWin