Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Common/LtsPluginManager/lts_plugin_loader.h
T
berrux-dev 84f8cfb41f Remove unused code from the Release 2 scope modules
Trim mostly-deletion changes (~700 lines) across the modules the Release
2 build compiles: unused telegrams and receiver/handler code in
TrainingAreaBase (telegrams, recv_from_dds_aes/fts, ism/main/pdm/position
handlers), dead members in SqlBrowser and ProjectDataManagement,
unused LtsPluginManager loader paths, LtsSession unit-test, WlsTetra and
DdsView cleanups, plus the stale include_directories removal in
Lts/CMakeLists.txt. Continues the Release 2 source prune (keep only what
the build compiles).

Excluded from this commit by design: the machine-specific .envrc
(MIGRATE_PIPELINE_ROOT path fix stays uncommitted) and the untracked
qt5-before/ reference tree.
2026-11-17 17:28:48 +01:00

89 lines
1.9 KiB
C++

/**
* @RDE_HEADER@
* plugin loader helper function
* $Id$
* $HeadURL$
* $Author$
*
* Created by Christian Ehrlicher, SLSE, 2016-07-07
*/
#pragma once
#define PLUGIN_LOADER_VERSION 3
#include <qglobal.h>
#include <functional>
#include <QMap>
#include <QPair>
#ifndef LTSPLUGINLOADER_EXPORT
# ifdef BUILD_STATIC_LIBRARIES
# define LTSPLUGINLOADER_EXPORT
# else
# if defined(MAKE_LTSPLUGINLOADER_LIB)
# define LTSPLUGINLOADER_EXPORT Q_DECL_EXPORT
# else
# define LTSPLUGINLOADER_EXPORT Q_DECL_IMPORT
# endif
# endif
#endif
class QObject;
class QPluginLoader;
namespace LtsAppDescriptor
{
struct AppDescription;
}
namespace LtsPluginManager
{
enum class PluginType
{
UNKNOWN = 0, // should not happen
DATA, // 1
GUI, // 2
TOPIC_TYPE,
PROJECT,
STYLE,
SPECIAL, // TODO: rm
GUI_ELEMENT,
};
struct PluginInstance // one instance for one plugin
{
QString pluginName;
QString fullFileName;
QString fileName;
QObject *plugin = nullptr;
QPluginLoader *pluginLoader = nullptr;
};
class LTSPLUGINLOADER_EXPORT LtsPluginLoader
{
public:
static LtsPluginLoader *getInstance();
void unloadAllPlugins();
void checkPlugins(const QVector<LtsAppDescriptor::AppDescription> &appVector,
QStringList &errors /* out */);
bool loadPlugins(PluginType requestedPluginType,
const std::function<bool(const PluginInstance &pluginInstance)> &loadPlugin,
const QStringList &requiredPlugins = QStringList(), /* leave empty to get all plugins of the given type */
const QString &specialTopicTypeFilter = QString(),
const QStringList &optionalPlugins = QStringList());
typedef QPair<PluginType, QString> PluginKey;
private:
friend struct LtsPluginLoaderHandler;
LtsPluginLoader() = default;
~LtsPluginLoader();
QMap<PluginKey, PluginInstance> m_loadedPlugins; // TODO: meh...
};
} // namespace LtsPluginManager