Complete Qt6 migration: full clean build green across groups G1-G12 incl. runtime plugin set
new_docker_build.sh gains Group 12 (212 GUI/Data plugins); fixes LtsUtilsGuiDds visibility (LTO-stripped exports), LtsProjectionWorkstation unity name shadow, 6 unity-off dirs (dup file-scope statics, ddsftc INTERFACE sources) and reconfigures BUILD_FILTERMANAGEMENT/BUILD_PLUGINS_SERVICEMONITOR=ON
This commit is contained in:
1 parent
eb1d949edc
commit
815e16368e
1718 files changed
+126739
-18495
No files matched your search
+2
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "smo_equipment_error_registration_dialog.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include "ui_smo_equipment_error_registration_dialog.h"
|
||||
|
||||
#include "smo_equipment_error_registration_model.h"
|
||||
@@ -20,6 +21,7 @@ EquipmentErrorRegistrationDialog::EquipmentErrorRegistrationDialog(QWidget *pare
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_session(nullptr)
|
||||
, m_ui(new Ui::EquipmentErrorRegistrationDialog)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &EquipmentErrorRegistrationDialog::onPrint);
|
||||
|
||||
+11
-9
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "smo_equipment_error_registration_model.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
#include <ngltools/ngltools_dtg.h>
|
||||
|
||||
@@ -28,6 +29,7 @@ EquipmentErrorRegistrationModel::EquipmentErrorRegistrationModel(QObject *parent
|
||||
, m_chunksRequested(0)
|
||||
, m_chunksReceived(0)
|
||||
, m_session(nullptr)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -86,14 +88,14 @@ QVariant EquipmentErrorRegistrationModel::data(const QModelIndex &index, int rol
|
||||
void EquipmentErrorRegistrationModel::doEventRequests()
|
||||
{
|
||||
ExerciseManagement::Exercise ex = m_exmDtc->exercise(m_session->partitionId());
|
||||
int64_t startTime = ex.beginTime();
|
||||
const int64_t endTime = ex.stopTime() > 0 ? ex.stopTime() : m_session->partitionTime();
|
||||
int64_t startTime = ex.beginTime;
|
||||
const int64_t endTime = ex.stopTime > 0 ? ex.stopTime : m_session->partitionTime();
|
||||
|
||||
while (startTime < endTime)
|
||||
{
|
||||
int64_t reqEnd = ((startTime + 24 * 60 * 60 * 1000) > endTime ? endTime : startTime + 24 * 60 * 60 * 1000);
|
||||
|
||||
m_requests += m_eemForeign->requestData(startTime, reqEnd, {ProjectDataManagement::PdmEventType::EventType_EquipmentErrorReport});
|
||||
m_requests += m_eemForeign->requestData(startTime, reqEnd, {static_cast<int>(ProjectDataManagement::PdmEventType::EventType_EquipmentErrorReport)});
|
||||
|
||||
|
||||
startTime += (24 * 60 * 60 * 1000) + 1;
|
||||
@@ -104,10 +106,10 @@ void EquipmentErrorRegistrationModel::doEventRequests()
|
||||
static inline EquipmentErrorRegistrationEntry event2Entry(const ExerciseEventManagement::Event &event)
|
||||
{
|
||||
EquipmentErrorRegistrationEntry entry;
|
||||
const QJsonObject obj = QJsonDocument::fromJson(QByteArray::fromRawData(event.properties().c_str(),
|
||||
event.properties().size())).object();
|
||||
entry.equipmentNumber = event.equipmentNumber();
|
||||
entry.sampleTime = event.sampleTime();
|
||||
const QJsonObject obj = QJsonDocument::fromJson(QByteArray::fromRawData(event.properties.c_str(),
|
||||
event.properties.size())).object();
|
||||
entry.equipmentNumber = event.equipmentNumber;
|
||||
entry.sampleTime = event.sampleTime;
|
||||
entry.participant = obj[QStringLiteral("participant")].toString();
|
||||
entry.device = obj[QStringLiteral("device")].toString();
|
||||
entry.text = obj[QStringLiteral("text")].toString();
|
||||
@@ -133,9 +135,9 @@ void EquipmentErrorRegistrationModel::onRequestedDataAvailable(TimeLineManagemen
|
||||
|
||||
void EquipmentErrorRegistrationModel::onLiveEvent(const ExerciseEventManagement::Event &ev)
|
||||
{
|
||||
if (ev.eventTypeId() != ProjectDataManagement::PdmEventType::EventType_EquipmentErrorReport)
|
||||
if (ev.eventTypeId != ProjectDataManagement::PdmEventType::EventType_EquipmentErrorReport)
|
||||
return;
|
||||
INFO_LOG(m_logger) << "Event EquipmentNumber=" << ev.equipmentNumber();
|
||||
INFO_LOG(m_logger) << "Event EquipmentNumber=" << ev.equipmentNumber;
|
||||
insertRow(event2Entry(ev));
|
||||
|
||||
emit chunksUpdated(m_chunksReceived, m_chunksRequested);
|
||||
|
||||
+2
-2
@@ -3,9 +3,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ExerciseManagement/exm_data_plugin.h>
|
||||
#include <Plugins/ExerciseManagement/Data/exm_data_plugin.h>
|
||||
#include <ParticipantManagement/Data/ppm_data_plugin.h>
|
||||
#include <ProjectDataManagement/pdm_data_plugin.h>
|
||||
#include <Plugins/ProjectDataManagement/Data/pdm_data_plugin.h>
|
||||
#include <Timeline/tln_data_plugin_interface.h>
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
+2
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "smo_hgr_and_mine_search_dialog.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include "ui_smo_hgr_and_mine_search_dialog.h"
|
||||
|
||||
#include "smo_hgr_and_mine_search_model.h"
|
||||
@@ -23,6 +24,7 @@ HgrAndMineSearchDialog::HgrAndMineSearchDialog(QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_session(nullptr)
|
||||
, m_ui(new Ui::HgrAndMineSearchDialog)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &HgrAndMineSearchDialog::onPrint);
|
||||
|
||||
+2
-2
@@ -11,9 +11,9 @@
|
||||
#include <ExerciseManagement/exm_data_plugin_interface.h>
|
||||
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
|
||||
#include <ProjectDataManagement/pdm_data_plugin.h>
|
||||
#include <Plugins/ProjectDataManagement/Data/pdm_data_plugin.h>
|
||||
#include <Timeline/tln_data_plugin_interface.h>
|
||||
#include <AreaEffectSimulation/aes_data_plugin.h>
|
||||
#include <Plugins/AreaEffectSimulation/Data/aes_data_plugin.h>
|
||||
|
||||
namespace ServiceMonitor
|
||||
{
|
||||
|
||||
+44
-42
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "smo_hgr_and_mine_search_model.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <utility>
|
||||
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
@@ -44,6 +45,7 @@ HgrAndMineSearchModel::HgrAndMineSearchModel(QObject *parent)
|
||||
, m_chunksRequested(0)
|
||||
, m_chunksReceived(0)
|
||||
, m_session(nullptr)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
{}
|
||||
|
||||
bool HgrAndMineSearchModel::initModel(LtsSession::LtsSession *session,
|
||||
@@ -181,9 +183,9 @@ QVariant HgrAndMineSearchModel::data(const QModelIndex &index, int role) const
|
||||
case EventType:
|
||||
return ProjectDataManagement::toString(entry.type);
|
||||
case EventPosition:
|
||||
if (entry.pos.lon() == 0 || entry.pos.lat() == 0 || std::isnan(entry.pos.lon()))
|
||||
if (entry.pos.lon == 0 || entry.pos.lat == 0 || std::isnan(entry.pos.lon))
|
||||
return QStringLiteral("---");
|
||||
return LtsCoordTrans::mgrsFromGeographic(entry.pos.lon(), entry.pos.lat());
|
||||
return LtsCoordTrans::mgrsFromGeographic(entry.pos.lon, entry.pos.lat);
|
||||
case EventTime:
|
||||
return QDateTime::fromMSecsSinceEpoch(entry.timeStamp);
|
||||
case EventSource:
|
||||
@@ -199,10 +201,10 @@ QVariant HgrAndMineSearchModel::data(const QModelIndex &index, int role) const
|
||||
QString vulnerabilityState = tr("All Types");
|
||||
if (entry.vbg>=0)
|
||||
{
|
||||
ParticipantManagement::TypeClass typeClass = m_ppmDtc->type(m_ppmDtc->participant(entry.participantId).typeId()).typeClass();
|
||||
ParticipantManagement::TypeClass typeClass = m_ppmDtc->type(m_ppmDtc->participant(entry.participantId).typeId).typeClass;
|
||||
const ProjectDataManagement::VulnerabilityClass vc = typeClass == ParticipantManagement::TypeClass::Human ?
|
||||
ProjectDataManagement::VulnerabilityClass::SoldierInjuries :
|
||||
ProjectDataManagement::VulnerabilityClass::VehicleDamages;
|
||||
ProjectDataManagement::VulnerabilityClass::VulnerabilityClass_SoldierInjuries :
|
||||
ProjectDataManagement::VulnerabilityClass::VulnerabilityClass_VehicleDamages;
|
||||
ProjectDataManagement::VulnerabilityState vs = static_cast<ProjectDataManagement::VulnerabilityState>(entry.vbg);
|
||||
vulnerabilityState = ProjectDataManagement::toString(vs, vc);
|
||||
}
|
||||
@@ -216,7 +218,7 @@ QVariant HgrAndMineSearchModel::data(const QModelIndex &index, int role) const
|
||||
switch (index.column())
|
||||
{
|
||||
case EventType:
|
||||
return entry.type.underlying();
|
||||
return static_cast<int>(entry.type);
|
||||
case EventParty:
|
||||
return entry.party;
|
||||
default:
|
||||
@@ -235,10 +237,10 @@ QPointF HgrAndMineSearchModel::position(const QModelIndex &index) const
|
||||
|
||||
const Core::GeoPosition pos = m_vecData.at(index.row()).pos;
|
||||
|
||||
if (pos.lon() == 0 || pos.lat() == 0 || std::isnan(pos.lon()))
|
||||
if (pos.lon == 0 || pos.lat == 0 || std::isnan(pos.lon))
|
||||
return QPointF();
|
||||
|
||||
return {pos.lon(), pos.lat()};
|
||||
return {pos.lon, pos.lat};
|
||||
}
|
||||
|
||||
void HgrAndMineSearchModel::onEquipmentSystemEventDataReply(const Core::FunctionReplyObject &replyObject)
|
||||
@@ -249,14 +251,14 @@ void HgrAndMineSearchModel::onEquipmentSystemEventDataReply(const Core::Function
|
||||
{
|
||||
auto cb = [this, &replyObject](const ParticipantManagement::EquipmentSystemEventFtcReply &event)
|
||||
{
|
||||
if (event.filterId() != replyObject.id())
|
||||
if (event.filterId != replyObject.id())
|
||||
return;
|
||||
HgrAndMineSearchEntry entry;
|
||||
|
||||
entry.type = ProjectDataManagement::HgrMineSearchFilterType(ProjectDataManagement::HgrMineSearchFilterType::Handgrenade);
|
||||
entry.pos = event.position();
|
||||
entry.timeStamp = event.timeStamp();
|
||||
entry.source = event.equipmentNumber();
|
||||
entry.pos = event.position;
|
||||
entry.timeStamp = event.timeStamp;
|
||||
entry.source = event.equipmentNumber;
|
||||
entry.participantId = 0;
|
||||
entry.party = 0;
|
||||
entry.vbg = 0;
|
||||
@@ -283,20 +285,20 @@ void HgrAndMineSearchModel::onRequestedDataAvailable(TimeLineManagement::Timelin
|
||||
HgrAndMineSearchEntry entry;
|
||||
for (const auto &event : events)
|
||||
{
|
||||
const QJsonObject obj = QJsonDocument::fromJson(QByteArray::fromRawData(event.properties().c_str(),
|
||||
event.properties().size())).object();
|
||||
const QJsonObject obj = QJsonDocument::fromJson(QByteArray::fromRawData(event.properties.c_str(),
|
||||
event.properties.size())).object();
|
||||
entry.type = m_evtFlt.value(obj.value(QStringLiteral("OriginatorChargeTypeId")).toInt());
|
||||
|
||||
if (entry.type == ProjectDataManagement::HgrMineSearchFilterType::Mine)
|
||||
continue;
|
||||
|
||||
entry.pos = event.position();
|
||||
entry.timeStamp = event.sampleTime();
|
||||
entry.source = event.equipmentNumber();
|
||||
entry.participantId = event.participantId();
|
||||
entry.party = event.partyId();
|
||||
entry.pos = event.position;
|
||||
entry.timeStamp = event.sampleTime;
|
||||
entry.source = event.equipmentNumber;
|
||||
entry.participantId = event.participantId;
|
||||
entry.party = event.partyId;
|
||||
entry.vbg = obj.value(QStringLiteral("VulnerabilityState")).toInt();
|
||||
entry.properties = QString::fromUtf8(event.properties().c_str());
|
||||
entry.properties = QString::fromUtf8(event.properties.c_str());
|
||||
|
||||
insertRow(entry);
|
||||
}
|
||||
@@ -307,22 +309,22 @@ void HgrAndMineSearchModel::onRequestedDataAvailable(TimeLineManagement::Timelin
|
||||
void HgrAndMineSearchModel::doEquipmentSystemEventRequests()
|
||||
{
|
||||
ExerciseManagement::Exercise ex = m_exmDtc->exercise(m_session->exerciseId());
|
||||
int64_t start = ex.beginTime();
|
||||
int64_t end = m_session->partitionTime() < ex.endTime() ? m_session->partitionTime() : ex.endTime();
|
||||
int64_t start = ex.beginTime;
|
||||
int64_t end = m_session->partitionTime() < ex.endTime ? m_session->partitionTime() : ex.endTime;
|
||||
|
||||
while (start < end)
|
||||
{
|
||||
ParticipantManagement::EquipmentSystemEventDataRequest req;
|
||||
int64_t reqEnd = ((start + 24 * 60 * 60 * 1000) > end ? end : start + 24 * 60 * 60 * 1000);
|
||||
|
||||
req.startTime(start);
|
||||
req.endTime(reqEnd);
|
||||
req.startTime = start;
|
||||
req.endTime = reqEnd;
|
||||
|
||||
for (const auto &filter : std::as_const(m_equipSysEvtFlt))
|
||||
{
|
||||
req.equipmentFunctionId(filter.equipmentFunctionId());
|
||||
req.subDeviceId(filter.subDeviceId());
|
||||
req.deviceSpecificEventCode(filter.deviceSpecificCode());
|
||||
req.equipmentFunctionId = filter.equipmentFunctionId;
|
||||
req.subDeviceId = filter.subDeviceId;
|
||||
req.deviceSpecificEventCode = filter.deviceSpecificCode;
|
||||
|
||||
m_ppmFtc->equipmentSystemEventDataRequest(req, this);
|
||||
|
||||
@@ -337,8 +339,8 @@ void HgrAndMineSearchModel::doEquipmentSystemEventRequests()
|
||||
void HgrAndMineSearchModel::doEventRequests()
|
||||
{
|
||||
ExerciseManagement::Exercise ex = m_exmDtc->exercise(m_session->partitionId());
|
||||
int64_t startTime = ex.beginTime();
|
||||
const int64_t endTime = ex.stopTime() > 0 ? ex.stopTime() : m_session->partitionTime();
|
||||
int64_t startTime = ex.beginTime;
|
||||
const int64_t endTime = ex.stopTime > 0 ? ex.stopTime : m_session->partitionTime();
|
||||
while (startTime < endTime)
|
||||
{
|
||||
int64_t reqEnd = ((startTime + 24 * 60 * 60 * 1000) > endTime ? endTime : startTime + 24 * 60 * 60 * 1000);
|
||||
@@ -347,9 +349,9 @@ void HgrAndMineSearchModel::doEventRequests()
|
||||
arr += QJsonValue(it.key());
|
||||
const QJsonObject filter({{QStringLiteral("OriginatorChargeTypeId"), arr}});
|
||||
|
||||
m_requests += m_eemForeign->requestData(startTime, reqEnd, {ProjectDataManagement::PdmEventType::EventType_Hit,
|
||||
ProjectDataManagement::PdmEventType::EventType_HitEffectSimulation,
|
||||
ProjectDataManagement::PdmEventType::EventType_HitMine}, filter);
|
||||
m_requests += m_eemForeign->requestData(startTime, reqEnd, {static_cast<int>(ProjectDataManagement::PdmEventType::EventType_Hit),
|
||||
static_cast<int>(ProjectDataManagement::PdmEventType::EventType_HitEffectSimulation),
|
||||
static_cast<int>(ProjectDataManagement::PdmEventType::EventType_HitMine)}, filter);
|
||||
|
||||
|
||||
startTime += (24 * 60 * 60 * 1000) + 1;
|
||||
@@ -372,16 +374,16 @@ void HgrAndMineSearchModel::doInsertMines()
|
||||
if (!mineAreas.contains(it.key()))
|
||||
mineAreas.insert(it.key(), m_aesDtc->mineArea(it.key()));
|
||||
|
||||
const std::vector<AreaEffectSimulation::DusMine> mines = it.value().mines();
|
||||
entry.party = mineAreas.value(it.key()).partyId().is_set() ? mineAreas.value(it.key()).partyId().get() : 0;
|
||||
const std::vector<AreaEffectSimulation::DusMine> mines = it.value().mines;
|
||||
entry.party = mineAreas.value(it.key()).partyId.has_value() ? mineAreas.value(it.key()).partyId.get() : 0;
|
||||
|
||||
for (const AreaEffectSimulation::DusMine ¤tMine : mines)
|
||||
{
|
||||
properties.insert(tr("Mine-ID"), currentMine.eqId());
|
||||
properties.insert(tr("Mine-ID"), currentMine.eqId);
|
||||
|
||||
entry.properties = QString::fromUtf8(QJsonDocument(properties).toJson(QJsonDocument::Compact));
|
||||
entry.pos.lon(currentMine.position().lon());
|
||||
entry.pos.lat(currentMine.position().lat());
|
||||
entry.pos.lon = currentMine.position.lon;
|
||||
entry.pos.lat = currentMine.position.lat;
|
||||
|
||||
insertRow(entry);
|
||||
}
|
||||
@@ -396,7 +398,7 @@ void HgrAndMineSearchModel::loadFilterSettings()
|
||||
|
||||
auto cb = [this](const ProjectDataManagement::EventFilterHgrMineSearch &filter)
|
||||
{
|
||||
m_evtFlt.insert(filter.chargeTypeId(), filter.hgrMineSearchFilterType());
|
||||
m_evtFlt.insert(filter.chargeTypeId, filter.hgrMineSearchFilterType);
|
||||
};
|
||||
m_pdmDtc->eventFilterHgrMineSearchs(cb);
|
||||
}
|
||||
@@ -457,7 +459,7 @@ QIcon HgrAndMineSearchModel::iconFromPartyId(int partyId) const
|
||||
auto it = m_partyIcons.find(partyId);
|
||||
if (it != m_partyIcons.end())
|
||||
return it.value();
|
||||
const QRgb col = QRgb(m_ppmDtc->party(partyId).color());
|
||||
const QRgb col = QRgb(m_ppmDtc->party(partyId).color);
|
||||
const QIcon icon = m_ppmGuiCbxIfc->pixmapFromParty(col);
|
||||
m_partyIcons.insert(partyId, icon);
|
||||
return icon;
|
||||
@@ -468,7 +470,7 @@ QVariant HgrAndMineSearchModel::stringFromPartyId(int partyId) const
|
||||
auto it = m_partyNames.find(partyId);
|
||||
if (it != m_partyNames.end())
|
||||
return it.value();
|
||||
const QString name = ParticipantManagement::trPartyName(m_ppmDtc->party(partyId).name());
|
||||
const QString name = ParticipantManagement::trPartyName(m_ppmDtc->party(partyId).name);
|
||||
m_partyNames.insert(partyId, name);
|
||||
return name;
|
||||
}
|
||||
@@ -484,7 +486,7 @@ void HgrAndMineSearchModel::onUpdateComboboxFilterData()
|
||||
cfc.data.reserve(types.size());
|
||||
for (const auto typeId : types)
|
||||
{
|
||||
cfd.data = typeId;
|
||||
cfd.data = static_cast<int>(typeId);
|
||||
cfd.text = ProjectDataManagement::toString(typeId);
|
||||
cfc.data.push_back(cfd);
|
||||
}
|
||||
@@ -499,7 +501,7 @@ void HgrAndMineSearchModel::onUpdateComboboxFilterData()
|
||||
for (const int i : std::as_const(availablePartyIds))
|
||||
{
|
||||
cfd.data = i;
|
||||
cfd.text = ParticipantManagement::trPartyName(m_ppmDtc->party(i).name());
|
||||
cfd.text = ParticipantManagement::trPartyName(m_ppmDtc->party(i).name);
|
||||
cfd.icon = iconFromPartyId(i);
|
||||
cfc.data.push_back(cfd);
|
||||
}
|
||||
|
||||
+4
-4
@@ -3,12 +3,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ExerciseManagement/exm_data_plugin.h>
|
||||
#include <Plugins/ExerciseManagement/Data/exm_data_plugin.h>
|
||||
#include <ParticipantManagement/Data/ppm_data_plugin.h>
|
||||
#include <ProjectDataManagement/pdm_data_plugin.h>
|
||||
#include <Plugins/ProjectDataManagement/Data/pdm_data_plugin.h>
|
||||
#include <Timeline/tln_data_plugin_interface.h>
|
||||
#include <ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
|
||||
#include <AreaEffectSimulation/aes_data_plugin.h>
|
||||
#include <Plugins/AreaEffectSimulation/Data/aes_data_plugin.h>
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
@@ -19,7 +19,7 @@ namespace ServiceMonitor
|
||||
{
|
||||
struct HgrAndMineSearchEntry
|
||||
{
|
||||
ProjectDataManagement::HgrMineSearchFilterType type = ProjectDataManagement::HgrMineSearchFilterType_Unknown;
|
||||
ProjectDataManagement::HgrMineSearchFilterType type = ProjectDataManagement::HgrMineSearchFilterType::HgrMineSearchFilterType_Unknown;
|
||||
Core::GeoPosition pos;
|
||||
int64_t timeStamp = -1;
|
||||
int32_t source = -1;
|
||||
|
||||
+11
-11
@@ -86,8 +86,8 @@ void BaseEquipmentCheck::sendBiteRequest(const std::vector<int> &selectedIds,
|
||||
return;
|
||||
|
||||
ParticipantManagement::CallBiteRequest req;
|
||||
req.participantIds(selectedIds);
|
||||
req.withSelfTest(bWithSelfTest);
|
||||
req.participantIds = selectedIds;
|
||||
req.withSelfTest = bWithSelfTest;
|
||||
m_requestHelper->startSingleRequest([req, this]() { return m_ppmFtc->callBiteRequest(req, this); });
|
||||
|
||||
for (int id : selectedIds)
|
||||
@@ -110,12 +110,12 @@ void BaseEquipmentCheck::sendInitRequest(const std::vector<int> &selectedIds,
|
||||
if (!resetManipulation && !restockCharges && !resetVulnerabilityState)
|
||||
return;
|
||||
ParticipantManagement::InitParticipantRequest req;
|
||||
req.workstationId(LtsSessionData::LtsSessionData::getInstance()->getWorkstationId());
|
||||
req.participantIds(selectedIds);
|
||||
req.resetManipulation(resetManipulation);
|
||||
req.restockCharges(restockCharges);
|
||||
req.resetVulnerabilityState(resetVulnerabilityState);
|
||||
req.restockSanitationMaterial(restockSanMat);
|
||||
req.workstationId = LtsSessionData::LtsSessionData::getInstance()->getWorkstationId();
|
||||
req.participantIds = selectedIds;
|
||||
req.resetManipulation = resetManipulation;
|
||||
req.restockCharges = restockCharges;
|
||||
req.resetVulnerabilityState = resetVulnerabilityState;
|
||||
req.restockSanitationMaterial = restockSanMat;
|
||||
m_requestHelper->startSingleRequest([req, this]() { return m_ppmFtc->initParticipantRequest(req, this); });
|
||||
}
|
||||
|
||||
@@ -123,9 +123,9 @@ void BaseEquipmentCheck::sendModifyState(const std::vector<int> &selectedIds,
|
||||
ProjectDataManagement::VulnerabilityState vs)
|
||||
{
|
||||
ParticipantManagement::ModifyStateRequest req;
|
||||
req.workstationId(LtsSessionData::LtsSessionData::getInstance()->getWorkstationId());
|
||||
req.participantIds(selectedIds);
|
||||
req.vulnerabilityState(vs);
|
||||
req.workstationId = LtsSessionData::LtsSessionData::getInstance()->getWorkstationId();
|
||||
req.participantIds = selectedIds;
|
||||
req.vulnerabilityState = vs;
|
||||
m_requestHelper->startSingleRequest([req, this]() { return m_ppmFtc->modifyStateRequest(req, this); });
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -4,6 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <ParticipantManagement/ppm_ftc.h>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
+98
-96
@@ -8,6 +8,7 @@
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
#include <LtsUtils/LtsUtilsCore/outdated_position.h>
|
||||
#include <LtsUtils/LtsUtilsCore/variant_operators.h>
|
||||
#include <ProjectDataManagement/pdm_to_string.h>
|
||||
#include <ProjectDataManagement/pdm_translation.h>
|
||||
#include <ParticipantManagement/ppm_translation.h>
|
||||
@@ -52,6 +53,7 @@ BasePlayerModel::BasePlayerModel(QObject *parent)
|
||||
, m_timeoutCheckTimer(new QTimer(this))
|
||||
, m_positionAgeTimer(new QTimer(this))
|
||||
, m_session(nullptr)
|
||||
, m_logger(getLogger("BasePlayerModel"))
|
||||
{
|
||||
m_timeoutCheckTimer->setSingleShot(false);
|
||||
connect(m_timeoutCheckTimer, &QTimer::timeout,
|
||||
@@ -167,22 +169,22 @@ QVariant BasePlayerModel::headerData(int section, Qt::Orientation orientation, i
|
||||
auto fill = [&cfc, this](ProjectDataManagement::VulnerabilityState state, const QIcon &icon)
|
||||
{
|
||||
LtsWidgets::ComboboxFilterData cfd;
|
||||
cfd.data = state.underlying();
|
||||
cfd.data = static_cast<int>(state);
|
||||
cfd.text = vulnerabilityStateString(ParticipantManagement::TypeClass::Human, state);
|
||||
cfd.icon = icon;
|
||||
cfc.data.push_back(std::move(cfd));
|
||||
};
|
||||
|
||||
fill(ProjectDataManagement::VulnerabilityState::CombatReady, m_tactStatusGreen);
|
||||
fill(ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady, m_tactStatusGreen);
|
||||
{
|
||||
LtsWidgets::ComboboxFilterData cfd;
|
||||
cfd.data = ProjectDataManagement::VulnerabilityState::LightDamage;
|
||||
cfd.data = static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_LightDamage);
|
||||
cfd.text = tr("Wounded / Damaged");
|
||||
cfd.icon = m_tactStatusYellow;
|
||||
cfc.data.push_back(std::move(cfd));
|
||||
}
|
||||
fill(ProjectDataManagement::VulnerabilityState::CatastrophicKill, m_tactStatusRed);
|
||||
fill(ProjectDataManagement::VulnerabilityState::NotReady, m_tactStatusOrange);
|
||||
fill(ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill, m_tactStatusRed);
|
||||
fill(ProjectDataManagement::VulnerabilityState::VulnerabilityState_NotReady, m_tactStatusOrange);
|
||||
|
||||
return cfc.toVariant();
|
||||
}
|
||||
@@ -211,7 +213,7 @@ QVariant BasePlayerModel::headerData(int section, Qt::Orientation orientation, i
|
||||
for (const int typeId : m_usedTypeIds)
|
||||
{
|
||||
cfd.data = typeId;
|
||||
cfd.text = ParticipantManagement::trTypeName(m_types.value(typeId).name());
|
||||
cfd.text = ParticipantManagement::trTypeName(m_types.value(typeId).name);
|
||||
cfc.data.push_back(cfd);
|
||||
}
|
||||
cfc.sortItems = true;
|
||||
@@ -243,7 +245,7 @@ QVariant BasePlayerModel::data(const QModelIndex &index, int role) const
|
||||
return decorationData(index, data.participantId);
|
||||
case ColTacticalStatus:
|
||||
{
|
||||
switch (data.vulnerabilityState.underlying())
|
||||
switch (data.vulnerabilityState)
|
||||
{
|
||||
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_NotReady:
|
||||
return m_tactStatusOrange;
|
||||
@@ -341,16 +343,16 @@ QVariant BasePlayerModel::data(const QModelIndex &index, int role) const
|
||||
return data.partyId;
|
||||
case ColTacticalStatus:
|
||||
{
|
||||
switch (data.vulnerabilityState.underlying())
|
||||
switch (data.vulnerabilityState)
|
||||
{
|
||||
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_NotReady:
|
||||
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady:
|
||||
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill:
|
||||
return data.vulnerabilityState.underlying();
|
||||
return static_cast<int>(data.vulnerabilityState);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ProjectDataManagement::VulnerabilityState::LightDamage;
|
||||
return static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_LightDamage);
|
||||
}
|
||||
case ColPosition:
|
||||
return data.isOutdated;
|
||||
@@ -366,7 +368,7 @@ QVariant BasePlayerModel::data(const QModelIndex &index, int role) const
|
||||
|
||||
QString BasePlayerModel::getBitResult(const ParticipantManagement::Bite &bite, int equipmnetNumber) const
|
||||
{
|
||||
if (bite.equipmentNumber() != equipmnetNumber)
|
||||
if (bite.equipmentNumber != equipmnetNumber)
|
||||
return QString();
|
||||
const QString bitErrors = m_biteModel->getBitErrors(bite);
|
||||
return (bitErrors.isEmpty() ? tr("Ok") : bitErrors);
|
||||
@@ -374,9 +376,9 @@ QString BasePlayerModel::getBitResult(const ParticipantManagement::Bite &bite, i
|
||||
|
||||
QString BasePlayerModel::getBiteWarnings(const ParticipantManagement::Bite &bite, int equipmnetNumber) const
|
||||
{
|
||||
if (bite.equipmentNumber() != equipmnetNumber)
|
||||
if (bite.equipmentNumber != equipmnetNumber)
|
||||
return QString();
|
||||
const QString s1(m_biteModel->getLowBattery(bite.batteryState()));
|
||||
const QString s1(m_biteModel->getLowBattery(bite.batteryState));
|
||||
const QString s2(m_biteModel->getComponents(bite));
|
||||
|
||||
QStringList ret;
|
||||
@@ -384,7 +386,7 @@ QString BasePlayerModel::getBiteWarnings(const ParticipantManagement::Bite &bite
|
||||
ret << s1;
|
||||
if (!s2.isEmpty())
|
||||
ret << s2;
|
||||
if (bite.configError())
|
||||
if (bite.configError)
|
||||
ret << tr("Config Error");
|
||||
return ret.isEmpty() ? QStringLiteral("-") : ret.join(QStringLiteral(", "));
|
||||
}
|
||||
@@ -392,12 +394,12 @@ QString BasePlayerModel::getBiteWarnings(const ParticipantManagement::Bite &bite
|
||||
QString BasePlayerModel::getPositionString(const ParticipantManagement::ParticipantPosition &position,
|
||||
int participantId) const
|
||||
{
|
||||
if (position.participantId() != participantId)
|
||||
if (position.participantId != participantId)
|
||||
return QStringLiteral("-");
|
||||
QString mgrs = LtsCoordTrans::mgrsFromGeographic(position.pos().lon(),
|
||||
position.pos().lat());
|
||||
if (!qFuzzyIsNull(position.pos().z()))
|
||||
mgrs.append(QStringLiteral(" ") + QString::number(position.pos().z(), 'f', 2));
|
||||
QString mgrs = LtsCoordTrans::mgrsFromGeographic(position.pos.lon,
|
||||
position.pos.lat);
|
||||
if (!qFuzzyIsNull(position.pos.z))
|
||||
mgrs.append(QStringLiteral(" ") + QString::number(position.pos.z, 'f', 2));
|
||||
return mgrs;
|
||||
}
|
||||
|
||||
@@ -495,10 +497,10 @@ void BasePlayerModel::onDynamicParticipantChanged(const ParticipantManagement::D
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "**** onDynamicParticipantChanged: " << data;
|
||||
|
||||
int row = findRowForId(data.participantId());
|
||||
int row = findRowForId(data.participantId);
|
||||
if (row < 0)
|
||||
{
|
||||
row = findRowForId(-data.participantId());
|
||||
row = findRowForId(-data.participantId);
|
||||
if (row < 0)
|
||||
return;
|
||||
if (modType == DataModification::eAdded)
|
||||
@@ -512,9 +514,9 @@ void BasePlayerModel::onDynamicParticipantChanged(const ParticipantManagement::D
|
||||
{
|
||||
PlayerData playerData = getRowData(row);
|
||||
const auto oldSymbol = playerData.symbolStr;
|
||||
playerData.isManipulated = data.manipulation().size();
|
||||
playerData.isManipulated = data.manipulation.size();
|
||||
const auto tactStatus = getTacticalStatus(data);
|
||||
playerData.vulnerabilityState = tactStatus.vulnerabilityState();
|
||||
playerData.vulnerabilityState = tactStatus.vulnerabilityState;
|
||||
playerData.vulnerabilityStateStr = vulnerabilityStateString(playerData.typeClass,
|
||||
playerData.vulnerabilityState);
|
||||
|
||||
@@ -540,59 +542,59 @@ void BasePlayerModel::onParticipantChanged(const ParticipantManagement::Particip
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
int row = -1;
|
||||
auto it = m_participants.find(participant.id());
|
||||
auto it = m_participants.find(participant.id);
|
||||
if (it == m_participants.end())
|
||||
{
|
||||
if (participant.equipmentNumber().is_set())
|
||||
row = findRowForId(-participant.equipmentNumber().get());
|
||||
if (participant.equipmentNumber.has_value())
|
||||
row = findRowForId(-participant.equipmentNumber.get());
|
||||
if (row < 0)
|
||||
{
|
||||
|
||||
m_participants.insert(participant.id(), participant);
|
||||
m_participants.insert(participant.id, participant);
|
||||
return;
|
||||
}
|
||||
it = m_participants.insert(participant.id(), ParticipantManagement::Participant());
|
||||
it = m_participants.insert(participant.id, ParticipantManagement::Participant());
|
||||
}
|
||||
|
||||
const auto old = it.value();
|
||||
it.value() = participant;
|
||||
|
||||
if (row < 0)
|
||||
row = findRowForId(participant.id());
|
||||
if (row < 0 && participant.equipmentNumber().is_set())
|
||||
row = findRowForId(-participant.equipmentNumber().get());
|
||||
row = findRowForId(participant.id);
|
||||
if (row < 0 && participant.equipmentNumber.has_value())
|
||||
row = findRowForId(-participant.equipmentNumber.get());
|
||||
if (row < 0)
|
||||
return;
|
||||
|
||||
if (old.equipmentNumber() != participant.equipmentNumber() ||
|
||||
old.partyId() != participant.partyId() ||
|
||||
old.superiorId() != participant.superiorId() ||
|
||||
old.designator() != participant.designator() ||
|
||||
old.tacticalIdentifier() != participant.tacticalIdentifier() ||
|
||||
old.info() != participant.info() ||
|
||||
old.symbol() != participant.symbol() ||
|
||||
old.identification() != participant.identification())
|
||||
if (old.equipmentNumber != participant.equipmentNumber ||
|
||||
old.partyId != participant.partyId ||
|
||||
old.superiorId != participant.superiorId ||
|
||||
old.designator != participant.designator ||
|
||||
old.tacticalIdentifier != participant.tacticalIdentifier ||
|
||||
old.info != participant.info ||
|
||||
old.symbol != participant.symbol ||
|
||||
old.identification != participant.identification)
|
||||
{
|
||||
const auto party = m_parties.value(participant.partyId());
|
||||
const auto type = m_types.value(participant.typeId());
|
||||
const auto party = m_parties.value(participant.partyId);
|
||||
const auto type = m_types.value(participant.typeId);
|
||||
PlayerData &data = m_vecData[row];
|
||||
|
||||
|
||||
data.partyColor = party.color;
|
||||
|
||||
data.equipmentNumber = participant.equipmentNumber().is_set() ? participant.equipmentNumber().get() : 0;
|
||||
data.participantId = participant.id();
|
||||
data.partyId = participant.partyId();
|
||||
data.typeId = participant.typeId();
|
||||
data.equipmentNumber = participant.equipmentNumber.has_value() ? participant.equipmentNumber.get() : 0;
|
||||
data.participantId = participant.id;
|
||||
data.partyId = participant.partyId;
|
||||
data.typeId = participant.typeId;
|
||||
|
||||
data.designator = QString::fromStdString(participant.designator());
|
||||
data.designator = QString::fromStdString(participant.designator);
|
||||
data.hierarchy = m_ppmDtc->hierarchyFromParticipant(data.participantId, m_participants);
|
||||
data.info = QString::fromStdString(participant.info());
|
||||
data.info = QString::fromStdString(participant.info);
|
||||
data.partyStr = party.name;
|
||||
data.symbolStr = QString::fromStdString(participant.symbol());
|
||||
data.tacticalIdentifier = QString::fromStdString(participant.tacticalIdentifier());
|
||||
data.typeName = type.id() > 0 ? ParticipantManagement::trTypeName(type.name()) : tr("Unknown (%1)").arg(participant.typeId());
|
||||
data.identification = QString::fromStdString(participant.identification());
|
||||
data.symbolStr = QString::fromStdString(participant.symbol);
|
||||
data.tacticalIdentifier = QString::fromStdString(participant.tacticalIdentifier);
|
||||
data.typeName = type.id > 0 ? ParticipantManagement::trTypeName(type.name) : tr("Unknown (%1)").arg(participant.typeId);
|
||||
data.identification = QString::fromStdString(participant.identification);
|
||||
|
||||
tryRenderSymbol(data.symbolStr,
|
||||
data.participantId,
|
||||
@@ -612,47 +614,47 @@ PlayerData BasePlayerModel::setPlayerData(int participantId,
|
||||
PlayerData BasePlayerModel::setPlayerData(const ParticipantManagement::Participant &participant,
|
||||
const ParticipantManagement::DynamicParticipantData &dp)
|
||||
{
|
||||
const auto bite = participant.equipmentNumber().is_set()
|
||||
? m_bites.value(participant.equipmentNumber().get())
|
||||
const auto bite = participant.equipmentNumber.has_value()
|
||||
? m_bites.value(participant.equipmentNumber.get())
|
||||
: ParticipantManagement::Bite();
|
||||
const auto party = m_parties.value(participant.partyId());
|
||||
const auto pos = m_positions.value(participant.id());
|
||||
const auto type = m_types.value(participant.typeId());
|
||||
const auto party = m_parties.value(participant.partyId);
|
||||
const auto pos = m_positions.value(participant.id);
|
||||
const auto type = m_types.value(participant.typeId);
|
||||
const auto tactStatus = getTacticalStatus(dp);
|
||||
|
||||
PlayerData data;
|
||||
|
||||
data.biteSampleTime = bite.sampleTime();
|
||||
data.positionSampleTime = pos.sampleTime();
|
||||
data.biteSampleTime = bite.sampleTime;
|
||||
data.positionSampleTime = pos.sampleTime;
|
||||
|
||||
data.partyColor = party.color;
|
||||
|
||||
data.vulnerabilityState = tactStatus.vulnerabilityState();
|
||||
data.typeClass = type.typeClass();
|
||||
data.vulnerabilityState = tactStatus.vulnerabilityState;
|
||||
data.typeClass = type.typeClass;
|
||||
data.partyRole = party.role;
|
||||
|
||||
data.equipmentNumber = participant.equipmentNumber().is_set() ? participant.equipmentNumber().get() : 0;
|
||||
data.participantId = participant.id();
|
||||
data.partyId = participant.partyId();
|
||||
data.typeId = participant.typeId();
|
||||
data.equipmentNumber = participant.equipmentNumber.has_value() ? participant.equipmentNumber.get() : 0;
|
||||
data.participantId = participant.id;
|
||||
data.partyId = participant.partyId;
|
||||
data.typeId = participant.typeId;
|
||||
|
||||
data.isManipulated = dp.manipulation().size();
|
||||
data.isManipulated = dp.manipulation.size();
|
||||
data.isOutdated = LtsUtils::isPositionTimeOutdated(m_partitionTime, data.positionSampleTime);
|
||||
|
||||
|
||||
data.biteResultStr = getBitResult(bite, data.equipmentNumber);
|
||||
data.biteWarningsStr = getBiteWarnings(bite, data.equipmentNumber);
|
||||
data.designator = QString::fromStdString(participant.designator());
|
||||
data.designator = QString::fromStdString(participant.designator);
|
||||
data.hierarchy = m_ppmDtc->hierarchyFromParticipant(data.participantId, m_participants);
|
||||
data.info = QString::fromStdString(participant.info());
|
||||
data.info = QString::fromStdString(participant.info);
|
||||
data.partyStr = party.name;
|
||||
data.positionStr = getPositionString(pos, data.participantId);
|
||||
data.symbolStr = QString::fromStdString(participant.symbol());
|
||||
data.tacticalIdentifier = QString::fromStdString(participant.tacticalIdentifier());
|
||||
data.typeName = type.id() > 0 ? ParticipantManagement::trTypeName(type.name()) : tr("Unknown (%1)").arg(participant.typeId());
|
||||
data.vulnerabilityStateStr = vulnerabilityStateString(type.typeClass(),
|
||||
tactStatus.vulnerabilityState());
|
||||
data.identification = QString::fromStdString(participant.identification());
|
||||
data.symbolStr = QString::fromStdString(participant.symbol);
|
||||
data.tacticalIdentifier = QString::fromStdString(participant.tacticalIdentifier);
|
||||
data.typeName = type.id > 0 ? ParticipantManagement::trTypeName(type.name) : tr("Unknown (%1)").arg(participant.typeId);
|
||||
data.vulnerabilityStateStr = vulnerabilityStateString(type.typeClass,
|
||||
tactStatus.vulnerabilityState);
|
||||
data.identification = QString::fromStdString(participant.identification);
|
||||
|
||||
tryRenderSymbol(data.symbolStr,
|
||||
data.participantId,
|
||||
@@ -679,7 +681,7 @@ qint64 BasePlayerModel::calculatePositionAge(qint64 sampleTime) const
|
||||
|
||||
ParticipantManagement::StateInformation BasePlayerModel::getTacticalStatus(const ParticipantManagement::DynamicParticipantData &data) const
|
||||
{
|
||||
return m_ppmDtc->youngestStateInformation(data.stateHistory());
|
||||
return m_ppmDtc->youngestStateInformation(data.stateHistory);
|
||||
}
|
||||
|
||||
void BasePlayerModel::onPositionChanged(const ParticipantManagement::ParticipantPosition &position,
|
||||
@@ -689,12 +691,12 @@ void BasePlayerModel::onPositionChanged(const ParticipantManagement::Participant
|
||||
return;
|
||||
DEBUG_LOG(m_logger) << "**** onPositionChanged: " << position;
|
||||
|
||||
m_positions[position.participantId()] = position;
|
||||
m_positions[position.participantId] = position;
|
||||
|
||||
int row = findRowForId(position.participantId());
|
||||
int row = findRowForId(position.participantId);
|
||||
if (row < 0)
|
||||
{
|
||||
row = findRowForId(-position.participantId());
|
||||
row = findRowForId(-position.participantId);
|
||||
if (row < 0)
|
||||
return;
|
||||
}
|
||||
@@ -703,8 +705,8 @@ void BasePlayerModel::onPositionChanged(const ParticipantManagement::Participant
|
||||
(modType == DataModification::eModified))
|
||||
{
|
||||
auto &playerData = m_vecData[row];
|
||||
playerData.positionSampleTime = position.sampleTime();
|
||||
playerData.positionStr = getPositionString(position, position.participantId());
|
||||
playerData.positionSampleTime = position.sampleTime;
|
||||
playerData.positionStr = getPositionString(position, position.participantId);
|
||||
playerData.isOutdated = false;
|
||||
const auto idxPosition(index(row, ColPosition));
|
||||
const auto idxPositionAge(index(row, ColPositionAge));
|
||||
@@ -720,9 +722,9 @@ void BasePlayerModel::onBiteChanged(const ParticipantManagement::Bite &bite,
|
||||
return;
|
||||
DEBUG_LOG(m_logger) << "**** onBiteChanged: " << bite;
|
||||
|
||||
m_bites[bite.equipmentNumber()] = bite;
|
||||
m_bites[bite.equipmentNumber] = bite;
|
||||
|
||||
int row = findRowForEquipmentNumber(bite.equipmentNumber());
|
||||
int row = findRowForEquipmentNumber(bite.equipmentNumber);
|
||||
if (row < 0)
|
||||
return;
|
||||
|
||||
@@ -730,9 +732,9 @@ void BasePlayerModel::onBiteChanged(const ParticipantManagement::Bite &bite,
|
||||
(modType == DataModification::eModified))
|
||||
{
|
||||
setBiteResult(row,
|
||||
bite.sampleTime(),
|
||||
getBitResult(bite, bite.equipmentNumber()),
|
||||
getBiteWarnings(bite, bite.equipmentNumber()));
|
||||
bite.sampleTime,
|
||||
getBitResult(bite, bite.equipmentNumber),
|
||||
getBiteWarnings(bite, bite.equipmentNumber));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -742,10 +744,10 @@ void BasePlayerModel::onPartyChanged(const ParticipantManagement::Party &party,
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
SmoParty smoParty;
|
||||
smoParty.id = party.id();
|
||||
smoParty.name = ParticipantManagement::trPartyName(party.name());
|
||||
smoParty.color = QColor::fromRgb(QRgb(party.color()));
|
||||
smoParty.role = AdvancedSymbology::roleToRole(party.role());
|
||||
smoParty.id = party.id;
|
||||
smoParty.name = ParticipantManagement::trPartyName(party.name);
|
||||
smoParty.color = QColor::fromRgb(QRgb(party.color));
|
||||
smoParty.role = AdvancedSymbology::roleToRole(party.role);
|
||||
|
||||
if (m_ppmGuiCbxIfc)
|
||||
smoParty.icon = m_ppmGuiCbxIfc->pixmapFromParty(smoParty.color);
|
||||
@@ -786,8 +788,8 @@ QString BasePlayerModel::vulnerabilityStateString(ParticipantManagement::TypeCla
|
||||
ProjectDataManagement::VulnerabilityState vulState) const
|
||||
{
|
||||
const ProjectDataManagement::VulnerabilityClass vc = typeClass == ParticipantManagement::TypeClass::Human ?
|
||||
ProjectDataManagement::VulnerabilityClass::SoldierInjuries :
|
||||
ProjectDataManagement::VulnerabilityClass::VehicleDamages;
|
||||
ProjectDataManagement::VulnerabilityClass::VulnerabilityClass_SoldierInjuries :
|
||||
ProjectDataManagement::VulnerabilityClass::VulnerabilityClass_VehicleDamages;
|
||||
|
||||
return ProjectDataManagement::toString(vulState, vc);
|
||||
}
|
||||
@@ -800,14 +802,14 @@ void BasePlayerModel::onTypeChanged(const ParticipantManagement::Type &type,
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
{
|
||||
m_types[type.id()] = type;
|
||||
m_types[type.id] = type;
|
||||
bool bNeedUpdate = false;
|
||||
for (auto &data : m_vecData)
|
||||
{
|
||||
if (data.typeId != type.id())
|
||||
if (data.typeId != type.id)
|
||||
continue;
|
||||
data.typeClass = type.typeClass();
|
||||
data.typeName = ParticipantManagement::trTypeName(type.name());
|
||||
data.typeClass = type.typeClass;
|
||||
data.typeName = ParticipantManagement::trTypeName(type.name);
|
||||
bNeedUpdate = true;
|
||||
}
|
||||
if (bNeedUpdate)
|
||||
@@ -815,7 +817,7 @@ void BasePlayerModel::onTypeChanged(const ParticipantManagement::Type &type,
|
||||
break;
|
||||
}
|
||||
case DataModification::eRemoved:
|
||||
m_types.remove(type.id());
|
||||
m_types.remove(type.id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -895,7 +897,7 @@ bool BasePlayerProxyModel::lessThan(const QModelIndex &source_left, const QModel
|
||||
case BasePlayerModel::ColBitResult:
|
||||
case BasePlayerModel::ColWarnings:
|
||||
|
||||
return source_left.data() < source_right.data();
|
||||
return LtsUtils::lessThan(source_left.data(), source_right.data());
|
||||
};
|
||||
return LtsColumnFilterProxyModel::lessThan(source_left, source_right);
|
||||
}
|
||||
|
||||
+33
-32
@@ -17,6 +17,7 @@ BiteModel::BiteModel(QObject *parent)
|
||||
tr("Low Battery"),
|
||||
tr("Component")},
|
||||
parent)
|
||||
, m_logger(getLogger("BiteModel"))
|
||||
{}
|
||||
|
||||
bool BiteModel::initModel(const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
@@ -51,13 +52,13 @@ QVariant BiteModel::data(const QModelIndex &index, int role) const
|
||||
switch (index.column())
|
||||
{
|
||||
case ReceiveTime:
|
||||
return QDateTime::fromMSecsSinceEpoch(biteMsg.sampleTime());
|
||||
return QDateTime::fromMSecsSinceEpoch(biteMsg.sampleTime);
|
||||
case EquipmentNummer:
|
||||
return biteMsg.equipmentNumber();
|
||||
return biteMsg.equipmentNumber;
|
||||
case BitError:
|
||||
return getBitErrors(biteMsg);
|
||||
case LowBattery:
|
||||
return getLowBattery(biteMsg.batteryState());
|
||||
return getLowBattery(biteMsg.batteryState);
|
||||
case Component:
|
||||
return getComponents(biteMsg);
|
||||
}
|
||||
@@ -68,10 +69,10 @@ bool BiteModel::isFiltered(const ParticipantManagement::Bite &data, DataModifica
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
|
||||
return data.biteState() == data.configState() &&
|
||||
!data.configError() &&
|
||||
data.batteryState() == 0 &&
|
||||
data.biteErrors().size() == 0;
|
||||
return data.biteState == data.configState &&
|
||||
!data.configError &&
|
||||
data.batteryState == 0 &&
|
||||
data.biteErrors.size() == 0;
|
||||
}
|
||||
|
||||
QString BiteModel::getBitErrors(const ParticipantManagement::Bite &bite) const
|
||||
@@ -91,15 +92,15 @@ QString BiteModel::getBitErrors(const ParticipantManagement::Bite &bite) const
|
||||
|
||||
QString BiteModel::checkBit(const ParticipantManagement::Bite &bite, quint32 bitValue) const
|
||||
{
|
||||
bool available = (bite.biteState() & bitValue) == bitValue;
|
||||
bool statusOk = (bite.configState() & bitValue) == bitValue;
|
||||
bool available = (bite.biteState & bitValue) == bitValue;
|
||||
bool statusOk = (bite.configState & bitValue) == bitValue;
|
||||
|
||||
QString name;
|
||||
for (const ProjectDataManagement::CanComponentString &ccs : m_ccsMap)
|
||||
{
|
||||
if (ccs.bitMask() == bitValue)
|
||||
if (ccs.pdm_bitMask == bitValue)
|
||||
{
|
||||
name = m_pdmDtc->trCanComponentStringName(ccs.id());
|
||||
name = m_pdmDtc->trCanComponentStringName(ccs.id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -142,9 +143,9 @@ QString BiteModel::checkBatteryBit(int state, qint64 bitValue) const
|
||||
|
||||
|
||||
qint64 compareValue = (bitValue << 32);
|
||||
if (ccs.bitMask() == compareValue)
|
||||
if (ccs.pdm_bitMask == compareValue)
|
||||
{
|
||||
name = m_pdmDtc->trCanComponentStringName(ccs.id());
|
||||
name = m_pdmDtc->trCanComponentStringName(ccs.id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -159,9 +160,9 @@ QString BiteModel::checkBatteryBit(int state, qint64 bitValue) const
|
||||
QString BiteModel::getComponents(const ParticipantManagement::Bite &bite) const
|
||||
{
|
||||
QStringList errorString;
|
||||
for (const auto &bitError : bite.biteErrors())
|
||||
for (const auto &bitError : bite.biteErrors)
|
||||
{
|
||||
if (bitError.errorNumber() == 0)
|
||||
if (bitError.errorNumber == 0)
|
||||
continue;
|
||||
errorString += getErrorString(bitError);
|
||||
}
|
||||
@@ -172,8 +173,8 @@ QString BiteModel::getCanDeviceName(int id) const
|
||||
{
|
||||
for (const ProjectDataManagement::CanComponentString &ccs : m_ccsMap)
|
||||
{
|
||||
if (ccs.canDeviceId() == id)
|
||||
return m_pdmDtc->trCanComponentStringName(ccs.id());
|
||||
if (ccs.canDeviceId == id)
|
||||
return m_pdmDtc->trCanComponentStringName(ccs.id);
|
||||
}
|
||||
return tr("Unknown Can device (%1)").arg(id);
|
||||
}
|
||||
@@ -182,8 +183,8 @@ QString BiteModel::getSubDeviceName(int id) const
|
||||
{
|
||||
for (const ProjectDataManagement::CanComponentString &ccs : m_ccsMap)
|
||||
{
|
||||
if (ccs.subDeviceId() == id)
|
||||
return m_pdmDtc->trCanComponentStringName(ccs.id());
|
||||
if (ccs.subDeviceId == id)
|
||||
return m_pdmDtc->trCanComponentStringName(ccs.id);
|
||||
}
|
||||
return tr("Unknown subdevice (%1)").arg(id);
|
||||
}
|
||||
@@ -191,37 +192,37 @@ QString BiteModel::getSubDeviceName(int id) const
|
||||
QString BiteModel::getErrorString(const ParticipantManagement::BiteError &error) const
|
||||
{
|
||||
QString errString;
|
||||
const bool subDevice = (error.subdeviceNumber() != 0);
|
||||
const bool subDevice = (error.subdeviceNumber != 0);
|
||||
|
||||
for (const ProjectDataManagement::BiteComponentText &bct : m_bctMap)
|
||||
{
|
||||
if (((subDevice && bct.subDeviceId() == error.subdeviceNumber()) ||
|
||||
(bct.canDeviceId() == error.canDeviceNumber())) &&
|
||||
(bct.errorNumber() == error.errorNumber()))
|
||||
if (((subDevice && bct.subDeviceId == error.subdeviceNumber) ||
|
||||
(bct.canDeviceId == error.canDeviceNumber)) &&
|
||||
(bct.errorNumber == error.errorNumber))
|
||||
{
|
||||
errString = m_pdmDtc->trBiteComponentTextName(bct.id());
|
||||
errString = m_pdmDtc->trBiteComponentTextName(bct.id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (errString.isEmpty())
|
||||
errString = tr("Unknown error (%1)").arg(error.errorNumber());
|
||||
errString = tr("Unknown error (%1)").arg(error.errorNumber);
|
||||
|
||||
QString subErrString;
|
||||
if (subDevice)
|
||||
subErrString = QLatin1Char('-') +
|
||||
getSubDeviceName(error.subdeviceNumber()) +
|
||||
getSubDeviceName(error.subdeviceNumber) +
|
||||
QLatin1Char('-') +
|
||||
QString::number( error.uniqueId(), 16 ).toUpper();
|
||||
QString::number( error.uniqueId, 16 ).toUpper();
|
||||
|
||||
|
||||
return tr("Error: %1 - Device: %2 %3").arg(errString, getCanDeviceName(error.canDeviceNumber()), subErrString);
|
||||
return tr("Error: %1 - Device: %2 %3").arg(errString, getCanDeviceName(error.canDeviceNumber), subErrString);
|
||||
}
|
||||
|
||||
int BiteModel::findRowForEquipmentNumber(int equipNo) const
|
||||
{
|
||||
for (int i = 0; i < m_vecData.size(); ++i)
|
||||
{
|
||||
if (m_vecData.at(i).equipmentNumber() == equipNo)
|
||||
if (m_vecData.at(i).equipmentNumber == equipNo)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "findRowForEquipmentNumber: "
|
||||
<< equipNo << "-->" << i;
|
||||
@@ -236,7 +237,7 @@ void BiteModel::biteDataChanged(const ParticipantManagement::Bite &data,
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "biteDataChanged";
|
||||
|
||||
const int equipNo = data.equipmentNumber();
|
||||
const int equipNo = data.equipmentNumber;
|
||||
const int row = findRowForEquipmentNumber(equipNo);
|
||||
|
||||
switch (modType)
|
||||
@@ -293,9 +294,9 @@ bool BiteProxyModel::lessThan(const QModelIndex &source_left, const QModelIndex
|
||||
switch (source_left.column())
|
||||
{
|
||||
case BiteModel::ReceiveTime:
|
||||
return dataLeft.sampleTime() < dataRight.sampleTime();
|
||||
return dataLeft.sampleTime < dataRight.sampleTime;
|
||||
case BiteModel::EquipmentNummer:
|
||||
return dataLeft.equipmentNumber() < dataRight.equipmentNumber();
|
||||
return dataLeft.equipmentNumber < dataRight.equipmentNumber;
|
||||
case BiteModel::BitError:
|
||||
case BiteModel::LowBattery:
|
||||
case BiteModel::Component:
|
||||
|
||||
+1
@@ -7,6 +7,7 @@
|
||||
#include <LtsWidgets/lts_column_filter_proxy_model.h>
|
||||
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
|
||||
namespace ProjectDataManagement {
|
||||
namespace Interface {
|
||||
|
||||
+19
-19
@@ -87,7 +87,7 @@ void CheckButtonHandler::addTacticalState()
|
||||
m_vbgs.reserve(13);
|
||||
|
||||
|
||||
ProjectDataManagement::VulnerabilityState vs = ProjectDataManagement::VulnerabilityState::CombatReady;
|
||||
ProjectDataManagement::VulnerabilityState vs = ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady;
|
||||
QAction *a1 = new QAction(ProjectDataManagement::toString(vs) + tr(" (Bldg: without cont. reset)"), m_menuTacticalState);
|
||||
m_vbgs += a1;
|
||||
m_menuTacticalState->addAction(a1);
|
||||
@@ -97,7 +97,7 @@ void CheckButtonHandler::addTacticalState()
|
||||
connect(m_vbgs.last(), &QAction::triggered, this, &CheckButtonHandler::combatReadyRequested);
|
||||
|
||||
|
||||
vs = ProjectDataManagement::VulnerabilityState::CombatReady;
|
||||
vs = ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady;
|
||||
QAction *a2 = new QAction(ProjectDataManagement::toString(vs) + tr(" (Bldg: with cont. reset)"), m_menuTacticalState);
|
||||
m_vbgs += a2;
|
||||
m_menuTacticalState->addAction(a2);
|
||||
@@ -107,7 +107,7 @@ void CheckButtonHandler::addTacticalState()
|
||||
connect(m_vbgs.last(), &QAction::triggered, this, &CheckButtonHandler::combatReadyResetContamintationRequested);
|
||||
|
||||
|
||||
vs = ProjectDataManagement::VulnerabilityState::NoChange;
|
||||
vs = ProjectDataManagement::VulnerabilityState::VulnerabilityState_NoChange;
|
||||
QAction *a3 = new QAction( tr("Contamination reset only"), m_menuTacticalState);
|
||||
m_vbgs += a3;
|
||||
m_menuTacticalState->addAction(a3);
|
||||
@@ -120,7 +120,7 @@ void CheckButtonHandler::addTacticalState()
|
||||
QAction *ac = new QAction(ProjectDataManagement::toString(vs), m_menuTacticalState);
|
||||
m_vbgs += ac;
|
||||
m_menuTacticalState->addAction(ac);
|
||||
if (i == static_cast<int>(ProjectDataManagement::VulnerabilityState::CombatReady))
|
||||
if (i == static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady))
|
||||
{
|
||||
connect(m_vbgs.last(), &QAction::triggered,
|
||||
this, [this]() { sendInitRequest(m_selectedParticipants, false, false, true, false);});
|
||||
@@ -174,12 +174,12 @@ void CheckButtonHandler::sendInitRequest(const std::vector<int> &selectedIds,
|
||||
if (!resetManipulation && !restockCharges && !resetVulnerabilityState && !restockSanMat)
|
||||
return;
|
||||
ParticipantManagement::InitParticipantRequest req;
|
||||
req.workstationId(LtsSessionData::LtsSessionData::getInstance()->getWorkstationId());
|
||||
req.participantIds(selectedIds);
|
||||
req.resetManipulation(resetManipulation);
|
||||
req.restockCharges(restockCharges);
|
||||
req.resetVulnerabilityState(resetVulnerabilityState);
|
||||
req.restockSanitationMaterial(restockSanMat);
|
||||
req.workstationId = LtsSessionData::LtsSessionData::getInstance()->getWorkstationId();
|
||||
req.participantIds = selectedIds;
|
||||
req.resetManipulation = resetManipulation;
|
||||
req.restockCharges = restockCharges;
|
||||
req.resetVulnerabilityState = resetVulnerabilityState;
|
||||
req.restockSanitationMaterial = restockSanMat;
|
||||
m_requestHelper->startSingleRequest([req, this]() { return m_ppmFtc->initParticipantRequest(req, this); });
|
||||
}
|
||||
void CheckButtonHandler::sendModifyState(const std::vector<int> &selectedIds,
|
||||
@@ -190,9 +190,9 @@ void CheckButtonHandler::sendModifyState(const std::vector<int> &selectedIds,
|
||||
return;
|
||||
|
||||
ParticipantManagement::ModifyStateRequest req;
|
||||
req.workstationId(LtsSessionData::LtsSessionData::getInstance()->getWorkstationId());
|
||||
req.participantIds(selectedIds);
|
||||
req.vulnerabilityState(vs);
|
||||
req.workstationId = LtsSessionData::LtsSessionData::getInstance()->getWorkstationId();
|
||||
req.participantIds = selectedIds;
|
||||
req.vulnerabilityState = vs;
|
||||
m_requestHelper->startSingleRequest([req, this]() { return m_ppmFtc->modifyStateRequest(req, this); });
|
||||
}
|
||||
|
||||
@@ -203,9 +203,9 @@ void CheckButtonHandler::sendModifyVitality(const std::vector<int> &selectedIds,
|
||||
return;
|
||||
|
||||
ParticipantManagement::ModifyStateRequest req;
|
||||
req.workstationId(LtsSessionData::LtsSessionData::getInstance()->getWorkstationId());
|
||||
req.participantIds(selectedIds);
|
||||
req.vitality(vitality);
|
||||
req.workstationId = LtsSessionData::LtsSessionData::getInstance()->getWorkstationId();
|
||||
req.participantIds = selectedIds;
|
||||
req.vitality = vitality;
|
||||
m_requestHelper->startSingleRequest([req, this]() { return m_ppmFtc->modifyStateRequest(req, this); });
|
||||
}
|
||||
|
||||
@@ -233,15 +233,15 @@ std::vector<int> CheckButtonHandler::setSelectedParticipantIds(const std::vector
|
||||
const ParticipantManagement::Participant &part = partIter.value();
|
||||
|
||||
|
||||
if (!part.equipmentNumber().is_set() || part.equipmentNumber().get() < 0)
|
||||
if (!part.equipmentNumber.has_value() || part.equipmentNumber.get() < 0)
|
||||
continue;
|
||||
|
||||
|
||||
int typeId = part.typeId();
|
||||
int typeId = part.typeId;
|
||||
auto typeIter = types.constFind(typeId);
|
||||
if (typeIter == types.constEnd())
|
||||
continue;
|
||||
const ParticipantManagement::TypeClass &tc = typeIter.value().typeClass();
|
||||
const ParticipantManagement::TypeClass &tc = typeIter.value().typeClass;
|
||||
|
||||
m_selectedParticipants.push_back(partIter.key());
|
||||
|
||||
|
||||
+2
@@ -6,6 +6,8 @@
|
||||
#include <Lts/Plugins/ServiceMonitor/Gui/Monitors/smocheckbuttonhandler_export.h>
|
||||
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_dtc.h> // complete Interface::Dtc type (legacy include)
|
||||
#include <ParticipantManagement/ppm_ftc.h>
|
||||
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
+9
-8
@@ -21,6 +21,7 @@ CtasErrorModel:: CtasErrorModel(QObject *parent)
|
||||
},
|
||||
parent)
|
||||
, m_ppmDtc(nullptr)
|
||||
, m_logger(getLogger("CtasErrorModel"))
|
||||
{}
|
||||
|
||||
bool CtasErrorModel::initModel(const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc)
|
||||
@@ -49,15 +50,15 @@ QVariant CtasErrorModel::data(const QModelIndex &index, int role) const
|
||||
switch (index.column())
|
||||
{
|
||||
case ReceiveTime:
|
||||
return QDateTime::fromMSecsSinceEpoch(error.timeReceipt());
|
||||
return QDateTime::fromMSecsSinceEpoch(error.timeReceipt);
|
||||
case EquipmentNummer:
|
||||
return error.equipmentNumber();
|
||||
return error.equipmentNumber;
|
||||
case TimePlayerUnit:
|
||||
return QDateTime::fromMSecsSinceEpoch(error.timePlayerUnit());
|
||||
return QDateTime::fromMSecsSinceEpoch(error.timePlayerUnit);
|
||||
case ErrorReason:
|
||||
return ProjectDataManagement::toString(error.errorReason());
|
||||
return ProjectDataManagement::toString(error.errorReason);
|
||||
case TelegramId:
|
||||
return telegramId2Text(error.telegramId());
|
||||
return telegramId2Text(error.telegramId);
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
@@ -283,11 +284,11 @@ bool CtasErrorProxyModel::lessThan(const QModelIndex &source_left, const QModelI
|
||||
switch (source_left.column())
|
||||
{
|
||||
case CtasErrorModel::ReceiveTime:
|
||||
return dataLeft.timeReceipt() < dataRight.timeReceipt();
|
||||
return dataLeft.timeReceipt < dataRight.timeReceipt;
|
||||
case CtasErrorModel::EquipmentNummer:
|
||||
return dataLeft.equipmentNumber() < dataRight.equipmentNumber();
|
||||
return dataLeft.equipmentNumber < dataRight.equipmentNumber;
|
||||
case CtasErrorModel::TimePlayerUnit:
|
||||
return dataLeft.timePlayerUnit() < dataRight.timePlayerUnit();
|
||||
return dataLeft.timePlayerUnit < dataRight.timePlayerUnit;
|
||||
case CtasErrorModel::ErrorReason:
|
||||
case CtasErrorModel::TelegramId:
|
||||
break;
|
||||
|
||||
+1
@@ -6,6 +6,7 @@
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
#include <LtsWidgets/lts_column_filter_proxy_model.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <Common/logger.h>
|
||||
|
||||
namespace ServiceMonitor
|
||||
|
||||
+2
-1
@@ -32,6 +32,7 @@ ServiceMonitorDialog::ServiceMonitorDialog(Monitor monitor,
|
||||
, m_proxyModel(nullptr)
|
||||
, m_ppmDtc(nullptr)
|
||||
, m_pdmDtc(nullptr)
|
||||
, m_logger(getLogger("ServiceMonitorDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &ServiceMonitorDialog::onPrint);
|
||||
@@ -379,7 +380,7 @@ int ServiceMonitorDialog::participantId(const QModelIndex &index) const
|
||||
if (bm)
|
||||
{
|
||||
const ParticipantManagement::Bite &bite = bm->getRowData(index.row());
|
||||
return bite.participantId();
|
||||
return bite.participantId;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
+40
-40
@@ -58,28 +58,28 @@ bool EgcuEdit::init(const EgcuData &data, LtsSession::LtsSession *session)
|
||||
|
||||
auto cbRelayInfos = [this, l](const AssetManagement::RelayInfo &relayInfo)
|
||||
{
|
||||
QLabel *name = new QLabel(QString::fromStdString(relayInfo.name()), this);
|
||||
QLabel *name = new QLabel(QString::fromStdString(relayInfo.name), this);
|
||||
|
||||
QComboBox *cb = new QComboBox(this);
|
||||
if (EgcuModel::readAllowance(InfrastructureManagement::EffectOverride::PermanentOn, relayInfo.property()))
|
||||
cb->addItem(tr("On"), InfrastructureManagement::EffectOverride::PermanentOn);
|
||||
if (EgcuModel::readAllowance(InfrastructureManagement::EffectOverride::PermanentOff, relayInfo.property()))
|
||||
cb->addItem(tr("Off"), InfrastructureManagement::EffectOverride::PermanentOff);
|
||||
cb->addItem(tr("Auto"), InfrastructureManagement::EffectOverride::Automatic);
|
||||
if (EgcuModel::readAllowance(InfrastructureManagement::EffectOverride::PermanentOn, relayInfo.property))
|
||||
cb->addItem(tr("On"), static_cast<int>(InfrastructureManagement::EffectOverride::PermanentOn));
|
||||
if (EgcuModel::readAllowance(InfrastructureManagement::EffectOverride::PermanentOff, relayInfo.property))
|
||||
cb->addItem(tr("Off"), static_cast<int>(InfrastructureManagement::EffectOverride::PermanentOff));
|
||||
cb->addItem(tr("Auto"), static_cast<int>(InfrastructureManagement::EffectOverride::Automatic));
|
||||
|
||||
l->addWidget(name, l->rowCount(), 0);
|
||||
l->addWidget(cb, l->rowCount()-1, 1);
|
||||
|
||||
cb->setCurrentIndex(cb->findData(InfrastructureManagement::EffectOverride::Automatic));
|
||||
m_relayCbs.insert(relayInfo.id(), cb);
|
||||
cb->setCurrentIndex(cb->findData(static_cast<int>(InfrastructureManagement::EffectOverride::Automatic)));
|
||||
m_relayCbs.insert(relayInfo.id, cb);
|
||||
};
|
||||
|
||||
asmDtc->waitForHistoricalDataRelayInfo();
|
||||
asmDtc->relayInfos(cbRelayInfos);
|
||||
l->addItem(new QSpacerItem(20, 210, QSizePolicy::Minimum, QSizePolicy::Expanding), l->rowCount(), 0);
|
||||
|
||||
m_ui->lblHostname->setText(QString::fromStdString(data.instrumentationAsset.hostname()));
|
||||
m_ui->leSegmentName->setText(QString::fromStdString(data.mountingPointAsset.name().empty() ? data.instrumentationAsset.hostname() : data.mountingPointAsset.name()));
|
||||
m_ui->lblHostname->setText(QString::fromStdString(data.instrumentationAsset.hostname));
|
||||
m_ui->leSegmentName->setText(QString::fromStdString(data.mountingPointAsset.name.empty() ? data.instrumentationAsset.hostname : data.mountingPointAsset.name));
|
||||
|
||||
|
||||
|
||||
@@ -87,40 +87,40 @@ bool EgcuEdit::init(const EgcuData &data, LtsSession::LtsSession *session)
|
||||
|
||||
QMap<qint32, QTreeWidgetItem*> treemap;
|
||||
|
||||
const std::vector<InfrastructureManagement::StructureElement> &vecElements = data.mainStructureElement.elements();
|
||||
const std::vector<InfrastructureManagement::StructureElement> &vecElements = data.mainStructureElement.elements;
|
||||
for (const auto &se : vecElements)
|
||||
{
|
||||
if (se.structureElementTypeId() != InfrastructureManagement::StructureElementType::Floor)
|
||||
if (se.structureElementTypeId != InfrastructureManagement::StructureElementType::Floor)
|
||||
continue;
|
||||
QTreeWidgetItem *twi = new QTreeWidgetItem(m_ui->twRooms, {QString::fromStdString(se.displayName())});
|
||||
QTreeWidgetItem *twi = new QTreeWidgetItem(m_ui->twRooms, {QString::fromStdString(se.displayName)});
|
||||
twi->setFlags(twi->flags() | Qt::ItemIsAutoTristate | Qt::ItemIsUserCheckable);
|
||||
twi->setCheckState(0, Qt::Unchecked);
|
||||
treemap[se.id()] = twi;
|
||||
treemap[se.id] = twi;
|
||||
}
|
||||
|
||||
|
||||
for (const auto &se : vecElements)
|
||||
{
|
||||
if (se.structureElementTypeId() != InfrastructureManagement::StructureElementType::Room)
|
||||
if (se.structureElementTypeId != InfrastructureManagement::StructureElementType::Room)
|
||||
continue;
|
||||
|
||||
if (se.path().size() < 2)
|
||||
if (se.path.size() < 2)
|
||||
continue;
|
||||
|
||||
|
||||
|
||||
const int floorId = se.path()[1];
|
||||
const int floorId = se.path[1];
|
||||
if (!treemap.contains(floorId))
|
||||
continue;
|
||||
|
||||
QTreeWidgetItem *floorItem = treemap[floorId];
|
||||
|
||||
QTreeWidgetItem *mountingPoint = new QTreeWidgetItem(floorItem, {QString::fromStdString(se.displayName())});
|
||||
QTreeWidgetItem *mountingPoint = new QTreeWidgetItem(floorItem, {QString::fromStdString(se.displayName)});
|
||||
|
||||
treemap.insert(se.id(), mountingPoint);
|
||||
bool selected = data.rooms.contains(se.mountingPointId());
|
||||
treemap.insert(se.id, mountingPoint);
|
||||
bool selected = data.rooms.contains(se.mountingPointId);
|
||||
mountingPoint->setCheckState(0, selected ? Qt::Checked : Qt::Unchecked);
|
||||
mountingPoint->setData(0, Qt::UserRole, se.mountingPointId());
|
||||
mountingPoint->setData(0, Qt::UserRole, se.mountingPointId);
|
||||
if (selected)
|
||||
floorItem->setExpanded(true);
|
||||
}
|
||||
@@ -143,9 +143,9 @@ void EgcuEdit::updateRelays()
|
||||
{
|
||||
|
||||
InfrastructureManagement::StructureElement structureElement;
|
||||
for (const auto &se : m_egcuData.mainStructureElement.elements())
|
||||
for (const auto &se : m_egcuData.mainStructureElement.elements)
|
||||
{
|
||||
if (se.id() == m_egcuData.mountingPoint.id())
|
||||
if (se.id == m_egcuData.mountingPoint.id())
|
||||
{
|
||||
structureElement = se;
|
||||
break;
|
||||
@@ -153,7 +153,7 @@ void EgcuEdit::updateRelays()
|
||||
}
|
||||
|
||||
QJsonParseError parserError;
|
||||
QByteArray content = QByteArray::fromStdString(structureElement.properties());
|
||||
QByteArray content = QByteArray::fromStdString(structureElement.properties);
|
||||
const QJsonDocument doc(QJsonDocument::fromJson(content, &parserError));
|
||||
|
||||
if (parserError.error != QJsonParseError::NoError)
|
||||
@@ -179,7 +179,7 @@ void EgcuEdit::updateRelays()
|
||||
|
||||
void EgcuEdit::onMountinPointAssetChanged(const InfrastructureManagement::MountingPointAsset &mpa, DataModification mod)
|
||||
{
|
||||
if (m_egcuData.mountingPointAsset.id() != mpa.id())
|
||||
if (m_egcuData.mountingPointAsset.id != mpa.id)
|
||||
return;
|
||||
|
||||
if (mod == DataModification::eRemoved)
|
||||
@@ -188,7 +188,7 @@ void EgcuEdit::onMountinPointAssetChanged(const InfrastructureManagement::Mounti
|
||||
|
||||
QString EgcuEdit::dialogIdentifier() const
|
||||
{
|
||||
return QLatin1String("EgcuEdit") + QString::number(m_egcuData.instrumentationAsset.id());
|
||||
return QLatin1String("EgcuEdit") + QString::number(m_egcuData.instrumentationAsset.id);
|
||||
}
|
||||
|
||||
void EgcuEdit::retranslate()
|
||||
@@ -233,25 +233,25 @@ bool EgcuEdit::apply()
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const auto &se : m_egcuData.mainStructureElement.elements())
|
||||
for (const auto &se : m_egcuData.mainStructureElement.elements)
|
||||
{
|
||||
if (se.id() == m_egcuData.mountingPoint.id())
|
||||
if (se.id == m_egcuData.mountingPoint.id())
|
||||
{
|
||||
structureElement = se;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_ui->leSegmentName->text() != QString::fromStdString(m_egcuData.mountingPointAsset.name()))
|
||||
if (m_ui->leSegmentName->text() != QString::fromStdString(m_egcuData.mountingPointAsset.name))
|
||||
{
|
||||
InfrastructureManagement::MountingPointAssetModifyRequest req;
|
||||
InfrastructureManagement::MountingPointAsset &mpa = req;
|
||||
mpa = m_egcuData.mountingPointAsset;
|
||||
mpa.name(m_ui->leSegmentName->text().toStdString());
|
||||
mpa.name = m_ui->leSegmentName->text().toStdString();
|
||||
m_requestHelper->addRequest([this, req]() {return m_ismFtc->mountingPointAssetModifyRequest(req, this);});
|
||||
}
|
||||
|
||||
properties= structureElement.properties();
|
||||
properties= structureElement.properties;
|
||||
DEBUG_LOG(m_logger) << "structureElementId=" << m_egcuData.mountingPoint.id()
|
||||
<< " properties=" << properties;
|
||||
|
||||
@@ -260,7 +260,7 @@ bool EgcuEdit::apply()
|
||||
for (auto it = m_relayCbs.cbegin(); it != m_relayCbs.cend(); ++it)
|
||||
{
|
||||
QJsonObject objRelay;
|
||||
if (it.value()->currentData().toInt() == InfrastructureManagement::EffectOverride::Automatic)
|
||||
if (it.value()->currentData().toInt() == static_cast<int>(InfrastructureManagement::EffectOverride::Automatic))
|
||||
continue;
|
||||
objRelay[QString::number(it.key())] = it.value()->currentData().toInt();
|
||||
arrRelays.append(objRelay);
|
||||
@@ -272,12 +272,12 @@ bool EgcuEdit::apply()
|
||||
overrideObj.insert(QStringLiteral("relays"),arrRelays);
|
||||
resultObj.insert (QStringLiteral("Overrides"), overrideObj);
|
||||
QByteArray content_neu = QJsonDocument(resultObj).toJson(QJsonDocument::Compact);
|
||||
structureElement.properties(content_neu.toStdString());
|
||||
structureElement.properties = content_neu.toStdString();
|
||||
|
||||
InfrastructureManagement::StructureElementModifyRequest request;
|
||||
request.mainStructureElementId(m_egcuData.mainStructureElement.id());
|
||||
request.elements().resize(1);
|
||||
request.elements().at(0) = structureElement;
|
||||
request.mainStructureElementId = m_egcuData.mainStructureElement.id;
|
||||
request.elements.resize(1);
|
||||
request.elements.at(0) = structureElement;
|
||||
|
||||
m_requestHelper->addRequest([this, request]() {return m_ismFtc->structureElementModifyRequest(request, this);});
|
||||
m_requestHelper->startRequests();
|
||||
@@ -287,7 +287,7 @@ bool EgcuEdit::apply()
|
||||
bool EgcuEdit::saveEgcuToRooms()
|
||||
{
|
||||
QJsonParseError parserError;
|
||||
QByteArray content = QByteArray::fromStdString(m_egcuData.mainStructureElement.properties());
|
||||
QByteArray content = QByteArray::fromStdString(m_egcuData.mainStructureElement.properties);
|
||||
const QJsonDocument doc(QJsonDocument::fromJson(content, &parserError));
|
||||
|
||||
if (parserError.error != QJsonParseError::NoError)
|
||||
@@ -299,7 +299,7 @@ bool EgcuEdit::saveEgcuToRooms()
|
||||
for (int i=0; i<arrEgcus.size(); ++i)
|
||||
{
|
||||
QJsonObject objRooms = arrEgcus[i].toObject();
|
||||
if (m_egcuData.mountingPoint.data().mountingPointId() != objRooms.value(QStringLiteral("mountpointEgcu")).toInt())
|
||||
if (m_egcuData.mountingPoint.data().mountingPointId != objRooms.value(QStringLiteral("mountpointEgcu")).toInt())
|
||||
continue;
|
||||
|
||||
|
||||
@@ -327,13 +327,13 @@ bool EgcuEdit::saveEgcuToRooms()
|
||||
QVariantList roomIds;
|
||||
getRoomIds(m_ui->twRooms->invisibleRootItem(), roomIds);
|
||||
objRooms.insert(QLatin1String("rooms"), QJsonArray::fromVariantList(roomIds));
|
||||
objRooms.insert(QLatin1String("mountpointEgcu"), m_egcuData.mountingPoint.data().mountingPointId());
|
||||
objRooms.insert(QLatin1String("mountpointEgcu"), m_egcuData.mountingPoint.data().mountingPointId);
|
||||
arrEgcus.append(objRooms);
|
||||
}
|
||||
|
||||
docObj.insert(QStringLiteral("egcusToRooms"), arrEgcus);
|
||||
content = QJsonDocument(docObj).toJson(QJsonDocument::Compact);
|
||||
m_egcuData.mainStructureElement.properties(content.toStdString());
|
||||
m_egcuData.mainStructureElement.properties = content.toStdString();
|
||||
|
||||
InfrastructureManagement::MainStructureElementModifyRequest request;
|
||||
InfrastructureManagement::MainStructureElement &mse = request;
|
||||
|
||||
+164
-166
@@ -2,10 +2,11 @@
|
||||
|
||||
|
||||
#include "smo_egcu_model.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <utility>
|
||||
|
||||
#include <InfrastructureManagement/ism_translation.h>
|
||||
#include <InfrastructureManagement/ism_mounting_point.h>
|
||||
#include <InfrastructureManagement/Shared/ism_mounting_point.h>
|
||||
#include <Common/logger.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
@@ -77,6 +78,7 @@ EgcuModel::EgcuModel(QObject *parent)
|
||||
tr("Hostname"), tr("Properties"), tr("Rooms"), tr("Overrides"), tr("Status")})
|
||||
, m_visRoot(new NGLTreeItem(tr("Mounting Points")))
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_logger(getLogger("EgcuModel"))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -94,31 +96,31 @@ QVariant EgcuModel::data(const QModelIndex &index, int role) const
|
||||
if (item->data().canConvert<EgcuData>())
|
||||
{
|
||||
const EgcuData itemData = item->data().value<EgcuData>();
|
||||
InfrastructureManagement::InstrumentationAsset instrumentationAsset = m_dtc->instrumentationAsset(itemData.mountingPointAsset.assetId());
|
||||
InfrastructureManagement::InstrumentationAsset instrumentationAsset = m_dtc->instrumentationAsset(itemData.mountingPointAsset.assetId);
|
||||
switch (index.column())
|
||||
{
|
||||
case Id:
|
||||
DEBUG_LOG(m_logger) << "EGCU DATA= "
|
||||
<< " instrumentationAsset.id=" << instrumentationAsset.id()
|
||||
<< " hostname=" << instrumentationAsset.hostname()
|
||||
<< " name=" << instrumentationAsset.name()
|
||||
<< " mountingPointAsset.assetId=" << itemData.mountingPointAsset.assetId()
|
||||
<< " mountingPointAsset.id=" << itemData.mountingPointAsset.id();
|
||||
return itemData.mountingPointAsset.assetId();
|
||||
<< " instrumentationAsset.id=" << instrumentationAsset.id
|
||||
<< " hostname=" << instrumentationAsset.hostname
|
||||
<< " name=" << instrumentationAsset.name
|
||||
<< " mountingPointAsset.assetId=" << itemData.mountingPointAsset.assetId
|
||||
<< " mountingPointAsset.id=" << itemData.mountingPointAsset.id;
|
||||
return itemData.mountingPointAsset.assetId;
|
||||
|
||||
case Name:
|
||||
{
|
||||
QString ret = itemData.segmentName();
|
||||
if (ret == QString::fromStdString(instrumentationAsset.name()))
|
||||
if (ret == QString::fromStdString(instrumentationAsset.name))
|
||||
return ret;
|
||||
return tr("%1 / %2").arg(ret).arg(QString::fromStdString(itemData.instrumentationAsset.name()));
|
||||
return tr("%1 / %2").arg(ret).arg(QString::fromStdString(itemData.instrumentationAsset.name));
|
||||
}
|
||||
case MountingPointType:
|
||||
return InfrastructureManagement::toString(itemData.mountingPoint.type());
|
||||
case Barcode:
|
||||
return QString::fromStdString(instrumentationAsset.barcode());
|
||||
return QString::fromStdString(instrumentationAsset.barcode);
|
||||
case Hostname:
|
||||
return QString::fromStdString(instrumentationAsset.hostname());
|
||||
return QString::fromStdString(instrumentationAsset.hostname);
|
||||
case Properties:
|
||||
return itemData.mountingPoint.properties();
|
||||
case Rooms:
|
||||
@@ -135,20 +137,20 @@ QVariant EgcuModel::data(const QModelIndex &index, int role) const
|
||||
switch (index.column())
|
||||
{
|
||||
case Id:
|
||||
return itemData.id();
|
||||
return itemData.id;
|
||||
case Name:
|
||||
return QString::fromStdString(itemData.displayName());
|
||||
return QString::fromStdString(itemData.displayName);
|
||||
case MountingPointType:
|
||||
return InfrastructureManagement::toString(itemData.structureElementTypeId());
|
||||
return InfrastructureManagement::toString(itemData.structureElementTypeId);
|
||||
case Barcode:
|
||||
return QString::fromStdString(itemData.barcode());
|
||||
return QString::fromStdString(itemData.barcode);
|
||||
case Properties:
|
||||
return QString::fromStdString(itemData.properties());
|
||||
return QString::fromStdString(itemData.properties);
|
||||
case Rooms:
|
||||
case Hostname:
|
||||
return {};
|
||||
case Overrides:
|
||||
return getOverridesFlash(QByteArray::fromStdString(itemData.properties()));
|
||||
return getOverridesFlash(QByteArray::fromStdString(itemData.properties));
|
||||
}
|
||||
return {};
|
||||
}
|
||||
@@ -163,10 +165,10 @@ QString EgcuModel::getRoomsString(const EgcuData &data)
|
||||
QStringList sl;
|
||||
for(int room : std::as_const(data.rooms))
|
||||
{
|
||||
for (const auto &elem : std::as_const(data.mainStructureElement.elements()))
|
||||
if (elem.mountingPointId() == room)
|
||||
for (const auto &elem : std::as_const(data.mainStructureElement.elements))
|
||||
if (elem.mountingPointId == room)
|
||||
{
|
||||
sl << QString::fromStdString(elem.displayName());
|
||||
sl << QString::fromStdString(elem.displayName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -191,7 +193,7 @@ QString EgcuModel::getOverridesFlash(const QByteArray &properties)
|
||||
|
||||
InfrastructureManagement::EffectOverride flash = static_cast<InfrastructureManagement::EffectOverride>(overridesObj.value(QStringLiteral("flash")).toInt());
|
||||
QString res;
|
||||
switch(flash.underlying())
|
||||
switch(flash)
|
||||
{
|
||||
case InfrastructureManagement::EffectOverride::PermanentOff:
|
||||
res = tr("Off");
|
||||
@@ -212,9 +214,9 @@ QString EgcuModel::getOverridesString(const EgcuData &data) const
|
||||
|
||||
for (auto it = data.effectOverrides.cbegin(); it != data.effectOverrides.cend(); ++it)
|
||||
{
|
||||
InfrastructureManagement::EffectOverride override = static_cast<InfrastructureManagement::EffectOverride>(it.value().underlying());
|
||||
InfrastructureManagement::EffectOverride override = static_cast<InfrastructureManagement::EffectOverride>(it.value());
|
||||
QString res;
|
||||
switch(override.underlying())
|
||||
switch(override)
|
||||
{
|
||||
case InfrastructureManagement::EffectOverride::PermanentOff:
|
||||
res = tr("Off");
|
||||
@@ -226,7 +228,7 @@ QString EgcuModel::getOverridesString(const EgcuData &data) const
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
sl << tr("%1: %2").arg(QString::fromStdString(m_relayInfos.value(it.key()).name())).arg(res);
|
||||
sl << tr("%1: %2").arg(QString::fromStdString(m_relayInfos.value(it.key()).name)).arg(res);
|
||||
}
|
||||
|
||||
return sl.join(QLatin1String(", "));
|
||||
@@ -235,13 +237,13 @@ QString EgcuModel::getOverridesString(const EgcuData &data) const
|
||||
QString EgcuModel::getRelaisStates(const EgcuData &data) const
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "getRelaisStates"
|
||||
<< " offlineTime=" << data.relayState.offlineTime()
|
||||
<< " stateTime=" << data.relayState.stateTime()
|
||||
<< " offlineTime=" << data.relayState.offlineTime
|
||||
<< " stateTime=" << data.relayState.stateTime
|
||||
<< " mountingPoint.id=" << data.mountingPoint.id()
|
||||
<< " mountingPointAsset.id=" << data.mountingPointAsset.id()
|
||||
<< " mountingPointAsset.assetId=" << data.mountingPointAsset.assetId()
|
||||
<< " mountingPointAsset.id=" << data.mountingPointAsset.id
|
||||
<< " mountingPointAsset.assetId=" << data.mountingPointAsset.assetId
|
||||
<< " segmentName=" << data.segmentName()
|
||||
<< " instrumentationAsset.id()" << data.instrumentationAsset.id();
|
||||
<< " instrumentationAsset.id()" << data.instrumentationAsset.id;
|
||||
|
||||
|
||||
|
||||
@@ -252,13 +254,13 @@ QString EgcuModel::getRelaisStates(const EgcuData &data) const
|
||||
|
||||
QStringList sl;
|
||||
|
||||
Buildings::RelayState relayState = m_bldDtc->relayState(data.mountingPointAsset.assetId());
|
||||
DEBUG_LOG(m_logger) << "relayState id=" << relayState.id()
|
||||
<< " offlineTime=" << relayState.offlineTime()
|
||||
<< " stateTime=" << relayState.stateTime()
|
||||
<< " relayStates().size=" << relayState.relayStates().size();
|
||||
Buildings::RelayState relayState = m_bldDtc->relayState(data.mountingPointAsset.assetId);
|
||||
DEBUG_LOG(m_logger) << "relayState id=" << relayState.id
|
||||
<< " offlineTime=" << relayState.offlineTime
|
||||
<< " stateTime=" << relayState.stateTime
|
||||
<< " relayStates().size=" << relayState.relayStates.size();
|
||||
|
||||
if (relayState.offlineTime() > relayState.stateTime())
|
||||
if (relayState.offlineTime > relayState.stateTime)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << QString(tr("Connection Error"));
|
||||
sl << QString(tr("Connection Error"));
|
||||
@@ -266,18 +268,18 @@ QString EgcuModel::getRelaisStates(const EgcuData &data) const
|
||||
}
|
||||
|
||||
|
||||
for ( unsigned int i = 0; i < relayState.relayStates().size(); ++i)
|
||||
for ( unsigned int i = 0; i < relayState.relayStates.size(); ++i)
|
||||
{
|
||||
AssetManagement::RelayInfo relayInfo = m_asmDtc->relayInfo(relayState.relayStates()[i].id());
|
||||
bool state = relayState.relayStates().at(i).state();
|
||||
DEBUG_LOG(m_logger) << "relayInfo id=" << relayInfo.id()
|
||||
<< " name=" << relayInfo.name()
|
||||
<< " property=" << relayInfo.property()
|
||||
AssetManagement::RelayInfo relayInfo = m_asmDtc->relayInfo(relayState.relayStates[i].id);
|
||||
bool state = relayState.relayStates.at(i).state;
|
||||
DEBUG_LOG(m_logger) << "relayInfo id=" << relayInfo.id
|
||||
<< " name=" << relayInfo.name
|
||||
<< " property=" << relayInfo.property
|
||||
<< " state=" << state;
|
||||
|
||||
if ( relayInfo.name().size() > 0)
|
||||
if ( relayInfo.name.size() > 0)
|
||||
{
|
||||
sl << QString(QStringLiteral("<img src=\"%1\" height=\"32\" />")).arg(getIconFromState(relayInfo.property(), state));
|
||||
sl << QString(QStringLiteral("<img src=\"%1\" height=\"32\" />")).arg(getIconFromState(relayInfo.property, state));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,7 +300,7 @@ QString EgcuModel::getRelaisStates(const EgcuData &data) const
|
||||
|
||||
|
||||
|
||||
if ( data.mountingPointAsset.assetId() == 0)
|
||||
if ( data.mountingPointAsset.assetId == 0)
|
||||
return (tr("not instrumented"));
|
||||
return sl.isEmpty() ? tr("Connection Error") : sl.join(QStringLiteral(" "));
|
||||
}
|
||||
@@ -352,7 +354,7 @@ bool EgcuModel::initModel(LtsSession::LtsSession *session)
|
||||
|
||||
auto cbRelayInfos = [this](const AssetManagement::RelayInfo & c)
|
||||
{
|
||||
m_relayInfos.insert(c.id(), c);
|
||||
m_relayInfos.insert(c.id, c);
|
||||
};
|
||||
m_asmDtc->waitForHistoricalDataRelayInfo();
|
||||
m_asmDtc->relayInfos(cbRelayInfos);
|
||||
@@ -370,17 +372,17 @@ QModelIndex EgcuModel::getIndexOfVisableRootItem() const
|
||||
|
||||
bool EgcuModel::mseHasMountedAsset(const InfrastructureManagement::MainStructureElement &mse, InfrastructureManagement::MountingPointType mpType)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "mseHasMountedBsm mse.id=" << mse.id()
|
||||
<< " name=" << mse.name();
|
||||
for (const InfrastructureManagement::StructureElement &element : std::as_const(mse.elements()))
|
||||
DEBUG_LOG(m_logger) << "mseHasMountedBsm mse.id=" << mse.id
|
||||
<< " name=" << mse.name;
|
||||
for (const InfrastructureManagement::StructureElement &element : std::as_const(mse.elements))
|
||||
{
|
||||
|
||||
if (element.mountingPointTypeId() != mpType)
|
||||
if (element.mountingPointTypeId != mpType)
|
||||
continue;
|
||||
|
||||
DEBUG_LOG(m_logger) << "Mountpoint BSM:" << element.id()
|
||||
<< " name=" << element.name();
|
||||
if (isMounted(element.id()))
|
||||
DEBUG_LOG(m_logger) << "Mountpoint BSM:" << element.id
|
||||
<< " name=" << element.name;
|
||||
if (isMounted(element.id))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -391,9 +393,9 @@ bool EgcuModel::isMounted(int mountingPointId)
|
||||
DEBUG_LOG(m_logger) << "isMounted id=" << mountingPointId;
|
||||
for (const InfrastructureManagement::MountingPointAsset &asset : std::as_const(m_mountingPointAssets))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "assetId=" << asset.structureElementId()
|
||||
DEBUG_LOG(m_logger) << "assetId=" << asset.structureElementId
|
||||
<< " mountingPointId=" << mountingPointId;
|
||||
if (asset.structureElementId() == mountingPointId)
|
||||
if (asset.structureElementId == mountingPointId)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -419,28 +421,28 @@ void EgcuModel::initData()
|
||||
for (const InfrastructureManagement::MainStructureElement &mse : std::as_const(mainStructEles))
|
||||
{
|
||||
|
||||
if (mse.structureElementTypeId() != InfrastructureManagement::StructureElementType::Building)
|
||||
if (mse.structureElementTypeId != InfrastructureManagement::StructureElementType::Building)
|
||||
continue;
|
||||
|
||||
if ( !m_dtc->isElementAssignedToExercise( mse, m_session->exerciseId()))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "EgcuModel::initData mseId=" << mse.id() << " not in Exercise";
|
||||
DEBUG_LOG(m_logger) << "EgcuModel::initData mseId=" << mse.id << " not in Exercise";
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
QJsonParseError parserError;
|
||||
QByteArray content = QByteArray::fromStdString(mse.properties());
|
||||
QByteArray content = QByteArray::fromStdString(mse.properties);
|
||||
|
||||
|
||||
QJsonDocument::fromJson(content, &parserError);
|
||||
if (parserError.error != QJsonParseError::NoError)
|
||||
continue;
|
||||
|
||||
for (const InfrastructureManagement::StructureElement ¤tElement : std::as_const(mse.elements()))
|
||||
for (const InfrastructureManagement::StructureElement ¤tElement : std::as_const(mse.elements))
|
||||
{
|
||||
NGLTreeItem *item = nullptr;
|
||||
if (currentElement.structureElementTypeId() == InfrastructureManagement::StructureElementType::MountingPoint)
|
||||
if (currentElement.structureElementTypeId == InfrastructureManagement::StructureElementType::MountingPoint)
|
||||
item = createItemFromMountingPoint(currentElement);
|
||||
else
|
||||
item = createItemFromStructureElement(currentElement);
|
||||
@@ -448,7 +450,7 @@ void EgcuModel::initData()
|
||||
if (!item)
|
||||
continue;
|
||||
|
||||
const auto &path = currentElement.path();
|
||||
const auto &path = currentElement.path;
|
||||
|
||||
QModelIndex parentIndex;
|
||||
if (path.size() > 1)
|
||||
@@ -456,15 +458,15 @@ void EgcuModel::initData()
|
||||
parentIndex = treeIndices.value(path.at(path.size() - 2), indexFromItem(m_rootItem));
|
||||
if (!parentIndex.isValid())
|
||||
{
|
||||
INFO_LOG(m_logger) << "Did not find parent for structure element with id " << currentElement.id() << " mseid: " << mse.id();
|
||||
for (const InfrastructureManagement::StructureElement &se : mse.elements())
|
||||
INFO_LOG(m_logger) << " se: " << se.id() << ", " << se.name();
|
||||
INFO_LOG(m_logger) << "Did not find parent for structure element with id " << currentElement.id << " mseid: " << mse.id;
|
||||
for (const InfrastructureManagement::StructureElement &se : mse.elements)
|
||||
INFO_LOG(m_logger) << " se: " << se.id << ", " << se.name;
|
||||
}
|
||||
}
|
||||
else
|
||||
parentIndex = indexFromItem(m_rootItem);
|
||||
|
||||
if (currentElement.mountingPointTypeId() == InfrastructureManagement::MountingPointType::BuildingSensorModule)
|
||||
if (currentElement.mountingPointTypeId == InfrastructureManagement::MountingPointType::BuildingSensorModule)
|
||||
continue;
|
||||
|
||||
bool bMseHasMountedBsm = mseHasMountedAsset(mse, InfrastructureManagement::MountingPointType::BuildingSensorModule);
|
||||
@@ -473,11 +475,11 @@ void EgcuModel::initData()
|
||||
|
||||
|
||||
if ( ( bMseHasMountedBsm || bMseHasMountedEgcu)
|
||||
&& (currentElement.structureElementTypeId() != InfrastructureManagement::StructureElementType::Room)
|
||||
&& (currentElement.structureElementTypeId() != InfrastructureManagement::StructureElementType::Floor))
|
||||
&& (currentElement.structureElementTypeId != InfrastructureManagement::StructureElementType::Room)
|
||||
&& (currentElement.structureElementTypeId != InfrastructureManagement::StructureElementType::Floor))
|
||||
{
|
||||
insertRow(rowCount(parentIndex), parentIndex, item);
|
||||
treeIndices.insert(currentElement.id(), index(item->row(), 0, parentIndex));
|
||||
treeIndices.insert(currentElement.id, index(item->row(), 0, parentIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -485,12 +487,12 @@ void EgcuModel::initData()
|
||||
|
||||
NGLTreeItem* EgcuModel::createItemFromMountingPoint(const InfrastructureManagement::StructureElement ¤tElement)
|
||||
{
|
||||
const InfrastructureManagement::MountingPoint &mountingPoint = m_dataInterface->mountingPoint(currentElement.id());
|
||||
const InfrastructureManagement::MountingPoint &mountingPoint = m_dataInterface->mountingPoint(currentElement.id);
|
||||
|
||||
if (!mountingPoint.isValid())
|
||||
return {};
|
||||
|
||||
switch (mountingPoint.type().underlying())
|
||||
switch (mountingPoint.type())
|
||||
{
|
||||
case InfrastructureManagement::MountingPointType::EffectGenerationControlUnit:
|
||||
{
|
||||
@@ -499,13 +501,13 @@ NGLTreeItem* EgcuModel::createItemFromMountingPoint(const InfrastructureManageme
|
||||
DEBUG_LOG(m_logger) << "mountingPoint Id=" << mountingPoint.buildingId()
|
||||
<< " properties=" << mountingPoint.properties()
|
||||
<< " associatedAssetId=" << mountingPoint.associatedAssetId()
|
||||
<< " isUsed=" << mountingPoint.data().isUsed()
|
||||
<< " mountingPointId=" << mountingPoint.data().mountingPointId();
|
||||
<< " isUsed=" << mountingPoint.data().isUsed
|
||||
<< " mountingPointId=" << mountingPoint.data().mountingPointId;
|
||||
|
||||
const InfrastructureManagement::InstrumentationAsset ia = m_dtc->instrumentationAsset(mountingPoint.associatedAssetId());
|
||||
|
||||
int mpaId = 0;
|
||||
m_dtc->getMountingPointAssetId(currentElement.id(), ia.id(), mpaId);
|
||||
m_dtc->getMountingPointAssetId(currentElement.id, ia.id, mpaId);
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||
QSet<int> relayIds;
|
||||
@@ -515,8 +517,8 @@ NGLTreeItem* EgcuModel::createItemFromMountingPoint(const InfrastructureManageme
|
||||
const QSet<int> relayIds(m_relayInfos.keyBegin(), m_relayInfos.keyEnd());
|
||||
#endif
|
||||
|
||||
const auto &mse = m_dtc->mainStructureElement(currentElement.mainStructureElementId());
|
||||
EgcuData mpData(ia, mountingPoint, mse, m_bldDtc->relayState(ia.id()), m_dtc->mountingPointAsset(mpaId), relayIds);
|
||||
const auto &mse = m_dtc->mainStructureElement(currentElement.mainStructureElementId);
|
||||
EgcuData mpData(ia, mountingPoint, mse, m_bldDtc->relayState(ia.id), m_dtc->mountingPointAsset(mpaId), relayIds);
|
||||
|
||||
return new NGLTreeItem(QVariant::fromValue(mpData));
|
||||
break;
|
||||
@@ -540,7 +542,7 @@ NGLTreeItem* EgcuModel::createItemFromMountingPoint(const InfrastructureManageme
|
||||
|
||||
NGLTreeItem* EgcuModel::createItemFromStructureElement(const InfrastructureManagement::StructureElement ¤tElement)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "createItemFromStructureElement" << currentElement.displayName();
|
||||
DEBUG_LOG(m_logger) << "createItemFromStructureElement" << currentElement.displayName;
|
||||
return new NGLTreeItem(QVariant::fromValue(currentElement));
|
||||
}
|
||||
|
||||
@@ -572,21 +574,21 @@ InfrastructureManagement::StructureElementType EgcuModel::getStructureElementTyp
|
||||
{
|
||||
NGLTreeItem *item = privateData(index);
|
||||
if (!item)
|
||||
return InfrastructureManagement::StructureElementType::get_default();
|
||||
return InfrastructureManagement::StructureElementType::TrainingArea;
|
||||
|
||||
if (item->data().canConvert<EgcuData>())
|
||||
return InfrastructureManagement::StructureElementType::MountingPoint;
|
||||
else if (item->data().canConvert<InfrastructureManagement::StructureElement>())
|
||||
return item->data().value<InfrastructureManagement::StructureElement>().structureElementTypeId();
|
||||
return item->data().value<InfrastructureManagement::StructureElement>().structureElementTypeId;
|
||||
else
|
||||
return InfrastructureManagement::StructureElementType::get_default();
|
||||
return InfrastructureManagement::StructureElementType::TrainingArea;
|
||||
}
|
||||
|
||||
void EgcuModel::udpatePropertiesForRelayOverride(const int relay,
|
||||
const InfrastructureManagement::EffectOverride state,
|
||||
InfrastructureManagement::StructureElement &se)
|
||||
{
|
||||
QByteArray content = QByteArray::fromStdString(se.properties());
|
||||
QByteArray content = QByteArray::fromStdString(se.properties);
|
||||
const QJsonDocument doc(QJsonDocument::fromJson(content));
|
||||
|
||||
QJsonObject docObj = QJsonObject(doc.object());
|
||||
@@ -604,15 +606,15 @@ void EgcuModel::udpatePropertiesForRelayOverride(const int relay,
|
||||
if (key != relay)
|
||||
continue;
|
||||
|
||||
if (state.underlying() != InfrastructureManagement::EffectOverride::Automatic)
|
||||
arrRelays[i] = QJsonObject({qMakePair<QString, QJsonValue>(keyStr, state.underlying())});
|
||||
if (state != InfrastructureManagement::EffectOverride::Automatic)
|
||||
arrRelays[i] = QJsonObject({QPair<QString, QJsonValue>(keyStr, QJsonValue(static_cast<int>(state)))});
|
||||
else
|
||||
arrRelays.removeAt(i);
|
||||
containsRelay = true;
|
||||
break;
|
||||
}
|
||||
if (!containsRelay && state.underlying() != InfrastructureManagement::EffectOverride::Automatic)
|
||||
arrRelays.append(QJsonObject({qMakePair<QString, QJsonValue>(QString::number(relay), state.underlying())}));
|
||||
if (!containsRelay && state != InfrastructureManagement::EffectOverride::Automatic)
|
||||
arrRelays.append(QJsonObject({QPair<QString, QJsonValue>(QString::number(relay), QJsonValue(static_cast<int>(state)))}));
|
||||
|
||||
if (arrRelays.isEmpty())
|
||||
overridesObj.remove(QStringLiteral("relays"));
|
||||
@@ -626,21 +628,21 @@ void EgcuModel::udpatePropertiesForRelayOverride(const int relay,
|
||||
|
||||
QByteArray content_neu = QJsonDocument(docObj).toJson(QJsonDocument::Compact);
|
||||
|
||||
se.properties(content_neu.toStdString());
|
||||
se.properties = content_neu.toStdString();
|
||||
}
|
||||
|
||||
void EgcuModel::udpatePropertiesForOverride(const QString &tagName,
|
||||
const InfrastructureManagement::EffectOverride state,
|
||||
InfrastructureManagement::StructureElement &se)
|
||||
{
|
||||
QByteArray content = QByteArray::fromStdString(se.properties());
|
||||
QByteArray content = QByteArray::fromStdString(se.properties);
|
||||
const QJsonDocument doc(QJsonDocument::fromJson(content));
|
||||
|
||||
QJsonObject docObj = QJsonObject(doc.object());
|
||||
QJsonObject overridesObj = docObj.value(QStringLiteral("Overrides")).toObject();
|
||||
|
||||
if (state.underlying() != InfrastructureManagement::EffectOverride::Automatic)
|
||||
overridesObj.insert(tagName, state.underlying());
|
||||
if (state != InfrastructureManagement::EffectOverride::Automatic)
|
||||
overridesObj.insert(tagName, static_cast<int>(state));
|
||||
else
|
||||
overridesObj.remove(tagName);
|
||||
|
||||
@@ -651,7 +653,7 @@ void EgcuModel::udpatePropertiesForOverride(const QString &tagName,
|
||||
|
||||
QByteArray content_neu = QJsonDocument(docObj).toJson(QJsonDocument::Compact);
|
||||
|
||||
se.properties(content_neu.toStdString());
|
||||
se.properties = content_neu.toStdString();
|
||||
}
|
||||
|
||||
|
||||
@@ -681,8 +683,8 @@ void EgcuModel::findBuildings(NGLTreeItem *item, QMap<int, InfrastructureManagem
|
||||
return;
|
||||
|
||||
InfrastructureManagement::StructureElement se = item->data().value<InfrastructureManagement::StructureElement>();
|
||||
if (se.structureElementTypeId() == InfrastructureManagement::StructureElementType::Building)
|
||||
buildings[se.mainStructureElementId()] = se;
|
||||
if (se.structureElementTypeId == InfrastructureManagement::StructureElementType::Building)
|
||||
buildings[se.mainStructureElementId] = se;
|
||||
}
|
||||
|
||||
QPair<QMap<int, InfrastructureManagement::StructureElement>, QMap<int, InfrastructureManagement::StructureElement> > EgcuModel::findEgcusAndBuildings(const QModelIndexList &indexes)
|
||||
@@ -744,26 +746,26 @@ void EgcuModel::getContextMenu(const QModelIndexList &indexes, QMenu &menu)
|
||||
{
|
||||
menu.addSeparator();
|
||||
menu.addAction(addContextMenuHeaderItem(tr("Center on Map")));
|
||||
menu.addAction(getCenterAction(buildings.first().mainStructureElementId()));
|
||||
menu.addAction(getCenterAction(buildings.first().mainStructureElementId));
|
||||
}
|
||||
}
|
||||
|
||||
QAction* EgcuModel::getRelayAction(const InfrastructureManagement::EffectOverride eo, const QMap<int, InfrastructureManagement::StructureElement> &egcus, const AssetManagement::RelayInfo &relayInfo)
|
||||
{
|
||||
if (!readAllowance(eo, relayInfo.property()))
|
||||
if (!readAllowance(eo, relayInfo.property))
|
||||
return nullptr;
|
||||
|
||||
QAction *action = new QAction(QString::fromStdString(relayInfo.name()), this);
|
||||
QAction *action = new QAction(QString::fromStdString(relayInfo.name), this);
|
||||
|
||||
for (const InfrastructureManagement::StructureElement &se : std::as_const(egcus))
|
||||
{
|
||||
connect(action, &QAction::triggered, this, [this, se, eo, relayInfo](){
|
||||
auto copy = se;
|
||||
udpatePropertiesForRelayOverride(relayInfo.id(), eo, copy);
|
||||
udpatePropertiesForRelayOverride(relayInfo.id, eo, copy);
|
||||
InfrastructureManagement::StructureElementModifyRequest request;
|
||||
request.mainStructureElementId(se.mainStructureElementId());
|
||||
request.elements().resize(1);
|
||||
request.elements().at(0) = copy;
|
||||
request.mainStructureElementId = se.mainStructureElementId;
|
||||
request.elements.resize(1);
|
||||
request.elements.at(0) = copy;
|
||||
m_requestHelper->startSingleRequest([request, this]()
|
||||
{
|
||||
return m_ftc->structureElementModifyRequest(request, this);
|
||||
@@ -783,7 +785,7 @@ void EgcuModel::setAllOverrides(InfrastructureManagement::EffectOverride eo, con
|
||||
QVector<AssetManagement::RelayInfo> allowedRelays;
|
||||
for (const AssetManagement::RelayInfo &relayInfo : m_asmDtc->relayInfos())
|
||||
{
|
||||
if (readAllowance(eo, relayInfo.property()))
|
||||
if (readAllowance(eo, relayInfo.property))
|
||||
allowedRelays << relayInfo;
|
||||
}
|
||||
|
||||
@@ -794,16 +796,16 @@ void EgcuModel::setAllOverrides(InfrastructureManagement::EffectOverride eo, con
|
||||
{
|
||||
auto copy = egcu;
|
||||
for (const AssetManagement::RelayInfo &relayInfo : std::as_const(allowedRelays))
|
||||
udpatePropertiesForRelayOverride(relayInfo.id(), eo, copy);
|
||||
udpatePropertiesForRelayOverride(relayInfo.id, eo, copy);
|
||||
|
||||
if (!requests.contains(egcu.mainStructureElementId()))
|
||||
if (!requests.contains(egcu.mainStructureElementId))
|
||||
{
|
||||
requests.insert(egcu.mainStructureElementId(), {});
|
||||
requests[egcu.mainStructureElementId()].mainStructureElementId(egcu.mainStructureElementId());
|
||||
requests.insert(egcu.mainStructureElementId, {});
|
||||
requests[egcu.mainStructureElementId].mainStructureElementId = egcu.mainStructureElementId;
|
||||
}
|
||||
auto &req = requests[egcu.mainStructureElementId()];
|
||||
req.elements().resize(req.elements().size() + 1);
|
||||
req.elements().at(req.elements().size() - 1) = copy;
|
||||
auto &req = requests[egcu.mainStructureElementId];
|
||||
req.elements.resize(req.elements.size() + 1);
|
||||
req.elements.at(req.elements.size() - 1) = copy;
|
||||
}
|
||||
|
||||
for (const InfrastructureManagement::StructureElement &building : std::as_const(buildings))
|
||||
@@ -811,14 +813,14 @@ void EgcuModel::setAllOverrides(InfrastructureManagement::EffectOverride eo, con
|
||||
auto copy = building;
|
||||
udpatePropertiesForOverride(QLatin1String("flash"), eo == InfrastructureManagement::EffectOverride::PermanentOn ? InfrastructureManagement::EffectOverride::Automatic : eo, copy);
|
||||
|
||||
if (!requests.contains(building.mainStructureElementId()))
|
||||
if (!requests.contains(building.mainStructureElementId))
|
||||
{
|
||||
requests.insert(building.mainStructureElementId(), {});
|
||||
requests[building.mainStructureElementId()].mainStructureElementId(building.mainStructureElementId());
|
||||
requests.insert(building.mainStructureElementId, {});
|
||||
requests[building.mainStructureElementId].mainStructureElementId = building.mainStructureElementId;
|
||||
}
|
||||
auto &req = requests[building.mainStructureElementId()];
|
||||
req.elements().resize(req.elements().size() + 1);
|
||||
req.elements().at(req.elements().size() - 1) = copy;
|
||||
auto &req = requests[building.mainStructureElementId];
|
||||
req.elements.resize(req.elements.size() + 1);
|
||||
req.elements.at(req.elements.size() - 1) = copy;
|
||||
}
|
||||
|
||||
for (const auto &req : std::as_const(requests))
|
||||
@@ -849,9 +851,9 @@ QAction* EgcuModel::getGenericAction(const InfrastructureManagement::EffectOverr
|
||||
auto copy = se;
|
||||
udpatePropertiesForOverride(tagName, eo, copy);
|
||||
InfrastructureManagement::StructureElementModifyRequest request;
|
||||
request.mainStructureElementId(copy.mainStructureElementId());
|
||||
request.elements().resize(1);
|
||||
request.elements().at(0) = copy;
|
||||
request.mainStructureElementId = copy.mainStructureElementId;
|
||||
request.elements.resize(1);
|
||||
request.elements.at(0) = copy;
|
||||
m_requestHelper->startSingleRequest([request, this]()
|
||||
{
|
||||
return m_ftc->structureElementModifyRequest(request, this);
|
||||
@@ -864,15 +866,15 @@ QAction* EgcuModel::getGenericAction(const InfrastructureManagement::EffectOverr
|
||||
Buildings::SwitchRelayRequest EgcuModel::createSwitchRelayRequest(int buildingId, int assetId, int relayId, Buildings::StateSetRelay state, int pulse, int count, int pause)
|
||||
{
|
||||
Buildings::SwitchRelayRequest req;
|
||||
req.buildingId(buildingId);
|
||||
req.assetId(assetId);
|
||||
req.number(relayId);
|
||||
req.buildingId = buildingId;
|
||||
req.assetId = assetId;
|
||||
req.number = relayId;
|
||||
Buildings::SwitchRelayPulse pulseAttributes;
|
||||
pulseAttributes.count(count);
|
||||
pulseAttributes.delay(pause);
|
||||
pulseAttributes.pulse(pulse);
|
||||
req.pulseAttributes(pulseAttributes);
|
||||
req.state(state);
|
||||
pulseAttributes.count = count;
|
||||
pulseAttributes.delay = pause;
|
||||
pulseAttributes.pulse = pulse;
|
||||
req.pulseAttributes = pulseAttributes;
|
||||
req.state = state;
|
||||
return req;
|
||||
}
|
||||
|
||||
@@ -899,7 +901,7 @@ NGLTreeItem* EgcuModel::findItemByAssetId(int assetId, NGLTreeItem *parent) cons
|
||||
if (parent->data().canConvert<EgcuData>())
|
||||
{
|
||||
EgcuData mpData = parent->data().value<EgcuData>();
|
||||
if (mpData.instrumentationAsset.id() == assetId)
|
||||
if (mpData.instrumentationAsset.id == assetId)
|
||||
return parent;
|
||||
}
|
||||
for (NGLTreeItem* child : parent->constChildren())
|
||||
@@ -916,7 +918,7 @@ NGLTreeItem* EgcuModel::findItemByMseId(int mseId, NGLTreeItem *parent) const
|
||||
if (parent->data().canConvert<InfrastructureManagement::StructureElement>())
|
||||
{
|
||||
InfrastructureManagement::StructureElement se = parent->data().value<InfrastructureManagement::StructureElement>();
|
||||
if (se.mainStructureElementId() == mseId)
|
||||
if (se.mainStructureElementId == mseId)
|
||||
return parent;
|
||||
}
|
||||
for (NGLTreeItem* child : parent->constChildren())
|
||||
@@ -933,7 +935,7 @@ NGLTreeItem* EgcuModel::findItemByStructureElementId(int seId, NGLTreeItem *pare
|
||||
if (parent->data().canConvert<InfrastructureManagement::StructureElement>())
|
||||
{
|
||||
InfrastructureManagement::StructureElement se = parent->data().value<InfrastructureManagement::StructureElement>();
|
||||
if (se.id() == seId)
|
||||
if (se.id == seId)
|
||||
return parent;
|
||||
}
|
||||
for (NGLTreeItem* child : parent->constChildren())
|
||||
@@ -961,14 +963,14 @@ void EgcuModel::findStructureElementChildrenByIds(NGLTreeItem *parent, const QVe
|
||||
if (parent->data().canConvert<EgcuData>())
|
||||
{
|
||||
const auto &val = parent->data().value<EgcuData>();
|
||||
if (structureElementIds.contains(val.mountingPoint.data().id()))
|
||||
map.insert(val.mountingPoint.data().id(), indexFromItem(parent));
|
||||
if (structureElementIds.contains(val.mountingPoint.data().id))
|
||||
map.insert(val.mountingPoint.data().id, indexFromItem(parent));
|
||||
}
|
||||
else if (parent->data().canConvert<InfrastructureManagement::StructureElement>())
|
||||
{
|
||||
const auto &val = parent->data().value<InfrastructureManagement::StructureElement>();
|
||||
if (structureElementIds.contains(val.id()))
|
||||
map.insert(val.id(), indexFromItem(parent));
|
||||
if (structureElementIds.contains(val.id))
|
||||
map.insert(val.id, indexFromItem(parent));
|
||||
}
|
||||
for (NGLTreeItem* child : parent->constChildren())
|
||||
findStructureElementChildrenByIds(child, structureElementIds, map);
|
||||
@@ -1026,7 +1028,7 @@ void EgcuModel::onInstrumentationAssetChanged(const InfrastructureManagement::In
|
||||
{
|
||||
EgcuData mpData = egcu->data().value<EgcuData>();
|
||||
|
||||
if (mpData.instrumentationAsset.id() != instrumentationAsset.id())
|
||||
if (mpData.instrumentationAsset.id != instrumentationAsset.id)
|
||||
continue;
|
||||
|
||||
mpData.update(instrumentationAsset, false);
|
||||
@@ -1041,7 +1043,7 @@ void EgcuModel::onMainStructureElementChanged(const InfrastructureManagement::Ma
|
||||
if (modType != DataModification::eModified)
|
||||
return;
|
||||
|
||||
NGLTreeItem *buildingSe = findItemByMseId(mainStructureElement.id(), m_rootItem);
|
||||
NGLTreeItem *buildingSe = findItemByMseId(mainStructureElement.id, m_rootItem);
|
||||
if (!buildingSe)
|
||||
return;
|
||||
|
||||
@@ -1053,10 +1055,10 @@ void EgcuModel::onMainStructureElementChanged(const InfrastructureManagement::Ma
|
||||
EgcuData mpData = egcu->data().value<EgcuData>();
|
||||
mpData.update(mainStructureElement);
|
||||
|
||||
for (auto se : mainStructureElement.elements())
|
||||
for (auto se : mainStructureElement.elements)
|
||||
{
|
||||
int oldId = mpData.mountingPoint.data().id();
|
||||
if (oldId != se.id())
|
||||
int oldId = mpData.mountingPoint.data().id;
|
||||
if (oldId != se.id)
|
||||
continue;
|
||||
mpData.update(se,false);
|
||||
break;
|
||||
@@ -1070,10 +1072,10 @@ void EgcuModel::onMainStructureElementChanged(const InfrastructureManagement::Ma
|
||||
findStructureElementChildren(buildingSe, structureElements);
|
||||
for (const auto &item : std::as_const(structureElements))
|
||||
{
|
||||
for (const auto &se : std::as_const(mainStructureElement.elements()))
|
||||
for (const auto &se : std::as_const(mainStructureElement.elements))
|
||||
{
|
||||
int oldId = item->data().value<InfrastructureManagement::StructureElement>().id();
|
||||
if (oldId != se.id())
|
||||
int oldId = item->data().value<InfrastructureManagement::StructureElement>().id;
|
||||
if (oldId != se.id)
|
||||
continue;
|
||||
item->setData(QVariant::fromValue(se));
|
||||
emit dataChanged(indexFromItem(item), indexFromItem(item,columnCount()-1));
|
||||
@@ -1085,7 +1087,7 @@ void EgcuModel::onMainStructureElementChanged(const InfrastructureManagement::Ma
|
||||
void EgcuModel::onRelayStateChanged(const Buildings::RelayState &data, DataModification modType)
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
NGLTreeItem *item = findItemByAssetId(data.id(), m_rootItem);
|
||||
NGLTreeItem *item = findItemByAssetId(data.id, m_rootItem);
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
@@ -1098,9 +1100,9 @@ void EgcuModel::onRelayStateChanged(const Buildings::RelayState &data, DataModif
|
||||
void EgcuModel::onRelayInfoChanged(const AssetManagement::RelayInfo &data, DataModification modType)
|
||||
{
|
||||
if (modType == DataModification::eRemoved)
|
||||
m_relayInfos.remove(data.id());
|
||||
m_relayInfos.remove(data.id);
|
||||
else
|
||||
m_relayInfos[data.id()] = data;
|
||||
m_relayInfos[data.id] = data;
|
||||
}
|
||||
|
||||
void EgcuModel::onMountingPointAssetChanged(const InfrastructureManagement::MountingPointAsset &mpa, DataModification modType)
|
||||
@@ -1108,12 +1110,12 @@ void EgcuModel::onMountingPointAssetChanged(const InfrastructureManagement::Moun
|
||||
if (modType == DataModification::eAdded)
|
||||
{
|
||||
InfrastructureManagement::StructureElement se;
|
||||
m_dtc->getStructureElementById(mpa.structureElementId(), se);
|
||||
m_dtc->getStructureElementById(mpa.structureElementId, se);
|
||||
NGLTreeItem *item = createItemFromMountingPoint(se);
|
||||
|
||||
if (!item)
|
||||
return;
|
||||
int id = se.path()[se.path().size() - 2];
|
||||
int id = se.path[se.path.size() - 2];
|
||||
NGLTreeItem *parent = findItemByStructureElementId(id, m_rootItem);
|
||||
if (!parent)
|
||||
return;
|
||||
@@ -1123,17 +1125,16 @@ void EgcuModel::onMountingPointAssetChanged(const InfrastructureManagement::Moun
|
||||
}
|
||||
else if (modType == DataModification::eRemoved)
|
||||
{
|
||||
NGLTreeItem *item = findItemByAssetId(mpa.assetId(), m_rootItem);
|
||||
NGLTreeItem *item = findItemByAssetId(mpa.assetId, m_rootItem);
|
||||
if (!item)
|
||||
return;
|
||||
QModelIndex index = indexFromItem(item);
|
||||
removeRow(index.row(), index.parent());
|
||||
emit beginFilterChange();
|
||||
endFilterChange();
|
||||
emit invalidateFilter();
|
||||
}
|
||||
else if (modType == DataModification::eModified)
|
||||
{
|
||||
NGLTreeItem *item = findItemByAssetId(mpa.assetId(), m_rootItem);
|
||||
NGLTreeItem *item = findItemByAssetId(mpa.assetId, m_rootItem);
|
||||
if (!item)
|
||||
return;
|
||||
EgcuData mpData = item->data().value<EgcuData>();
|
||||
@@ -1213,8 +1214,7 @@ void EgcuProxyModel::showIncluded(const bool bShow)
|
||||
if (m_bShowIncluded == bShow)
|
||||
return;
|
||||
m_bShowIncluded = bShow;
|
||||
beginFilterChange();
|
||||
endFilterChange();
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
void EgcuProxyModel::showNotIncluded(const bool bShow)
|
||||
@@ -1222,8 +1222,7 @@ void EgcuProxyModel::showNotIncluded(const bool bShow)
|
||||
if (m_bShowNotIncluded == bShow)
|
||||
return;
|
||||
m_bShowNotIncluded = bShow;
|
||||
beginFilterChange();
|
||||
endFilterChange();
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
void EgcuProxyModel::setTypeFilter(const QSet<InfrastructureManagement::MountingPointType> &visibleTypes)
|
||||
@@ -1231,8 +1230,7 @@ void EgcuProxyModel::setTypeFilter(const QSet<InfrastructureManagement::Mounting
|
||||
if (m_visibleTypes == visibleTypes)
|
||||
return;
|
||||
m_visibleTypes = visibleTypes;
|
||||
beginFilterChange();
|
||||
endFilterChange();
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
void EgcuProxyModel::addToTypeFilter(const InfrastructureManagement::MountingPointType mpt, const bool bAdd)
|
||||
@@ -1292,12 +1290,12 @@ void EgcuData::update(const InfrastructureManagement::MountingPoint &mp, const b
|
||||
return;
|
||||
|
||||
mountingPoint = mp;
|
||||
rooms = EgcuModel::getRoomsForEgcu(mainStructureElement.properties(), mountingPoint.data().mountingPointId());
|
||||
rooms = EgcuModel::getRoomsForEgcu(mainStructureElement.properties, mountingPoint.data().mountingPointId);
|
||||
}
|
||||
|
||||
void EgcuData::update(const InfrastructureManagement::InstrumentationAsset &ia, const bool overrideId)
|
||||
{
|
||||
if ((ia.id() != instrumentationAsset.id()) && !overrideId)
|
||||
if ((ia.id != instrumentationAsset.id) && !overrideId)
|
||||
return;
|
||||
|
||||
instrumentationAsset = ia;
|
||||
@@ -1307,8 +1305,8 @@ EgcuData::EgcuData(const InfrastructureManagement::InstrumentationAsset &ia, con
|
||||
, mountingPoint(mp)
|
||||
, mainStructureElement(mse)
|
||||
, relayState(rs)
|
||||
, mountingPointAsset(mpa),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {
|
||||
, mountingPointAsset(mpa)
|
||||
{
|
||||
for (int relayId : relayIds)
|
||||
effectOverrides.insert(relayId, InfrastructureManagement::EffectOverride::Automatic);
|
||||
|
||||
@@ -1318,13 +1316,13 @@ EgcuData::EgcuData(const InfrastructureManagement::InstrumentationAsset &ia, con
|
||||
|
||||
void EgcuData::update(const InfrastructureManagement::MainStructureElement &mse)
|
||||
{
|
||||
if (mse.id() != mainStructureElement.id())
|
||||
if (mse.id != mainStructureElement.id)
|
||||
return;
|
||||
|
||||
mainStructureElement = mse;
|
||||
for(const auto &se : mse.elements())
|
||||
for(const auto &se : mse.elements)
|
||||
{
|
||||
if (se.id() != mountingPoint.id())
|
||||
if (se.id != mountingPoint.id())
|
||||
continue;
|
||||
update(se, false);
|
||||
}
|
||||
@@ -1332,14 +1330,14 @@ void EgcuData::update(const InfrastructureManagement::MainStructureElement &mse)
|
||||
|
||||
void EgcuData::update(const InfrastructureManagement::StructureElement &se, const bool overrideId)
|
||||
{
|
||||
if ((mountingPoint.id() != se.id()) && !overrideId)
|
||||
if ((mountingPoint.id() != se.id) && !overrideId)
|
||||
return;
|
||||
|
||||
mountingPoint.updateData(se, -10);
|
||||
rooms = EgcuModel::getRoomsForEgcu(mainStructureElement.properties(), mountingPoint.data().mountingPointId());
|
||||
rooms = EgcuModel::getRoomsForEgcu(mainStructureElement.properties, mountingPoint.data().mountingPointId);
|
||||
|
||||
QJsonParseError parserError;
|
||||
QByteArray content = QByteArray::fromStdString(se.properties());
|
||||
QByteArray content = QByteArray::fromStdString(se.properties);
|
||||
const QJsonDocument doc(QJsonDocument::fromJson(content, &parserError));
|
||||
|
||||
if (parserError.error != QJsonParseError::NoError)
|
||||
@@ -1379,14 +1377,14 @@ void EgcuData::update(const Buildings::RelayState &data)
|
||||
|
||||
int EgcuData::update(const InfrastructureManagement::MountingPointAsset &mpa)
|
||||
{
|
||||
if (mpa.id() != mountingPointAsset.id())
|
||||
if (mpa.id != mountingPointAsset.id)
|
||||
return 0;
|
||||
|
||||
mountingPointAsset = mpa;
|
||||
|
||||
if (mpa.assetId() != instrumentationAsset.id())
|
||||
if (mpa.assetId != instrumentationAsset.id)
|
||||
return 1;
|
||||
if (mpa.structureElementId() != mountingPoint.id())
|
||||
if (mpa.structureElementId != mountingPoint.id())
|
||||
return 2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
+2
-2
@@ -49,7 +49,7 @@ public:
|
||||
QMap<int, InfrastructureManagement::EffectOverride> effectOverrides;
|
||||
|
||||
QVector<int> rooms;
|
||||
QString segmentName() const { return (mountingPointAsset.name().empty() ? QString::fromStdString(instrumentationAsset.name()) : QString::fromStdString(mountingPointAsset.name())); }
|
||||
QString segmentName() const { return (mountingPointAsset.name.empty() ? QString::fromStdString(instrumentationAsset.name) : QString::fromStdString(mountingPointAsset.name)); }
|
||||
|
||||
explicit EgcuData() = default;
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
const InfrastructureManagement::MountingPointAsset &mpa,
|
||||
const QSet<int> &relayIds);
|
||||
|
||||
bool isNull() const { return (instrumentationAsset.id() == 0 || mountingPoint.id() == 0 || mainStructureElement.id() == 0); }
|
||||
bool isNull() const { return (instrumentationAsset.id == 0 || mountingPoint.id() == 0 || mainStructureElement.id == 0); }
|
||||
|
||||
|
||||
void update(const InfrastructureManagement::MainStructureElement &mse);
|
||||
|
||||
+7
-7
@@ -121,9 +121,9 @@ bool FaultMessageDialog::apply()
|
||||
return false;
|
||||
|
||||
OcSituationServer::EquipmentErrorRequest req;
|
||||
req.equipmentNumber(m_ui->leParticipant->text().toInt());
|
||||
req.device(m_ui->leDevice->text().toStdString());
|
||||
req.text(m_ui->teComment->toPlainText().toStdString());
|
||||
req.equipmentNumber = m_ui->leParticipant->text().toInt();
|
||||
req.device = m_ui->leDevice->text().toStdString();
|
||||
req.text = m_ui->teComment->toPlainText().toStdString();
|
||||
return m_requestHelper->startSingleRequest([req, this]()
|
||||
{
|
||||
return m_ossFtc->equipmentErrorRequest(req, this);
|
||||
@@ -167,8 +167,8 @@ void FaultMessageDialog::onSlotSelectionChanged()
|
||||
if (!selIndexes.isEmpty())
|
||||
{
|
||||
ParticipantManagement::ParticipantData part = m_model->getParticipantData(selIndexes.first());
|
||||
if (part.equipmentNumber().is_set())
|
||||
m_selectedEqNr = part.equipmentNumber().get();
|
||||
if (part.equipmentNumber.has_value())
|
||||
m_selectedEqNr = part.equipmentNumber.get();
|
||||
else
|
||||
m_selectedEqNr = -1;
|
||||
}
|
||||
@@ -209,9 +209,9 @@ void FaultMessageDialog::onSpecificsEquipmentChanged(const TrainingAreaBaseOC::S
|
||||
if (DataModification::eRemoved == modType)
|
||||
return;
|
||||
|
||||
m_ownEquipmentId = data.equipmentNumber();
|
||||
m_ownEquipmentId = data.equipmentNumber;
|
||||
if (m_ownEquipmentId <= 0)
|
||||
WARNING_LOG(m_logger) << "EquipmentNumber " << data.equipmentNumber() << " is not present ";
|
||||
WARNING_LOG(m_logger) << "EquipmentNumber " << data.equipmentNumber << " is not present ";
|
||||
}
|
||||
|
||||
}
|
||||
+25
-24
@@ -15,6 +15,7 @@ ManipulationModel::ManipulationModel(QObject *parent)
|
||||
tr("Time (PU)"),
|
||||
tr("Equipment Identification")},
|
||||
parent)
|
||||
, m_logger(getLogger("ManipulationModel"))
|
||||
{}
|
||||
|
||||
bool ManipulationModel::initModel(const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
@@ -30,7 +31,7 @@ bool ManipulationModel::initModel(const std::shared_ptr<ParticipantManagement::I
|
||||
|
||||
auto cbCs = [this](const ProjectDataManagement::CanComponentString &ccs)
|
||||
{
|
||||
m_ccsMap[ccs.canDeviceId()] = ccs;
|
||||
m_ccsMap[ccs.canDeviceId] = ccs;
|
||||
};
|
||||
pdmDtc->canComponentStrings(cbCs);
|
||||
|
||||
@@ -76,9 +77,9 @@ QVariant ManipulationModel::data(const QModelIndex &index,
|
||||
void ManipulationModel::manipulationDataChanged(const ParticipantManagement::DynamicParticipantData &data,
|
||||
DataModification modType)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "manipulationDataChanged: " << data.manipulation().size() << ", " << modType;
|
||||
DEBUG_LOG(m_logger) << "manipulationDataChanged: " << data.manipulation.size() << ", " << modType;
|
||||
|
||||
const bool isManipulated = data.manipulation().size() > 0;
|
||||
const bool isManipulated = data.manipulation.size() > 0;
|
||||
|
||||
switch (modType)
|
||||
{
|
||||
@@ -92,16 +93,16 @@ void ManipulationModel::manipulationDataChanged(const ParticipantManagement::Dyn
|
||||
return;
|
||||
|
||||
insertRow(mData);
|
||||
m_participantsWithManipulation += data.participantId();
|
||||
m_participantsWithManipulation += data.participantId;
|
||||
break;
|
||||
}
|
||||
case DataModification::eModified:
|
||||
{
|
||||
const int row = findRowForId(data.participantId());
|
||||
const int row = findRowForId(data.participantId);
|
||||
if (isManipulated)
|
||||
{
|
||||
if (row >= 0 && data.manipulation().size() > 0 &&
|
||||
m_vecData.at(row).manipulationTime == data.manipulation().at(data.manipulation().size() - 1).manipulationTime())
|
||||
if (row >= 0 && data.manipulation.size() > 0 &&
|
||||
m_vecData.at(row).manipulationTime == data.manipulation.at(data.manipulation.size() - 1).manipulationTime)
|
||||
{
|
||||
|
||||
break;
|
||||
@@ -113,12 +114,12 @@ void ManipulationModel::manipulationDataChanged(const ParticipantManagement::Dyn
|
||||
insertRow(mData);
|
||||
else
|
||||
setRowData(row, mData);
|
||||
m_participantsWithManipulation += data.participantId();
|
||||
m_participantsWithManipulation += data.participantId;
|
||||
}
|
||||
else
|
||||
{
|
||||
removeRow(row);
|
||||
m_participantsWithManipulation -= data.participantId();
|
||||
m_participantsWithManipulation -= data.participantId;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -129,18 +130,18 @@ void ManipulationModel::manipulationDataChanged(const ParticipantManagement::Dyn
|
||||
|
||||
void ManipulationModel::participantChanged(const ParticipantManagement::Participant &data, DataModification modType)
|
||||
{
|
||||
if (!m_participantsWithManipulation.contains(data.id()))
|
||||
if (!m_participantsWithManipulation.contains(data.id))
|
||||
return;
|
||||
const int row = findRowForId(data.id());
|
||||
const int row = findRowForId(data.id);
|
||||
if (row < 0)
|
||||
return;
|
||||
if (!data.equipmentNumber().is_set() || modType == DataModification::eRemoved)
|
||||
if (!data.equipmentNumber.has_value() || modType == DataModification::eRemoved)
|
||||
{
|
||||
removeRow(row);
|
||||
m_participantsWithManipulation -= data.id();
|
||||
m_participantsWithManipulation -= data.id;
|
||||
return;
|
||||
}
|
||||
m_vecData[row].equipNo = data.equipmentNumber().get();
|
||||
m_vecData[row].equipNo = data.equipmentNumber.get();
|
||||
const QModelIndex idx(index(row, EquipmentNummer));
|
||||
emit dataChanged(idx, idx, {Qt::DisplayRole});
|
||||
}
|
||||
@@ -148,16 +149,16 @@ void ManipulationModel::participantChanged(const ParticipantManagement::Particip
|
||||
ManipulationData ManipulationModel::buildManipulationData(const ParticipantManagement::DynamicParticipantData &data) const
|
||||
{
|
||||
ManipulationData mData;
|
||||
if (data.manipulation().size() == 0)
|
||||
if (data.manipulation.size() == 0)
|
||||
return mData;
|
||||
const auto equipNo = m_ppmDtc->participant(data.participantId()).equipmentNumber();
|
||||
if (!equipNo.is_set())
|
||||
const auto equipNo = m_ppmDtc->participant(data.participantId).equipmentNumber;
|
||||
if (!equipNo.has_value())
|
||||
return mData;
|
||||
mData.participantId = data.participantId();
|
||||
mData.participantId = data.participantId;
|
||||
mData.equipNo = equipNo.get();
|
||||
mData.sampleTime = data.sampleTime();
|
||||
mData.manipulationTime = data.manipulation().at(data.manipulation().size() - 1).manipulationTime();
|
||||
mData.canDevices = buildCanDeviceString(data.manipulation());
|
||||
mData.sampleTime = data.sampleTime;
|
||||
mData.manipulationTime = data.manipulation.at(data.manipulation.size() - 1).manipulationTime;
|
||||
mData.canDevices = buildCanDeviceString(data.manipulation);
|
||||
return mData;
|
||||
}
|
||||
|
||||
@@ -166,11 +167,11 @@ QString ManipulationModel::buildCanDeviceString(const std::vector<ParticipantMan
|
||||
QStringList canDeviceList;
|
||||
for (const ParticipantManagement::ManipulationInformation &mi : manipulations)
|
||||
{
|
||||
auto it = m_ccsMap.find(mi.equipmentFunctionId());
|
||||
auto it = m_ccsMap.find(mi.equipmentFunctionId);
|
||||
if (it == m_ccsMap.end())
|
||||
canDeviceList.prepend(tr("Unknown can device (%1)").arg(mi.equipmentFunctionId()));
|
||||
canDeviceList.prepend(tr("Unknown can device (%1)").arg(mi.equipmentFunctionId));
|
||||
else
|
||||
canDeviceList.prepend(m_pdmDtc->trCanComponentStringName(it.value().id()));
|
||||
canDeviceList.prepend(m_pdmDtc->trCanComponentStringName(it.value().id));
|
||||
}
|
||||
return canDeviceList.join(QLatin1Char(','));
|
||||
}
|
||||
|
||||
+1
@@ -7,6 +7,7 @@
|
||||
#include <LtsWidgets/lts_column_filter_proxy_model.h>
|
||||
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ProjectDataManagement/pdm_dtc.h>
|
||||
#include <QtCore/QSet>
|
||||
#include <Common/logger.h>
|
||||
|
||||
+2
-2
@@ -23,9 +23,9 @@ bool PartyPlayerModel::initModel(LtsSession::LtsSessionDataDds *session)
|
||||
const auto dynPartData = m_ppmDtc->dynamicParticipantDatas();
|
||||
for (const ParticipantManagement::Participant &part : std::as_const(m_participants))
|
||||
{
|
||||
if (!part.equipmentNumber().is_set())
|
||||
if (!part.equipmentNumber.has_value())
|
||||
continue;
|
||||
playerData.push_back(setPlayerData(part, dynPartData.value(part.id())));
|
||||
playerData.push_back(setPlayerData(part, dynPartData.value(part.id)));
|
||||
};
|
||||
setData(playerData);
|
||||
|
||||
|
||||
+19
-19
@@ -30,12 +30,12 @@ void SinglePlayerModel::loadData(const QVector<int> &idList)
|
||||
if (itParticipants == participants.end())
|
||||
continue;
|
||||
const auto &participant = itParticipants.value();
|
||||
if (!participant.equipmentNumber().is_set())
|
||||
if (!participant.equipmentNumber.has_value())
|
||||
continue;
|
||||
const int row = findRowForId(participant.id());
|
||||
const int row = findRowForId(participant.id);
|
||||
if (row == -1)
|
||||
{
|
||||
auto itDynData = dynPartData.find(participant.id());
|
||||
auto itDynData = dynPartData.find(participant.id);
|
||||
newRows.push_back(setPlayerData(itParticipants.value(), itDynData == dynPartData.end() ?
|
||||
ParticipantManagement::DynamicParticipantData() :
|
||||
itDynData.value()));
|
||||
@@ -51,15 +51,15 @@ void SinglePlayerModel::loadData(const QVector<int> &idList)
|
||||
{
|
||||
if (equipNos.isEmpty())
|
||||
break;
|
||||
if (participant.equipmentNumber().is_set() && equipNos.contains(-participant.equipmentNumber().get()))
|
||||
if (participant.equipmentNumber.has_value() && equipNos.contains(-participant.equipmentNumber.get()))
|
||||
{
|
||||
equipNos.removeAll(-participant.equipmentNumber().get());
|
||||
int row = findRowForId(participant.id());
|
||||
equipNos.removeAll(-participant.equipmentNumber.get());
|
||||
int row = findRowForId(participant.id);
|
||||
if (row < 0)
|
||||
row = findRowForId(-participant.equipmentNumber().get());
|
||||
row = findRowForId(-participant.equipmentNumber.get());
|
||||
if (row == -1)
|
||||
{
|
||||
auto itDynData = dynPartData.find(participant.id());
|
||||
auto itDynData = dynPartData.find(participant.id);
|
||||
newRows.push_back(setPlayerData(participant, itDynData == dynPartData.end() ?
|
||||
ParticipantManagement::DynamicParticipantData() :
|
||||
itDynData.value()));
|
||||
@@ -70,9 +70,9 @@ void SinglePlayerModel::loadData(const QVector<int> &idList)
|
||||
for (int equipNo : std::as_const(equipNos))
|
||||
{
|
||||
ParticipantManagement::Participant p;
|
||||
p.id(equipNo);
|
||||
p.equipmentNumber(-equipNo);
|
||||
if (!findParticipantId(p.id()))
|
||||
p.id = equipNo;
|
||||
p.equipmentNumber = -equipNo;
|
||||
if (!findParticipantId(p.id))
|
||||
newRows.push_back(setPlayerData(p, ParticipantManagement::DynamicParticipantData()));
|
||||
}
|
||||
insertRows(newRows);
|
||||
@@ -96,18 +96,18 @@ QVector<int> SinglePlayerModel::updateDataView(const QVector<int> &equipNumberLi
|
||||
if (itEquipNo == equipNo2PartMap.end())
|
||||
{
|
||||
ParticipantManagement::Participant p;
|
||||
p.id(-number);
|
||||
p.equipmentNumber(number);
|
||||
if (!findParticipantId(p.id()))
|
||||
p.id = -number;
|
||||
p.equipmentNumber = number;
|
||||
if (!findParticipantId(p.id))
|
||||
newRows.push_back(setPlayerData(p, ParticipantManagement::DynamicParticipantData()));
|
||||
continue;
|
||||
}
|
||||
const auto &participant = itEquipNo.value();
|
||||
ret += participant.id();
|
||||
const int row = findRowForId(participant.id());
|
||||
ret += participant.id;
|
||||
const int row = findRowForId(participant.id);
|
||||
if (row == -1)
|
||||
{
|
||||
auto itDynData = dynPartData.find(participant.id());
|
||||
auto itDynData = dynPartData.find(participant.id);
|
||||
newRows.push_back(setPlayerData(itEquipNo.value(),
|
||||
itDynData == dynPartData.end() ?
|
||||
ParticipantManagement::DynamicParticipantData() :
|
||||
@@ -128,8 +128,8 @@ QHash<int,ParticipantManagement::Participant> SinglePlayerModel::participantsByE
|
||||
ret.reserve(m_participants.size());
|
||||
for (const ParticipantManagement::Participant &part : m_participants)
|
||||
{
|
||||
if (part.equipmentNumber().is_set())
|
||||
ret.insert(part.equipmentNumber().get(), part);
|
||||
if (part.equipmentNumber.has_value())
|
||||
ret.insert(part.equipmentNumber.get(), part);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
+25
-25
@@ -41,15 +41,15 @@ bool StructureElementEdit::init(const InfrastructureManagement::StructureElement
|
||||
if (!session->getFtc<InfrastructureManagement::DataInterface>(m_ismFtc))
|
||||
return false;
|
||||
|
||||
if (m_structureElement.structureElementTypeId() != InfrastructureManagement::StructureElementType::Building)
|
||||
if (m_structureElement.structureElementTypeId != InfrastructureManagement::StructureElementType::Building)
|
||||
{
|
||||
m_ui->groupBox->hide();
|
||||
}
|
||||
|
||||
|
||||
m_ui->cbFlashing->addItem(tr("Off"), InfrastructureManagement::EffectOverride::PermanentOff);
|
||||
m_ui->cbFlashing->addItem(tr("Auto"), InfrastructureManagement::EffectOverride::Automatic);
|
||||
m_ui->cbFlashing->setCurrentIndex(m_ui->cbFlashing->findData(InfrastructureManagement::EffectOverride::Automatic));
|
||||
m_ui->cbFlashing->addItem(tr("Off"), static_cast<int>(InfrastructureManagement::EffectOverride::PermanentOff));
|
||||
m_ui->cbFlashing->addItem(tr("Auto"), static_cast<int>(InfrastructureManagement::EffectOverride::Automatic));
|
||||
m_ui->cbFlashing->setCurrentIndex(m_ui->cbFlashing->findData(static_cast<int>(InfrastructureManagement::EffectOverride::Automatic)));
|
||||
|
||||
updateComboBoxes();
|
||||
|
||||
@@ -58,19 +58,19 @@ bool StructureElementEdit::init(const InfrastructureManagement::StructureElement
|
||||
m_ui->lblFloor->hide();
|
||||
m_ui->lbxFloor->hide();
|
||||
|
||||
switch (m_structureElement.path().size()) {
|
||||
switch (m_structureElement.path.size()) {
|
||||
case 3:
|
||||
m_ui->lblRoom->setText(structureElementName(m_structureElement.path()[2]));
|
||||
m_ui->lblRoom->setText(structureElementName(m_structureElement.path[2]));
|
||||
m_ui->lblRoom->show();
|
||||
m_ui->lbxRoom->show();
|
||||
Q_FALLTHROUGH();
|
||||
case 2:
|
||||
m_ui->lblFloor->setText(structureElementName(m_structureElement.path()[1]));
|
||||
m_ui->lblFloor->setText(structureElementName(m_structureElement.path[1]));
|
||||
m_ui->lblFloor->show();
|
||||
m_ui->lbxFloor->show();
|
||||
Q_FALLTHROUGH();
|
||||
case 1:
|
||||
m_ui->lblBuilding->setText(structureElementName(m_structureElement.path()[0]));
|
||||
m_ui->lblBuilding->setText(structureElementName(m_structureElement.path[0]));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -83,7 +83,7 @@ QString StructureElementEdit::structureElementName(int seId)
|
||||
{
|
||||
InfrastructureManagement::StructureElement se;
|
||||
m_ismDtc->getStructureElementById(seId, se);
|
||||
return QString::fromStdString(se.displayName());
|
||||
return QString::fromStdString(se.displayName);
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ StructureElementEdit::~StructureElementEdit()
|
||||
void StructureElementEdit::updateComboBoxes()
|
||||
{
|
||||
QJsonParseError parserError;
|
||||
QByteArray content = QByteArray::fromStdString(m_structureElement.properties());
|
||||
QByteArray content = QByteArray::fromStdString(m_structureElement.properties);
|
||||
const QJsonDocument doc(QJsonDocument::fromJson(content, &parserError));
|
||||
|
||||
if (parserError.error != QJsonParseError::NoError)
|
||||
@@ -113,12 +113,12 @@ void StructureElementEdit::updateComboBoxes()
|
||||
|
||||
QString StructureElementEdit::dialogIdentifier() const
|
||||
{
|
||||
return QLatin1String("StructureElementEdit") + QString::number(m_structureElement.id());
|
||||
return QLatin1String("StructureElementEdit") + QString::number(m_structureElement.id);
|
||||
}
|
||||
|
||||
void StructureElementEdit::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Edit Building/Floor/Room: %1").arg(QString::fromStdString(m_structureElement.displayName())));
|
||||
translate(m_ui, tr("Edit Building/Floor/Room: %1").arg(QString::fromStdString(m_structureElement.displayName)));
|
||||
}
|
||||
|
||||
void StructureElementEdit::onStructureElementModifyReply(const Core::FunctionReplyObject &replyObject)
|
||||
@@ -131,15 +131,15 @@ bool StructureElementEdit::apply()
|
||||
std::string properties;
|
||||
QByteArray content_neu;
|
||||
|
||||
properties= m_structureElement.properties();
|
||||
DEBUG_LOG(m_logger) << "structureElementId=" << m_structureElement.id()
|
||||
properties= m_structureElement.properties;
|
||||
DEBUG_LOG(m_logger) << "structureElementId=" << m_structureElement.id
|
||||
<< " properties=" << properties
|
||||
<< " MountingPointType=" << m_structureElement.mountingPointTypeId()
|
||||
<< " structureElementTypeId=" << m_structureElement.structureElementTypeId();
|
||||
<< " MountingPointType=" << m_structureElement.mountingPointTypeId
|
||||
<< " structureElementTypeId=" << m_structureElement.structureElementTypeId;
|
||||
|
||||
QJsonObject resultObj;
|
||||
QJsonObject overrideObj;
|
||||
if (m_ui->cbFlashing->currentData().toInt() != InfrastructureManagement::EffectOverride::Automatic)
|
||||
if (m_ui->cbFlashing->currentData().toInt() != static_cast<int>(InfrastructureManagement::EffectOverride::Automatic))
|
||||
overrideObj.insert(QStringLiteral("flash"), m_ui->cbFlashing->currentData().toInt());
|
||||
if (overrideObj.size())
|
||||
resultObj.insert (QStringLiteral("Overrides"), overrideObj);
|
||||
@@ -148,16 +148,16 @@ bool StructureElementEdit::apply()
|
||||
if (content_neu.toStdString() == properties)
|
||||
return true;
|
||||
|
||||
m_structureElement.properties(content_neu.toStdString());
|
||||
ERROR_LOG(m_logger) << "properties=" << m_structureElement.properties()
|
||||
<< " name=" << m_structureElement.name()
|
||||
<< " seId=" << m_structureElement.id()
|
||||
<< " mountingPointId=" << m_structureElement.mountingPointId();
|
||||
m_structureElement.properties = content_neu.toStdString();
|
||||
ERROR_LOG(m_logger) << "properties=" << m_structureElement.properties
|
||||
<< " name=" << m_structureElement.name
|
||||
<< " seId=" << m_structureElement.id
|
||||
<< " mountingPointId=" << m_structureElement.mountingPointId;
|
||||
|
||||
InfrastructureManagement::StructureElementModifyRequest request;
|
||||
request.mainStructureElementId(m_structureElement.mainStructureElementId());
|
||||
request.elements().resize(1);
|
||||
request.elements().at(0) = m_structureElement;
|
||||
request.mainStructureElementId = m_structureElement.mainStructureElementId;
|
||||
request.elements.resize(1);
|
||||
request.elements.at(0) = m_structureElement;
|
||||
|
||||
m_requestHelper->addRequest([this, request]() {return m_ismFtc->structureElementModifyRequest(request, this);});
|
||||
m_requestHelper->startRequests();
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "smo_system_monitor_dialog.h"
|
||||
#include "ui_smo_system_monitor_dialog.h"
|
||||
#include <QWebEngineView>
|
||||
#include <QtWebEngineWidgets/QWebEngineView>
|
||||
#include <LtsUtilsSettings/settings.h>
|
||||
|
||||
namespace ServiceMonitor
|
||||
|
||||
Reference in new issue
Block a user