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.
This commit is contained in:
berrux-dev committed 2026-11-17 17:28:48 +01:00
1 parent e60a860283
commit 84f8cfb41f
45 files changed
+12 -706

No files matched your search

@@ -16,8 +16,6 @@ else()
endif() endif()
# Add only existing subdirectories to allow partial checkouts / incremental migration # Add only existing subdirectories to allow partial checkouts / incremental migration
# Release 2 scope: Tools, DDS, Common, Services (minimal), Proxies (TrainingAreaBase only), Plugins (Styles only for LtsWidgets dependency)
# Excluded: Application, Viewer, Projects, most Plugins (not in Release 2)
set(LTS_SUBDIRS Tools DDS Common Services Proxies Plugins) set(LTS_SUBDIRS Tools DDS Common Services Proxies Plugins)
foreach(dir IN LISTS LTS_SUBDIRS) foreach(dir IN LISTS LTS_SUBDIRS)
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${dir}") if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${dir}")
@@ -46,13 +44,10 @@ ENDIF()
INCLUDE(MacroCodeGenIdl) INCLUDE(MacroCodeGenIdl)
# Add stub headers for non-RTI/non-FilterManagement builds # Add stub headers for non-RTI/non-FilterManagement builds
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include/AudioVideoManagement/) # (AudioVideoManagement, TopicEditorBase, OperatorManagement, LtsScriptTimeline and
# Services/PresentationManagement entries removed: pruned in Release 2, paths gone.)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include/NGLLogger/) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include/NGLLogger/)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include/LtsSession/) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include/LtsSession/)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include/TopicEditorBase/)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include/OperatorManagement/)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include/LtsScriptTimeline/)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include/LtsUtilsGuiDds/) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include/LtsUtilsGuiDds/)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include/Services/PresentationManagement/)
CODEGEN_WRITE_SERVICEFILE_INFO() CODEGEN_WRITE_SERVICEFILE_INFO()
@@ -5,7 +5,6 @@
# Created by Mike Wille, SLSE, 2016-01-13 # Created by Mike Wille, SLSE, 2016-01-13
# #
# Make ${Qt6_Widgets} optional # Make ${Qt6_Widgets} optional
if(QT6_GUI_AVAILABLE AND TARGET Qt6::Widgets) if(QT6_GUI_AVAILABLE AND TARGET Qt6::Widgets)
set(Qt6_Widgets ${Qt6_Widgets}) set(Qt6_Widgets ${Qt6_Widgets})
@@ -13,7 +12,6 @@ else()
set(Qt6_Widgets "") set(Qt6_Widgets "")
endif() endif()
SET(LtsNoti_SRCS SET(LtsNoti_SRCS
lts_notification.h lts_notification.h
lts_notification.cpp lts_notification.cpp
@@ -22,7 +20,6 @@ SET(LtsNoti_SRCS
) )
NGL_ADD_LIBRARY2(WS LtsNotification SHARED ${LtsNoti_SRCS}) NGL_ADD_LIBRARY2(WS LtsNotification SHARED ${LtsNoti_SRCS})
NGL_TARGET_INCLUDE_DIRECTORIES(LtsNotification NGL_TARGET_INCLUDE_DIRECTORIES(LtsNotification
PUBLIC PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../ ${CMAKE_CURRENT_SOURCE_DIR}/../
@@ -11,20 +11,16 @@
#include "lts_plugin_loader.h" #include "lts_plugin_loader.h"
#include <memory> #include <memory>
#include <utility> #include <utility>
#include <NGLLogger/NGLLoggerBootstrap.h> #include <NGLLogger/NGLLoggerBootstrap.h>
#include <LtsAppDescriptor/lts_app_descriptor.h> #include <LtsAppDescriptor/lts_app_descriptor.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QDirIterator> #include <QDirIterator>
#include <QFileInfo> #include <QFileInfo>
#include <QJsonObject> #include <QJsonObject>
#include <QPluginLoader> #include <QPluginLoader>
#include <QMutableListIterator> #include <QMutableListIterator>
#include <QDebug> #include <QDebug>
namespace LtsPluginManager namespace LtsPluginManager
{ {
@@ -42,7 +38,6 @@ void LtsPluginLoaderHandler::cleanupPluginLoader()
s_ltsPluginLoader->ltsPluginLoader.unloadAllPlugins(); s_ltsPluginLoader->ltsPluginLoader.unloadAllPlugins();
} }
LtsPluginLoader *LtsPluginLoader::getInstance() LtsPluginLoader *LtsPluginLoader::getInstance()
{ {
if (!s_ltsPluginLoader.exists()) if (!s_ltsPluginLoader.exists())
@@ -50,7 +45,6 @@ LtsPluginLoader *LtsPluginLoader::getInstance()
return &s_ltsPluginLoader->ltsPluginLoader; return &s_ltsPluginLoader->ltsPluginLoader;
} }
LtsPluginLoader::~LtsPluginLoader() LtsPluginLoader::~LtsPluginLoader()
{ {
unloadAllPlugins(); unloadAllPlugins();
@@ -72,7 +66,6 @@ void LtsPluginLoader::unloadAllPlugins()
m_loadedPlugins.clear(); m_loadedPlugins.clear();
} }
void LtsPluginLoader::checkPlugins(const QVector<LtsAppDescriptor::AppDescription> &appVector, void LtsPluginLoader::checkPlugins(const QVector<LtsAppDescriptor::AppDescription> &appVector,
QStringList &errors /* out */) QStringList &errors /* out */)
{ {
@@ -84,7 +77,6 @@ void LtsPluginLoader::checkPlugins(const QVector<LtsAppDescriptor::AppDescriptio
return; return;
} }
QVector<PluginInstance> dataPlugins; QVector<PluginInstance> dataPlugins;
QVector<PluginInstance> guiPlugins; QVector<PluginInstance> guiPlugins;
auto addDataPluginFn = [&](const PluginInstance &pi) auto addDataPluginFn = [&](const PluginInstance &pi)
@@ -110,8 +102,6 @@ void LtsPluginLoader::checkPlugins(const QVector<LtsAppDescriptor::AppDescriptio
return; return;
} }
// check for duplicate iids per plugin type // check for duplicate iids per plugin type
auto checkDuplicateIidsFn = [&](const QVector<PluginInstance> &plugins, const QString &pluginType) auto checkDuplicateIidsFn = [&](const QVector<PluginInstance> &plugins, const QString &pluginType)
{ {
@@ -133,18 +123,13 @@ void LtsPluginLoader::checkPlugins(const QVector<LtsAppDescriptor::AppDescriptio
checkDuplicateIidsFn(dataPlugins, QStringLiteral("data")); checkDuplicateIidsFn(dataPlugins, QStringLiteral("data"));
checkDuplicateIidsFn(guiPlugins, QStringLiteral("gui")); checkDuplicateIidsFn(guiPlugins, QStringLiteral("gui"));
QVector<PluginInstance> plugins(dataPlugins + guiPlugins); QVector<PluginInstance> plugins(dataPlugins + guiPlugins);
// check if all in apps.json requested plugins are available // check if all in apps.json requested plugins are available
for (auto i1 = appVector.constBegin(); i1 != appVector.constEnd(); ++i1) // Apps for (auto i1 = appVector.constBegin(); i1 != appVector.constEnd(); ++i1) // Apps
{ {
const LtsAppDescriptor::AppDescription &app = *i1; const LtsAppDescriptor::AppDescription &app = *i1;
//WARNING_LOG(logger) << "Checking app '"<<app.appName<<"'"; //WARNING_LOG(logger) << "Checking app '"<<app.appName<<"'";
const QVector<LtsAppDescriptor::PluginInfo> &piVector = app.pluginInfos; const QVector<LtsAppDescriptor::PluginInfo> &piVector = app.pluginInfos;
for (auto i2 = piVector.constBegin(); i2 != piVector.constEnd(); i2++) // App's Required Plugins for (auto i2 = piVector.constBegin(); i2 != piVector.constEnd(); i2++) // App's Required Plugins
@@ -174,7 +159,6 @@ void LtsPluginLoader::checkPlugins(const QVector<LtsAppDescriptor::AppDescriptio
return; return;
} }
bool LtsPluginLoader::loadPlugins(PluginType requestedPluginType, bool LtsPluginLoader::loadPlugins(PluginType requestedPluginType,
const std::function<bool(const PluginInstance &)> &loadPlugin, const std::function<bool(const PluginInstance &)> &loadPlugin,
const QStringList &requiredPlugins, const QStringList &requiredPlugins,
@@ -211,30 +195,25 @@ bool LtsPluginLoader::loadPlugins(PluginType requestedPluginType,
} }
} }
{ {
QMutableListIterator<QString> i1(optionalPluginsList); // delete all plugins from the to-load list that were cached QMutableListIterator<QString> i1(optionalPluginsList); // delete all plugins from the to-load list that were cached
while (i1.hasNext()) while (i1.hasNext())
{ {
const QString pluginName = i1.next().toLower(); const QString pluginName = i1.next().toLower();
QMap<PluginKey, PluginInstance>::iterator i2 = m_loadedPlugins.find(PluginKey(requestedPluginType, pluginName)); QMap<PluginKey, PluginInstance>::iterator i2 = m_loadedPlugins.find(PluginKey(requestedPluginType, pluginName));
if (i2 != m_loadedPlugins.end()) if (i2 != m_loadedPlugins.end())
{ {
DEBUG_LOG(logger) << "Plugin " << pluginName << " already loaded, using that instance"; DEBUG_LOG(logger) << "Plugin " << pluginName << " already loaded, using that instance";
if (loadPlugin) if (loadPlugin)
loadPlugin(i2.value()); loadPlugin(i2.value());
i1.remove(); i1.remove();
} }
} }
} }
} }
QFileInfo libPathInfo(QCoreApplication::applicationDirPath() + QStringLiteral("/../lib/")); QFileInfo libPathInfo(QCoreApplication::applicationDirPath() + QStringLiteral("/../lib/"));
QString libPath(libPathInfo.absolutePath()); QString libPath(libPathInfo.absolutePath());
if (!libPathInfo.exists()) if (!libPathInfo.exists())
@@ -272,7 +251,6 @@ bool LtsPluginLoader::loadPlugins(PluginType requestedPluginType,
continue; continue;
const QString absoluteFilePath = pluginDir.filePath(); const QString absoluteFilePath = pluginDir.filePath();
DEBUG_LOG(logger) << "File Path: " << absoluteFilePath; DEBUG_LOG(logger) << "File Path: " << absoluteFilePath;
// if (!filename.contains(type)) // if (!filename.contains(type))
@@ -284,7 +262,6 @@ bool LtsPluginLoader::loadPlugins(PluginType requestedPluginType,
std::unique_ptr<QPluginLoader> pluginLoader(new QPluginLoader); std::unique_ptr<QPluginLoader> pluginLoader(new QPluginLoader);
pluginLoader->setFileName(absoluteFilePath); pluginLoader->setFileName(absoluteFilePath);
const QJsonObject jObj = pluginLoader->metaData(); const QJsonObject jObj = pluginLoader->metaData();
QJsonObject::const_iterator iid = jObj.find(QStringLiteral("IID")); QJsonObject::const_iterator iid = jObj.find(QStringLiteral("IID"));
@@ -297,7 +274,6 @@ bool LtsPluginLoader::loadPlugins(PluginType requestedPluginType,
const QString jsonIid = iid.value().toString().toLower(); // LOWERCASE ! (pun intended) const QString jsonIid = iid.value().toString().toLower(); // LOWERCASE ! (pun intended)
// Use QStringView for efficient string operations // Use QStringView for efficient string operations
const QList<QStringView> iidParameters = QStringView{jsonIid}.split(QLatin1Char(':')); const QList<QStringView> iidParameters = QStringView{jsonIid}.split(QLatin1Char(':'));
DEBUG_LOG(logger) << "Plugin " << absoluteFilePath << " provides iid '" << jsonIid; DEBUG_LOG(logger) << "Plugin " << absoluteFilePath << " provides iid '" << jsonIid;
if (iidParameters.count() != 3) if (iidParameters.count() != 3)
@@ -316,7 +292,6 @@ bool LtsPluginLoader::loadPlugins(PluginType requestedPluginType,
} }
PluginType pluginType = PluginType::UNKNOWN; PluginType pluginType = PluginType::UNKNOWN;
const QString pluginName = iidParameters.at(2).toString(); const QString pluginName = iidParameters.at(2).toString();
const QString pluginTypeString = iidParameters.at(0).toString(); const QString pluginTypeString = iidParameters.at(0).toString();
switch (pluginTypes.indexOf(pluginTypeString)) switch (pluginTypes.indexOf(pluginTypeString))
@@ -367,11 +342,9 @@ bool LtsPluginLoader::loadPlugins(PluginType requestedPluginType,
{ {
QMutableListIterator<QString> i (requiredPluginsList); QMutableListIterator<QString> i (requiredPluginsList);
while (i.hasNext()) while (i.hasNext())
{ {
const QString requiredPlugin = i.next().toLower(); const QString requiredPlugin = i.next().toLower();
if (pluginName == requiredPlugin) if (pluginName == requiredPlugin)
{ {
found = true; found = true;
@@ -381,13 +354,11 @@ bool LtsPluginLoader::loadPlugins(PluginType requestedPluginType,
} }
} }
if (!found) if (!found)
{ {
for (auto i = optionalPluginsList.constBegin(); i != optionalPluginsList.constEnd(); i++) for (auto i = optionalPluginsList.constBegin(); i != optionalPluginsList.constEnd(); i++)
{ {
const QString optionalPlugin = (*i).toLower(); const QString optionalPlugin = (*i).toLower();
if (pluginName == optionalPlugin) if (pluginName == optionalPlugin)
{ {
found = true; found = true;
@@ -396,25 +367,19 @@ bool LtsPluginLoader::loadPlugins(PluginType requestedPluginType,
} }
} }
if (!found) if (!found)
{ {
DEBUG_LOG(logger) << "Plugin " << pluginName << " was not requested"; DEBUG_LOG(logger) << "Plugin " << pluginName << " was not requested";
continue; // plugin was not requested to be loaded continue; // plugin was not requested to be loaded
} }
} }
// before we create a new instance of a plugin, which is not needed as one instance is perfectly fine to use for many apps, look it up in the loaded plugins list // before we create a new instance of a plugin, which is not needed as one instance is perfectly fine to use for many apps, look it up in the loaded plugins list
if (loadPlugin && !m_loadedPlugins.isEmpty()) // only lookup if there is something to lookup TODO: faster to NOT do that check? if (loadPlugin && !m_loadedPlugins.isEmpty()) // only lookup if there is something to lookup TODO: faster to NOT do that check?
{ {
QMap<PluginKey, PluginInstance>::iterator i = m_loadedPlugins.find(PluginKey(requestedPluginType, pluginName)); QMap<PluginKey, PluginInstance>::iterator i = m_loadedPlugins.find(PluginKey(requestedPluginType, pluginName));
if (i != m_loadedPlugins.end()) if (i != m_loadedPlugins.end())
{ {
DEBUG_LOG(logger) << "Plugin " << pluginName << " already loaded, using that instance ("<<i.value().plugin->metaObject()->className()<<")"; DEBUG_LOG(logger) << "Plugin " << pluginName << " already loaded, using that instance ("<<i.value().plugin->metaObject()->className()<<")";
loadPlugin(i.value()); loadPlugin(i.value());
continue; // found, next plugin! continue; // found, next plugin!
} }
@@ -422,7 +387,6 @@ bool LtsPluginLoader::loadPlugins(PluginType requestedPluginType,
// plugin not already loaded: // plugin not already loaded:
QObject *plugin = pluginLoader->instance(); QObject *plugin = pluginLoader->instance();
if (!plugin) if (!plugin)
{ {
ERROR_LOG(logger) << "Failed to load " << filename << " - " << pluginLoader->errorString(); ERROR_LOG(logger) << "Failed to load " << filename << " - " << pluginLoader->errorString();
@@ -435,7 +399,6 @@ bool LtsPluginLoader::loadPlugins(PluginType requestedPluginType,
pi.fullFileName = absoluteFilePath; pi.fullFileName = absoluteFilePath;
pi.plugin = plugin; pi.plugin = plugin;
pi.pluginLoader = pluginLoader.get(); pi.pluginLoader = pluginLoader.get();
if (loadPlugin && !loadPlugin(pi)) // does the dev want this plugin? if no, unload it! TODO: really unload? or still cache it?? if (loadPlugin && !loadPlugin(pi)) // does the dev want this plugin? if no, unload it! TODO: really unload? or still cache it??
{ {
DEBUG_LOG(logger) << "Plugin " << pluginName << " unloaded"; DEBUG_LOG(logger) << "Plugin " << pluginName << " unloaded";
@@ -444,7 +407,6 @@ bool LtsPluginLoader::loadPlugins(PluginType requestedPluginType,
continue; // next plugin continue; // next plugin
} }
pi.pluginLoader = pluginLoader.release(); pi.pluginLoader = pluginLoader.release();
// the dev decided to use that plugin, so cache it // the dev decided to use that plugin, so cache it
m_loadedPlugins.insert(PluginKey(requestedPluginType, pluginName), pi); m_loadedPlugins.insert(PluginKey(requestedPluginType, pluginName), pi);
@@ -454,13 +416,11 @@ bool LtsPluginLoader::loadPlugins(PluginType requestedPluginType,
DEBUG_LOG(logger) << "Loaded " << jsonIid << " - File: " << filename; DEBUG_LOG(logger) << "Loaded " << jsonIid << " - File: " << filename;
} // end of >> pluginDir.hasNext(); } // end of >> pluginDir.hasNext();
if (checkPluginsLists && !requiredPluginsList.isEmpty()) if (checkPluginsLists && !requiredPluginsList.isEmpty())
{ {
WARNING_LOG(logger) << "These plugins could not be found for Plugin Type " << (int)requestedPluginType << ": " << requiredPluginsList.join(QStringLiteral(", ")); WARNING_LOG(logger) << "These plugins could not be found for Plugin Type " << (int)requestedPluginType << ": " << requiredPluginsList.join(QStringLiteral(", "));
return false; return false;
} }
return true; return true;
} }
@@ -53,7 +53,6 @@ enum class PluginType
}; };
struct PluginInstance // one instance for one plugin struct PluginInstance // one instance for one plugin
{ {
QString pluginName; QString pluginName;
@@ -63,23 +62,18 @@ struct PluginInstance // one instance for one plugin
QPluginLoader *pluginLoader = nullptr; QPluginLoader *pluginLoader = nullptr;
}; };
class LTSPLUGINLOADER_EXPORT LtsPluginLoader class LTSPLUGINLOADER_EXPORT LtsPluginLoader
{ {
public: public:
static LtsPluginLoader *getInstance(); static LtsPluginLoader *getInstance();
void unloadAllPlugins(); void unloadAllPlugins();
void checkPlugins(const QVector<LtsAppDescriptor::AppDescription> &appVector, void checkPlugins(const QVector<LtsAppDescriptor::AppDescription> &appVector,
QStringList &errors /* out */); QStringList &errors /* out */);
bool loadPlugins(PluginType requestedPluginType, bool loadPlugins(PluginType requestedPluginType,
const std::function<bool(const PluginInstance &pluginInstance)> &loadPlugin, const std::function<bool(const PluginInstance &pluginInstance)> &loadPlugin,
const QStringList &requiredPlugins = QStringList(), /* leave empty to get all plugins of the given type */ const QStringList &requiredPlugins = QStringList(), /* leave empty to get all plugins of the given type */
const QString &specialTopicTypeFilter = QString(), const QString &specialTopicTypeFilter = QString(),
const QStringList &optionalPlugins = QStringList()); const QStringList &optionalPlugins = QStringList());
typedef QPair<PluginType, QString> PluginKey; typedef QPair<PluginType, QString> PluginKey;
private: private:
@@ -52,7 +52,6 @@ LtsPluginManager::LtsPluginManager()
LtsPluginManager::~LtsPluginManager() LtsPluginManager::~LtsPluginManager()
{ {
delete m_sessionManager; delete m_sessionManager;
} }
@@ -100,9 +99,7 @@ bool LtsPluginManager::startApp(const LtsAppDescriptor::AppDescription& app, boo
const LtsSession::DdsConnectionParams& connParams, const QString& workspaceId, const LtsSession::DdsConnectionParams& connParams, const QString& workspaceId,
bool hidden) bool hidden)
{ {
LtsWidgets::LtsWaitDialogContainer wait; LtsWidgets::LtsWaitDialogContainer wait;
m_app = app; m_app = app;
LtsPluginLoader* pluginLoader = LtsPluginLoader::getInstance(); LtsPluginLoader* pluginLoader = LtsPluginLoader::getInstance();
@@ -134,12 +131,10 @@ bool LtsPluginManager::startApp(const LtsAppDescriptor::AppDescription& app, boo
for (auto i = dataPlugins.constBegin(); i != dataPlugins.constEnd(); ++i) for (auto i = dataPlugins.constBegin(); i != dataPlugins.constEnd(); ++i)
{ {
const PluginInstance& pi = *i; const PluginInstance& pi = *i;
AppPluginInstance api; AppPluginInstance api;
api.pluginInstance = pi; api.pluginInstance = pi;
api.m_appName = m_app.appName; api.m_appName = m_app.appName;
api.m_appId = m_app.id; api.m_appId = m_app.id;
dataApiList.append(api); dataApiList.append(api);
} }
@@ -147,7 +142,6 @@ bool LtsPluginManager::startApp(const LtsAppDescriptor::AppDescription& app, boo
for (auto i = guiPlugins.constBegin(); i != guiPlugins.constEnd(); ++i) for (auto i = guiPlugins.constBegin(); i != guiPlugins.constEnd(); ++i)
{ {
const PluginInstance& pi = *i; const PluginInstance& pi = *i;
AppPluginInstance api; AppPluginInstance api;
api.pluginInstance = pi; api.pluginInstance = pi;
api.m_appName = m_app.appName; api.m_appName = m_app.appName;
@@ -156,17 +150,13 @@ bool LtsPluginManager::startApp(const LtsAppDescriptor::AppDescription& app, boo
for (auto i2 = app.pluginInfos.constBegin(); i2 != app.pluginInfos.constEnd(); ++i2) for (auto i2 = app.pluginInfos.constBegin(); i2 != app.pluginInfos.constEnd(); ++i2)
{ {
const LtsAppDescriptor::PluginInfo& rp = *i2; const LtsAppDescriptor::PluginInfo& rp = *i2;
if (rp.type == LtsAppDescriptor::PluginInfo::PluginType::GUI && rp.iid == pi.pluginName) if (rp.type == LtsAppDescriptor::PluginInfo::PluginType::GUI && rp.iid == pi.pluginName)
{ {
api.m_flags = rp.flags; api.m_flags = rp.flags;
api.m_options = rp.options; api.m_options = rp.options;
break; break;
} }
} }
guiApiList.append(api); guiApiList.append(api);
} }
@@ -174,12 +164,10 @@ bool LtsPluginManager::startApp(const LtsAppDescriptor::AppDescription& app, boo
if (!connParamsNew.isValid()) if (!connParamsNew.isValid())
{ {
INFO_LOG(m_logger) << "Invalid connection params given - using default parameter"; INFO_LOG(m_logger) << "Invalid connection params given - using default parameter";
connParamsNew.domainId = LtsSessionData::LtsSessionData::getInstance()->getDomainIdPreset(); connParamsNew.domainId = LtsSessionData::LtsSessionData::getInstance()->getDomainIdPreset();
connParamsNew.partitionId = 0; connParamsNew.partitionId = 0;
connParamsNew.exerciseId = 0; connParamsNew.exerciseId = 0;
connParamsNew.partitionType = IDL::PartitionType::Global; connParamsNew.partitionType = IDL::PartitionType::Global;
connParamsNew.tcpConnectionUrl = LtsSessionData::LtsSessionData::getInstance()->getTcpConnectionUrl(); connParamsNew.tcpConnectionUrl = LtsSessionData::LtsSessionData::getInstance()->getTcpConnectionUrl();
} }
if (LtsSessionData::LtsSessionData::getInstance()->getQosFile().size() > 0 && if (LtsSessionData::LtsSessionData::getInstance()->getQosFile().size() > 0 &&
@@ -192,7 +180,6 @@ bool LtsPluginManager::startApp(const LtsAppDescriptor::AppDescription& app, boo
ERROR_LOG(m_logger) << "Could not create Global Session - abort."; ERROR_LOG(m_logger) << "Could not create Global Session - abort.";
return false; return false;
} }
return true; return true;
} }
@@ -58,7 +58,6 @@ namespace LtsPluginManager
struct AppPluginInstance struct AppPluginInstance
{ {
PluginInstance pluginInstance; PluginInstance pluginInstance;
QFlags<LtsAppDescriptor::PluginInfo::Flag> m_flags; QFlags<LtsAppDescriptor::PluginInfo::Flag> m_flags;
QStringList m_options; QStringList m_options;
QString m_appName; QString m_appName;
@@ -77,7 +76,6 @@ class LTSPLUGINMANAGER_EXPORT LtsPluginManager : public QObject
const LtsSession::DdsConnectionParams& connParams, const QString& workspaceId = QString(), const LtsSession::DdsConnectionParams& connParams, const QString& workspaceId = QString(),
bool hidden = false); bool hidden = false);
LtsSession::LtsSession* getSession(IDL::PartitionType partitionType, int partitionId); LtsSession::LtsSession* getSession(IDL::PartitionType partitionType, int partitionId);
bool isInitialized() const bool isInitialized() const
{ {
return m_initialized; return m_initialized;
@@ -31,9 +31,6 @@ private slots:
void clearScope(); void clearScope();
private: private:
// LtsSessionData is a process-wide singleton and clear() only resets the
// preset + operator state. Bring it back to a known baseline before each
// slot so the slots do not depend on execution order.
void resetSessionData(); void resetSessionData();
}; };
@@ -12,7 +12,6 @@ else()
set(Qt6_WebSockets "") set(Qt6_WebSockets "")
endif() endif()
SET(SRCS SET(SRCS
logger.cpp logger.cpp
logger.h logger.h
@@ -8,7 +8,6 @@
*/ */
#include "logger.h" #include "logger.h"
#include <NGLLogger/NGLLoggerBootstrap.h> #include <NGLLogger/NGLLoggerBootstrap.h>
namespace WlsTetra namespace WlsTetra
@@ -44,17 +44,12 @@ LtsWebSocket::AbstractClientMessage *ClientMessageFactory::createMessage(LtsWebS
return checkResult(client, message, result); return checkResult(client, message, result);
} }
ClientMessage::ClientMessage(DataManager *dataManager, LtsWebSocket::ReplyHandler *client, const QString &type, const int typeId, const QString &uuid, const QJsonValue &data) ClientMessage::ClientMessage(DataManager *dataManager, LtsWebSocket::ReplyHandler *client, const QString &type, const int typeId, const QString &uuid, const QJsonValue &data)
: LtsWebSocket::AbstractClientMessage(client, type, typeId, uuid, data) : LtsWebSocket::AbstractClientMessage(client, type, typeId, uuid, data)
, m_dataManager(dataManager) , m_dataManager(dataManager)
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) , m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
{} {}
SendBiteRequest::SendBiteRequest(DataManager *dataManager, LtsWebSocket::ReplyHandler *client, const QString &type, const int typeId, const QString &uuid, const QJsonValue &data) SendBiteRequest::SendBiteRequest(DataManager *dataManager, LtsWebSocket::ReplyHandler *client, const QString &type, const int typeId, const QString &uuid, const QJsonValue &data)
: ClientMessage(dataManager, client, type, typeId, uuid, data) : ClientMessage(dataManager, client, type, typeId, uuid, data)
{} {}
@@ -24,15 +24,10 @@ class DataManager;
namespace ClientMessages namespace ClientMessages
{ {
class ClientMessageFactory final : public LtsWebSocket::AbstractClientMessageFactory class ClientMessageFactory final : public LtsWebSocket::AbstractClientMessageFactory
{ {
public: public:
explicit ClientMessageFactory(DataManager *dataManager); explicit ClientMessageFactory(DataManager *dataManager);
LtsWebSocket::AbstractClientMessage *createMessage(LtsWebSocket::ReplyHandler *client, LtsWebSocket::AbstractClientMessage *createMessage(LtsWebSocket::ReplyHandler *client,
const QString &message); const QString &message);
@@ -41,8 +36,6 @@ private:
}; };
class ClientMessage : public LtsWebSocket::AbstractClientMessage class ClientMessage : public LtsWebSocket::AbstractClientMessage
{ {
protected: protected:
@@ -22,8 +22,6 @@ using namespace JsonKeys;
namespace Messages namespace Messages
{ {
QString ReplyMessage::toJsonString() const QString ReplyMessage::toJsonString() const
{ {
return QString::fromUtf8(QJsonDocument(m_jsonRepresentation).toJson(QJsonDocument::Compact)); return QString::fromUtf8(QJsonDocument(m_jsonRepresentation).toJson(QJsonDocument::Compact));
@@ -35,8 +33,6 @@ ReplyMessage::ReplyMessage(const QString &type, const int typeId, const QString
} }
OkMessage::OkMessage(const OkMessage::OkData &data) OkMessage::OkMessage(const OkMessage::OkData &data)
: ReplyMessage(OK(), 1, data.uuid) : ReplyMessage(OK(), 1, data.uuid)
{ {
@@ -47,8 +43,6 @@ OkMessage::OkMessage(const OkMessage::OkData &data)
})); }));
} }
ErrorMessage::ErrorMessage(const ErrorMessage::ErrorData &data) ErrorMessage::ErrorMessage(const ErrorMessage::ErrorData &data)
: ReplyMessage(ERROR_(), -1, data.uuid) : ReplyMessage(ERROR_(), -1, data.uuid)
{ {
@@ -59,9 +53,6 @@ ErrorMessage::ErrorMessage(const ErrorMessage::ErrorData &data)
})); }));
} }
QJsonObject BiteDataMessage::ErrorText::toJson() const QJsonObject BiteDataMessage::ErrorText::toJson() const
{ {
return QJsonObject({{LANG(), lang}, return QJsonObject({{LANG(), lang},
@@ -81,7 +72,6 @@ QJsonObject BiteDataMessage::BasicError::toJson() const
return QJsonObject({{ERROR_TEXT(), text}}); return QJsonObject({{ERROR_TEXT(), text}});
} }
QJsonObject BiteDataMessage::BiteError::toJson() const QJsonObject BiteDataMessage::BiteError::toJson() const
{ {
return QJsonObject({{ERROR_TEXT(), vecToPath(errorTexts)}, return QJsonObject({{ERROR_TEXT(), vecToPath(errorTexts)},
@@ -92,7 +82,6 @@ QJsonObject BiteDataMessage::BiteError::toJson() const
}); });
} }
BiteDataMessage::BiteDataMessage(const BiteDataMessage::BiteData &data, const QString &uuid) BiteDataMessage::BiteDataMessage(const BiteDataMessage::BiteData &data, const QString &uuid)
: ReplyMessage(BITE_DATA(), 2, uuid) : ReplyMessage(BITE_DATA(), 2, uuid)
{ {
@@ -108,7 +97,6 @@ BiteDataMessage::BiteDataMessage(const BiteDataMessage::BiteData &data, const QS
})); }));
} }
PositionMessage::PositionMessage(const PositionMessage::PositionData &data, const QString &uuid) PositionMessage::PositionMessage(const PositionMessage::PositionData &data, const QString &uuid)
: ReplyMessage(POSITION_DATA(), 3, uuid) : ReplyMessage(POSITION_DATA(), 3, uuid)
{ {
@@ -120,9 +108,6 @@ PositionMessage::PositionMessage(const PositionMessage::PositionData &data, cons
{LAST_POSITION_UPDATE(), data.gpsTime} {LAST_POSITION_UPDATE(), data.gpsTime}
})); }));
} }
} }
} }
} }
@@ -27,11 +27,8 @@ namespace Messages
class ReplyMessage : public LtsWebSocket::ReplyMessage class ReplyMessage : public LtsWebSocket::ReplyMessage
{ {
public: public:
ReplyMessage() = default; ReplyMessage() = default;
virtual ~ReplyMessage() = default; virtual ~ReplyMessage() = default;
virtual QString toJsonString() const; virtual QString toJsonString() const;
protected: protected:
@@ -73,7 +70,6 @@ public:
{} {}
}; };
class OkMessage final class OkMessage final
: public ReplyMessage : public ReplyMessage
{ {
@@ -7,7 +7,6 @@
*/ */
#include "dds_handler.h" #include "dds_handler.h"
#include <DDS/DDSConnector/publisher.h> #include <DDS/DDSConnector/publisher.h>
#include <DDS/DDSConnector/dds_connector.h> #include <DDS/DDSConnector/dds_connector.h>
#include <DDS/Core/pacemaker.h> #include <DDS/Core/pacemaker.h>
@@ -1,6 +1,3 @@
#include "exm_handler.h" #include "exm_handler.h"
#include "main_handler.h" #include "main_handler.h"
#include <NGLLogger/NGLLoggerBootstrap.h> #include <NGLLogger/NGLLoggerBootstrap.h>
@@ -34,7 +31,6 @@ ExerciseManagement::Exercise ExmHandler::exercise(int exerciseId)
return m_exmDtc->exercise(exerciseId); return m_exmDtc->exercise(exerciseId);
} }
void ExmHandler::onExerciseChanged(const ExerciseManagement::Exercise &data, DataModification modType) void ExmHandler::onExerciseChanged(const ExerciseManagement::Exercise &data, DataModification modType)
{ {
if (!data.radioGroupId.has_value() || data.radioGroupId.get() == 0) if (!data.radioGroupId.has_value() || data.radioGroupId.get() == 0)
@@ -68,6 +64,4 @@ void ExmHandler::onExerciseChanged(const ExerciseManagement::Exercise &data, Dat
if (bExercise2RadioGroupChanged) if (bExercise2RadioGroupChanged)
emit exercise2RadioGroupChanged(); emit exercise2RadioGroupChanged();
} }
} }
@@ -1,6 +1,3 @@
#pragma once #pragma once
#include <ExerciseManagement/exm_dtc.h> #include <ExerciseManagement/exm_dtc.h>
#include <unordered_map> #include <unordered_map>
@@ -15,9 +12,7 @@ class ExmHandler final : public QObject
Q_OBJECT Q_OBJECT
public: public:
explicit ExmHandler(MainHandler *mainHandler); explicit ExmHandler(MainHandler *mainHandler);
bool init(); bool init();
std::unordered_map<int, int> exercise2RadioGroup() const { return m_exercise2RadioGroup; } std::unordered_map<int, int> exercise2RadioGroup() const { return m_exercise2RadioGroup; }
ExerciseManagement::Exercise exercise(int exerciseId); ExerciseManagement::Exercise exercise(int exerciseId);
@@ -1,6 +1,4 @@
#include "ism_handler.h" #include "ism_handler.h"
#include <utility> #include <utility>
#include "main_handler.h" #include "main_handler.h"
@@ -42,20 +40,6 @@ bool IsmHandler::init()
ERROR_LOG(m_logger) << "Can not read data from ISM"; ERROR_LOG(m_logger) << "Can not read data from ISM";
return false; return false;
} }
return true; return true;
} }
@@ -77,8 +61,6 @@ IsmHandler::OpsData IsmHandler::dataFromOpsCode(int ipsCode)
int assetId = m_dtcIsm->getAssetIdFromOpticalCode(ipsCode); int assetId = m_dtcIsm->getAssetIdFromOpticalCode(ipsCode);
OpsData opsData; OpsData opsData;
if ( assetId < 0) if ( assetId < 0)
{ {
WARNING_LOG(m_logger) << "No asset for ops code=" << ipsCode << " found"; WARNING_LOG(m_logger) << "No asset for ops code=" << ipsCode << " found";
@@ -87,14 +69,6 @@ IsmHandler::OpsData IsmHandler::dataFromOpsCode(int ipsCode)
opsData.opsCode = ipsCode; opsData.opsCode = ipsCode;
opsData.assetId = assetId; opsData.assetId = assetId;
DEBUG_LOG(m_logger) << "OpsData.structureElementId=" << opsData.structureElementId DEBUG_LOG(m_logger) << "OpsData.structureElementId=" << opsData.structureElementId
<< " assetId=" << opsData.assetId << " assetId=" << opsData.assetId
<< " mountingPointTypeId=" << opsData.mountingPointTypeId << " mountingPointTypeId=" << opsData.mountingPointTypeId
@@ -103,13 +77,10 @@ IsmHandler::OpsData IsmHandler::dataFromOpsCode(int ipsCode)
<< " roomId=" << opsData.roomId; << " roomId=" << opsData.roomId;
{ {
DEBUG_LOG(m_logger) <<"---------------- UPDATE OPS-Data ------------------"; DEBUG_LOG(m_logger) <<"---------------- UPDATE OPS-Data ------------------";
updateOpsData(opsData, true); updateOpsData(opsData, true);
opsData= m_opsData[opsData.opsCode] ; opsData= m_opsData[opsData.opsCode] ;
} }
return opsData; return opsData;
} }
@@ -171,10 +142,8 @@ void IsmHandler::onMountingPointAssetChanged(const InfrastructureManagement::Mou
case DataModification::eModified: case DataModification::eModified:
{ {
OpsData opsData; OpsData opsData;
opsData.opsCode = m_dtcIsm->getOpticalCodeFromAssetId(data.assetId); opsData.opsCode = m_dtcIsm->getOpticalCodeFromAssetId(data.assetId);
opsData.assetId = data.assetId; opsData.assetId = data.assetId;
updateOpsData(opsData, true); updateOpsData(opsData, true);
break; break;
} }
@@ -189,8 +158,6 @@ void IsmHandler::onMountingPointAssetChanged(const InfrastructureManagement::Mou
void IsmHandler::rotateBuildingFootprint(int mseId) void IsmHandler::rotateBuildingFootprint(int mseId)
{ {
if ( m_relBuildingFootprintsRotated.contains(mseId)) if ( m_relBuildingFootprintsRotated.contains(mseId))
{ {
DEBUG_LOG(m_logger) << " mainStructureElements.Rotate already done id=" << mseId; DEBUG_LOG(m_logger) << " mainStructureElements.Rotate already done id=" << mseId;
@@ -225,7 +192,6 @@ void IsmHandler::rotateBuildingFootprint(int mseId)
void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &data, DataModification modType) void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::MainStructureElement &data, DataModification modType)
{ {
switch (modType) switch (modType)
{ {
case DataModification::eAdded: case DataModification::eAdded:
@@ -235,8 +201,6 @@ void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::M
if ( !m_dtcIsm->isElementAssignedToExercise(data, exerciseId)) if ( !m_dtcIsm->isElementAssignedToExercise(data, exerciseId))
{ {
INFO_LOG(m_logger) << "HandlerBuildingData::onMainStructureElementChanged() id=" << data.id << " remove"; INFO_LOG(m_logger) << "HandlerBuildingData::onMainStructureElementChanged() id=" << data.id << " remove";
m_buildingBoundingBoxes.remove(data.id); m_buildingBoundingBoxes.remove(data.id);
m_relBuildingFootprints.remove(data.id); m_relBuildingFootprints.remove(data.id);
m_relBuildingFootprintsRotated.remove((data.id)); m_relBuildingFootprintsRotated.remove((data.id));
@@ -251,7 +215,6 @@ void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::M
removeOpsDataByStructureElementId(se.id); removeOpsDataByStructureElementId(se.id);
} }
QMutableHashIterator<int, OpsData> iter(m_opsData); QMutableHashIterator<int, OpsData> iter(m_opsData);
while (iter.hasNext()) while (iter.hasNext())
{ {
@@ -267,10 +230,6 @@ void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::M
return; return;
} }
for (const InfrastructureManagement::StructureElement &se : data.elements) for (const InfrastructureManagement::StructureElement &se : data.elements)
{ {
if (se.mountingPointTypeId != InfrastructureManagement::MountingPointType::IndoorIPS && if (se.mountingPointTypeId != InfrastructureManagement::MountingPointType::IndoorIPS &&
@@ -285,8 +244,6 @@ void IsmHandler::onMainStructureElementChanged(const InfrastructureManagement::M
} }
DEBUG_LOG(m_logger) << " mainStructureElements Vor Rotate id=" << data.id; DEBUG_LOG(m_logger) << " mainStructureElements Vor Rotate id=" << data.id;
QMap<int, InfrastructureManagement::MainFootprint> mainFootprints = m_dtcIsm->getFootprintsByExerciseId(exerciseId); QMap<int, InfrastructureManagement::MainFootprint> mainFootprints = m_dtcIsm->getFootprintsByExerciseId(exerciseId);
if (mainFootprints.contains(data.id)) if (mainFootprints.contains(data.id))
{ {
rotateBuildingFootprint(data.id); rotateBuildingFootprint(data.id);
@@ -316,8 +273,6 @@ void IsmHandler::onMainFootprintChanged(const InfrastructureManagement::MainFoot
case DataModification::eAdded: case DataModification::eAdded:
case DataModification::eModified: case DataModification::eModified:
{ {
DEBUG_LOG(m_logger) << "mainStructureElements onMainFootprintChanged id=" << data.id; DEBUG_LOG(m_logger) << "mainStructureElements onMainFootprintChanged id=" << data.id;
double minX = 0; double minX = 0;
double maxX = 0; double maxX = 0;
@@ -445,11 +400,8 @@ void IsmHandler::updateOpsData(OpsData &data, bool force)
const auto &mainStructureElements = m_dtcIsm->mainStructureElements(); const auto &mainStructureElements = m_dtcIsm->mainStructureElements();
for (const auto &mse : std::as_const(mainStructureElements)) for (const auto &mse : std::as_const(mainStructureElements))
{ {
if (!force && !m_dtcIsm->isElementAssignedToExercise(mse, exerciseId)) if (!force && !m_dtcIsm->isElementAssignedToExercise(mse, exerciseId))
continue; continue;
for (const InfrastructureManagement::StructureElement &se : mse.elements) for (const InfrastructureManagement::StructureElement &se : mse.elements)
@@ -500,13 +452,9 @@ bool IsmHandler::posInExtendedBuildingFootprint(int mainStructureElementId, cons
return false; return false;
} }
DEBUG_LOG(m_logger) << "mainStructureElementId=" << mainStructureElementId DEBUG_LOG(m_logger) << "mainStructureElementId=" << mainStructureElementId
<< " position=" << position; << " position=" << position;
int exerciseId = m_mainHandler->ddsHandler()->getExerciseId(); int exerciseId = m_mainHandler->ddsHandler()->getExerciseId();
InfrastructureManagement::MainStructureElement mse = m_dtcIsm->mainStructureElement(mainStructureElementId); InfrastructureManagement::MainStructureElement mse = m_dtcIsm->mainStructureElement(mainStructureElementId);
@@ -516,29 +464,21 @@ bool IsmHandler::posInExtendedBuildingFootprint(int mainStructureElementId, cons
if (!m_buildingBoundingBoxes.contains(mainStructureElementId)) if (!m_buildingBoundingBoxes.contains(mainStructureElementId))
return false; return false;
TetraIcd::RelativePosition relBldgPosition = m_mainHandler->posHandler()->geographicToRelative(mse.geoPosition); TetraIcd::RelativePosition relBldgPosition = m_mainHandler->posHandler()->geographicToRelative(mse.geoPosition);
TetraIcd::RelativePosition relPosition = m_mainHandler->posHandler()->geographicToRelative(position); TetraIcd::RelativePosition relPosition = m_mainHandler->posHandler()->geographicToRelative(position);
DEBUG_LOG(m_logger) << "relBldgPosition=" << relBldgPosition.offsetX << "/" << relBldgPosition.offsetY DEBUG_LOG(m_logger) << "relBldgPosition=" << relBldgPosition.offsetX << "/" << relBldgPosition.offsetY
<< ", relPosition=" << relPosition.offsetX << "/" << relPosition.offsetY; << ", relPosition=" << relPosition.offsetX << "/" << relPosition.offsetY;
QPointF relPositionMgrs(relPosition.offsetX, relPosition.offsetY); QPointF relPositionMgrs(relPosition.offsetX, relPosition.offsetY);
QPolygonF relBuildingFootprint = m_relBuildingFootprintsRotated[mainStructureElementId]; QPolygonF relBuildingFootprint = m_relBuildingFootprintsRotated[mainStructureElementId];
QPointF relPositionF(relPosition.offsetX - relBldgPosition.offsetX, relPosition.offsetY - relBldgPosition.offsetY); QPointF relPositionF(relPosition.offsetX - relBldgPosition.offsetX, relPosition.offsetY - relBldgPosition.offsetY);
if (relBuildingFootprint.containsPoint(relPositionF, Qt::OddEvenFill)) if (relBuildingFootprint.containsPoint(relPositionF, Qt::OddEvenFill))
{ {
DEBUG_LOG(m_logger) << "Position is inside Building-Footprint"; DEBUG_LOG(m_logger) << "Position is inside Building-Footprint";
return true; return true;
} }
DEBUG_LOG(m_logger) << "relBuildingFootprint.size=" << relBuildingFootprint.size(); DEBUG_LOG(m_logger) << "relBuildingFootprint.size=" << relBuildingFootprint.size();
for (int i = 0; i < relBuildingFootprint.size() ; i++) for (int i = 0; i < relBuildingFootprint.size() ; i++)
{ {
@@ -613,6 +553,4 @@ double IsmHandler::squareLen(const QPointF &p1, const QPointF &p2)
double vy = p2.y() - p1.y(); double vy = p2.y() - p1.y();
return vx * vx + vy * vy; return vx * vx + vy * vy;
} }
} }
@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtCore/QMap> #include <QtCore/QMap>
@@ -42,9 +41,6 @@ public:
OpsData dataFromOpsCode(int ipsCode) ; OpsData dataFromOpsCode(int ipsCode) ;
int getAssetTypeIdFromStructureElementId (int structureElementId) {return m_structure_ElementId2AssetTypeId.value(structureElementId);} int getAssetTypeIdFromStructureElementId (int structureElementId) {return m_structure_ElementId2AssetTypeId.value(structureElementId);}
bool posInExtendedBuildingFootprint(int mainStructureElementId, const Core::GeoPosition &position, const int mountPointTypeId) const; bool posInExtendedBuildingFootprint(int mainStructureElementId, const Core::GeoPosition &position, const int mountPointTypeId) const;
private Q_SLOTS: private Q_SLOTS:
@@ -67,24 +63,16 @@ private:
NGL::INGLLogger &m_logger; NGL::INGLLogger &m_logger;
MainHandler *m_mainHandler; MainHandler *m_mainHandler;
QHash<int, OpsData> m_opsData; QHash<int, OpsData> m_opsData;
QMap<int, int> m_structure_ElementId2AssetTypeId; QMap<int, int> m_structure_ElementId2AssetTypeId;
QMap<int, int> m_structureElementId2AssetId; QMap<int, int> m_structureElementId2AssetId;
QMap<int, int> m_assetId2StructureElementId; QMap<int, int> m_assetId2StructureElementId;
QMap<int, QRectF> m_buildingBoundingBoxes; QMap<int, QRectF> m_buildingBoundingBoxes;
QMap<int, QPolygonF> m_relBuildingFootprints; QMap<int, QPolygonF> m_relBuildingFootprints;
QMap<int, QPolygonF> m_relBuildingFootprintsRotated; QMap<int, QPolygonF> m_relBuildingFootprintsRotated;
QMap<int, QRectF> m_buildingBoundingBoxesMgrs; QMap<int, QRectF> m_buildingBoundingBoxesMgrs;
QMap<int, QPolygonF> m_relBuildingFootprintsRotatedMgrs; QMap<int, QPolygonF> m_relBuildingFootprintsRotatedMgrs;
std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_dtcIsm; std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_dtcIsm;
int m_distanceIpsToGps; int m_distanceIpsToGps;
int m_distanceOpsToGps; int m_distanceOpsToGps;
}; };
@@ -1,8 +1,5 @@
#include "logger.h" #include "logger.h"
#include <NGLLogger/NGLLoggerBootstrap.h> #include <NGLLogger/NGLLoggerBootstrap.h>
namespace TrainingAreaBase namespace TrainingAreaBase
@@ -27,5 +24,4 @@ namespace TrainingAreaBase
abort(); abort();
} }
} }
} }
@@ -1,6 +1,4 @@
#pragma once #pragma once
#include <NGLLogger/INGLLogger.h> #include <NGLLogger/INGLLogger.h>
@@ -19,10 +19,8 @@
#include <LtsPluginManager/lts_plugin_loader.h> #include <LtsPluginManager/lts_plugin_loader.h>
#include <TrainingAreaBase/tab_record_replay_plugin.h> #include <TrainingAreaBase/tab_record_replay_plugin.h>
#include <TrainingAreaBase/tab_record_replay_plugin_custom.h> #include <TrainingAreaBase/tab_record_replay_plugin_custom.h>
#include <nglsettings/nglsettings_connections.h> #include <nglsettings/nglsettings_connections.h>
#include <ngldb/nsqlquery.h> #include <ngldb/nsqlquery.h>
#include <QUuid> #include <QUuid>
#include <QJsonDocument> #include <QJsonDocument>
#include <QSqlDatabase> #include <QSqlDatabase>
@@ -42,18 +40,15 @@ MainHandler::~MainHandler()
LtsPluginManager::LtsPluginLoader::getInstance()->unloadAllPlugins(); LtsPluginManager::LtsPluginLoader::getInstance()->unloadAllPlugins();
m_interfaces.clear(); m_interfaces.clear();
m_ifcConnectionState.clear(); m_ifcConnectionState.clear();
m_rxHandler.reset(); m_rxHandler.reset();
m_txHandler.reset(); m_txHandler.reset();
m_ftsHandler.reset(); m_ftsHandler.reset();
m_posHandler.reset(); m_posHandler.reset();
m_ppmHandler.reset(); m_ppmHandler.reset();
m_pdmHandler.reset(); m_pdmHandler.reset();
m_exmHandler.reset(); m_exmHandler.reset();
m_ismHandler.reset(); m_ismHandler.reset();
m_aesHandler.reset(); m_aesHandler.reset();
m_ddsHandler.reset(); m_ddsHandler.reset();
m_dbHandler.reset(); m_dbHandler.reset();
} }
@@ -168,8 +163,6 @@ bool MainHandler::init(int domainId, int exerciseId)
for (const std::shared_ptr<Plugin::Interface> &ifc : m_interfaces) for (const std::shared_ptr<Plugin::Interface> &ifc : m_interfaces)
m_txHandler->addTxHandler(ifc->sendToTab()); m_txHandler->addTxHandler(ifc->sendToTab());
// WebSocketServer // WebSocketServer
m_handlerWebSocket = std::make_shared<WebSocketInterface::WebSocketInterfaceHandler>(this); m_handlerWebSocket = std::make_shared<WebSocketInterface::WebSocketInterfaceHandler>(this);
DEBUG_LOG(m_logger) << "Reset WebSocketInterfaceHandler successful."; DEBUG_LOG(m_logger) << "Reset WebSocketInterfaceHandler successful.";
@@ -181,8 +174,6 @@ bool MainHandler::init(int domainId, int exerciseId)
} }
m_ddsHandler->pacemaker()->addPort(m_handlerWebSocket->serverWebSocketPort(), Core::CorePortType::WebSocketServer, QStringLiteral("{\"id\":\"TAB\"}")); m_ddsHandler->pacemaker()->addPort(m_handlerWebSocket->serverWebSocketPort(), Core::CorePortType::WebSocketServer, QStringLiteral("{\"id\":\"TAB\"}"));
DEBUG_LOG(m_logger) << "Initialisation WebSocketInterfaceHandler successful."; DEBUG_LOG(m_logger) << "Initialisation WebSocketInterfaceHandler successful.";
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::Running); m_ddsHandler->pacemaker()->setNewState(Core::RunningState::Running);
return true; return true;
} }
@@ -234,7 +225,6 @@ bool MainHandler::loadPlugin(const LtsPluginManager::PluginInstance &pi)
connect(ifc.get(), &Plugin::Interface::directMessage, this, &MainHandler::onDirectMessage); connect(ifc.get(), &Plugin::Interface::directMessage, this, &MainHandler::onDirectMessage);
m_interfaces.push_back(ifc); m_interfaces.push_back(ifc);
m_ccsMap = m_pdmHandler->dtc()->canComponentStrings(); m_ccsMap = m_pdmHandler->dtc()->canComponentStrings();
m_bctMap = m_pdmHandler->dtc()->biteComponentTexts(); m_bctMap = m_pdmHandler->dtc()->biteComponentTexts();
@@ -356,7 +346,6 @@ void MainHandler::onConnectionState(const QString &name, bool connectionState)
{ {
m_ifcConnectionState.insert(name, connectionState); m_ifcConnectionState.insert(name, connectionState);
} }
DEBUG_LOG(m_logger) << "Publishing connection states: " << m_ifcConnectionState.size(); DEBUG_LOG(m_logger) << "Publishing connection states: " << m_ifcConnectionState.size();
TrainingAreaBase::Connections connections; TrainingAreaBase::Connections connections;
@@ -371,17 +360,13 @@ void MainHandler::onDirectMessage(const QByteArray &jsonMessage)
{ {
DEBUG_LOG(m_logger) << "Got direct message " << jsonMessage; DEBUG_LOG(m_logger) << "Got direct message " << jsonMessage;
WebSocketInterface::Messages::BiteDataMessage::BiteData biteData; WebSocketInterface::Messages::BiteDataMessage::BiteData biteData;
QJsonObject obj = QJsonDocument::fromJson(jsonMessage).object(); QJsonObject obj = QJsonDocument::fromJson(jsonMessage).object();
biteData.equipNo = obj.value(WebSocketInterface::JsonKeys::EQUIP_NO()).toInt(); biteData.equipNo = obj.value(WebSocketInterface::JsonKeys::EQUIP_NO()).toInt();
biteData.isLicensed = obj.value(QStringLiteral("doLicence")).toBool(); biteData.isLicensed = obj.value(QStringLiteral("doLicence")).toBool();
qint64 biteState = obj.value(QStringLiteral("biteState")).toInt(); qint64 biteState = obj.value(QStringLiteral("biteState")).toInt();
qint64 configState = obj.value(QStringLiteral("configState")).toInt(); qint64 configState = obj.value(QStringLiteral("configState")).toInt();
qint64 batteryState = obj.value(QStringLiteral("batteryState")).toInt(); qint64 batteryState = obj.value(QStringLiteral("batteryState")).toInt();
qint64 configError = obj.value(QStringLiteral("configError")).toInt(); qint64 configError = obj.value(QStringLiteral("configError")).toInt();
QJsonArray biteError = obj.value(QStringLiteral("biteError")).toArray(); QJsonArray biteError = obj.value(QStringLiteral("biteError")).toArray();
if (biteData.equipNo <= 0) if (biteData.equipNo <= 0)
@@ -515,7 +500,6 @@ void MainHandler::onPositionChanged(int equipNo, const ParticipantManagement::Pa
positionData.equipNo = equipNo; positionData.equipNo = equipNo;
positionData.pos = pos.pos; positionData.pos = pos.pos;
positionData.gpsTime = pos.sampleTime; positionData.gpsTime = pos.sampleTime;
WebSocketInterface::Messages::PositionMessage *msg = new WebSocketInterface::Messages::PositionMessage(positionData, QUuid::createUuid().toString()); WebSocketInterface::Messages::PositionMessage *msg = new WebSocketInterface::Messages::PositionMessage(positionData, QUuid::createUuid().toString());
if (m_handlerWebSocket != nullptr) if (m_handlerWebSocket != nullptr)
@@ -1,5 +1,4 @@
#pragma once #pragma once
#include <QtCore/QObject> #include <QtCore/QObject>
@@ -24,9 +23,6 @@
#include "tab_plugin_interface.h" #include "tab_plugin_interface.h"
#include "WebSocketInterface/websocket_interface_handler.h" #include "WebSocketInterface/websocket_interface_handler.h"
#include <ngldb/db_service_handler.h> #include <ngldb/db_service_handler.h>
#include "logger.h" #include "logger.h"
namespace NGLDB namespace NGLDB
@@ -65,7 +61,6 @@ public:
std::shared_ptr<PpmHandler> ppmHandler() const { return m_ppmHandler; } std::shared_ptr<PpmHandler> ppmHandler() const { return m_ppmHandler; }
std::shared_ptr<PositionHandler> posHandler() const { return m_posHandler; } std::shared_ptr<PositionHandler> posHandler() const { return m_posHandler; }
int exerciseId() const override { return m_ddsHandler->ddsConnector()->getPartitionId(); } int exerciseId() const override { return m_ddsHandler->ddsConnector()->getPartitionId(); }
bool useTetraScrambling() const override; bool useTetraScrambling() const override;
ProjectDataManagement::RadioGroup exerciseRadioGroup() const override; ProjectDataManagement::RadioGroup exerciseRadioGroup() const override;
@@ -108,7 +103,6 @@ private:
std::vector<std::shared_ptr<Plugin::Interface>> m_interfaces; std::vector<std::shared_ptr<Plugin::Interface>> m_interfaces;
std::shared_ptr<WebSocketInterface::WebSocketInterfaceHandler> m_handlerWebSocket; std::shared_ptr<WebSocketInterface::WebSocketInterfaceHandler> m_handlerWebSocket;
ExerciseManagement::Exercise m_exerciseData; ExerciseManagement::Exercise m_exerciseData;
QMap<int, ProjectDataManagement::CanComponentString> m_ccsMap; QMap<int, ProjectDataManagement::CanComponentString> m_ccsMap;
QMap<int, ProjectDataManagement::BiteComponentText> m_bctMap; QMap<int, ProjectDataManagement::BiteComponentText> m_bctMap;
@@ -1,10 +1,7 @@
#include "pdm_handler.h" #include "pdm_handler.h"
#include <utility> #include <utility>
#include "main_handler.h" #include "main_handler.h"
#include <ProjectDataManagement/pdm_dtc.h> #include <ProjectDataManagement/pdm_dtc.h>
#include <NGLLogger/NGLLoggerBootstrap.h> #include <NGLLogger/NGLLoggerBootstrap.h>
@@ -39,8 +36,6 @@ bool PdmHandler::init()
bool PdmHandler::initializePdm() bool PdmHandler::initializePdm()
{ {
if (!m_dtcPdm->waitForHistoricalDataChargeType(20000) || if (!m_dtcPdm->waitForHistoricalDataChargeType(20000) ||
!m_dtcPdm->waitForHistoricalDataGearType(20000) || !m_dtcPdm->waitForHistoricalDataGearType(20000) ||
!m_dtcPdm->waitForHistoricalDataGearTypeChargeType(20000) || !m_dtcPdm->waitForHistoricalDataGearTypeChargeType(20000) ||
@@ -176,32 +171,11 @@ int PdmHandler::vulnerabilityKindId(int tasVulnerabilityKindId, int equipmentNum
return it.value().taVulnerabilityKind; return it.value().taVulnerabilityKind;
} }
QMap<int, ProjectDataManagement::RadioGroup> PdmHandler::radioGroups() QMap<int, ProjectDataManagement::RadioGroup> PdmHandler::radioGroups()
{ {
initializePdm(); initializePdm();
return m_radioGroups; return m_radioGroups;
} }
static const int s_unknownMarker = 0x80000000; static const int s_unknownMarker = 0x80000000;
int PdmHandler::chargeTypeIdFromGearAndChargeTasCode(int gearTasCode, int chargeTasCode) int PdmHandler::chargeTypeIdFromGearAndChargeTasCode(int gearTasCode, int chargeTasCode)
@@ -1,6 +1,4 @@
#include "position_handler.h" #include "position_handler.h"
#include "exm_handler.h" #include "exm_handler.h"
#include "logger.h" #include "logger.h"
@@ -51,13 +49,8 @@ bool PositionHandler::initCoordinateConversion() const
const LtsCoordTrans::UtmCoordinate bottomLeft(LtsCoordTrans::UtmCoordinate::fromGeographic(ta.bottomLeft.lon, ta.bottomLeft.lat)); const LtsCoordTrans::UtmCoordinate bottomLeft(LtsCoordTrans::UtmCoordinate::fromGeographic(ta.bottomLeft.lon, ta.bottomLeft.lat));
const QPointF mid(bottomLeft.geographic(ta.width / 2, ta.height / 2)); const QPointF mid(bottomLeft.geographic(ta.width / 2, ta.height / 2));
QString mgrs = LtsCoordTrans::mgrsFromGeographic(mid.x(), mid.y(), -1); QString mgrs = LtsCoordTrans::mgrsFromGeographic(mid.x(), mid.y(), -1);
mgrs += QStringLiteral("00000000000000"); mgrs += QStringLiteral("00000000000000");
m_utm2Geographic = LtsCoordTrans::UtmCoordinate::fromMgrs(mgrs); m_utm2Geographic = LtsCoordTrans::UtmCoordinate::fromMgrs(mgrs);
LtsCoordTrans::UtmCoordinate topRight(bottomLeft); LtsCoordTrans::UtmCoordinate topRight(bottomLeft);
@@ -116,10 +109,7 @@ QPointF PositionHandler::geographicToRelativePointF(const Core::GeoPosition2D &p
QPointF PositionHandler::geographicToRelativePointF(const Core::GeoPosition &p) const QPointF PositionHandler::geographicToRelativePointF(const Core::GeoPosition &p) const
{ {
initCoordinateConversion(); initCoordinateConversion();
const LtsCoordTrans::UtmCoordinate point(LtsCoordTrans::UtmCoordinate::fromGeographic(p.lon, p.lat, m_utm2Geographic.zone)); const LtsCoordTrans::UtmCoordinate point(LtsCoordTrans::UtmCoordinate::fromGeographic(p.lon, p.lat, m_utm2Geographic.zone));
return QPointF(point.x - m_utm2Geographic.x, point.y - m_utm2Geographic.y); return QPointF(point.x - m_utm2Geographic.x, point.y - m_utm2Geographic.y);
} }
@@ -140,7 +130,6 @@ TetraIcd::RelativePosition PositionHandler::geographicToRelative(const Core::Geo
const LtsCoordTrans::UtmCoordinate &PositionHandler::baseCoordinate() const const LtsCoordTrans::UtmCoordinate &PositionHandler::baseCoordinate() const
{ {
initCoordinateConversion(); initCoordinateConversion();
return m_utm2Geographic; return m_utm2Geographic;
} }
@@ -165,8 +154,6 @@ double PositionHandler::speed (const TetraIcd::RelativePosition &relPos, const i
<< " timeStamp=" << timeStamp << " timeStamp=" << timeStamp
<< " lastParticipantPosition=" << lastParticipantPosition.time << " lastParticipantPosition=" << lastParticipantPosition.time
<< " deltaTime=" << deltaTime; << " deltaTime=" << deltaTime;
double speed = line.length() / (deltaTime / 1000); double speed = line.length() / (deltaTime / 1000);
return speed; return speed;
} }
@@ -37,7 +37,6 @@ public:
TetraIcd::RelativePosition geographicToRelative(const Core::GeoPosition2D &p, double z) const; TetraIcd::RelativePosition geographicToRelative(const Core::GeoPosition2D &p, double z) const;
const LtsCoordTrans::UtmCoordinate &baseCoordinate() const; const LtsCoordTrans::UtmCoordinate &baseCoordinate() const;
static bool isPositionMarkedInvalid(const TetraIcd::RelativePosition &p) static bool isPositionMarkedInvalid(const TetraIcd::RelativePosition &p)
{ {
static_assert(std::is_integral<decltype(p.offsetX)>::value, "RelativePosition.offsetX must be an integer!"); static_assert(std::is_integral<decltype(p.offsetX)>::value, "RelativePosition.offsetX must be an integer!");
@@ -48,10 +47,8 @@ public:
(invalidPos == (p.offsetY & threeBytes))); (invalidPos == (p.offsetY & threeBytes)));
} }
double speed(const TetraIcd::RelativePosition &relPos, const int equipNo, const qint64 timeStamp) const; double speed(const TetraIcd::RelativePosition &relPos, const int equipNo, const qint64 timeStamp) const;
bool isTimeToPerformSpeedCheckExceeded(const int equipNo, const qint64 timeStamp, const int maxTime) const; bool isTimeToPerformSpeedCheckExceeded(const int equipNo, const qint64 timeStamp, const int maxTime) const;
void setLastPosition(int equipNo, const TrainingAreaBase::TabPosition &pos); void setLastPosition(int equipNo, const TrainingAreaBase::TabPosition &pos);
void setLastMountPointTypeId(int equipNo, const int lastMountPointTypeId); void setLastMountPointTypeId(int equipNo, const int lastMountPointTypeId);
void setLastBuildingId(int equipNo, const int lastBuildingId); void setLastBuildingId(int equipNo, const int lastBuildingId);
@@ -61,7 +58,6 @@ public:
int lastMountPointTypeId(const int equipNo) const; int lastMountPointTypeId(const int equipNo) const;
int lastBuildingId(const int equipNo) const; int lastBuildingId(const int equipNo) const;
int lastRoomId(const int equipNo) const; int lastRoomId(const int equipNo) const;
bool isInTrainingArea(const TetraIcd::RelativePosition &relPos) const; bool isInTrainingArea(const TetraIcd::RelativePosition &relPos) const;
private: private:
@@ -73,7 +69,6 @@ private:
mutable std::shared_ptr<AssetManagement::Interface::Dtc> m_dtcAsm; mutable std::shared_ptr<AssetManagement::Interface::Dtc> m_dtcAsm;
mutable LtsCoordTrans::UtmCoordinate m_utm2Geographic; mutable LtsCoordTrans::UtmCoordinate m_utm2Geographic;
QHash<int, ParticipantPosition> m_lastPosition; QHash<int, ParticipantPosition> m_lastPosition;
mutable QPointF m_relPosBottomLeft; mutable QPointF m_relPosBottomLeft;
mutable QPointF m_relPosTopRight; mutable QPointF m_relPosTopRight;
}; };
@@ -1,6 +1,4 @@
#include "ppm_handler.h" #include "ppm_handler.h"
#include "main_handler.h" #include "main_handler.h"
#include "send_to_tab.h" #include "send_to_tab.h"
@@ -20,9 +20,7 @@ class PpmHandler final : public QObject
Q_OBJECT Q_OBJECT
public: public:
explicit PpmHandler(MainHandler *mainHandler); explicit PpmHandler(MainHandler *mainHandler);
bool init(); bool init();
std::shared_ptr<ParticipantManagement::Interface::Dtc> getDtc() { return m_ppmDtc; } std::shared_ptr<ParticipantManagement::Interface::Dtc> getDtc() { return m_ppmDtc; }
std::unordered_map<int, std::unordered_set<int>> exerciseEquipmentAssignment() const { return m_exerciseEquipmentAssignments; } std::unordered_map<int, std::unordered_set<int>> exerciseEquipmentAssignment() const { return m_exerciseEquipmentAssignments; }
@@ -1,6 +1,4 @@
#include "recv_from_dds_aes.h" #include "recv_from_dds_aes.h"
#include <utility> #include <utility>
#include "main_handler.h" #include "main_handler.h"
@@ -15,15 +13,11 @@
namespace TrainingAreaBase namespace TrainingAreaBase
{ {
AesStateHandler::AesStateHandler(MainHandler *mainHandler) AesStateHandler::AesStateHandler(MainHandler *mainHandler)
: m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) : m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
, m_dbInterface(mainHandler->dbHandler()->db()) , m_dbInterface(mainHandler->dbHandler()->db())
, m_exerciseId(mainHandler->exerciseId()) {} , m_exerciseId(mainHandler->exerciseId()) {}
template<> template<>
void RecvFromDdsAes::txData(const TrainingAreaBase::TetraIcd::DusMineReactivation &tele) void RecvFromDdsAes::txData(const TrainingAreaBase::TetraIcd::DusMineReactivation &tele)
{ {
@@ -38,8 +32,6 @@ bool AesStateHandler::init()
{ {
const auto cb = [this](const Database::AesId2TaId & item) const auto cb = [this](const Database::AesId2TaId & item)
{ {
m_tetraId2ddsId[item.aesTetraId] = item.aesDdsId; m_tetraId2ddsId[item.aesTetraId] = item.aesDdsId;
m_ddsId2TetraId[item.aesDdsId] = item.aesTetraId; m_ddsId2TetraId[item.aesDdsId] = item.aesTetraId;
DEBUG_LOG(m_logger) << "AES internal DDS id: " << item.aesDdsId << " - tetra id: " << item.aesTetraId; DEBUG_LOG(m_logger) << "AES internal DDS id: " << item.aesDdsId << " - tetra id: " << item.aesTetraId;
@@ -59,7 +51,6 @@ bool AesStateHandler::init()
int AesStateHandler::createAesTetraId(int aesDdsId, bool &alreadyExists) int AesStateHandler::createAesTetraId(int aesDdsId, bool &alreadyExists)
{ {
alreadyExists = false; alreadyExists = false;
Database::AesId2TaId aes2Ta; Database::AesId2TaId aes2Ta;
aes2Ta.aesTetraId = getAesTetraId(aesDdsId); aes2Ta.aesTetraId = getAesTetraId(aesDdsId);
if (aes2Ta.aesTetraId != 0) if (aes2Ta.aesTetraId != 0)
@@ -107,9 +98,6 @@ bool AesStateHandler::update(int aesDdsId, int aesTetraId, bool bSentToTetra)
return true; return true;
} }
RecvFromDdsAes::RecvFromDdsAes(MainHandler *mainHandler, RecvFromDdsAes::RecvFromDdsAes(MainHandler *mainHandler,
const std::shared_ptr<SendToTab> &txCallback, const std::shared_ptr<SendToTab> &txCallback,
QObject *parent) QObject *parent)
@@ -128,7 +116,6 @@ RecvFromDdsAes::RecvFromDdsAes(MainHandler *mainHandler,
connect(m_checkOutdatedTelegramsTimer, &QTimer::timeout, connect(m_checkOutdatedTelegramsTimer, &QTimer::timeout,
this, &RecvFromDdsAes::onCheckOutdatedTelegrams); this, &RecvFromDdsAes::onCheckOutdatedTelegrams);
m_sendDusMineReactivtionTimer->setSingleShot(true); m_sendDusMineReactivtionTimer->setSingleShot(true);
m_sendDusMineReactivtionTimer->setInterval(200); m_sendDusMineReactivtionTimer->setInterval(200);
connect(m_sendDusMineReactivtionTimer, &QTimer::timeout, connect(m_sendDusMineReactivtionTimer, &QTimer::timeout,
@@ -372,9 +359,6 @@ bool RecvFromDdsAes::sendSingleFireSMArt(const SendCesHitRequest &request)
return true; return true;
} }
template <typename T> template <typename T>
void RecvFromDdsAes::handleEffectSimulation(const T &data, DataModification modType, TetraIcd::AreaEffectSimulationType aesType) void RecvFromDdsAes::handleEffectSimulation(const T &data, DataModification modType, TetraIcd::AreaEffectSimulationType aesType)
{ {
@@ -442,8 +426,6 @@ void RecvFromDdsAes::handleEffectSimulation(const T &data, DataModification modT
} }
else else
{ {
if (!(std::is_same<T, AreaEffectSimulation::FunctionalArea>::value) || if (!(std::is_same<T, AreaEffectSimulation::FunctionalArea>::value) ||
(data.effectStateId == AreaEffectSimulation::AesEffectState::EsActivated)) (data.effectStateId == AreaEffectSimulation::AesEffectState::EsActivated))
handleSendToTetra(data, aesType); handleSendToTetra(data, aesType);
@@ -545,12 +527,9 @@ void RecvFromDdsAes::onTriggeredImpactsChanged(const AreaEffectSimulation::Trigg
return; return;
if (data.aesTypeId != AreaEffectSimulation::AesType::AtMineAreaSingleMines) if (data.aesTypeId != AreaEffectSimulation::AesType::AtMineAreaSingleMines)
return; return;
if (data.aesItemId == 0) if (data.aesItemId == 0)
return; return;
bool completeUntriggered = true; bool completeUntriggered = true;
for (size_t i = 0; i < data.bitfield.size() && completeUntriggered; ++i) for (size_t i = 0; i < data.bitfield.size() && completeUntriggered; ++i)
{ {
@@ -572,7 +551,6 @@ void RecvFromDdsAes::onTriggeredImpactsChanged(const AreaEffectSimulation::Trigg
if (completeUntriggered) if (completeUntriggered)
return; return;
auto it = m_currentMineArea.find(data.aesItemId); auto it = m_currentMineArea.find(data.aesItemId);
if (it != m_currentMineArea.end()) if (it != m_currentMineArea.end())
{ {
@@ -605,9 +583,7 @@ void RecvFromDdsAes::onTriggeredImpactsChanged(const AreaEffectSimulation::Trigg
} }
TetraIcd::MineAreaSingleMineState out; TetraIcd::MineAreaSingleMineState out;
out.aesDdsId = data.aesItemId; out.aesDdsId = data.aesItemId;
out.mineCount = data.impactCount; out.mineCount = data.impactCount;
out.mineState.reserve(data.bitfield.size()); out.mineState.reserve(data.bitfield.size());
for (const auto &c : data.bitfield) for (const auto &c : data.bitfield)
@@ -625,23 +601,16 @@ void RecvFromDdsAes::onDusMineStateChanged(const AreaEffectSimulation::DusMineSt
if (vec.size() == 0) if (vec.size() == 0)
return; return;
for (const auto &mine : vec) for (const auto &mine : vec)
{ {
if (!m_mainHandler->pdmHandler()->isReactivatableChargeType({mine.chargeTypeId, 0,0})) if (!m_mainHandler->pdmHandler()->isReactivatableChargeType({mine.chargeTypeId, 0,0}))
continue; continue;
if (mine != m_allReactivatableDusMines.value(mine.eqId)) if (mine != m_allReactivatableDusMines.value(mine.eqId))
{ {
if (!mine.triggered && if (!mine.triggered &&
m_allReactivatableDusMines.contains(mine.eqId) && m_allReactivatableDusMines.value(mine.eqId).triggered m_allReactivatableDusMines.contains(mine.eqId) && m_allReactivatableDusMines.value(mine.eqId).triggered
) )
m_minesToSend << mine.eqId; m_minesToSend << mine.eqId;
m_allReactivatableDusMines.insert(mine.eqId, mine); m_allReactivatableDusMines.insert(mine.eqId, mine);
} }
} }
@@ -711,16 +680,11 @@ void setCommonCombatParams(T &out, const S &in, const int aesTetraId)
out.effectDuration = in.effectDuration; out.effectDuration = in.effectDuration;
} }
void RecvFromDdsAes::onEffectsChanged(const AreaEffectSimulation::Effects &data, DataModification modType) void RecvFromDdsAes::onEffectsChanged(const AreaEffectSimulation::Effects &data, DataModification modType)
{ {
if (modType == DataModification::eRemoved) if (modType == DataModification::eRemoved)
return; return;
if (data.aesTypeId != AreaEffectSimulation::AesType::AtExplosionClusterSingleExplosions) if (data.aesTypeId != AreaEffectSimulation::AesType::AtExplosionClusterSingleExplosions)
return; return;
@@ -728,32 +692,23 @@ void RecvFromDdsAes::onEffectsChanged(const AreaEffectSimulation::Effects &data,
if (aesItemId <= 0) if (aesItemId <= 0)
return; return;
const AreaEffectSimulation::ExplosionCluster &aes = m_dtcAes->explosionCluster(aesItemId); const AreaEffectSimulation::ExplosionCluster &aes = m_dtcAes->explosionCluster(aesItemId);
if (aes.id != aesItemId) if (aes.id != aesItemId)
return; return;
const bool bIsLaserGuidable = m_mainHandler->pdmHandler()->isLaserGuidable(aes.chargeStruct); const bool bIsLaserGuidable = m_mainHandler->pdmHandler()->isLaserGuidable(aes.chargeStruct);
if (!bIsLaserGuidable) if (!bIsLaserGuidable)
return; return;
const std::vector<AreaEffectSimulation::SingleEffect> &singleEffectsRef = data.singleEffects; const std::vector<AreaEffectSimulation::SingleEffect> &singleEffectsRef = data.singleEffects;
if (!singleEffectsRef.empty()) if (!singleEffectsRef.empty())
{ {
bool bAlreadyExists = false; bool bAlreadyExists = false;
const int aesTetraId = m_aesStateHandler->createAesTetraId(aesItemId, bAlreadyExists); const int aesTetraId = m_aesStateHandler->createAesTetraId(aesItemId, bAlreadyExists);
DEBUG_LOG(m_logger) << "RecvFromDdsAes::onEffectsChanged(Effects, " DEBUG_LOG(m_logger) << "RecvFromDdsAes::onEffectsChanged(Effects, "
<< aesTetraId << ")"; << aesTetraId << ")";
TetraIcd::CreateAreaExplosion cAes; TetraIcd::CreateAreaExplosion cAes;
setCommonCombatParams(cAes, aes, aesTetraId); setCommonCombatParams(cAes, aes, aesTetraId);
if(cAes.effectStart > 0) if(cAes.effectStart > 0)
{ {
@@ -763,11 +718,9 @@ void RecvFromDdsAes::onEffectsChanged(const AreaEffectSimulation::Effects &data,
cAes.effectStart += (delayMSec); cAes.effectStart += (delayMSec);
} }
const AreaEffectSimulation::SingleEffect &firstSingleEffect = singleEffectsRef.front(); const AreaEffectSimulation::SingleEffect &firstSingleEffect = singleEffectsRef.front();
const Core::GeoPosition &fsePosition = firstSingleEffect.position; const Core::GeoPosition &fsePosition = firstSingleEffect.position;
cAes.relCorner = m_posHandler->geographicToRelative(fsePosition); cAes.relCorner = m_posHandler->geographicToRelative(fsePosition);
cAes.width = qRound(aes.area.width); cAes.width = qRound(aes.area.width);
cAes.height = qRound(aes.area.height); cAes.height = qRound(aes.area.height);
cAes.rotationAngle = aes.area.rotation; cAes.rotationAngle = aes.area.rotation;
@@ -784,14 +737,7 @@ void RecvFromDdsAes::onEffectsChanged(const AreaEffectSimulation::Effects &data,
for (const Core::GeoPosition2D &pos : std::as_const(aes.mhPoints)) for (const Core::GeoPosition2D &pos : std::as_const(aes.mhPoints))
mhPointsRef.emplace_back(m_posHandler->geographicToRelative(pos, 0)); mhPointsRef.emplace_back(m_posHandler->geographicToRelative(pos, 0));
cAes.chargeTypeId = 254; cAes.chargeTypeId = 254;
txData(cAes); txData(cAes);
} }
} }
@@ -811,8 +757,6 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::AirS
cAes.header.equipmentNumber = 0; cAes.header.equipmentNumber = 0;
cAes.relEffectPosition = m_posHandler->geographicToRelative(aes.impactPosition, 0); cAes.relEffectPosition = m_posHandler->geographicToRelative(aes.impactPosition, 0);
const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct.chargeTypeId)); const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct.chargeTypeId));
cAes.chargeTypeId = chargeType.legacyId > 0 ? chargeType.legacyId : chargeType.id; cAes.chargeTypeId = chargeType.legacyId > 0 ? chargeType.legacyId : chargeType.id;
@@ -846,7 +790,6 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::BCCo
cAes.validityTimeWind = aes.weatherTimestamp; cAes.validityTimeWind = aes.weatherTimestamp;
cAes.relPositionValidityTimeWind = m_posHandler->geographicToRelative(aes.weatherPosition, 0); cAes.relPositionValidityTimeWind = m_posHandler->geographicToRelative(aes.weatherPosition, 0);
const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct.chargeTypeId)); const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct.chargeTypeId));
cAes.chargeTypeId = chargeType.legacyId > 0 ? chargeType.legacyId : chargeType.id; cAes.chargeTypeId = chargeType.legacyId > 0 ? chargeType.legacyId : chargeType.id;
@@ -890,8 +833,6 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Expl
cAes.impactCount = aes.cannonCount * aes.cannonRounds; cAes.impactCount = aes.cannonCount * aes.cannonRounds;
cAes.impactEdgeLength = qRound(pdm()->impactEdgeLength(aes.chargeStruct)); cAes.impactEdgeLength = qRound(pdm()->impactEdgeLength(aes.chargeStruct));
cAes.hazardDistance = m_mainHandler->pdmHandler()->hazardDistance(aes.chargeStruct); cAes.hazardDistance = m_mainHandler->pdmHandler()->hazardDistance(aes.chargeStruct);
const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct.chargeTypeId)); const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct.chargeTypeId));
cAes.chargeTypeId = chargeType.legacyId > 0 ? chargeType.legacyId : chargeType.id; cAes.chargeTypeId = chargeType.legacyId > 0 ? chargeType.legacyId : chargeType.id;
@@ -903,17 +844,13 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Expl
void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::ExplosionCluster &aes, int aesTetraId) void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::ExplosionCluster &aes, int aesTetraId)
{ {
const bool bIsLaserGuidable = m_mainHandler->pdmHandler()->isLaserGuidable(aes.chargeStruct); const bool bIsLaserGuidable = m_mainHandler->pdmHandler()->isLaserGuidable(aes.chargeStruct);
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation " DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation "
<< ", aes " << aes << ", aes " << aes
<< ", bIsLaserGuidable " << bIsLaserGuidable; << ", bIsLaserGuidable " << bIsLaserGuidable;
if (bIsLaserGuidable) if (bIsLaserGuidable)
{ {
return; return;
} }
@@ -925,10 +862,7 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Expl
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation(ExplosionArea, " DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation(ExplosionArea, "
<< aesTetraId << ")"; << aesTetraId << ")";
TetraIcd::CreateAreaExplosion cAes; TetraIcd::CreateAreaExplosion cAes;
setCommonCombatParams(cAes, aes, aesTetraId); setCommonCombatParams(cAes, aes, aesTetraId);
cAes.relCorner = m_posHandler->geographicToRelative(aes.area.cornerBottomLeft, 0); cAes.relCorner = m_posHandler->geographicToRelative(aes.area.cornerBottomLeft, 0);
cAes.width = qRound(aes.area.width); cAes.width = qRound(aes.area.width);
cAes.height = qRound(aes.area.height); cAes.height = qRound(aes.area.height);
@@ -948,9 +882,6 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Expl
int chargeTypeId = 0; int chargeTypeId = 0;
const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct.chargeTypeId)); const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct.chargeTypeId));
chargeTypeId = pdm()->legacyChargeTypeIgniterType(aes.chargeStruct.chargeTypeId, aes.chargeStruct.igniterTypeId, aes.chargeStruct.igniterFunctionId); chargeTypeId = pdm()->legacyChargeTypeIgniterType(aes.chargeStruct.chargeTypeId, aes.chargeStruct.igniterTypeId, aes.chargeStruct.igniterFunctionId);
if (chargeTypeId > 0) if (chargeTypeId > 0)
cAes.chargeTypeId = chargeTypeId; cAes.chargeTypeId = chargeTypeId;
else else
@@ -960,7 +891,6 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Expl
if (cAes.chargeTypeId <= 0) if (cAes.chargeTypeId <= 0)
return; return;
txData(cAes); txData(cAes);
} }
@@ -979,8 +909,6 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Expl
cAes.header.equipmentNumber = equipmentNumber; cAes.header.equipmentNumber = equipmentNumber;
cAes.relEffectPosition = m_posHandler->geographicToRelative(aes.impactPosition, 0); cAes.relEffectPosition = m_posHandler->geographicToRelative(aes.impactPosition, 0);
cAes.effectDiameter = qRound(2 * pdm()->impactRadius(aes.chargeStruct)); cAes.effectDiameter = qRound(2 * pdm()->impactRadius(aes.chargeStruct));
const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct.chargeTypeId)); const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct.chargeTypeId));
cAes.chargeTypeId = chargeType.legacyId > 0 ? chargeType.legacyId : chargeType.id; cAes.chargeTypeId = chargeType.legacyId > 0 ? chargeType.legacyId : chargeType.id;
@@ -1002,13 +930,8 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Mine
TetraIcd::CreateMineArea cAes; TetraIcd::CreateMineArea cAes;
setCommonCombatParams(cAes, aes, aesTetraId); setCommonCombatParams(cAes, aes, aesTetraId);
cAes.layingDepth = aes.width; cAes.layingDepth = aes.width;
cAes.layingDensity = aes.density; cAes.layingDensity = aes.density;
const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct.chargeTypeId)); const auto chargeType(pdm()->chargeTypeFromId(aes.chargeStruct.chargeTypeId));
cAes.chargeTypeId = chargeType.legacyId > 0 ? chargeType.legacyId : chargeType.id; cAes.chargeTypeId = chargeType.legacyId > 0 ? chargeType.legacyId : chargeType.id;
@@ -1069,9 +992,7 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::NCon
cAes.borderLengthOuter = qRound(aes.borderLengthOuter); cAes.borderLengthOuter = qRound(aes.borderLengthOuter);
cAes.spanAngle = aes.spanAngle; cAes.spanAngle = aes.spanAngle;
cAes.rotationAngle = aes.rotationAngle; cAes.rotationAngle = aes.rotationAngle;
cAes.chargeTypeId = aes.chargeStruct.chargeTypeId; cAes.chargeTypeId = aes.chargeStruct.chargeTypeId;
txData(cAes); txData(cAes);
} }
@@ -1111,9 +1032,7 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::Tech
DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation(TechnicalArea, " DEBUG_LOG(m_logger) << "RecvFromDdsAes::sendCreateEffectSimulation(TechnicalArea, "
<< aesTetraId << ")"; << aesTetraId << ")";
TetraIcd::TechnicalArea fAes; TetraIcd::TechnicalArea fAes;
fAes.aesDdsId = aes.id; fAes.aesDdsId = aes.id;
fAes.name = aes.name; fAes.name = aes.name;
fAes.taType = static_cast<TetraIcd::TechnicalArea::Type>(aes.type); fAes.taType = static_cast<TetraIcd::TechnicalArea::Type>(aes.type);
fAes.relCorner = m_posHandler->geographicToRelative(aes.area.cornerBottomLeft, 0); fAes.relCorner = m_posHandler->geographicToRelative(aes.area.cornerBottomLeft, 0);
@@ -1148,15 +1067,12 @@ void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::DusS
void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::GasPipe &aes, int aesTetraId) void RecvFromDdsAes::sendCreateEffectSimulation(const AreaEffectSimulation::GasPipe &aes, int aesTetraId)
{ {
Q_UNUSED(aes); Q_UNUSED(aes);
Q_UNUSED(aesTetraId); Q_UNUSED(aesTetraId);
} }
void RecvFromDdsAes::sendModifyEffectSimulationName(TetraIcd::AreaEffectSimulationType aesType, int aesTetraId, const std::string &name, int aesId) void RecvFromDdsAes::sendModifyEffectSimulationName(TetraIcd::AreaEffectSimulationType aesType, int aesTetraId, const std::string &name, int aesId)
{ {
if (aesTetraId == 0) if (aesTetraId == 0)
{ {
WARNING_LOG(m_logger) << "Trying to modify an effect simulation name but have no aes identification: " << name; WARNING_LOG(m_logger) << "Trying to modify an effect simulation name but have no aes identification: " << name;
@@ -1168,9 +1084,7 @@ void RecvFromDdsAes::sendModifyEffectSimulationName(TetraIcd::AreaEffectSimulati
TetraIcd::ModifyAreaEffectSimulationName mAes; TetraIcd::ModifyAreaEffectSimulationName mAes;
mAes.aesType = aesType; mAes.aesType = aesType;
mAes.aesDdsId = aesId; mAes.aesDdsId = aesId;
mAes.name = name; mAes.name = name;
txData(mAes); txData(mAes);
} }
@@ -1181,8 +1095,6 @@ void RecvFromDdsAes::sendRemoveEffectSimulation(TetraIcd::AreaEffectSimulationTy
if (aesType == TetraIcd::AreaEffectSimulationType::GasPipeDetonation) if (aesType == TetraIcd::AreaEffectSimulationType::GasPipeDetonation)
return; return;
const int aesTetraId = m_aesStateHandler->getAesTetraId(aesDdsId); const int aesTetraId = m_aesStateHandler->getAesTetraId(aesDdsId);
if (aesTetraId == 0) if (aesTetraId == 0)
{ {
@@ -1237,8 +1149,6 @@ void RecvFromDdsAes::sendPauseEffectSimulation(int aesDdsId)
TetraIcd::PauseEffectSimulation dAes; TetraIcd::PauseEffectSimulation dAes;
dAes.aesDdsId = aesDdsId; dAes.aesDdsId = aesDdsId;
txData(dAes); txData(dAes);
} }
@@ -1269,7 +1179,6 @@ void RecvFromDdsAes::sendResumeEffectSimulation(const AreaEffectSimulation::Expl
TetraIcd::ResumeEffectSimulation dAes; TetraIcd::ResumeEffectSimulation dAes;
dAes.aesDdsId = aes.id; dAes.aesDdsId = aes.id;
dAes.sequelNumber = AreaEffectSimulation::Polygons::getSequelNumber(aes.id, dAes.sequelNumber = AreaEffectSimulation::Polygons::getSequelNumber(aes.id,
aes.cannonCount * aes.cannonRounds, aes.cannonCount * aes.cannonRounds,
aes.originalEffectDuration, aes.originalEffectDuration,
@@ -1281,7 +1190,6 @@ void RecvFromDdsAes::sendResumeEffectSimulation(const AreaEffectSimulation::Expl
txData(dAes); txData(dAes);
} }
template<> template<>
void RecvFromDdsAes::sendResumeEffectSimulation(const AreaEffectSimulation::ExplosionCluster &aes) void RecvFromDdsAes::sendResumeEffectSimulation(const AreaEffectSimulation::ExplosionCluster &aes)
{ {
@@ -1370,6 +1278,5 @@ void RecvFromDdsAes::fillCentralChangesTable(const T &data)
{ {
dataChanged(data); dataChanged(data);
} }
} }
@@ -1,6 +1,4 @@
#pragma once #pragma once
#include <QtCore/QObject> #include <QtCore/QObject>
@@ -60,8 +58,6 @@ private:
int m_exerciseId; int m_exerciseId;
}; };
class RecvFromDdsAes : public QObject class RecvFromDdsAes : public QObject
{ {
Q_OBJECT Q_OBJECT
@@ -95,21 +91,15 @@ public:
} }
void resetAllDusMines(); void resetAllDusMines();
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> dtcAes() const { return m_dtcAes;} std::shared_ptr<AreaEffectSimulation::Interface::Dtc> dtcAes() const { return m_dtcAes;}
private: private:
template<typename T> template<typename T>
void handleEffectSimulation(const T &data, DataModification modType, TetraIcd::AreaEffectSimulationType aesType); void handleEffectSimulation(const T &data, DataModification modType, TetraIcd::AreaEffectSimulationType aesType);
template<typename T> template<typename T>
void fillCentralChangesTable(const T &data); void fillCentralChangesTable(const T &data);
template <typename T> template <typename T>
void handleSendToTetra(const T &data, TetraIcd::AreaEffectSimulationType aesType); void handleSendToTetra(const T &data, TetraIcd::AreaEffectSimulationType aesType);
void onAirSupportImpactChanged(const AreaEffectSimulation::AirSupportImpact &data, DataModification modType); void onAirSupportImpactChanged(const AreaEffectSimulation::AirSupportImpact &data, DataModification modType);
void onBcContaminationChanged(const AreaEffectSimulation::BCContamination &data, DataModification modType); void onBcContaminationChanged(const AreaEffectSimulation::BCContamination &data, DataModification modType);
void onExplosionAreaChanged(const AreaEffectSimulation::ExplosionArea &data, DataModification modType); void onExplosionAreaChanged(const AreaEffectSimulation::ExplosionArea &data, DataModification modType);
@@ -147,7 +137,6 @@ private:
static_assert(std::is_base_of<AreaEffectSimulation::AesItem, T>::value, "Given type for sendResumeEffectSimulation is not an aes item!"); static_assert(std::is_base_of<AreaEffectSimulation::AesItem, T>::value, "Given type for sendResumeEffectSimulation is not an aes item!");
} }
void doSpecialization(const AreaEffectSimulation::ExplosionArea &data, std::unordered_map<int, AreaEffectSimulation::ExplosionArea> &cont) void doSpecialization(const AreaEffectSimulation::ExplosionArea &data, std::unordered_map<int, AreaEffectSimulation::ExplosionArea> &cont)
{ {
cont[data.id].remainExplosionNumber = data.remainExplosionNumber; } cont[data.id].remainExplosionNumber = data.remainExplosionNumber; }
@@ -170,8 +159,6 @@ private:
DEBUG_LOG(m_logger) << "new AES Item: " << data; DEBUG_LOG(m_logger) << "new AES Item: " << data;
return true; return true;
} }
it->second.effectStateId = data.effectStateId; it->second.effectStateId = data.effectStateId;
doSpecialization(data, cont); doSpecialization(data, cont);
@@ -182,12 +169,11 @@ private:
return false; return false;
} }
T tmp(it->second); T tmp(it->second);
tmp.name = data.name; tmp.sampleTime = data.sampleTime; onlyNameChanged = (tmp == data); tmp.name = data.name;
tmp.sampleTime = data.sampleTime;
onlyNameChanged = (tmp == data);
std::swap(it->second, dataTmp); std::swap(it->second, dataTmp);
DEBUG_LOG(m_logger) << "changed AES Item: " << data; DEBUG_LOG(m_logger) << "changed AES Item: " << data;
return true; return true;
} }
@@ -202,14 +188,14 @@ private:
bool dataChanged(const AreaEffectSimulation::ExplosionArea &current, bool &onlyNameChanged) bool dataChanged(const AreaEffectSimulation::ExplosionArea &current, bool &onlyNameChanged)
{ {
AreaEffectSimulation::ExplosionArea copy(current); AreaEffectSimulation::ExplosionArea copy(current);
copy.remainExplosionNumber = 0;
copy.remainExplosionNumber = 0; return dataChanged(copy, m_currentExplosionArea, onlyNameChanged); return dataChanged(copy, m_currentExplosionArea, onlyNameChanged);
} }
bool dataChanged(const AreaEffectSimulation::ExplosionCluster &current, bool &onlyNameChanged) bool dataChanged(const AreaEffectSimulation::ExplosionCluster &current, bool &onlyNameChanged)
{ {
AreaEffectSimulation::ExplosionCluster copy(current); AreaEffectSimulation::ExplosionCluster copy(current);
copy.remainExplosionNumber = 0;
copy.remainExplosionNumber = 0; return dataChanged(copy, m_currentExplosionCluster, onlyNameChanged); return dataChanged(copy, m_currentExplosionCluster, onlyNameChanged);
} }
bool dataChanged(const AreaEffectSimulation::ExplosionSingle &current, bool &onlyNameChanged) bool dataChanged(const AreaEffectSimulation::ExplosionSingle &current, bool &onlyNameChanged)
@@ -241,16 +227,13 @@ private:
return dataChanged(current, m_currentGasPipes, onlyNameChanged); return dataChanged(current, m_currentGasPipes, onlyNameChanged);
} }
bool dataChanged(const AreaEffectSimulation::BoobyTrap &current) bool dataChanged(const AreaEffectSimulation::BoobyTrap &current)
{ {
bool placeholder; bool placeholder;
Q_UNUSED(placeholder); Q_UNUSED(placeholder);
return dataChanged(current, m_currentBoobyTraps, placeholder); return dataChanged(current, m_currentBoobyTraps, placeholder);
} }
bool dataChanged(const AreaEffectSimulation::OffRouteMine &current) bool dataChanged(const AreaEffectSimulation::OffRouteMine &current)
{ {
bool placeholder; bool placeholder;
@@ -320,7 +303,6 @@ private:
} }
std::shared_ptr<PdmHandler> pdm(); std::shared_ptr<PdmHandler> pdm();
template<typename T> template<typename T>
void txData(const T &tele) void txData(const T &tele)
{ {
@@ -348,19 +330,12 @@ private:
std::unordered_map<int, AreaEffectSimulation::TechnicalArea> m_currentTechnicalArea; std::unordered_map<int, AreaEffectSimulation::TechnicalArea> m_currentTechnicalArea;
std::unordered_map<int, AreaEffectSimulation::DusSingleMine> m_currentDusSingleMine; std::unordered_map<int, AreaEffectSimulation::DusSingleMine> m_currentDusSingleMine;
std::unordered_map<int, AreaEffectSimulation::GasPipe> m_currentGasPipes; std::unordered_map<int, AreaEffectSimulation::GasPipe> m_currentGasPipes;
std::unordered_map<int, AreaEffectSimulation::BoobyTrap> m_currentBoobyTraps; std::unordered_map<int, AreaEffectSimulation::BoobyTrap> m_currentBoobyTraps;
std::unordered_map<int, AreaEffectSimulation::OffRouteMine> m_currentOffRouteMines; std::unordered_map<int, AreaEffectSimulation::OffRouteMine> m_currentOffRouteMines;
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector; std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
std::shared_ptr<SendToTab> m_txCallback; std::shared_ptr<SendToTab> m_txCallback;
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_dtcAes; std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_dtcAes;
std::shared_ptr<AesStateHandler> m_aesStateHandler; std::shared_ptr<AesStateHandler> m_aesStateHandler;
QMap<int, AreaEffectSimulation::AesEffectState> m_currentEffectState; QMap<int, AreaEffectSimulation::AesEffectState> m_currentEffectState;
QMap<int, AreaEffectSimulation::DusMine> m_allReactivatableDusMines; QMap<int, AreaEffectSimulation::DusMine> m_allReactivatableDusMines;
QVector<int> m_minesToSend; QVector<int> m_minesToSend;
@@ -368,7 +343,6 @@ private:
MainHandler *m_mainHandler; MainHandler *m_mainHandler;
QTimer *m_checkOutdatedTelegramsTimer; QTimer *m_checkOutdatedTelegramsTimer;
QTimer *m_sendDusMineReactivtionTimer; QTimer *m_sendDusMineReactivtionTimer;
QVector<TetraIcd::TrainingAreaTelegram*> m_sentAesTelegrams; QVector<TetraIcd::TrainingAreaTelegram*> m_sentAesTelegrams;
QVector<int> m_sentAesTelegramsAesIds; QVector<int> m_sentAesTelegramsAesIds;
}; };
@@ -11,14 +11,10 @@
#include "main_handler.h" #include "main_handler.h"
#include "ism_handler.h" #include "ism_handler.h"
#include "settings.h" #include "settings.h"
#include <LtsUtilsCore/json.h> #include <LtsUtilsCore/json.h>
namespace TrainingAreaBase namespace TrainingAreaBase
{ {
RecvFromDdsFts::RecvFromDdsFts(MainHandler *mainHandler, const std::shared_ptr<Interface::Fts> &ftsTab, RecvFromDdsFts::RecvFromDdsFts(MainHandler *mainHandler, const std::shared_ptr<Interface::Fts> &ftsTab,
const std::shared_ptr<SendToTab> &txCallback) const std::shared_ptr<SendToTab> &txCallback)
: Interface::Fts::DemandBiteRequestHandler(ftsTab) : Interface::Fts::DemandBiteRequestHandler(ftsTab)
@@ -222,7 +218,6 @@ void RecvFromDdsFts::onSendGeopairingDataRequest(const rti::core::SampleIdentity
data.payloadType = TetraIcd::OpaquePayloadDataBase::Type::Geopairing; data.payloadType = TetraIcd::OpaquePayloadDataBase::Type::Geopairing;
data.header.equipmentNumber = request.equipmentNumber; data.header.equipmentNumber = request.equipmentNumber;
data.payload = request.payload; data.payload = request.payload;
m_ftsTab->sendGeopairingDataReply(cookie, fillFro(request.participantId, m_txCallback->txData(data))); m_ftsTab->sendGeopairingDataReply(cookie, fillFro(request.participantId, m_txCallback->txData(data)));
} }
@@ -232,7 +227,6 @@ void RecvFromDdsFts::onSendTargetDataRequest(const rti::core::SampleIdentity &co
data.payloadType = TetraIcd::OpaquePayloadDataBase::Type::Target; data.payloadType = TetraIcd::OpaquePayloadDataBase::Type::Target;
data.header.equipmentNumber = request.equipmentNumber; data.header.equipmentNumber = request.equipmentNumber;
data.payload = request.payload; data.payload = request.payload;
m_ftsTab->sendTargetDataReply(cookie, fillFro(request.participantId, m_txCallback->txData(data))); m_ftsTab->sendTargetDataReply(cookie, fillFro(request.participantId, m_txCallback->txData(data)));
} }
@@ -6,10 +6,8 @@
* $Author$ * $Author$
*/ */
#include "tab_record_replay_plugin_custom.h" #include "tab_record_replay_plugin_custom.h"
namespace TrainingAreaBase namespace TrainingAreaBase
{ {
@@ -68,7 +66,6 @@ bool RecordReplayPluginCustom::ppmDdsTopicsFromDatabase(NSqlQuery &q, qint64 fro
if (!readEquipmentState(q, fromTime, toTime)) return false; if (!readEquipmentState(q, fromTime, toTime)) return false;
if (!readSpecialSensorData(q, fromTime, toTime)) return false; if (!readSpecialSensorData(q, fromTime, toTime)) return false;
return true; return true;
} }
@@ -1,9 +1,6 @@
#include "training_area_telegrams.h" #include "training_area_telegrams.h"
#include <utility> #include <utility>
#include <QtCore/QJsonArray> #include <QtCore/QJsonArray>
#include <QtCore/QJsonDocument> #include <QtCore/QJsonDocument>
#include <QtCore/QJsonObject> #include <QtCore/QJsonObject>
@@ -12,7 +9,6 @@ namespace TrainingAreaBase
{ {
namespace TetraIcd namespace TetraIcd
{ {
JsonException::JsonException(const QJsonObject &obj, const QString &key) JsonException::JsonException(const QJsonObject &obj, const QString &key)
: m_obj(obj) : m_obj(obj)
, m_key(key) , m_key(key)
@@ -3063,10 +3059,8 @@ namespace TrainingAreaBase
UAVAction UAVAction::fromJson(const QJsonObject &obj) UAVAction UAVAction::fromJson(const QJsonObject &obj)
{ {
UAVAction ret; UAVAction ret;
get(obj, TASK(), ret.task); get(obj, TASK(), ret.task);
get(obj, POSITION(), ret.absPosition); get(obj, POSITION(), ret.absPosition);
return ret; return ret;
} }
@@ -3075,16 +3069,13 @@ namespace TrainingAreaBase
return QJsonObject{{TASK(), enumToJson(task)}, {POSITION(), absPosition.toJson()}}; return QJsonObject{{TASK(), enumToJson(task)}, {POSITION(), absPosition.toJson()}};
} }
UAVPerformMission UAVPerformMission::fromJson(const QJsonObject &obj) UAVPerformMission UAVPerformMission::fromJson(const QJsonObject &obj)
{ {
UAVPerformMission ret; UAVPerformMission ret;
get(obj, HEADER(), ret.header); get(obj, HEADER(), ret.header);
get(obj, ACTIONS(), ret.actions); get(obj, ACTIONS(), ret.actions);
get(obj, MISSION_NAME(), ret.missionName); get(obj, MISSION_NAME(), ret.missionName);
get(obj, MISSION_ID(), ret.missionId); get(obj, MISSION_ID(), ret.missionId);
return ret; return ret;
} }
@@ -3093,14 +3084,11 @@ namespace TrainingAreaBase
return QJsonObject{{HEADER(), header.toJson()}, {ACTIONS(), arrayToJson(actions)}, {MISSION_NAME(), missionName}, {MISSION_ID(), missionId}}; return QJsonObject{{HEADER(), header.toJson()}, {ACTIONS(), arrayToJson(actions)}, {MISSION_NAME(), missionName}, {MISSION_ID(), missionId}};
} }
UAVStatus UAVStatus::fromJson(const QJsonObject &obj) UAVStatus UAVStatus::fromJson(const QJsonObject &obj)
{ {
UAVStatus ret; UAVStatus ret;
get(obj, HEADER(), ret.header); get(obj, HEADER(), ret.header);
get(obj, UAVSTATE(), ret.uavState); get(obj, UAVSTATE(), ret.uavState);
return ret; return ret;
} }
@@ -3109,14 +3097,11 @@ namespace TrainingAreaBase
return QJsonObject{{HEADER(), header.toJson()}, {UAVSTATE(), enumToJson(uavState)}}; return QJsonObject{{HEADER(), header.toJson()}, {UAVSTATE(), enumToJson(uavState)}};
} }
UAVRadioLinkConnectionStatus UAVRadioLinkConnectionStatus::fromJson(const QJsonObject &obj) UAVRadioLinkConnectionStatus UAVRadioLinkConnectionStatus::fromJson(const QJsonObject &obj)
{ {
UAVRadioLinkConnectionStatus ret; UAVRadioLinkConnectionStatus ret;
get(obj, HEADER(), ret.header); get(obj, HEADER(), ret.header);
get(obj, UAVCONNECTIONSTATE(), ret.uavConnectionState); get(obj, UAVCONNECTIONSTATE(), ret.uavConnectionState);
return ret; return ret;
} }
@@ -3125,16 +3110,13 @@ namespace TrainingAreaBase
return QJsonObject{{HEADER(), header.toJson()}, {UAVCONNECTIONSTATE(), enumToJson(uavConnectionState)}}; return QJsonObject{{HEADER(), header.toJson()}, {UAVCONNECTIONSTATE(), enumToJson(uavConnectionState)}};
} }
UAVMissionStatus UAVMissionStatus::fromJson(const QJsonObject &obj) UAVMissionStatus UAVMissionStatus::fromJson(const QJsonObject &obj)
{ {
UAVMissionStatus ret; UAVMissionStatus ret;
get(obj, HEADER(), ret.header); get(obj, HEADER(), ret.header);
get(obj, CURRENT_ACTION(), ret.currentAction); get(obj, CURRENT_ACTION(), ret.currentAction);
get(obj, CURRENT_MISSION_NAME(), ret.currentMissionName); get(obj, CURRENT_MISSION_NAME(), ret.currentMissionName);
get(obj, MISSION_ENDED(), ret.missionEnded); get(obj, MISSION_ENDED(), ret.missionEnded);
return ret; return ret;
} }
@@ -3146,14 +3128,11 @@ namespace TrainingAreaBase
{MISSION_ENDED(), missionEnded}}; {MISSION_ENDED(), missionEnded}};
} }
UAVChangeState UAVChangeState::fromJson(const QJsonObject &obj) UAVChangeState UAVChangeState::fromJson(const QJsonObject &obj)
{ {
UAVChangeState ret; UAVChangeState ret;
get(obj, HEADER(), ret.header); get(obj, HEADER(), ret.header);
get(obj, REQUESTED_STATE(), ret.requestedState); get(obj, REQUESTED_STATE(), ret.requestedState);
return ret; return ret;
} }
@@ -3165,11 +3144,9 @@ namespace TrainingAreaBase
ExFireReadiness ExFireReadiness::fromJson(const QJsonObject &obj) ExFireReadiness ExFireReadiness::fromJson(const QJsonObject &obj)
{ {
ExFireReadiness ret; ExFireReadiness ret;
get(obj, HEADER(), ret.header); get(obj, HEADER(), ret.header);
get(obj, PARTY_ID(), ret.partyId); get(obj, PARTY_ID(), ret.partyId);
get(obj, REFERENCE(), ret.reference); get(obj, REFERENCE(), ret.reference);
return ret; return ret;
} }
@@ -3181,7 +3158,6 @@ namespace TrainingAreaBase
ExFiredReport ExFiredReport::fromJson(const QJsonObject &obj) ExFiredReport ExFiredReport::fromJson(const QJsonObject &obj)
{ {
ExFiredReport ret; ExFiredReport ret;
get(obj, HEADER(), ret.header); get(obj, HEADER(), ret.header);
get(obj, PARTY_ID(), ret.partyId); get(obj, PARTY_ID(), ret.partyId);
get(obj, REFERENCE(), ret.reference); get(obj, REFERENCE(), ret.reference);
@@ -3198,7 +3174,6 @@ namespace TrainingAreaBase
ExConfirmationReport ExConfirmationReport::fromJson(const QJsonObject &obj) ExConfirmationReport ExConfirmationReport::fromJson(const QJsonObject &obj)
{ {
ExConfirmationReport ret; ExConfirmationReport ret;
get(obj, HEADER(), ret.header); get(obj, HEADER(), ret.header);
get(obj, PARTY_ID(), ret.partyId); get(obj, PARTY_ID(), ret.partyId);
get(obj, REFERENCE(), ret.reference); get(obj, REFERENCE(), ret.reference);
@@ -20,15 +20,6 @@ SET(SRCS_common
logger.h logger.h
) )
# pdm_types.h was a migration-scaffolding stub with no qt5 counterpart and
# no consumer; the stub in include/ was removed and the copy with it.
# pdm_translation.h and pdm_enums.hpp stub copies (OFF-variant fallbacks whose
# include/ sources were removed together with the other shadowing stubs):
# with BUILD_GRANTLEE=ON and BUILD_RTI=ON the codegen writes the real files to
# these build-dir paths, so the copies are gone rather than kept for forbidden
# OFF variants.
# Define target name early for use in subsequent macros # Define target name early for use in subsequent macros
SET(PDM_COMMON_TARGET svcPdmCommon) SET(PDM_COMMON_TARGET svcPdmCommon)
@@ -193,9 +184,7 @@ ENDIF()
# #
# --- Executable svcProjectDataManagement (sPDM) ------------------------------------------------- # --- Executable svcProjectDataManagement (sPDM) -------------------------------------------------
# #
# The executable links LtsWebSocketServer, which was pruned from the # The executable links LtsWebSocketServer
# tree (prune commit 7fc6f6664), so the target is only created when the
# module is present.
IF(EXISTS "${CMAKE_SOURCE_DIR}/Lts/Common/LtsWebSocket") IF(EXISTS "${CMAKE_SOURCE_DIR}/Lts/Common/LtsWebSocket")
LIST(APPEND SRCS_exe LIST(APPEND SRCS_exe
convert_db_to_dds.h convert_db_to_dds.h
@@ -48,7 +48,6 @@ void ChargeTypeRename::onUpdateChargeNamesRequest(const rti::core::SampleIdentit
} }
m_dds->fts()->updateChargeNamesReply(cookie, Core::FunctionReplyObject(ct.id)); m_dds->fts()->updateChargeNamesReply(cookie, Core::FunctionReplyObject(ct.id));
m_dds->dts()->publish(Database::convert(ct)); m_dds->dts()->publish(Database::convert(ct));
} }
@@ -9,7 +9,6 @@
#include <ProjectDataManagement/pdm_fts.h> #include <ProjectDataManagement/pdm_fts.h>
#include <QtCore/QObject> #include <QtCore/QObject>
#include "logger.h" #include "logger.h"
namespace ProjectDataManagement namespace ProjectDataManagement
@@ -26,7 +26,6 @@ void MyLabel::mousePressEvent(QMouseEvent *ev)
/****************************************************************/ /****************************************************************/
ResizableStackedWidget::ResizableStackedWidget(QWidget *parent) ResizableStackedWidget::ResizableStackedWidget(QWidget *parent)
: QStackedWidget(parent) : QStackedWidget(parent)
{ {
@@ -58,7 +57,6 @@ void ResizableStackedWidget::onCurrentChanged(int index)
/****************************************************************/ /****************************************************************/
RWWidget::RWWidget(QWidget *parent) RWWidget::RWWidget(QWidget *parent)
: QWidget(parent) : QWidget(parent)
, m_label(new MyLabel(this)) , m_label(new MyLabel(this))
@@ -95,8 +93,6 @@ void RWWidget::onSetWritablePrivate()
} }
/****************************************************************/ /****************************************************************/
RWSpinBox::RWSpinBox(RwMode readOnly, QWidget *parent) RWSpinBox::RWSpinBox(RwMode readOnly, QWidget *parent)
: RWWidget(parent) : RWWidget(parent)
, m_spinBox(readOnly == RwMode::ReadOnly ? nullptr : new QSpinBox(this)) , m_spinBox(readOnly == RwMode::ReadOnly ? nullptr : new QSpinBox(this))
@@ -136,8 +132,6 @@ int RWSpinBox::value() const
} }
/*****************************************************/ /*****************************************************/
RWDoubleSpinBox::RWDoubleSpinBox(RwMode readOnly, QWidget *parent) RWDoubleSpinBox::RWDoubleSpinBox(RwMode readOnly, QWidget *parent)
: RWWidget(parent) : RWWidget(parent)
, m_doubleSpinBox(readOnly == RwMode::ReadOnly ? nullptr : new QDoubleSpinBox(this)) , m_doubleSpinBox(readOnly == RwMode::ReadOnly ? nullptr : new QDoubleSpinBox(this))
@@ -188,7 +182,6 @@ double RWDoubleSpinBox::value() const
/*****************************************************/ /*****************************************************/
RWCheckBox::RWCheckBox(RwMode readOnly, QWidget *parent) RWCheckBox::RWCheckBox(RwMode readOnly, QWidget *parent)
: RWWidget(parent) : RWWidget(parent)
, m_checkBox(readOnly == RwMode::ReadOnly ? nullptr : new QCheckBox(this)) , m_checkBox(readOnly == RwMode::ReadOnly ? nullptr : new QCheckBox(this))
@@ -248,7 +241,6 @@ QString RWLineEdit::text() const
/*****************************************************/ /*****************************************************/
RWComboBox::RWComboBox(RwMode readOnly, QWidget *parent) RWComboBox::RWComboBox(RwMode readOnly, QWidget *parent)
: RWWidget(parent) : RWWidget(parent)
, m_comboBox(readOnly == RwMode::ReadOnly ? nullptr : new QComboBox(this)) , m_comboBox(readOnly == RwMode::ReadOnly ? nullptr : new QComboBox(this))
@@ -1,18 +1,13 @@
#include "AddLine.h" #include "AddLine.h"
#include "ui_AddLinesUi.h" #include "ui_AddLinesUi.h"
#include <QtCore/QDebug> #include <QtCore/QDebug>
AddLines::AddLines(QWidget* parent) AddLines::AddLines(QWidget* parent)
: QDialog(parent) : QDialog(parent)
, m_ui(new Ui::AddLines) , m_ui(new Ui::AddLines)
{ {
qRegisterMetaType<AddModel*>("AddModel*"); qRegisterMetaType<AddModel*>("AddModel*");
m_ui->setupUi(this); m_ui->setupUi(this);
m_ui->dataView->setModel(&addModel); m_ui->dataView->setModel(&addModel);
connect(m_ui->pbDone, &QPushButton::clicked, connect(m_ui->pbDone, &QPushButton::clicked,
@@ -28,21 +23,17 @@ AddLines::AddLines(QWidget* parent)
this, &AddLines::slotClear); this, &AddLines::slotClear);
} }
AddLines::~AddLines() AddLines::~AddLines()
{ {
delete m_ui; delete m_ui;
} }
void AddLines::slotDeleteLines() void AddLines::slotDeleteLines()
{ {
//qWarning() << "slotDeleteLines"; //qWarning() << "slotDeleteLines";
while (m_ui->dataView->selectionModel()->selectedRows().count()) while (m_ui->dataView->selectionModel()->selectedRows().count())
{ {
const QModelIndexList selectedRows = m_ui->dataView->selectionModel()->selectedRows(); const QModelIndexList selectedRows = m_ui->dataView->selectionModel()->selectedRows();
if (selectedRows.at(0).row() == addModel.rowCount()-1) // do not delete empty row! if (selectedRows.at(0).row() == addModel.rowCount()-1) // do not delete empty row!
{ {
return; // In hope that the selectedRows list is sorted..... return; // In hope that the selectedRows list is sorted.....
@@ -52,27 +43,23 @@ void AddLines::slotDeleteLines()
} }
} }
void AddLines::slotClear() void AddLines::slotClear()
{ {
//qWarning() << "slotClear"; //qWarning() << "slotClear";
addModel.clear(); addModel.clear();
} }
void AddLines::reject() void AddLines::reject()
{ {
emit signalAddLines(nullptr); emit signalAddLines(nullptr);
} }
void AddLines::copyDataFromModel(DataModel* dataModel) void AddLines::copyDataFromModel(DataModel* dataModel)
{ {
addModel.setHeaderList(dataModel->getHeaderList()); addModel.setHeaderList(dataModel->getHeaderList());
addModel.setTablename(dataModel->getTableName()); addModel.setTablename(dataModel->getTableName());
} }
void AddLines::slotAddLines() void AddLines::slotAddLines()
{ {
this->hide(); // hide until in work.. this->hide(); // hide until in work..
@@ -1,7 +1,6 @@
#pragma once #pragma once
#include "AddModel.h" #include "AddModel.h"
#include <QtWidgets/QDialog> #include <QtWidgets/QDialog>
namespace Ui namespace Ui
@@ -9,7 +8,6 @@ namespace Ui
class AddLines; class AddLines;
} }
class AddLines : public QDialog class AddLines : public QDialog
{ {
Q_OBJECT Q_OBJECT
@@ -17,7 +15,6 @@ class AddLines : public QDialog
public: public:
explicit AddLines(QWidget *parent = nullptr); explicit AddLines(QWidget *parent = nullptr);
~AddLines(); ~AddLines();
void copyDataFromModel(DataModel* dataModel); void copyDataFromModel(DataModel* dataModel);
protected: protected:
@@ -1,8 +1,6 @@
#include "AddModel.h" #include "AddModel.h"
#include <QtCore/QDebug> #include <QtCore/QDebug>
void AddModel::setHeaderList(const HeaderList& headerList) void AddModel::setHeaderList(const HeaderList& headerList)
{ {
m_headerList = headerList; m_headerList = headerList;
@@ -10,17 +8,14 @@ void AddModel::setHeaderList(const HeaderList& headerList)
endResetModel(); endResetModel();
} }
const HeaderList& AddModel::getHeaderList() const const HeaderList& AddModel::getHeaderList() const
{ {
return m_headerList; return m_headerList;
} }
bool AddModel::removeRow(int row, const QModelIndex &parent) bool AddModel::removeRow(int row, const QModelIndex &parent)
{ {
//qWarning() << "removeRow"; //qWarning() << "removeRow";
(void)parent; (void)parent;
if (row >= m_dataList.count()) if (row >= m_dataList.count())
@@ -36,7 +31,6 @@ bool AddModel::removeRow(int row, const QModelIndex &parent)
return true; return true;
} }
void AddModel::clear() void AddModel::clear()
{ {
beginResetModel(); beginResetModel();
@@ -44,7 +38,6 @@ void AddModel::clear()
endResetModel(); endResetModel();
} }
QVariant AddModel::data(const QModelIndex &index, int role) const QVariant AddModel::data(const QModelIndex &index, int role) const
{ {
switch (role) switch (role)
@@ -96,7 +89,6 @@ bool AddModel::setData(const QModelIndex &index, const QVariant &value, int role
return true; return true;
} }
QMetaType::Type AddModel::getColumnType(const int column) const QMetaType::Type AddModel::getColumnType(const int column) const
{ {
if (column < 0 || column >= m_headerList.size()) if (column < 0 || column >= m_headerList.size())
@@ -104,7 +96,6 @@ QMetaType::Type AddModel::getColumnType(const int column) const
return m_headerList.at(column).second; return m_headerList.at(column).second;
} }
QVariant AddModel::headerData(int section, Qt::Orientation orientation, int role) const QVariant AddModel::headerData(int section, Qt::Orientation orientation, int role) const
{ {
if (orientation != Qt::Horizontal) if (orientation != Qt::Horizontal)
@@ -121,19 +112,16 @@ QVariant AddModel::headerData(int section, Qt::Orientation orientation, int role
return QVariant(); return QVariant();
} }
int AddModel::rowCount(const QModelIndex &) const int AddModel::rowCount(const QModelIndex &) const
{ {
return m_dataList.count() + 1 /* empty row for new data */; // yes, if the user wants to add more than 1 line! return m_dataList.count() + 1 /* empty row for new data */; // yes, if the user wants to add more than 1 line!
} }
int AddModel::columnCount(const QModelIndex &) const int AddModel::columnCount(const QModelIndex &) const
{ {
return m_headerList.count(); return m_headerList.count();
} }
Qt::ItemFlags AddModel::flags(const QModelIndex &) const Qt::ItemFlags AddModel::flags(const QModelIndex &) const
{ {
return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable; return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable;
@@ -145,7 +133,6 @@ void AddModel::setTablename(const QString& tableName)
m_tableName = tableName; m_tableName = tableName;
} }
const QString& AddModel::getTableName() const const QString& AddModel::getTableName() const
{ {
return m_tableName; return m_tableName;
@@ -13,7 +13,6 @@
#include <QShortcut> #include <QShortcut>
#include <QtCore/QThread> #include <QtCore/QThread>
BrowserWnd::BrowserWnd() BrowserWnd::BrowserWnd()
: QWidget(nullptr) : QWidget(nullptr)
, m_loginWnd(new LoginWnd(this)) , m_loginWnd(new LoginWnd(this))
@@ -49,13 +48,11 @@ BrowserWnd::~BrowserWnd()
delete m_loginWnd; delete m_loginWnd;
} }
void BrowserWnd::slotAddNewQuery() void BrowserWnd::slotAddNewQuery()
{ {
addNewQuery(); addNewQuery();
} }
void BrowserWnd::slotConnectResult(const QString &result) void BrowserWnd::slotConnectResult(const QString &result)
{ {
if (result.isEmpty()) // connection success! if (result.isEmpty()) // connection success!
@@ -70,9 +67,7 @@ void BrowserWnd::slotConnectResult(const QString &result)
m_ui->splitter->setStretchFactor(1, 1); // stretch the query widget m_ui->splitter->setStretchFactor(1, 1); // stretch the query widget
this->show(); this->show();
addNewQuery(); addNewQuery();
refreshTableList(); refreshTableList();
connect(m_ui->leFilter, &QLineEdit::textChanged, this, &BrowserWnd::slotFilterTableList); connect(m_ui->leFilter, &QLineEdit::textChanged, this, &BrowserWnd::slotFilterTableList);
@@ -94,13 +89,11 @@ void BrowserWnd::slotConnectResult(const QString &result)
m_waitWnd->hide(); m_waitWnd->hide();
} }
void BrowserWnd::slotFilterTableList(const QString &) void BrowserWnd::slotFilterTableList(const QString &)
{ {
refreshTableList(); refreshTableList();
} }
void BrowserWnd::addNewQuery(const QString &tableName) // tableName only set when query from double clicking table list void BrowserWnd::addNewQuery(const QString &tableName) // tableName only set when query from double clicking table list
{ {
Query *query = new Query(m_queryWorker); Query *query = new Query(m_queryWorker);
@@ -127,7 +120,6 @@ void BrowserWnd::addNewQuery(const QString &tableName) // tableName only set whe
// m_waitWnd->setStatus(percent); // m_waitWnd->setStatus(percent);
//} //}
void BrowserWnd::endThread() void BrowserWnd::endThread()
{ {
if (!m_queryThread) if (!m_queryThread)
@@ -143,17 +135,13 @@ void BrowserWnd::endThread()
m_queryWorker = nullptr; m_queryWorker = nullptr;
} }
void BrowserWnd::refreshTableList() void BrowserWnd::refreshTableList()
{ {
m_ui->lwTables->clear(); m_ui->lwTables->clear();
m_waitWnd->wait(QStringLiteral("Refreshing Table List ..")); m_waitWnd->wait(QStringLiteral("Refreshing Table List .."));
emit signalGetTableList(); emit signalGetTableList();
} }
void BrowserWnd::slotNewTableList(QStringList tables) void BrowserWnd::slotNewTableList(QStringList tables)
{ {
if (!m_ui->leFilter->text().isEmpty()) // filter when there is a filter if (!m_ui->leFilter->text().isEmpty()) // filter when there is a filter
@@ -163,15 +151,12 @@ void BrowserWnd::slotNewTableList(QStringList tables)
} }
m_ui->lwTables->addItems(tables); m_ui->lwTables->addItems(tables);
m_waitWnd->hide(); m_waitWnd->hide();
} }
void BrowserWnd::startConnect() void BrowserWnd::startConnect()
{ {
//m_loginWnd->setDefaultLoginData(presetManager. defaultLoginData); //m_loginWnd->setDefaultLoginData(presetManager. defaultLoginData);
if (!m_loginWnd->exec()) // false = user reject if (!m_loginWnd->exec()) // false = user reject
{ {
QCoreApplication::quit(); QCoreApplication::quit();
@@ -179,11 +164,9 @@ void BrowserWnd::startConnect()
} }
m_waitWnd->wait(tr("Connecting ..")); m_waitWnd->wait(tr("Connecting .."));
emit signalConnect(m_loginWnd->getLoginData()); emit signalConnect(m_loginWnd->getLoginData());
} }
bool BrowserWnd::test() bool BrowserWnd::test()
{ {
if (QSqlDatabase::drivers().isEmpty() || if (QSqlDatabase::drivers().isEmpty() ||
@@ -193,25 +176,20 @@ bool BrowserWnd::test()
tr("Missing Qt PostgreSQL driver"), tr("Missing Qt PostgreSQL driver"),
tr("There is no QPSQL driver." tr("There is no QPSQL driver."
"\nDid you install the package 'libQt5Sql5-postgresql'?")); "\nDid you install the package 'libQt5Sql5-postgresql'?"));
return false; return false;
} }
return true; return true;
} }
void BrowserWnd::slotFilterTableItemChanged(QListWidgetItem *item) void BrowserWnd::slotFilterTableItemChanged(QListWidgetItem *item)
{ {
QString tableName = item->text(); QString tableName = item->text();
addNewQuery(tableName); addNewQuery(tableName);
} }
void BrowserWnd::slotTabCloseRequested(int index) void BrowserWnd::slotTabCloseRequested(int index)
{ {
Query *q = qobject_cast<Query *>(m_ui->twQueries->widget(index)); Query *q = qobject_cast<Query *>(m_ui->twQueries->widget(index));
m_ui->twQueries->removeTab(index); m_ui->twQueries->removeTab(index);
if (!q) if (!q)
@@ -220,19 +198,16 @@ void BrowserWnd::slotTabCloseRequested(int index)
delete q; // It´s safe to delete nullptr; delete q; // It´s safe to delete nullptr;
} }
void BrowserWnd::slotShowWait(const QString &msg) void BrowserWnd::slotShowWait(const QString &msg)
{ {
m_waitWnd->wait(msg); m_waitWnd->wait(msg);
} }
void BrowserWnd::slotHideWait() void BrowserWnd::slotHideWait()
{ {
m_waitWnd->hide(); m_waitWnd->hide();
} }
void BrowserWnd::slotHeart() void BrowserWnd::slotHeart()
{ {
QWidget *w = new QWidget; QWidget *w = new QWidget;
@@ -246,6 +221,5 @@ void BrowserWnd::slotHeart()
l->setGraphicsEffect(shadow); l->setGraphicsEffect(shadow);
b->addWidget(l); b->addWidget(l);
w->setLayout(b); w->setLayout(b);
w->show(); w->show();
} }
@@ -6,7 +6,6 @@
#include <QtWidgets/QWidget> #include <QtWidgets/QWidget>
class QListWidgetItem; class QListWidgetItem;
class Query; class Query;
@@ -15,7 +14,6 @@ namespace Ui
class BrowserWnd; class BrowserWnd;
} }
class BrowserWnd: public QWidget class BrowserWnd: public QWidget
{ {
Q_OBJECT Q_OBJECT
@@ -49,7 +47,6 @@ private slots:
void slotConnectResult(const QString &); void slotConnectResult(const QString &);
void slotNewTableList(QStringList); void slotNewTableList(QStringList);
void slotHeart(); void slotHeart();
/*void slotSelectQueryResult(QString errorMsg, DataModel* dataModel); /*void slotSelectQueryResult(QString errorMsg, DataModel* dataModel);
void slotSelectQueryStatus(int percent); void slotSelectQueryStatus(int percent);
void slotQueryQuery(QString); // when the query widget starts a query....*/ void slotQueryQuery(QString); // when the query widget starts a query....*/
@@ -57,8 +54,6 @@ private slots:
/*void slotExecute(QString, QVariant, QModelIndex); /*void slotExecute(QString, QVariant, QModelIndex);
void slotExecuteQueryResult(bool success, QString msg, QVariant val, QModelIndex onThisPosition);*/ void slotExecuteQueryResult(bool success, QString msg, QVariant val, QModelIndex onThisPosition);*/
void slotAddNewQuery(); void slotAddNewQuery();
void slotShowWait(const QString &msg); void slotShowWait(const QString &msg);
void slotHideWait(); void slotHideWait();
@@ -14,7 +14,6 @@ else()
set(Qt6_Widgets "") set(Qt6_Widgets "")
endif() endif()
SET(my_SRCS SET(my_SRCS
main.cpp main.cpp
LoginWnd.cpp LoginWnd.cpp
@@ -46,7 +45,6 @@ SET(my_UICS
) )
set(CMAKE_AUTOUIC_SEARCH_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/ui) set(CMAKE_AUTOUIC_SEARCH_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/ui)
NGL_ADD_TOOL_ICON(my_SRCS "sql") NGL_ADD_TOOL_ICON(my_SRCS "sql")
NGL_WRAP_UI(my_SRCS ${my_UICS}) NGL_WRAP_UI(my_SRCS ${my_UICS})
NGL_ADD_EXECUTABLE(AAR SV WS NO_TRANSLATION sqlbrowser ${my_SRCS} ${my_UICS}) NGL_ADD_EXECUTABLE(AAR SV WS NO_TRANSLATION sqlbrowser ${my_SRCS} ${my_UICS})
@@ -9,7 +9,6 @@
//#define WAIT_FOR_IDLE while (!m_idle) { QThread::msleep(50); } (void)m_idle //#define WAIT_FOR_IDLE while (!m_idle) { QThread::msleep(50); } (void)m_idle
DataModel::DataModel(QObject *parent) // [M]VC DataModel::DataModel(QObject *parent) // [M]VC
: QAbstractTableModel(parent) : QAbstractTableModel(parent)
, m_idle(true) , m_idle(true)
@@ -28,19 +27,16 @@ DataModel::DataModel(QObject *parent) // [M]VC
// endResetModel(); // endResetModel();
//} //}
void DataModel::dataListReserve(const int size) void DataModel::dataListReserve(const int size)
{ {
m_newDataList.reserve(size); m_newDataList.reserve(size);
} }
void DataModel::addLine(const Data& data) void DataModel::addLine(const Data& data)
{ {
m_newDataList.append(data); m_newDataList.append(data);
} }
void DataModel::addColumn(const QString& columnName, QMetaType::Type type) void DataModel::addColumn(const QString& columnName, QMetaType::Type type)
{ {
// QPair<QString,QVariant::Type> pair; // QPair<QString,QVariant::Type> pair;
@@ -49,7 +45,6 @@ void DataModel::addColumn(const QString& columnName, QMetaType::Type type)
m_newHeaderList.append(QPair<QString,QMetaType::Type>(columnName, type)); m_newHeaderList.append(QPair<QString,QMetaType::Type>(columnName, type));
} }
void DataModel::slotSwapLists() // for threading.. void DataModel::slotSwapLists() // for threading..
{ {
m_dataList = m_newDataList; m_dataList = m_newDataList;
@@ -62,32 +57,27 @@ void DataModel::slotSwapLists() // for threading..
endResetModel(); endResetModel();
} }
void DataModel::setTableName(const QString &tableName) void DataModel::setTableName(const QString &tableName)
{ {
m_tableName = tableName; m_tableName = tableName;
setEditable(!m_tableName.isEmpty()); // editable items depend on wether it's a custom query, or a table list query setEditable(!m_tableName.isEmpty()); // editable items depend on wether it's a custom query, or a table list query
} }
QString DataModel::getTableName() const QString DataModel::getTableName() const
{ {
return m_tableName; return m_tableName;
} }
int DataModel::rowCount(const QModelIndex &parent) const int DataModel::rowCount(const QModelIndex &parent) const
{ {
return parent.isValid() ? 0 : m_dataList.count(); return parent.isValid() ? 0 : m_dataList.count();
} }
int DataModel::columnCount(const QModelIndex &parent) const int DataModel::columnCount(const QModelIndex &parent) const
{ {
return parent.isValid() ? 0 : m_headerList.count(); return parent.isValid() ? 0 : m_headerList.count();
} }
QVariant DataModel::data(const QModelIndex &index, int role) const QVariant DataModel::data(const QModelIndex &index, int role) const
{ {
if (index.row() >= m_dataList.count()) if (index.row() >= m_dataList.count())
@@ -127,7 +117,6 @@ QVariant DataModel::data(const QModelIndex &index, int role) const
return QVariant(); return QVariant();
} }
QVariant DataModel::headerData(int section, Qt::Orientation orientation, int role) const QVariant DataModel::headerData(int section, Qt::Orientation orientation, int role) const
{ {
if (orientation == Qt::Horizontal && section >= 0 && section < m_headerList.size()) if (orientation == Qt::Horizontal && section >= 0 && section < m_headerList.size())
@@ -145,7 +134,6 @@ QVariant DataModel::headerData(int section, Qt::Orientation orientation, int rol
return QAbstractTableModel::headerData(section, orientation, role); return QAbstractTableModel::headerData(section, orientation, role);
} }
void DataModel::setEditable(bool editable) void DataModel::setEditable(bool editable)
{ {
resetFlags(); resetFlags();
@@ -154,19 +142,16 @@ void DataModel::setEditable(bool editable)
m_flags |= Qt::ItemIsEditable; m_flags |= Qt::ItemIsEditable;
} }
const HeaderList& DataModel::getHeaderList() const const HeaderList& DataModel::getHeaderList() const
{ {
return m_headerList; return m_headerList;
} }
void DataModel::resetFlags() void DataModel::resetFlags()
{ {
m_flags = Qt::ItemIsSelectable | Qt::ItemIsEnabled; m_flags = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
} }
Qt::ItemFlags DataModel::flags(const QModelIndex &index) const Qt::ItemFlags DataModel::flags(const QModelIndex &index) const
{ {
Q_UNUSED(index); Q_UNUSED(index);
@@ -174,7 +159,6 @@ Qt::ItemFlags DataModel::flags(const QModelIndex &index) const
return m_flags; return m_flags;
} }
void DataModel::slotSetData(const QModelIndex &index, const QVariant &value) void DataModel::slotSetData(const QModelIndex &index, const QVariant &value)
{ {
Data row = m_dataList.at(index.row()); // get row from data list Data row = m_dataList.at(index.row()); // get row from data list
@@ -197,7 +181,6 @@ bool DataModel::setData(const QModelIndex &index, const QVariant &value, int rol
return false; // ALWAYS! as we need to wait for a result (which is async) return false; // ALWAYS! as we need to wait for a result (which is async)
} }
void DataModel::deleteLines(const QList<QModelIndex> &affectedRowsList) void DataModel::deleteLines(const QList<QModelIndex> &affectedRowsList)
{ {
if (affectedRowsList.isEmpty()) if (affectedRowsList.isEmpty())
@@ -2,13 +2,11 @@
#include <QtWidgets/QDialog> #include <QtWidgets/QDialog>
namespace Ui namespace Ui
{ {
class WaitWnd; class WaitWnd;
} }
class WaitWnd: public QDialog class WaitWnd: public QDialog
{ {
Q_OBJECT Q_OBJECT