File indexing completed on 2025-01-05 03:34:14

0001 /*
0002     File                 : PluginManager.h
0003     Project              : LabPlot/SciDAVis
0004     Description          : This class manages all plugins.
0005     --------------------------------------------------------------------
0006     SPDX-FileCopyrightText: 2009 Tilman Benkert <thzs*gmx.net  (use @ for *)>
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #ifndef PLUGINMANAGER_H
0011 #define PLUGINMANAGER_H
0012 
0013 #include <QList>
0014 #include <QObjectList>
0015 
0016 class PluginLoader;
0017 
0018 class PluginManager {
0019 private:
0020     PluginManager();
0021 
0022 public:
0023     static bool enablePlugin(const QString& absolutePath);
0024     static void disablePlugin(const QString& absolutePath, bool rightNow = false);
0025     static QObjectList plugins();
0026     static QStringList loadedPluginFileNames();
0027     static QStringList failedPluginFileNames();
0028     static QString errorOfPlugin(const QString& fileName);
0029     static QObject* instanceOfPlugin(const QString& fileName);
0030 
0031 #ifdef QT_DEBUG
0032     static void printAll();
0033 #endif
0034 
0035 private:
0036     static void loadAll();
0037     static QList<PluginLoader*> m_loadedPlugins;
0038     static QList<PluginLoader*> m_pluginsWithErrors;
0039     static QObjectList m_staticPlugins;
0040     static bool m_loaded;
0041     static QObjectList m_allPlugins;
0042 };
0043 
0044 #endif