Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Common/LtsPluginManager/lts_plugin_loader.h
T
berrux-dev 855b0a6101 Remove modules not compiled by this branch's release build
Lts/Common: drop the 17 submodules excluded from the RELEASE_BUILD
branch of Lts/Common/CMakeLists.txt (CodeGen, LtsAppManager, LtsBotan,
LtsCoordinate, LtsElevation, LtsLogin, LtsMultiMonitor,
LtsPluginManager, LtsPrinting, LtsProjectionWorkstation,
LtsScriptTimeline, LtsSession, LtsTimeline, LtsTimelineClassic,
LtsVirtualKeyboard, LtsWidgets, TopicEditorBase). Only the 13
subdirectories actually built remain.

TrainingAreaBase: drop sources of targets excluded by
IF(NOT RELEASE_BUILD) / IF(BUILD_RTI) (svcTabClient, svcTabServer,
svcTrainingAreaBase exe, RecordReplayPlugin customization) and the 7
plugin directories not added in the release path (AdlerJson,
ApacheHlaJson, DebugJsonDir, HlaJson, Nmea, UAS, WlsTetra). Only
tabTelegrams, svcTabCommon and the TetraJson plugin are compiled.

Cross-checked: no kept compiled source includes headers from the
removed modules (GuiPluginInterface - the only LtsWidgets consumer -
is itself NOT RELEASE_BUILD-guarded).
2026-10-13 19:19:55 +02:00

95 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