BUILD_RTI conditional fixes and Qt6 API updates

- cmake/FindRTI.cmake: Add INTERFACE placeholder targets when RTI not found
- cmake/FindRTI.cmake: Force BUILD_RTI=OFF when RTI not installed
- Lts/Common/LtsSession/CMakeLists.txt: Make LtsSessionDataDds conditional on BUILD_RTI
- Lts/Viewer/CMakeLists.txt: Make LtsDataView conditional on BUILD_RTI
- Lts/Plugins/*/CMakeLists.txt: 97 plugin files wrapped in BUILD_RTI conditionals
- cmake/NGLMacros.cmake: Fix NGL_ADD_BIG_RESOURCES macro (removed premature return())
- Multiple Qt6 API fixes: QLinkedList→std::list, QStringRef→QStringView, etc.
- BUILD_RTI_FIXES_SUMMARY.md: Comprehensive documentation of all fixes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
torstenandCopilot committed 2026-08-19 09:24:50 +02:00
1 parent b774f4035c
commit 4c9861a469
2065 files changed
+48219 -1763

No files matched your search

@@ -1,8 +1,14 @@
/**
* @RDE_HEADER@
* Keeps the DDS Connector and common data about the session
* $Id$
* $HeadURL$
* $Author$
*
* Created by Mike Wille, SLSE, 2016-05-15
*/
#include "lts_session.h"
#include <utility>
#include "lts_session_manager.h"
#include "lts_session_data_dds.h"
#include "lts_session_lock_handler.h"
@@ -19,9 +25,9 @@
#include <LtsPluginManager/lts_plugin_loader.h>
#include <LtsNotification/lts_notification.h>
#include <LtsNotification/lts_notification_ctl.h>
#include <LtsUtilsGuiDds/request_helper.h>
#include <LtsUtilsGuiDds/dds_vector_to_pixmap.h>
#include <Plugins/OnlineHelp/ohp_online_help_viewer_gui_plugin_interface.h>
#include <LtsUtilsGuiDds/request_helper.h> // TODO: rm on release !
#include <LtsUtilsGuiDds/dds_vector_to_pixmap.h> // app icons
#include <Plugins/OnlineHelp/ohp_online_help_viewer_gui_plugin_interface.h> // XXX: grrr..
#include <QHostInfo>
#include <QApplication>
@@ -38,7 +44,7 @@
#include <QMessageBox>
//#include <QDebug>
@@ -77,15 +83,15 @@ LtsSession::LtsSession(LtsSessionManager *sessionManager)
this, &LtsSession::slotStopWaitDialog);
// preparations for stack connect
connect(this, &LtsSession::_signalDoneInitializingSession,
this, [this]()
{
// if (m_initDone)
// qWarning() << "blub";
disconnect(this, &LtsSession::_signalDoneInitializingSession,
this, nullptr);
// qWarning() << "mep" << QStringLiteral("%1:%2").arg(QString::fromUtf8(__FILE__).split(QStringLiteral("/")).last()).arg(__LINE__);
m_initDone = true;
emit signalDoneInitializingSession();
});
@@ -97,7 +103,7 @@ LtsSession::LtsSession(LtsSessionManager *sessionManager)
this, &LtsSession::signalStillAlive);
t->start();
m_scriptEditorTimer = new QTimer(this);
// [Qatar MNQ-474] Crash open Script Editor application Hack
if ( strcmp(PROJECTBUILD, "qatarmout") == 0
|| strcmp(PROJECTBUILD, "qatar") == 0)
{
@@ -117,15 +123,15 @@ LtsSession::LtsSession(LtsSessionManager *sessionManager)
LtsSession::~LtsSession()
{
// qCritical() << "~LtsSession";
//delete m_mainBackground; parented on hiddenWidget!
delete m_baseLayout; // TODO: deleteLater? problem: clear interfaces!
//qWarning() << this << "deleted" << m_baseLayout;
// Don't: qDeleteAll(m_notiCtlList);
delete m_baseLayout;
// make sure to unref the data plugins, as they carry this LtsSession, and the erase method would not delete the Session (avoid circular dependencies)
clearGuiPluginInterfaces();
clearDataPluginInterfaces();
@@ -147,21 +153,21 @@ QString LtsSession::toString() const
<< ", LtsSessionDataDds=" << LtsSessionDataDds::toString();
return QString::fromStdString(stream.str());
// QString str;
// str.append(QStringLiteral(" domainId='%1'").arg()));
// str.append(QStringLiteral(", ='%1'").arg(this->partitionId()));
// str.append(QStringLiteral(", partitionType='%1'").arg(this->partitionType()));
// str.append(QStringLiteral(", exerciseId='%1'").arg(this->exerciseId()));
// str.append(QStringLiteral(", workspaceId='%1'").arg(this->workspaceId()));
// return str;
}
QWidget *LtsSession::baseLayoutWidget()
{
// qWarning() << "baseLayoutWidget" << m_baseLayout;
// qWarning() << "baseLayoutWidget (widget)" << static_cast<QWidget *>(m_baseLayout);
return static_cast<QWidget *>(m_baseLayout);
}
@@ -357,7 +363,7 @@ LtsNotification::LtsNotification *LtsSession::createNotification(const QString &
m_baseLayout->addNotification(c->createWidget());
m_notiCtlList.append(c);
// Wenn die notification getötet wird, auch wieder austragen...
connect(c, &LtsNotification::LtsNotificationController::destroyed,
this, [this, c]() { m_notiCtlList.removeAll(c); });
@@ -397,7 +403,7 @@ void LtsSession::initializePlugins(const QVector<LtsPluginManager::AppPluginInst
}
void LtsSession::initializeDataPlugins(const QVector<LtsPluginManager::AppPluginInstance> &dataPluginList)
void LtsSession::initializeDataPlugins(const QVector<LtsPluginManager::AppPluginInstance> &dataPluginList) // TODO: DOC: no gui ifcs in data ifcs ! (as fetchInterfaces() is done before gui ifcs are loaded)
{
QMap<QString, std::shared_ptr<DataPluginBase::Interface>> newDataPluginInterfaces;
@@ -411,7 +417,7 @@ void LtsSession::initializeDataPlugins(const QVector<LtsPluginManager::AppPlugin
continue;
}
// super heavy hardcore hack to speed up login -> we need to check what plugins are needed for an app!
if (app() == LtsAppDescriptor::App::Login
&& (!plugin->pluginName().contains(QStringLiteral("AssetManagement"))
&& !plugin->pluginName().contains(QStringLiteral("OperatorManagement"))
@@ -419,14 +425,14 @@ void LtsSession::initializeDataPlugins(const QVector<LtsPluginManager::AppPlugin
)
continue;
// check if plugin has to be loaded in this session type
if (!plugin->availableInPartition(partitionType()))
{
DEBUG_LOG(m_logger) << "Data plugin " << api.pluginInstance.pluginName << " is not available in this partition type " << partitionType();
continue;
}
// super heavy hardcore hack to speed up login
if ((!plugin->pluginName().contains(QStringLiteral("AssetManagement"))
&& !plugin->pluginName().contains(QStringLiteral("OperatorManagement"))
&& !plugin->pluginName().contains(QStringLiteral("ExerciseManagement"))
@@ -453,8 +459,9 @@ void LtsSession::initializeGuiPlugins(const QVector<LtsPluginManager::AppPluginI
{
m_failedFetches.clear();
/* important to create gui interfaces even if they are not available in a session,
* but foreign plugins can still use their ForeignGuiInterface to use
* their windows */
for (auto i = guiPluginList.constBegin(); i != guiPluginList.constEnd(); ++i)
{
@@ -469,7 +476,7 @@ void LtsSession::initializeGuiPlugins(const QVector<LtsPluginManager::AppPluginI
}
// check if plugin has to be loaded in this session type
if (!plugin->availableInPartition(partitionType()))
{
DEBUG_LOG(m_logger) << "Gui plugin " << api.pluginInstance.pluginName << " is not available in this partition type " << partitionType();
@@ -486,22 +493,25 @@ void LtsSession::initializeGuiPlugins(const QVector<LtsPluginManager::AppPluginI
}
QFlags<LtsAppDescriptor::PluginInfo::Flag> flags = api.m_flags;
QFlags<LtsAppDescriptor::PluginInfo::Flag> flags = api.m_flags; // copy flags
if (api.pluginInstance.pluginName == QStringLiteral("dev"))
flags |= LtsAppDescriptor::PluginInfo::Flag::ACTIONS;
ifc->setFlags(flags);
ifc->setOptions(api.m_options);
ifc->setAppId(api.m_appId);
ifc->setFlags(flags); // durchreichen.. raw plugin => plugin instance
ifc->setOptions(api.m_options); // s.a.a.
ifc->setAppId(api.m_appId); // s.a.a.
m_guiPluginInterfaces[plugin->pluginName()] = ifc;
DEBUG_LOG(m_logger) << "Adding gui plugin " << plugin->pluginName() << " for " << partitionType() << " - " << this;
}
QMutableMapIterator<QString, std::shared_ptr<GuiPluginBase::Interface> > it(m_guiPluginInterfaces);
/*/
* there are all plugin instances in this list
* if fetchInterface of a single plugin failes, that plugin instance will be removed (does not find his obligatory plugin(s) in this list)
* a refetch has to be done, in case some other plugin(s) used that plugin which is now deleted
/*/
QMutableMapIterator<QString, std::shared_ptr<GuiPluginBase::Interface> > it(m_guiPluginInterfaces); // modify a list while iterating through it
while (it.hasNext())
{
const auto val = it.next();
@@ -513,9 +523,9 @@ void LtsSession::initializeGuiPlugins(const QVector<LtsPluginManager::AppPluginI
DEBUG_LOG(m_logger) << "Fetching interfaces failed for Gui Plugin '" << guiPluginKey << "' - removing and refetching !";
m_failedFetches.append(guiPluginKey);
it.remove();
it.toFront();
it.toFront(); // rewind!
// remove from payloads list if failed, because payload might already be added before refetching, but we don't want payloads of plugins that failed fetching interfaces..
for (auto i = m_payloadPriorityMap.begin(); i != m_payloadPriorityMap.end(); ++i)
{
std::shared_ptr<GuiPluginBase::Interface> payloadIfc = *i;
@@ -528,7 +538,7 @@ void LtsSession::initializeGuiPlugins(const QVector<LtsPluginManager::AppPluginI
}
else
{
//ERROR_LOG(m_logger) << "GUI FETCH INTERFACE OKAY!";
int executionPriority = guiPlugin->executionPriority();
@@ -542,18 +552,18 @@ void LtsSession::initializeGuiPlugins(const QVector<LtsPluginManager::AppPluginI
m_payloadList.append(guiPlugin);
}
else
m_payloadPriorityMap.insert(executionPriority, guiPlugin);
m_payloadPriorityMap.insert(executionPriority, guiPlugin); // addPayload(executionPriority, guiPlugin);
//DEBUG_LOG(m_logger) << " > has payloads, adding payload request to session";
}
}
//DEBUG_LOG(m_logger) << " > done";
}
}
QTimer::singleShot(100, this, &LtsSession::slotStartPluginInit);
//executePayloads(); // does not execute when there are no payloads, but is needed to be called here !
}
@@ -567,7 +577,7 @@ LtsTabWidget *LtsSession::locateWidget(QWidget *widgetToLocate, LayoutArea area)
if (tabWidget->indexOf(widgetToLocate) >= 0)
return tabWidget;
return nullptr;
return nullptr; // not found!
}
@@ -648,18 +658,18 @@ const QString LtsSession::workspaceId() const
{
if (isReplayPartition())
return QStringLiteral("replay_%1").arg(QString::number(partitionId()));
return m_workspaceId;
return m_workspaceId;//sessionManager->workspaceId();
}
void LtsSession::setWorkspaceId(const QString &newWorkspaceId )
void LtsSession::setWorkspaceId(const QString &newWorkspaceId /* <= MW: that's why I like "get" in getter names (needed to prepend "new" because of already existing method with the name "workspaceId") */)
{
DEBUG_LOG(m_logger) << LOGFUNCTION << " change workspaceId: cur = '" << m_workspaceId << "' for app '" << appToString(app()) << "'";
DEBUG_LOG(m_logger) << LOGFUNCTION << " change workspaceId: new = '" << newWorkspaceId << "' for app '" << appToString(app()) << "'";
m_workspaceId = newWorkspaceId;
m_workspaceId = newWorkspaceId;//m_sessionManager->setWorkspaceId(workspaceId);
if (m_baseLayout)
m_baseLayout->setWorkspaceId(workspaceId() );
m_baseLayout->setWorkspaceId(workspaceId() /* use getter instead of member var, as replay partition strings can only be retrieved with the getter */);
emit workspaceIdChanged(newWorkspaceId);
}
@@ -673,7 +683,7 @@ ExcState LtsSession::exerciseState() const
void LtsSession::connectOnlineHelpButton(LtsWidgets::LtsDialog *widget)
{
// FIXME: HACK: also connect show online help here !!
connect(widget, &LtsDialog::signalShowOnlineHelp,
this, &LtsSession::slotShowOnlineHelp,
Qt::UniqueConnection);
@@ -696,9 +706,12 @@ void LtsSession::slotStapleTopicLockHandler(LtsWidgets::LtsDialog *widget)
return;
}
auto *topicLockHandler = new TopicLockHandler();
auto *topicLockHandler = new TopicLockHandler(/* widget <= see comment below */);
/*/
* Conceptional: widgets is closing, widget deletes lock handler, lock handler unlocks via ftc,
* lock handler was deleted, ftc answers to already deleted lock handler => crash
* This is a conceptional problem in all the ftc handlers
/*/
if (!topicLockHandler->init(m_coreFtc, m_exerciseId))
{
@@ -712,14 +725,14 @@ void LtsSession::slotStapleTopicLockHandler(LtsWidgets::LtsDialog *widget)
connect(topicLockHandler, &TopicLockHandler::signalUnlockDialog,
widget, &LtsDialog::slotUnlock, Qt::QueuedConnection);
connect(widget, &LtsDialog::signalLockTopic,
topicLockHandler, &TopicLockHandler::slotTryLock, Qt::DirectConnection);
topicLockHandler, &TopicLockHandler::slotTryLock, Qt::DirectConnection); // sync!
//widget->setTopicLockHandler(topicLockHandler);
connect(widget, &LtsDialog::destroyed,
topicLockHandler, &TopicLockHandler::slotFinalize, Qt::QueuedConnection);
//qWarning() << "added tlh to" << widget->windowTitle();
connectOnlineHelpButton(widget);
@@ -764,7 +777,7 @@ bool LtsSession::widgetExists(const QString &menuGroup, const QString &identifie
bool LtsSession::addWidget(LtsDialog *widget, const QString &menuGroup, const QString &identifier, LayoutArea area, bool setClosable)
{
// TODO: operator selection + possibility to permanent select base layout until its dissolving
if (!m_baseLayout)
{
@@ -772,10 +785,10 @@ bool LtsSession::addWidget(LtsDialog *widget, const QString &menuGroup, const QS
return false;
}
//slotStapleTopicLockHandler(widget); => already done in blw's addWidget (below!)
// FIXMe: connect(widget, &LtsDialog::signalShowOnlineHelp,
// this, &LtsSession::slotShowOnlineHelp,
// Qt::UniqueConnection); done in slotStaple.. because using LtsDialog::addDialog does NOT reach this code here !
return m_baseLayout->addWidget(widget, menuGroup, identifier, area, setClosable);
}
@@ -783,12 +796,12 @@ bool LtsSession::addWidget(LtsDialog *widget, const QString &menuGroup, const QS
void LtsSession::setExerciseData(const LtsWidgets::ExerciseData &exerciseData)
{
// avoid mutiple calls (and signal to emitted multiple times)
if ((*m_exerciseData) == exerciseData)
return;
*m_exerciseData = exerciseData;
// partitionType(); ?!?
if (!m_baseLayout)
return;
m_baseLayout->setExerciseData(exerciseData);
@@ -804,7 +817,7 @@ const LtsWidgets::ExerciseData *LtsSession::exerciseData() const
void LtsSession::setProfilePicture(const QPixmap &pixmap)
{
// partitionType(); ?!?
if (!m_baseLayout)
return;
m_baseLayout->setProfilePicture(pixmap);
@@ -814,7 +827,7 @@ void LtsSession::setProfilePicture(const QPixmap &pixmap)
void LtsSession::makeVisible()
{
Q_ASSERT(m_baseLayout == nullptr);
if (m_baseLayout)
if (m_baseLayout) // onyl create a new base layout when there was not one before !
{
qCritical() << "base layout already visible";
return;
@@ -826,7 +839,7 @@ void LtsSession::makeVisible()
void LtsSession::refetchActions()
{
// get actions
for (auto i = m_guiPluginInterfaces.cbegin(); i != m_guiPluginInterfaces.cend(); ++i)
{
std::shared_ptr<GuiPluginBase::Interface> ifc = *i;
@@ -837,7 +850,7 @@ void LtsSession::refetchActions()
continue;
}
if (m_firstActionsFetch && ifc->getFlags().testFlag(LtsAppDescriptor::PluginInfo::Flag::MAIN) && !ifc->getFlags().testFlag(LtsAppDescriptor::PluginInfo::Flag::ACTIONS))
if (m_firstActionsFetch && ifc->getFlags().testFlag(LtsAppDescriptor::PluginInfo::Flag::MAIN) && !ifc->getFlags().testFlag(LtsAppDescriptor::PluginInfo::Flag::ACTIONS)) // respect the MAIN flag, even though ACTIONS is not set (main, but NOT actions) [but only if this is NOT a refetch]
{
ERROR_LOG(m_logger) << "Plugin '" << i.key() << "' has flag 'MAIN' but is missing the 'ACTIONS' flag - ingoring actions!";
continue;
@@ -845,17 +858,17 @@ void LtsSession::refetchActions()
if (ifc->getFlags().testFlag(LtsAppDescriptor::PluginInfo::Flag::ACTIONS))
{
// get gui plugin's actions (only when init was successful)
const QVector<LtsWidgets::PluginData> plData = ifc->getActions();
if (plData.isEmpty())
DEBUG_LOG(m_logger) << i.key() << " (" << ifc->menuGroup() << ") does not provide actions";
//WARNING_LOG(m_logger) << " > " << plData.count() << " Actions";
for (const LtsWidgets::PluginData &pd : plData)
{
if (!pd.menuGroup.isEmpty() && !pd.menuText.isEmpty() && pd.identifier.isEmpty())
if (!pd.menuGroup.isEmpty() && !pd.menuText.isEmpty() && pd.identifier.isEmpty()) // check if identifier is missing
ERROR_LOG(m_logger) << "Identifier for Action " << pd.menuGroup << " - " << pd.menuText << " missing - not added!";
else
{
@@ -868,7 +881,7 @@ void LtsSession::refetchActions()
}
else
{
//WARNING_LOG(m_logger) << " > " << plData.count() << " Actions - but ignored by flag";
}
}
@@ -958,7 +971,7 @@ bool LtsSession::event(QEvent *e)
void LtsSession::addDeveloperActions()
{
// DEVELOPER / DEBUG MENU
{
LtsWidgets::PluginData p;
p.menuGroup = QStringLiteral("[Dev]");
@@ -970,7 +983,7 @@ void LtsSession::addDeveloperActions()
LtsSession *adminSession = m_sessionManager->getSession(IDL::PartitionType::Global, 0);
if (!adminSession)
{
//QMessageBox::information(nullptr, QString(), QStringLiteral("no admin session"));
DdsConnectionParams connParams;
connParams.domainId = domainId();
connParams.partitionId = 0;
@@ -980,7 +993,7 @@ void LtsSession::addDeveloperActions()
connParams.qos_file = m_qosFileList;
adminSession = m_sessionManager->createSession(connParams,
true,
false);
false); // no payloads !! TODO: is this a real domainId or a dead var ??
return;
}
else
@@ -1032,7 +1045,7 @@ void LtsSession::addDeveloperActions()
m_baseLayout->addMenuAction(p);
}
// END DEVELOPER / DEBUG MENU
}
@@ -1047,7 +1060,7 @@ bool LtsSession::notifyUnsavedChanges()
void LtsSession::createBaseLayout()
{
//qWarning() << "mep" << QStringLiteral("%1:%2").arg(QString::fromUtf8(__FILE__).split(QStringLiteral("/")).last()).arg(__LINE__);
using namespace LtsAppDescriptor;
@@ -1057,16 +1070,16 @@ void LtsSession::createBaseLayout()
if (m_baseLayout != nullptr)
{
WARNING_LOG(m_logger) << "Base Layout already exists for Session" << this;
return;
return; // already exists
}
m_baseLayout = new LtsBaseLayoutWidget;
m_baseLayout = new LtsBaseLayoutWidget; // main widget
connect(m_baseLayout, &LtsBaseLayoutWidget::signalSuccessfullyPlaced,
this, [this]()
{
DEBUG_LOG(m_logger) << "current APP "<<appToString(this->app());
// qWarning() << "mep" << QStringLiteral("%1:%2").arg(QString::fromUtf8(__FILE__).split(QStringLiteral("/")).last()).arg(__LINE__);
if ( this->app() == App::Scripts)
{
m_scriptEditorTimer->start();
@@ -1075,8 +1088,8 @@ void LtsSession::createBaseLayout()
{
if (m_needsToBeSuccessfullyPlaced)
{
emit _signalDoneInitializingSession();
// qWarning() << "mep" << QStringLiteral("%1:%2").arg(QString::fromUtf8(__FILE__).split(QStringLiteral("/")).last()).arg(__LINE__);
emit _signalDoneInitializingSession(); // needs to be emitted here, as if 'm_needsToBeSuccessfullyPlaced' is TRUE, it was not emitted before
}
}
});
@@ -1084,20 +1097,20 @@ void LtsSession::createBaseLayout()
connect(m_baseLayout, &LtsBaseLayoutWidget::destroyed,
this, [this]()
{
m_baseLayout = nullptr;
m_baseLayout = nullptr; // sec
//qWarning() << "baseLayout deleted";
});
m_baseLayout->hide();
m_baseLayout->setSessionInfo(domainId(), partitionType(), partitionId(), workspaceId());
m_baseLayout->setWindowIcon(appToIcon(app()));
m_baseLayout->hide(); // hide
m_baseLayout->setSessionInfo(domainId(), partitionType(), partitionId(), workspaceId()); // this shd ptr has a different counter ..
m_baseLayout->setWindowIcon(appToIcon(app())); // for the magic corner to have an icon to show for switching to / from secondaries
// auto *x = new QLabel;
// x->setPixmap(m_baseLayout->windowIcon().pixmap(128, 128));
// x->show();
if (app() == App::ScriptEditorEssentialsView ||
if (app() == App::ScriptEditorEssentialsView || // NOTE: timeline's replay app and snapshot's edit plan are secondaries, too - setSecondaryWidget needs to be called from timeline & snapshot app, too
m_presetBaseLayoutAsSecondaryWidget)
m_baseLayout->setSecondaryWidget();
@@ -1139,22 +1152,22 @@ void LtsSession::createBaseLayout()
addDeveloperActions();
for (LtsNotification::LtsNotificationController *ctl : std::as_const(m_notiCtlList))
for (LtsNotification::LtsNotificationController *ctl : qAsConst(m_notiCtlList))
{
if (!m_baseLayout->notificationExists(ctl->identifier()))
m_baseLayout->addNotification(ctl->createWidget());
if (!m_baseLayout->notificationExists(ctl->identifier())) // add if non-existent only
m_baseLayout->addNotification(ctl->createWidget()); // FIXME: crash when no icons?
}
m_hasBaseLayout = true;
m_hasBaseLayout = true; // not needed anymore, but for its correctness.....
m_baseLayout->getMenu()->setVisible(m_menuVisible);
m_baseLayout->initilizationFinished();
//QMessageBox::warning(nullptr, QStringLiteral("attach!"), QString());
if (!m_foreverInvisible)
{
// build list of irreplacable widgets by the dependency tree of its dependencies and their dependencies' dependencies
QVector<QWidget *> irreplacableWidgets {baseLayoutWidget()};
LtsSession *dependencySession = dependency();
int runaway = 100;
@@ -1165,10 +1178,10 @@ void LtsSession::createBaseLayout()
runaway--;
}
// qWarning() << "#2 irreplacableWidgets count" << irreplacableWidgets.count() << "from" << this;
// for (QWidget *w : irreplacableWidgets)
// qWarning() << "irre" << w;
@@ -1192,7 +1205,7 @@ void LtsSession::createBaseLayout()
if (!sessionData->isTablet())
return;
return; // done here if not a tablet
LtsNotification::LtsNotification *noti = createNotification(QStringLiteral("TabletWindowSwitcher"));
@@ -1200,7 +1213,7 @@ void LtsSession::createBaseLayout()
noti->setIcon(QIcon(QStringLiteral("icon:switch_display.svg")));
noti->setAction([this]()
{
emit taskSwitch(this );
emit taskSwitch(this /* tell it that we are the caller, don't hide US! */);
});
@@ -1241,9 +1254,9 @@ void LtsSession::delayScriptEditorStart()
DEBUG_LOG(m_logger)<<"LtsSession::delayScriptEditorStart ";
if (m_needsToBeSuccessfullyPlaced)
{
// qWarning() << "delayScriptEditorStart mep" << QStringLiteral("%1:%2").arg(QString::fromUtf8(__FILE__).split(QStringLiteral("/")).last()).arg(__LINE__);
emit _signalDoneInitializingSession();
emit _signalDoneInitializingSession(); // needs to be emitted here, as if 'm_needsToBeSuccessfullyPlaced' is TRUE, it was not emitted before
}
}
@@ -1260,30 +1273,30 @@ void LtsSession::doneInitializingSession()
{
LtsGlobalWaitDialog::getInstance()->done();
// qWarning() << "mep" << QStringLiteral("%1:%2").arg(QString::fromUtf8(__FILE__).split(QStringLiteral("/")).last()).arg(__LINE__);
if (m_markedForDeletion)
{
emit signalInitializationAborted();
emit signalClose();
emit signalInitializationAborted(); // to call done() on global wait dialog
emit signalClose(); // session manager removes us from his list and then deletes us
return;
}
if (!m_sessionManager->isHeadless())
if (!m_sessionManager->isHeadless()) // disallow base layout creation if app is headless
{
int sessionCount = m_sessionManager->sessionCount();
if (!m_hidden && (m_hasBaseLayout || sessionCount < 1))
if (!m_hidden && (m_hasBaseLayout || sessionCount < 1)) // show base layout if m_hasBaseLayout is true OR IF there is only this session (e.g. Payloads have not started any sessions)
makeVisible();
// if (!m_hasBaseLayout) // delete session if it's useless & empty
// {
// emit signalClose();
// return;
// }
}
// qWarning() << "emit signalDoneInitializingSession();";
if (!createTopicClient<Core::Interface::Ftc>(m_coreFtc))
WARNING_LOG(m_logger) << "could not create core ftc - no tlh";
@@ -1293,16 +1306,16 @@ void LtsSession::doneInitializingSession()
WARNING_LOG(m_logger) << "no ovh ifc, no Help-Button !";
INFO_LOG(m_logger) << "emit signalDoneInitializingSession, session=" << this;
if (!m_needsToBeSuccessfullyPlaced || m_sessionManager->isHeadless() || !m_hasBaseLayout)
// qWarning() << "mep" << QStringLiteral("%1:%2").arg(QString::fromUtf8(__FILE__).split(QStringLiteral("/")).last()).arg(__LINE__);
// qWarning() << !m_needsToBeSuccessfullyPlaced << m_sessionManager->isHeadless() << !m_hasBaseLayout;
if (!m_needsToBeSuccessfullyPlaced || m_sessionManager->isHeadless() || !m_hasBaseLayout) // can't be placed if without something to show .. :)
{
// qWarning() << "mep" << QStringLiteral("%1:%2").arg(QString::fromUtf8(__FILE__).split(QStringLiteral("/")).last()).arg(__LINE__);
// qWarning() << "!! headless !";
emit _signalDoneInitializingSession();
}
//qWarning() << "not headless !";
}
@@ -1310,7 +1323,7 @@ void LtsSession::slotShowOnlineHelp(const QString &fileName)
{
if (m_ohvIfc == nullptr)
{
LtsWidgets::LtsMessageDialog::showMessage(baseLayout() , tr("Online Help not available."));
LtsWidgets::LtsMessageDialog::showMessage(baseLayout() /* can be 0ptr */, tr("Online Help not available."));
return;
}
@@ -1333,7 +1346,7 @@ void LtsSession::slotShowOperatorSettings()
if (showOperatorSettingsDlg != nullptr)
{
addWidget(showOperatorSettingsDlg, pd.menuGroup, pd.identifier, pd.layoutArea, pd.closable);
//qWarning() << "showing operator settings";
}
else
WARNING_LOG(m_logger) << "could not create operator settings dialog from action";
@@ -1348,26 +1361,26 @@ void LtsSession::slotShowOperatorSettings()
void LtsSession::slotStartPluginInit()
{
m_initializeThesePlugins = m_guiPluginInterfaces;
m_initializeThesePlugins = m_guiPluginInterfaces; // copy
slotPluginInitDone();
}
void LtsSession::slotPluginInitDone()
void LtsSession::slotPluginInitDone() // NEVER call this directly, queue a signal to this slot !
{
//qWarning() << "LtsSession::slotPluginInitDone: sender" << sender();
if (m_pluginInitDone)
return;
if (m_slotPluginInitDoneMutex)
{
//qWarning() << "<< never call slotPluginInitDone directly or after all initialization was done! bad sender was" << sender();
//abort();
return;
}
m_slotPluginInitDoneMutex = true;
m_slotPluginInitDoneMutex = true; // lock
GuiPluginBase::Interface *theSender = dynamic_cast<GuiPluginBase::Interface *>(sender());
@@ -1377,24 +1390,24 @@ void LtsSession::slotPluginInitDone()
#ifdef LTS_DEBUG
WARNING_LOG(m_logger) << "current init ifc: " << m_currentInitIfc << ", sender: " << sender();
#endif
m_slotPluginInitDoneMutex = false;
m_slotPluginInitDoneMutex = false; // unlock
return;
}
//qWarning() << "currently initializing ifc"<<m_currentInitIfc<<"has finished!";
m_currentInitIfc = nullptr;
auto i = m_initializeThesePlugins.begin();
if (i == m_initializeThesePlugins.end())
if (i == m_initializeThesePlugins.end()) // list empty, everything initialized, now execute payloads
{
m_pluginInitDone = true;
//qWarning() << this << "done!! executing payloads!";
executePayloads();
// do not unlock mutex here as we are done with initialization and another call to this would not be good
return;
}
@@ -1403,19 +1416,19 @@ void LtsSession::slotPluginInitDone()
if (ifc->availableInPartition(partitionType()))
{
m_currentInitIfc = ifc.get();
//qWarning() << "set m_currentInitIfc to" << m_currentInitIfc;
//qWarning() << "initializing" << i.key() << (void *)ifc.get();
ifc->init();
if (!ifc->m_hasInit)
if (!ifc->m_hasInit) // workaround for ifcs without init method (which needs quitting by signals)
{
//qWarning() << "resetting m_currentInitIfc to nullptr";
m_currentInitIfc = nullptr;
QTimer::singleShot(0, this, &LtsSession::slotPluginInitDone);
}
}
else
else // do not initialize plugins that are not available in partition x
{
m_currentInitIfc = nullptr;
QTimer::singleShot(0, this, &LtsSession::slotPluginInitDone);
@@ -1423,38 +1436,39 @@ void LtsSession::slotPluginInitDone()
m_initializeThesePlugins.erase(i);
m_slotPluginInitDoneMutex = false;
m_slotPluginInitDoneMutex = false; // unlock
}
void LtsSession::slotExecuteNextPayload()
{
LtsWidgets::LtsGlobalWaitDialog::getInstance()->wait();
LtsWidgets::LtsGlobalWaitDialog::getInstance()->wait(); // show wait dialog again
/* there is currently a problem when executing a secondary event loop,
* which leads to resending already sent signals, as they might not be
* marked as executed by Qt itself. So this is a workaround.. */
// if (m_ignoreSignalInLoop)
// return;
// m_ignoreSignalInLoop = true;
auto it1 = m_payloadPriorityMap.begin();
// execute in order
auto it1 = m_payloadPriorityMap.begin(); // largest key (see qt doc)
if (it1 != m_payloadPriorityMap.end())
{
std::shared_ptr<GuiPluginBase::Interface> ifc = (*it1);
m_payloadPriorityMap.erase(it1);
m_payloadPriorityMap.erase(it1); // delete first, as executePayload can be stuck here when the connection is not queued !
DEBUG_LOG(m_logger) << "Executing priorized Payload in Partition " << partitionId() << ", Type " << partitionType();
LtsWidgets::LtsGlobalWaitDialog::getInstance()->done();
LtsWidgets::LtsGlobalWaitDialog::getInstance()->done(); // don't interrupt payload uis with the wait dialog
if (m_blub)
{
m_blub->stop();
m_blub->deleteLater();
// qWarning() << "killing blub";
}
m_blub = new QTimer(this);
m_blub2 = 0;
@@ -1462,38 +1476,38 @@ void LtsSession::slotExecuteNextPayload()
connect(m_blub, &QObject::destroyed,
this, [name]()
{
// qWarning() << "prio-payload for" << name << "DESTROYED!!!!";
});
connect(m_blub, &QTimer::timeout,
this, [this, name]()
{
m_blub2++;
// qWarning() << "prio-payload for" << name << "running since" << m_blub2 << "seconds";
});
m_blub->start(1000);
ifc->executePayload(m_mainBackground);
}
else
else // no priority payloads left, check for unpriorized payloads
{
auto it2 = m_payloadList.begin();
if (it2 != m_payloadList.end())
{
std::shared_ptr<GuiPluginBase::Interface> ifc = (*it2);
m_payloadList.erase(it2);
m_payloadList.erase(it2); // delete first, as executePayload can be stuck here when the connection is not queued !
DEBUG_LOG(m_logger) << "Executing unpriorized Payload in Partition " << partitionId() << ", Type " << partitionType();
LtsWidgets::LtsGlobalWaitDialog::getInstance()->done();
LtsWidgets::LtsGlobalWaitDialog::getInstance()->done(); // don't interrupt payload uis with the wait dialog
if (m_blub)
{
m_blub->stop();
m_blub->deleteLater();
// qWarning() << "killing blub";
}
m_blub = new QTimer(this);
m_blub2 = 0;
@@ -1501,66 +1515,66 @@ void LtsSession::slotExecuteNextPayload()
connect(m_blub, &QObject::destroyed,
this, [name]()
{
// qWarning() << "prio-payload for" << name << "DESTROYED!!!!";
});
connect(m_blub, &QTimer::timeout,
this, [this, name]()
{
m_blub2++;
// qWarning() << "prio-payload for" << name << "running since" << m_blub2 << "seconds";
});
m_blub->start(1000);
ifc->executePayload(m_mainBackground);
}
else
else // no payloads left, delete background widget(s) and say that all plugins have been loaded
{
Q_ASSERT(m_payloadsDone == false);
m_payloadsDone = true;
m_mainBackground = nullptr;
m_mainBackground = nullptr; // as it was parented to m_hiddenWidget
if (m_blub)
{
m_blub->stop();
m_blub->deleteLater();
// qWarning() << "killing blub - no payloads left";
m_blub = nullptr;
}
// qWarning() << "no payloads left";
doneInitializingSession();
}
}
//m_ignoreSignalInLoop = false; // executing payload is done, clear the ignore-flag
}
void LtsSession::executePayloads()
{
// look for gui plugins (needed to get execution priority and run payloads)
if (!m_payloadPriorityMap.isEmpty() || !m_payloadList.isEmpty())
{
//DEBUG_LOG(m_logger) << m_payloadPriorityMap.count() << " priorized payload(s), " << m_payloadList.count() << " unpriorized payload(s) - " << m_payloadPriorityMap.count() + m_payloadList.count() << " total.";
LtsWidgets::LtsGlobalWaitDialog::getInstance()->done();
//QMetaObject::invokeMethod(this, &LtsSession::slotExecuteNextPayload);
LtsWidgets::LtsGlobalWaitDialog::getInstance()->done(); // ugly workaround: as the next method says wait even if we call it the first time (LtsSession c_tor called wait already)
slotExecuteNextPayload();
}
else
{
// qWarning() << "this session has no payloads assigned!!";
DEBUG_LOG(m_logger) << "no payloads";
if (partitionType() == IDL::PartitionType::Global)
{
m_hasBaseLayout = true;
m_hasBaseLayout = true; // admin session has no payloads, so show base layout, otherwise there is nothing to show..
}
doneInitializingSession();
@@ -1573,7 +1587,7 @@ void LtsSession::clearDataPluginInterfaces()
QMap<QString, std::weak_ptr<DataPluginBase::Interface>> weakDataPluginInterfaces;
for (auto i = m_dataPluginInterfaces.cbegin(); i != m_dataPluginInterfaces.cend(); ++i)
{
//i.value()->clearInterfaces();
weakDataPluginInterfaces.insert(i.key(), i.value());
}
@@ -1581,7 +1595,7 @@ void LtsSession::clearDataPluginInterfaces()
m_dataPluginInterfaces.clear();
#ifdef LTS_DEBUG
// in global plugins somehow are not unloaded
if (partitionType() != IDL::PartitionType::Global)
{
for (auto i = weakDataPluginInterfaces.cbegin(); i != weakDataPluginInterfaces.cend(); ++i)
@@ -1624,7 +1638,7 @@ void LtsSession::clearGuiPluginInterfaces()
m_guiPluginInterfaces.clear();
#ifdef LTS_DEBUG
// in global plugins somehow are not unloaded
if (partitionType() != IDL::PartitionType::Global)
{
for (auto i = weakGuiPluginInterfaces.cbegin(); i != weakGuiPluginInterfaces.cend(); ++i)
@@ -1647,4 +1661,4 @@ LtsSessionManager *LtsSession::getSessionManager()
return m_sessionManager;
}
}
} // namespace LtsSession