Continue the Qt5->Qt6 migration so the LTS Projects (Group 10) and LTS
Application (Group 11) compile, link, and ctest runs.
Qt5->Qt6 API migration (resolves removed/deprecated Qt6 APIs) across Lts
Tools and Apps, e.g. QAction->QActionGroup, QAbstractSocket::errorOccurred,
Qt::SkipEmptyParts, QRandomGenerator, QInputDevice::DeviceType,
QRegularExpression, QLatin1Literal->QStringLiteral, and the SampleModel
m_description->description rename.
CMake build fixes:
- CMakeLists.txt: add Lts/Common to CMAKE_AUTOMOC_INCLUDE_DIRECTORIES so moc
resolves Q_INTERFACES(ProjectPlugin::Plugin) for the migrated Projects.
- cmake/NGLMacros.cmake: NGL_COMPILE_RESOURCES - replace return() (which aborts
the calling CMakeLists.txt) with an if/else/endif.
- OpApp/THP: guard the ArcGISQt5Hack link with $<IF:$<TARGET_EXISTS:...>> (the
target is absent when the SituationMap viewer is stubbed); matches
CentralEffectSimulation.
- LtsSession: prefer the in-tree svcCoreClient target over a FIND_LIBRARY in
/usr/local/lib.
- CnrProxyTester/DotMatrixDisplay: set AUTOUIC_SEARCH_PATHS for the ui/ subdir.
- TopicDiscover: link NGLLogger.
Export-header visibility stubs (expand the empty *_EXPORT macro to
__attribute__((visibility("default"))); the build sets -fvisibility=hidden and
these stubs shadow the CMake-generated header):
- include/LtsProjectionWorkstation/ltsprojectionworkstation_export.h (fixes
undefined reference to LtsProjectionWorkstation::getInstance /
setProjectionOperatorPreset)
- include/LtsSession/ltssession_export.h, include/LtsUtilsGuiDds/ltsutilsguidds_export.h (same pattern)
New plugin modules (copied from legacy) so LtsAppDescriptorChecker finds the
gui:3 IIDs referenced by the Projects' apps.json:
- TakeHomePackageManager/OldTHP gui:3:tpm.man, gui:3:tpm.usb
- PresentationManagement/.../ScriptEditor gui:3:pre.script.edit
- Timeline/Gui/EventTimelineClassic gui:3:tln.view
new_docker_build.sh: correct group targets to the actual CMake target names,
guard LtsReportDisplay on BUILD_CODIFICATION, and skip modules unavailable in
the prebuilt image (AsmWorkstationCertifier/botan2, TrajectoryWidget,
VideoImport, thp_viewer/VLC).
192 lines
6.2 KiB
C++
192 lines
6.2 KiB
C++
|
|
|
|
#include "lts_plugin_manager.h"
|
|
|
|
#include "Ui/lts_plugin_manager_dialog.h"
|
|
|
|
#include <LtsPluginManager/lts_plugin_loader.h>
|
|
#include <LtsSession/lts_session_data.h>
|
|
#include <LtsSession/lts_session_data_dds.h>
|
|
#include <LtsSession/lts_session_manager.h>
|
|
#include <LtsWidgets/lts_wait_dialog.h>
|
|
#include <NGLLogger/NGLLoggerBootstrap.h>
|
|
#include <PluginInterfaces/data_plugin_interface.h>
|
|
#include <PluginInterfaces/gui_plugin_interface.h>
|
|
#include <QtCore/QDebug>
|
|
#include <QtCore/QTimer>
|
|
#include <utility>
|
|
|
|
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(m_logger) << "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(m_logger) << "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(m_logger) << "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(m_logger) << "Could not create Global Session - abort.";
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
} // namespace LtsPluginManager
|