- NGL_ADD_LIBRARY2: 87 CMakeLists.txt konvertiert für Export-Header Generierung - 44 Export-Header Include-Pfade korrigiert (_export.h) - 81 DDS-Stub-Header generiert (*_dtc.h, *_fts.h, *_dts.h, *_ftc.h) - INGLLogger: Duplikat gelöscht, m_logger Member entfernt, variadische Makros - Q_FUNC_INFO Redefinition behoben (Qt6 definiert bereits) - FATAL_LOG Makro hinzugefügt - InfrastructureManagement DDS-Stubs (ism.hpp, ism_enums.hpp, ism_ftc.h) - FilterManagement DDS-Stubs (flt_ftc.h, flt_dts.h) - AreaEffectSimulation DDS-Stubs (aes.hpp, aes_enums.hpp) - SymbolAppearance Klasse vollständig definiert mit content() Methode - BuildingComponentFilter Klasse definiert mit Copy-Konstruktor - Ftc Factory: nullptr Return (abstract class) - AesFilter Klasse in aes.hpp hinzugefügt - Dtc Klasse in ppm.hpp mit participantChanged Signal - AesType Enum: alle 15 At* Werte definiert - AesEffectState_def: EsReceived hinzugefügt - DataModification Enum: eAdded/eModified/eRemoved - function_reply_object.h → core_types.h Include-Pfad (72 Dateien) - Enum-Class-Streaming Template-Operator in INGLLogger.h - ism_mounting_point.h: QImage → QtGui/QImage, QGuiApplication/QScreen - ism_data_plugin_interface.h: QSet Include, Include-Reihenfolge - QRegExp → QRegularExpression in tpm_js_parser.cpp - .underlying() Aufrufe zu direktem Enum-Vergleich korrigiert - Include-Pfade: aes.hpp in symbol_appearance_settings_impl.h und aes_display_filter_impl.h Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
288 lines
6.2 KiB
C++
Executable File
288 lines
6.2 KiB
C++
Executable File
|
|
|
|
|
|
#include "lts_plugin_manager.h"
|
|
#include <utility>
|
|
#include "Ui/lts_plugin_manager_dialog.h"
|
|
|
|
#include <LtsSession/lts_session_data_dds.h>
|
|
#include <NGLLogger/NGLLoggerBootstrap.h>
|
|
#include <LtsWidgets/lts_wait_dialog.h>
|
|
#include <LtsPluginManager/lts_plugin_loader.h>
|
|
#include <LtsSession/lts_session_manager.h>
|
|
#include <LtsSession/lts_session_data.h>
|
|
#include <PluginInterfaces/data_plugin_interface.h>
|
|
#include <PluginInterfaces/gui_plugin_interface.h>
|
|
|
|
#include <QTimer>
|
|
#include <QDebug>
|
|
|
|
|
|
namespace LtsPluginManager
|
|
{
|
|
|
|
LtsPluginManager::LtsPluginManager()
|
|
: m_sessionManager(new LtsSession::LtsSessionManager)
|
|
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("LtsPluginManager"))
|
|
, m_markedForDeletion(false)
|
|
{
|
|
connect(m_sessionManager, &LtsSession::LtsSessionManager::signalQuit,
|
|
this, &LtsPluginManager::signalQuit);
|
|
connect(m_sessionManager, &LtsSession::LtsSessionManager::signalLogout,
|
|
this, &LtsPluginManager::signalLogout);
|
|
connect(m_sessionManager, &LtsSession::LtsSessionManager::signalInitializationFinished,
|
|
this, &LtsPluginManager::signalInitializationFinished);
|
|
connect(m_sessionManager, &LtsSession::LtsSessionManager::signalInitializationAborted,
|
|
this, &LtsPluginManager::signalInitializationAborted);
|
|
connect(m_sessionManager, &LtsSession::LtsSessionManager::signalInitializationFinished,
|
|
this, &LtsPluginManager::slotInitializationFinished);
|
|
connect(m_sessionManager, &LtsSession::LtsSessionManager::taskSwitch,
|
|
this, &LtsPluginManager::taskSwitch);
|
|
connect(m_sessionManager, &LtsSession::LtsSessionManager::hideAllOtherBLWs,
|
|
this, &LtsPluginManager::hideAllOtherBLWs);
|
|
|
|
QTimer *t = new QTimer(this);
|
|
t->setInterval(1000);
|
|
connect(t, &QTimer::timeout,
|
|
this, &LtsPluginManager::signalStillAlive);
|
|
t->start();
|
|
}
|
|
|
|
|
|
LtsPluginManager::~LtsPluginManager()
|
|
{
|
|
|
|
|
|
delete m_sessionManager;
|
|
}
|
|
|
|
|
|
void LtsPluginManager::softQuit()
|
|
{
|
|
emit signalSoftQuit();
|
|
}
|
|
|
|
|
|
void LtsPluginManager::_softQuit()
|
|
{
|
|
m_sessionManager->softQuit();
|
|
}
|
|
|
|
|
|
QVector<LtsSession::LtsSession *> LtsPluginManager::sessions() const
|
|
{
|
|
return m_sessionManager->sessions();
|
|
}
|
|
|
|
bool LtsPluginManager::hasSituationMapInstance(const LtsAppDescriptor::AppDescription &appDescription, bool alsoTestForScriptApp)
|
|
{
|
|
if (alsoTestForScriptApp && appDescription.id == LtsAppDescriptor::App::Scripts)
|
|
return true;
|
|
|
|
for (const LtsAppDescriptor::PluginInfo &pluginInfo : std::as_const(appDescription.pluginInfos))
|
|
{
|
|
if (pluginInfo.flags.testFlag(LtsAppDescriptor::PluginInfo::Flag::ACTIONS) &&
|
|
(pluginInfo.iid == QStringLiteral("sitmap")))
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool LtsPluginManager::hasSituationMapInstance() const
|
|
{
|
|
return hasSituationMapInstance(m_app);
|
|
}
|
|
|
|
LtsSession::LtsSession *LtsPluginManager::getSession(IDL::PartitionType partitionType, int partitionId)
|
|
{
|
|
return m_sessionManager->getSession(partitionType, partitionId);
|
|
}
|
|
|
|
|
|
bool LtsPluginManager::startApp(const LtsAppDescriptor::AppDescription &app, bool headless,
|
|
const LtsSession::DdsConnectionParams &connParams, const QString &workspaceId,
|
|
bool hidden)
|
|
{
|
|
|
|
|
|
|
|
LtsWidgets::LtsWaitDialogContainer wait;
|
|
|
|
m_app = app;
|
|
LtsPluginLoader *pluginLoader = LtsPluginLoader::getInstance();
|
|
|
|
|
|
|
|
QVector<PluginInstance> dataPlugins;
|
|
auto cb = [&](const PluginInstance &pi)
|
|
{
|
|
dataPlugins.append(pi);
|
|
return true;
|
|
};
|
|
|
|
if (!pluginLoader->loadPlugins(PluginType::DATA, cb))
|
|
{
|
|
WARNING_LOG() << "PluginLoader failed to load data plugins - abort!";
|
|
return false;
|
|
}
|
|
|
|
|
|
|
|
QVector<PluginInstance> guiPlugins;
|
|
auto cbLoadPlugins = [&](const PluginInstance &pi)
|
|
{
|
|
guiPlugins.append(pi);
|
|
return true;
|
|
};
|
|
|
|
if (!pluginLoader->loadPlugins(PluginType::GUI, cbLoadPlugins))
|
|
{
|
|
WARNING_LOG() << "PluginLoader failed to load gui plugins - abort!";
|
|
return false;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QVector<AppPluginInstance> dataApiList;
|
|
for (auto i = dataPlugins.constBegin(); i != dataPlugins.constEnd(); ++i)
|
|
{
|
|
const PluginInstance &pi = *i;
|
|
|
|
AppPluginInstance api;
|
|
api.pluginInstance = pi;
|
|
api.m_appName = m_app.appName;
|
|
api.m_appId = m_app.id;
|
|
|
|
|
|
dataApiList.append(api);
|
|
}
|
|
|
|
|
|
|
|
|
|
QVector<AppPluginInstance> guiApiList;
|
|
for (auto i = guiPlugins.constBegin(); i != guiPlugins.constEnd(); ++i)
|
|
{
|
|
const PluginInstance &pi = *i;
|
|
|
|
AppPluginInstance api;
|
|
api.pluginInstance = pi;
|
|
api.m_appName = m_app.appName;
|
|
api.m_appId = m_app.id;
|
|
|
|
|
|
|
|
for (auto i2 = app.pluginInfos.constBegin(); i2 != app.pluginInfos.constEnd(); ++i2)
|
|
{
|
|
const LtsAppDescriptor::PluginInfo &rp = *i2;
|
|
|
|
|
|
if (rp.type == LtsAppDescriptor::PluginInfo::PluginType::GUI
|
|
&& rp.iid == pi.pluginName)
|
|
{
|
|
|
|
api.m_flags = rp.flags;
|
|
api.m_options = rp.options;
|
|
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
guiApiList.append(api);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LtsSession::DdsConnectionParams connParamsNew(connParams);
|
|
if (!connParamsNew.isValid())
|
|
{
|
|
INFO_LOG() << "Invalid connection params given - using default parameter";
|
|
|
|
connParamsNew.domainId = LtsSessionData::LtsSessionData::getInstance()->getDomainIdPreset();
|
|
connParamsNew.partitionId = 0;
|
|
connParamsNew.exerciseId = 0;
|
|
connParamsNew.partitionType = IDL::PartitionType::Global;
|
|
|
|
|
|
connParamsNew.tcpConnectionUrl = LtsSessionData::LtsSessionData::getInstance()->getTcpConnectionUrl();
|
|
}
|
|
if (LtsSessionData::LtsSessionData::getInstance()->getQosFile().size() > 0 && LtsSessionData::LtsSessionData::getInstance()->getQosFile().at(0).size() > 0)
|
|
connParamsNew.qos_file = LtsSessionData::LtsSessionData::getInstance()->getQosFile();
|
|
else
|
|
connParamsNew.qos_file = QStringList();
|
|
if (!m_sessionManager->init(connParamsNew,
|
|
dataApiList,
|
|
guiApiList,
|
|
m_app.id,
|
|
workspaceId,
|
|
headless,
|
|
hidden))
|
|
{
|
|
ERROR_LOG() << "Could not create Global Session - abort.";
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
}
|