- training_area_telegrams.cpp: Fixed QJsonObject initializer syntax (Qt6 requires {{}} not ({}))
- training_area_telegrams.cpp: Fixed fromJson() methods to access m_* members directly
- training_area_telegrams.cpp: Fixed brace mismatches in multiple toJson() methods
- training_area_telegrams.h: Changed Header struct to public members for consistency
- tx_mixin.cpp: Fixed getEquipmentNumber() template for direct member access
- lts_coordinate.cpp: Added missing #include <iomanip>
- MIGRATION_STATUS.md: Added migration progress tracking document
C++17 constraint enforced due to RTI Connext DDS 7.7.0 incompatibility with C++20+
Build status: BUILD_RTI=OFF successful (0 errors, warnings only)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
278 lines
5.9 KiB
C++
278 lines
5.9 KiB
C++
#pragma once
|
|
|
|
#include <Lts/Common/ProjectConfig/project_defines.h>
|
|
#include <LtsAppDescriptor/lts_app_descriptor.h>
|
|
#include <LtsSession/ltssessiondata_export.h>
|
|
#include <QtCore/QMap>
|
|
#include <QtCore/QObject>
|
|
#include <QtGui/QPixmap>
|
|
#include <QtCore/QSet>
|
|
#include <QtCore/QUrl>
|
|
#include <QtCore/QVariant>
|
|
#include <QtCore/qglobal.h>
|
|
|
|
namespace LtsSessionData
|
|
{
|
|
|
|
struct PartiesByExercise
|
|
{
|
|
int exerciseId = 0;
|
|
QVector<int> visibleParties;
|
|
};
|
|
|
|
class LTSSESSIONDATA_EXPORT LtsSessionData
|
|
{
|
|
public:
|
|
static LtsSessionData* getInstance();
|
|
|
|
// Presets:
|
|
const QString& getOperatorNamePreset() const
|
|
{
|
|
return m_operatorNamePreset;
|
|
}
|
|
|
|
const QString& getPasswordPreset() const
|
|
{
|
|
return m_passwordPreset;
|
|
}
|
|
|
|
void setOperatorPreset(const QString& operatorName, const QString& password)
|
|
{
|
|
m_operatorNamePreset = operatorName;
|
|
m_passwordPreset = password;
|
|
}
|
|
|
|
int getDomainIdPreset() const
|
|
{
|
|
return m_domainIdPreset;
|
|
}
|
|
|
|
void setDomainIdPreset(int domainIdPreset)
|
|
{
|
|
m_domainIdPreset = domainIdPreset;
|
|
}
|
|
|
|
QStringList getQosFile() const
|
|
{
|
|
return m_qosFile;
|
|
}
|
|
|
|
void setQosFile(const QStringList& qosFile)
|
|
{
|
|
m_qosFile = qosFile;
|
|
}
|
|
|
|
int getPartitionIdPreset() const
|
|
{
|
|
return m_partitionIdPreset;
|
|
}
|
|
|
|
IDL::PartitionType getPartitionTypePreset() const
|
|
{
|
|
return m_partitionTypePreset;
|
|
}
|
|
|
|
void setPartitionPreset(const int partitionId, IDL::PartitionType partitionType)
|
|
{
|
|
m_partitionIdPreset = partitionId;
|
|
m_partitionTypePreset = partitionType;
|
|
}
|
|
|
|
/**
|
|
* @brief removePresets IMPORTANT: call removePresets after using a Preset, otherwise other apps / sessions will
|
|
* pick these old Presets up..
|
|
*/
|
|
void removePresets();
|
|
|
|
// Other:
|
|
int getScriptId() const
|
|
{
|
|
return m_scriptId;
|
|
}
|
|
|
|
void setScriptId(int scriptId)
|
|
{
|
|
m_scriptId = scriptId;
|
|
}
|
|
|
|
int getOperatorId() const
|
|
{
|
|
return m_operatorId;
|
|
}
|
|
|
|
void setOperatorId(int operatorId)
|
|
{
|
|
m_operatorId = operatorId;
|
|
}
|
|
|
|
const QString& getOperatorName() const
|
|
{
|
|
return m_operatorName;
|
|
}
|
|
|
|
void setOperatorName(const QString& operatorName)
|
|
{
|
|
m_operatorName = operatorName;
|
|
}
|
|
|
|
const QSet<int>& getOperatorRights() const
|
|
{
|
|
return m_operatorRights;
|
|
}
|
|
|
|
void setOperatorRights(const QSet<int>& operatorRights)
|
|
{
|
|
m_operatorRights = operatorRights;
|
|
} // Todo: Emit newOperatorRights() if changed?
|
|
|
|
bool hasOperatorRight(int operatorRight) const;
|
|
|
|
const QPixmap& getProfilePicture() const
|
|
{
|
|
return m_profilePicture;
|
|
}
|
|
|
|
void setProfilePicture(const QPixmap& profilePicture)
|
|
{
|
|
m_profilePicture = profilePicture;
|
|
}
|
|
|
|
bool isVisibleParty(int exerciseId, int partyId) const;
|
|
|
|
const QVector<PartiesByExercise>& getVisibleParties() const
|
|
{
|
|
return m_visibleParties;
|
|
}
|
|
|
|
const QVector<int> getVisibleParties(int exerciseId) const;
|
|
|
|
void setVisibleParties(const QVector<PartiesByExercise>& visibleParties)
|
|
{
|
|
m_visibleParties = visibleParties;
|
|
}
|
|
|
|
QUrl getTcpConnectionUrl() const
|
|
{
|
|
return m_tcpConnectionUrl;
|
|
}
|
|
|
|
void setTcpConnectionUrl(const QUrl& tcpConnectionUrl)
|
|
{
|
|
m_tcpConnectionUrl = tcpConnectionUrl;
|
|
}
|
|
|
|
bool getShowTerminalWindow() const
|
|
{
|
|
return m_showTerminalWindow;
|
|
}
|
|
|
|
void setShowTerminalWindow(bool showTerminalWindow)
|
|
{
|
|
m_showTerminalWindow = showTerminalWindow;
|
|
}
|
|
|
|
LtsAppDescriptor::App getRequestedAppId() const
|
|
{
|
|
return m_requestedAppId;
|
|
}
|
|
|
|
void setRequestedAppId(LtsAppDescriptor::App requestedAppId)
|
|
{
|
|
m_requestedAppId = requestedAppId;
|
|
}
|
|
|
|
int getWorkstationId() const
|
|
{
|
|
return m_workstationId;
|
|
}
|
|
|
|
void setWorkstationId(int workstationId)
|
|
{
|
|
m_workstationId = workstationId;
|
|
}
|
|
|
|
bool isTablet() const
|
|
{
|
|
return m_isTablet;
|
|
}
|
|
|
|
void setAsTablet(bool isTablet = true);
|
|
|
|
bool getPlaceScriptScreens() const
|
|
{
|
|
return m_placeScriptScreens;
|
|
}
|
|
|
|
void setPlaceScriptScreens(bool placeScriptScreens)
|
|
{
|
|
m_placeScriptScreens = placeScriptScreens;
|
|
}
|
|
|
|
bool hasDebugFlag(const QString& debugFlag) const
|
|
{
|
|
return m_debugFlags.constEnd() != m_debugFlags.constFind(debugFlag);
|
|
}
|
|
|
|
QVariant debugFlagValue(const QString& debugFlag) const
|
|
{
|
|
QVariant result;
|
|
auto it = m_debugFlags.constFind(debugFlag);
|
|
if (it != m_debugFlags.constEnd())
|
|
result = *it;
|
|
return result;
|
|
}
|
|
|
|
void setDebugFlagValue(const QString& debugFlag, const QVariant& value)
|
|
{
|
|
m_debugFlags.insert(debugFlag, value);
|
|
}
|
|
|
|
const QMap<QString, QVariant>& debugFlags() const
|
|
{
|
|
return m_debugFlags;
|
|
}
|
|
|
|
void removeDebugFlag(const QString& debugFlag)
|
|
{
|
|
m_debugFlags.remove(debugFlag);
|
|
}
|
|
|
|
void clear();
|
|
void loggedOut();
|
|
|
|
private:
|
|
LtsSessionData();
|
|
~LtsSessionData() = default;
|
|
friend struct LtsSessionDataHandler;
|
|
|
|
// Presets to skip some Payloads
|
|
QString m_operatorNamePreset;
|
|
QString m_passwordPreset;
|
|
QStringList m_qosFile;
|
|
QUrl m_tcpConnectionUrl;
|
|
int m_domainIdPreset;
|
|
int m_partitionIdPreset;
|
|
IDL::PartitionType m_partitionTypePreset;
|
|
|
|
int m_operatorId;
|
|
int m_scriptId;
|
|
QString m_operatorName;
|
|
bool m_showTerminalWindow;
|
|
QSet<int> m_operatorRights;
|
|
QPixmap m_profilePicture;
|
|
QVector<PartiesByExercise> m_visibleParties;
|
|
QMap<QString, QVariant> m_debugFlags;
|
|
LtsAppDescriptor::App m_requestedAppId;
|
|
int m_workstationId;
|
|
bool m_isTablet;
|
|
bool m_placeScriptScreens;
|
|
};
|
|
|
|
static inline bool hasOperatorRight(int operatorRight)
|
|
{
|
|
auto instance = LtsSessionData::getInstance();
|
|
return instance->hasOperatorRight(operatorRight);
|
|
}
|
|
|
|
} // namespace LtsSessionData
|