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
+4
-4
@@ -71,20 +71,20 @@ if(QT6_GUI_AVAILABLE)
|
||||
LtsSession
|
||||
${Qt6_Widgets}
|
||||
NGLLogger
|
||||
AsbDataPluginInterface
|
||||
ExmDataPluginInterface
|
||||
advancedSymbologyGui
|
||||
LtsUtilsSettings
|
||||
PUBLIC
|
||||
Qt6::Core
|
||||
${Qt6_Gui}
|
||||
nglwidgets
|
||||
svcPpmCommon
|
||||
LtsDataView
|
||||
LtsUtilsGuiDds
|
||||
)
|
||||
endif()
|
||||
|
||||
# Optional: External dependencies (not available in migration context)
|
||||
# target_link_libraries(PpmCommon PRIVATE AsbDataPluginInterface ExmDataPluginInterface advancedSymbologyGui)
|
||||
# target_link_libraries(PpmCommon PUBLIC svcPpmCommon)
|
||||
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(PpmCommon
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../../..
|
||||
|
||||
+2
-2
@@ -47,7 +47,7 @@ DistypeEditor::DistypeEditor(QWidget *parent,
|
||||
}
|
||||
|
||||
for (const auto &typeClassId : setTypeClasses)
|
||||
mUi->m_ltsComboBox_typeClass->addItem(ParticipantManagement::toString(typeClassId), typeClassId.underlying());
|
||||
mUi->m_ltsComboBox_typeClass->addItem(ParticipantManagement::toString(typeClassId), typeClassId);
|
||||
|
||||
slotTypeClassChanged();
|
||||
|
||||
@@ -111,7 +111,7 @@ void DistypeEditor::slotTypeClassChanged()
|
||||
|
||||
for (const ParticipantManagement::Type &type : std::as_const(m_mapTypes))
|
||||
{
|
||||
if (type.typeClass().underlying() != currentTypeClass)
|
||||
if (type.typeClass() != currentTypeClass)
|
||||
continue;
|
||||
|
||||
mUi->m_ltsComboBox_type->addItem(LtsUtils::str2QString(type.name()), type.id());
|
||||
|
||||
+1
@@ -9,6 +9,7 @@
|
||||
#include <memory>
|
||||
#include <Common/participant_dis_type_edit.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_ftc.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
|
||||
+7
-7
@@ -38,19 +38,19 @@ DISTypeEdit::DISTypeEdit(QWidget *parent,
|
||||
|
||||
auto cbTypes = [this] (const ParticipantManagement::Type &type)
|
||||
{
|
||||
m_mapTypes[type.id()] = type;
|
||||
const ParticipantManagement::TypeClass &typeClassId = type.typeClass();
|
||||
m_mapTypes[type.id] = type;
|
||||
const ParticipantManagement::TypeClass &typeClassId = type.typeClass;
|
||||
|
||||
if (typeClassId == ParticipantManagement::TypeClass::SupportUnit || typeClassId == ParticipantManagement::TypeClass::SupportEntity)
|
||||
return;
|
||||
|
||||
|
||||
for (const auto &disId : type.disEntities())
|
||||
for (const auto &disId : type.disEntities)
|
||||
{
|
||||
if (m_usedDisTypes.contains(disId))
|
||||
continue;
|
||||
|
||||
m_DisEntitiesByType[type.id()] << disId;
|
||||
m_DisEntitiesByType[type.id] << disId;
|
||||
|
||||
|
||||
|
||||
@@ -122,9 +122,9 @@ bool DISTypeEdit::apply()
|
||||
for(int32_t typeId : std::as_const(m_setTouchedTypes))
|
||||
{
|
||||
Type &touchedType = m_mapTypes[typeId];
|
||||
touchedType.disEntities().clear();
|
||||
touchedType.disEntities.clear();
|
||||
for (int64_t disId : std::as_const(m_DisEntitiesByType[typeId]))
|
||||
touchedType.disEntities().push_back(disId);
|
||||
touchedType.disEntities.push_back(disId);
|
||||
|
||||
m_requestHelper->addRequest([this, touchedType]()
|
||||
{
|
||||
@@ -211,7 +211,7 @@ void DISTypeEdit::slotAddDistype()
|
||||
{
|
||||
const ParticipantManagement::Type& type = m_mapTypes[oldTypeId];
|
||||
|
||||
LtsWidgets::Button button = LtsWidgets::LtsMessageDialog::showMessage(this, tr("Specified DIS type is already mapped to:\nType id: %1\nName: \"%2\"\nType class: \"%3\".\nDo you want to change this mapping?").arg(QString::number(type.id()), QString::fromStdString(type.name()), ParticipantManagement::toString(type.typeClass())), tr("DIS type already in use"),
|
||||
LtsWidgets::Button button = LtsWidgets::LtsMessageDialog::showMessage(this, tr("Specified DIS type is already mapped to:\nType id: %1\nName: \"%2\"\nType class: \"%3\".\nDo you want to change this mapping?").arg(QString::number(type.id), QString::fromStdString(type.name), ParticipantManagement::toString(type.typeClass)), tr("DIS type already in use"),
|
||||
LtsWidgets::Behaviour::Modal, LtsWidgets::Button::Yes | LtsWidgets::Button::No);
|
||||
|
||||
if (button == LtsWidgets::Button::No)
|
||||
|
||||
+1
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <ppmcommon_export.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <Services/ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_ftc.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
+4
-4
@@ -37,7 +37,7 @@ DistypeEditor::DistypeEditor(QWidget *parent,
|
||||
|
||||
for (const ParticipantManagement::Type &type : std::as_const(m_mapTypes))
|
||||
{
|
||||
const ParticipantManagement::TypeClass typeClassId = type.typeClass();
|
||||
const ParticipantManagement::TypeClass typeClassId = type.typeClass;
|
||||
|
||||
if (typeClassId == ParticipantManagement::TypeClass::SupportUnit || typeClassId == ParticipantManagement::TypeClass::SupportEntity)
|
||||
continue;
|
||||
@@ -46,7 +46,7 @@ DistypeEditor::DistypeEditor(QWidget *parent,
|
||||
}
|
||||
|
||||
for (const auto &typeClassId : setTypeClasses)
|
||||
mUi->m_ltsComboBox_typeClass->addItem(ParticipantManagement::toString(typeClassId), typeClassId.underlying());
|
||||
mUi->m_ltsComboBox_typeClass->addItem(ParticipantManagement::toString(typeClassId), static_cast<int>(typeClassId));
|
||||
|
||||
slotTypeClassChanged();
|
||||
|
||||
@@ -110,10 +110,10 @@ void DistypeEditor::slotTypeClassChanged()
|
||||
|
||||
for (const ParticipantManagement::Type &type : std::as_const(m_mapTypes))
|
||||
{
|
||||
if (type.typeClass().underlying() != currentTypeClass)
|
||||
if (static_cast<int>(type.typeClass) != currentTypeClass)
|
||||
continue;
|
||||
|
||||
mUi->m_ltsComboBox_type->addItem(QString::fromStdString(type.name()), type.id());
|
||||
mUi->m_ltsComboBox_type->addItem(QString::fromStdString(type.name), type.id);
|
||||
}
|
||||
|
||||
slotTypeChanged();
|
||||
|
||||
+1
@@ -8,6 +8,7 @@
|
||||
#include <memory>
|
||||
#include <Common/participant_dis_type_edit.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_ftc.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
|
||||
+57
-57
@@ -36,9 +36,9 @@ bool ParticipantEditItemWidget::init(const QModelIndex &workingIndex,
|
||||
{
|
||||
m_isOrgChart = isOrgChart;
|
||||
m_editData = data;
|
||||
m_currentAssignState = data.assignState();
|
||||
m_currentAssignState = data.assignState;
|
||||
m_partyId = partyId;
|
||||
m_bEditMode = m_editData.typeId() > 0;
|
||||
m_bEditMode = m_editData.typeId > 0;
|
||||
m_workingIndex = workingIndex;
|
||||
m_alreadyAddedEquipmentNumbers = usedEquipmentNumbers;
|
||||
|
||||
@@ -63,8 +63,8 @@ void ParticipantEditItemWidget::setFiringUnitRestrictions(ParticipantEditModel *
|
||||
if (allowedType == Type())
|
||||
return;
|
||||
|
||||
m_ui->cbTypeClass->setCurrentIndex(m_ui->cbTypeClass->findData(allowedType.typeClass().underlying()));
|
||||
m_ui->cbType->setCurrentIndex(m_ui->cbType->findData(allowedType.id()));
|
||||
m_ui->cbTypeClass->setCurrentIndex(m_ui->cbTypeClass->findData(static_cast<int>(allowedType.typeClass)));
|
||||
m_ui->cbType->setCurrentIndex(m_ui->cbType->findData(allowedType.id));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -77,27 +77,27 @@ void ParticipantEditItemWidget::setFiringUnitRestrictions(ParticipantEditModel *
|
||||
const QVector<Type> allowedTypes = firingUnitValidator->artilleryParticipantTypes();
|
||||
|
||||
m_ui->cbTypeClass->setDisabled(true);
|
||||
m_ui->cbTypeClass->setCurrentIndex(m_ui->cbTypeClass->findData(allowedTypes.at(0).typeClass().underlying()));
|
||||
m_ui->cbTypeClass->setCurrentIndex(m_ui->cbTypeClass->findData(static_cast<int>(allowedTypes.at(0).typeClass)));
|
||||
|
||||
m_ui->cbType->clear();
|
||||
|
||||
std::function<bool(Type)> funcIsSameGearType = [=](const Type &t)
|
||||
{
|
||||
if (m_isAdler)
|
||||
return m_dtc->isAdlerType(t.id()) && (firingUnitValidator->getGearClassType(t.id()) == unitGearClassType);
|
||||
return firingUnitValidator->getGearClassType(t.id()) == unitGearClassType;
|
||||
return m_dtc->isAdlerType(t.id) && (static_cast<int>(firingUnitValidator->getGearClassType(t.id)) == unitGearClassType);
|
||||
return static_cast<int>(firingUnitValidator->getGearClassType(t.id)) == unitGearClassType;
|
||||
};
|
||||
QVector<Type>::ConstIterator typeIterator = std::find_if(allowedTypes.begin(), allowedTypes.end(), funcIsSameGearType);
|
||||
|
||||
if(typeIterator != allowedTypes.end())
|
||||
{
|
||||
m_ui->cbType->setDisabled(true);
|
||||
m_ui->cbType->addItem(ParticipantManagement::trTypeName(typeIterator->name()), typeIterator->id());
|
||||
m_ui->cbType->addItem(ParticipantManagement::trTypeName(typeIterator->name), typeIterator->id);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (const Type ¤tType : allowedTypes)
|
||||
m_ui->cbType->addItem(ParticipantManagement::trTypeName(currentType.name()), currentType.id());
|
||||
m_ui->cbType->addItem(ParticipantManagement::trTypeName(currentType.name), currentType.id);
|
||||
m_ui->cbType->model()->sort(0);
|
||||
}
|
||||
|
||||
@@ -151,44 +151,44 @@ void ParticipantEditItemWidget::setFiringUnitRestrictions(ParticipantEditModel *
|
||||
|
||||
void ParticipantEditItemWidget::setData()
|
||||
{
|
||||
m_ui->leDesignator->setText(QString::fromStdString(m_editData.designator()));
|
||||
m_ui->leTactIdent->setText(QString::fromStdString(m_editData.tacticalIdentifier()));
|
||||
m_ui->leInfo->setText(QString::fromStdString(m_editData.info()));
|
||||
m_ui->leSign->setText(QString::fromStdString(m_editData.identification()));
|
||||
m_ui->cbExternal->setChecked(m_editData.externalId() > 0);
|
||||
m_ui->leVerein->setText(QString::fromStdString(m_editData.name()));
|
||||
m_ui->leDesignator->setText(QString::fromStdString(m_editData.designator));
|
||||
m_ui->leTactIdent->setText(QString::fromStdString(m_editData.tacticalIdentifier));
|
||||
m_ui->leInfo->setText(QString::fromStdString(m_editData.info));
|
||||
m_ui->leSign->setText(QString::fromStdString(m_editData.identification));
|
||||
m_ui->cbExternal->setChecked(m_editData.externalId > 0);
|
||||
m_ui->leVerein->setText(QString::fromStdString(m_editData.name));
|
||||
|
||||
Type type = m_dtc->type(m_editData.typeId());
|
||||
m_ui->cbTypeClass->setCurrentIndex(m_ui->cbTypeClass->findData(type.typeClass().underlying()));
|
||||
m_ui->cbType->setCurrentIndex(m_ui->cbType->findData(type.id()));
|
||||
Type type = m_dtc->type(m_editData.typeId);
|
||||
m_ui->cbTypeClass->setCurrentIndex(m_ui->cbTypeClass->findData(static_cast<int>(type.typeClass)));
|
||||
m_ui->cbType->setCurrentIndex(m_ui->cbType->findData(type.id));
|
||||
|
||||
|
||||
setAssignmentButton();
|
||||
|
||||
if (isUnitType(m_editData.typeId()))
|
||||
if (isUnitType(m_editData.typeId))
|
||||
{
|
||||
m_ui->cbTypeClass->setEnabled(false);
|
||||
m_ui->sbEquipNr->setEnabled(false);
|
||||
m_ui->tbAssignment->setEnabled(false);
|
||||
|
||||
bool showVerein = m_dtc->isAdlerType(m_editData.typeId());
|
||||
bool showVerein = m_dtc->isAdlerType(m_editData.typeId);
|
||||
m_ui->lblVerein->setVisible(showVerein);
|
||||
m_ui->leVerein->setVisible(showVerein);
|
||||
}
|
||||
else
|
||||
{
|
||||
const bool isEquipped = m_editData.equipmentNumber().is_set() && m_editData.equipmentNumber().get() > 0;
|
||||
const bool isEquipped = m_editData.equipmentNumber.has_value() && m_editData.equipmentNumber.get() > 0;
|
||||
m_ui->cbTypeClass->setEnabled(!isEquipped);
|
||||
m_ui->cbType->setEnabled(!isEquipped);
|
||||
m_ui->sbEquipNr->setEnabled(m_editData.typeId() > 0);
|
||||
m_ui->sbEquipNr->setEnabled(m_editData.typeId > 0);
|
||||
}
|
||||
|
||||
if (m_editData.equipmentNumber().is_set())
|
||||
m_ui->sbEquipNr->setValue(m_editData.equipmentNumber().get());
|
||||
onChangeSymbol(QString::fromStdString(m_editData.symbol()));
|
||||
if (m_editData.equipmentNumber.has_value())
|
||||
m_ui->sbEquipNr->setValue(m_editData.equipmentNumber.get());
|
||||
onChangeSymbol(QString::fromStdString(m_editData.symbol));
|
||||
|
||||
|
||||
if (m_editData.externalId() > 0)
|
||||
if (m_editData.externalId > 0)
|
||||
{
|
||||
m_ui->leTactIdent->setEnabled(false);
|
||||
m_ui->sbEquipNr->setEnabled(false);
|
||||
@@ -200,8 +200,8 @@ void ParticipantEditItemWidget::setData()
|
||||
|
||||
void ParticipantEditItemWidget::setDesignatorData()
|
||||
{
|
||||
m_ui->leDesignator->setText(QString::fromStdString(m_editData.designator()));
|
||||
m_ui->leTactIdent->setText(QString::fromStdString(m_editData.tacticalIdentifier()));
|
||||
m_ui->leDesignator->setText(QString::fromStdString(m_editData.designator));
|
||||
m_ui->leTactIdent->setText(QString::fromStdString(m_editData.tacticalIdentifier));
|
||||
}
|
||||
|
||||
void ParticipantEditItemWidget::onAddItem()
|
||||
@@ -210,8 +210,8 @@ void ParticipantEditItemWidget::onAddItem()
|
||||
if (!collectParticipantData(newParticipantData))
|
||||
return;
|
||||
|
||||
if (newParticipantData.equipmentNumber().is_set())
|
||||
m_alreadyAddedEquipmentNumbers.append(newParticipantData.equipmentNumber().get());
|
||||
if (newParticipantData.equipmentNumber.has_value())
|
||||
m_alreadyAddedEquipmentNumbers.append(newParticipantData.equipmentNumber.get());
|
||||
|
||||
DEBUG_LOG(m_logger) << "add item: " << newParticipantData;
|
||||
if (m_workingIndex.isValid() || m_isOrgChart)
|
||||
@@ -226,7 +226,7 @@ bool ParticipantEditItemWidget::onEditItem()
|
||||
if (!collectParticipantData(newParticipantData))
|
||||
return false;
|
||||
m_editData = newParticipantData;
|
||||
m_currentAssignState = newParticipantData.assignState();
|
||||
m_currentAssignState = newParticipantData.assignState;
|
||||
|
||||
DEBUG_LOG(m_logger) << "edit item: " << m_editData;
|
||||
if (m_workingIndex.isValid() || m_isOrgChart)
|
||||
@@ -239,17 +239,17 @@ bool ParticipantEditItemWidget::collectParticipantData(ParticipantManagement::Pa
|
||||
{
|
||||
const int newEquipmentNumber = m_ui->sbEquipNr->value();
|
||||
|
||||
data.designator(m_ui->leDesignator->text().toStdString());
|
||||
data.tacticalIdentifier(m_ui->leTactIdent->text().toStdString());
|
||||
data.symbol(m_sidc.toStdString());
|
||||
data.typeId(m_ui->cbType->currentData().toInt());
|
||||
data.partyId(m_partyId);
|
||||
data.identification(m_ui->leSign->text().toStdString());
|
||||
data.info(m_ui->leInfo->text().toStdString());
|
||||
data.assignState(m_currentAssignState);
|
||||
data.designator = m_ui->leDesignator->text().toStdString();
|
||||
data.tacticalIdentifier = m_ui->leTactIdent->text().toStdString();
|
||||
data.symbol = m_sidc.toStdString();
|
||||
data.typeId = m_ui->cbType->currentData().toInt();
|
||||
data.partyId = m_partyId;
|
||||
data.identification = m_ui->leSign->text().toStdString();
|
||||
data.info = m_ui->leInfo->text().toStdString();
|
||||
data.assignState = m_currentAssignState;
|
||||
|
||||
|
||||
data.name(m_ui->leVerein->text().toStdString());
|
||||
data.name = m_ui->leVerein->text().toStdString();
|
||||
|
||||
if (newEquipmentNumber > 0)
|
||||
{
|
||||
@@ -258,7 +258,7 @@ bool ParticipantEditItemWidget::collectParticipantData(ParticipantManagement::Pa
|
||||
m_ui->lbMinMaxEquipNr->setText(QStringLiteral("<span style=\"color:#aa0000;\">%1</span>").arg(m_ui->lbMinMaxEquipNr->text()));
|
||||
return false;
|
||||
}
|
||||
if (m_editData.equipmentNumber() != newEquipmentNumber)
|
||||
if (m_editData.equipmentNumber != newEquipmentNumber)
|
||||
{
|
||||
int exerciseId = 0;
|
||||
if (!m_dtc->isEquipmentExerciseMappingEnabled())
|
||||
@@ -284,21 +284,21 @@ bool ParticipantEditItemWidget::collectParticipantData(ParticipantManagement::Pa
|
||||
}
|
||||
}
|
||||
}
|
||||
data.equipmentNumber(newEquipmentNumber);
|
||||
data.externalId(m_ui->cbExternal->isChecked() ? newEquipmentNumber : 0);
|
||||
data.equipmentNumber = newEquipmentNumber;
|
||||
data.externalId = m_ui->cbExternal->isChecked() ? newEquipmentNumber : 0;
|
||||
m_ui->sbEquipNr->setValue(newEquipmentNumber + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
data.equipmentNumber().reset();
|
||||
data.externalId(0);
|
||||
data.equipmentNumber.reset();
|
||||
data.externalId = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void ParticipantEditItemWidget::onTbAssignmentClicked()
|
||||
{
|
||||
switch (m_currentAssignState.underlying())
|
||||
switch (m_currentAssignState)
|
||||
{
|
||||
case ParticipantManagement::ParticipantAssignState::AssignedWms:
|
||||
m_currentAssignState = ParticipantManagement::ParticipantAssignState::HandoutExcon;
|
||||
@@ -314,8 +314,8 @@ void ParticipantEditItemWidget::onTbAssignmentClicked()
|
||||
m_ui->sbEquipNr->setValue(0);
|
||||
break;
|
||||
case ParticipantManagement::ParticipantAssignState::NotAssigned:
|
||||
if (m_editData.assignState() == ParticipantManagement::ParticipantAssignState::ExconWmsOverruled ||
|
||||
m_editData.assignState() == ParticipantManagement::ParticipantAssignState::HandoutWms)
|
||||
if (m_editData.assignState == ParticipantManagement::ParticipantAssignState::ExconWmsOverruled ||
|
||||
m_editData.assignState == ParticipantManagement::ParticipantAssignState::HandoutWms)
|
||||
m_currentAssignState = ParticipantManagement::ParticipantAssignState::ExconWmsOverruled;
|
||||
else
|
||||
m_currentAssignState = ParticipantManagement::ParticipantAssignState::HandoutExcon;
|
||||
@@ -333,16 +333,16 @@ void ParticipantEditItemWidget::onEqNoChanged()
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_editData.assignState() == ParticipantManagement::ParticipantAssignState::AssignedWms)
|
||||
if (m_editData.assignState == ParticipantManagement::ParticipantAssignState::AssignedWms)
|
||||
{
|
||||
if (m_editData.equipmentNumber().is_set() && m_editData.equipmentNumber().get() == m_ui->sbEquipNr->value())
|
||||
if (m_editData.equipmentNumber.has_value() && m_editData.equipmentNumber.get() == m_ui->sbEquipNr->value())
|
||||
m_currentAssignState = ParticipantManagement::ParticipantAssignState::AssignedWms;
|
||||
else
|
||||
m_currentAssignState = ParticipantManagement::ParticipantAssignState::HandoutExcon;
|
||||
}
|
||||
else if (m_editData.assignState() == ParticipantManagement::ParticipantAssignState::HandoutWms)
|
||||
else if (m_editData.assignState == ParticipantManagement::ParticipantAssignState::HandoutWms)
|
||||
{
|
||||
if (m_editData.equipmentNumber().is_set() && m_editData.equipmentNumber().get() == m_ui->sbEquipNr->value())
|
||||
if (m_editData.equipmentNumber.has_value() && m_editData.equipmentNumber.get() == m_ui->sbEquipNr->value())
|
||||
m_currentAssignState = ParticipantManagement::ParticipantAssignState::HandoutWms;
|
||||
else
|
||||
m_currentAssignState = ParticipantManagement::ParticipantAssignState::ExconWmsOverruled;
|
||||
@@ -352,12 +352,12 @@ void ParticipantEditItemWidget::onEqNoChanged()
|
||||
|
||||
void ParticipantEditItemWidget::setAssignmentButton()
|
||||
{
|
||||
switch (m_currentAssignState.underlying())
|
||||
switch (m_currentAssignState)
|
||||
{
|
||||
case ParticipantManagement::ParticipantAssignState::AssignedWms:
|
||||
case ParticipantManagement::ParticipantAssignState::HandoutWms:
|
||||
{
|
||||
if (m_editData.assignState().underlying() == ParticipantManagement::ParticipantAssignState::AssignedWms)
|
||||
if (m_editData.assignState == ParticipantManagement::ParticipantAssignState::AssignedWms)
|
||||
m_ui->tbAssignment->setText(tr("WH(A)"));
|
||||
else
|
||||
m_ui->tbAssignment->setText(tr("WH(H)"));
|
||||
@@ -383,7 +383,7 @@ void ParticipantEditItemWidget::setAssignmentButton()
|
||||
}
|
||||
|
||||
|
||||
if (m_editData.externalId() > 0 && m_ui->cbExternal->isChecked())
|
||||
if (m_editData.externalId > 0 && m_ui->cbExternal->isChecked())
|
||||
{
|
||||
m_ui->tbAssignment->setEnabled(false);
|
||||
m_ui->sbEquipNr->setEnabled(false);
|
||||
@@ -440,7 +440,7 @@ bool ParticipantEditItem::init(const QModelIndex &workingIndex,
|
||||
layout->addWidget(m_buttonBox);
|
||||
setLayout(layout);
|
||||
|
||||
if (data.typeId() > 0)
|
||||
if (data.typeId > 0)
|
||||
{
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, m_editItemWidget, &ParticipantEditItemWidget::onEditItem);
|
||||
m_buttonBox->getButton(LtsWidgets::DialogButton::Edit)->setText(tr("Apply"));
|
||||
@@ -494,7 +494,7 @@ bool ParticipantEditItemTab::init(const std::shared_ptr<Interface::Dtc> &dtc,
|
||||
const ParticipantData &data,
|
||||
bool isOrgChart)
|
||||
{
|
||||
if (!m_editItemWidget->init(QModelIndex(), data.partyId(), dtc, ppmGuiCbxIfc, asb, data, isOrgChart))
|
||||
if (!m_editItemWidget->init(QModelIndex(), data.partyId, dtc, ppmGuiCbxIfc, asb, data, isOrgChart))
|
||||
return false;
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
|
||||
+2
-2
@@ -55,8 +55,8 @@ protected Q_SLOTS:
|
||||
void onEqNoChanged();
|
||||
|
||||
protected:
|
||||
int editTypeId() const override { return m_editData.typeId(); }
|
||||
int currentPartyId() const override { return m_editData.partyId() > 1 ? m_editData.partyId() : m_partyId; }
|
||||
int editTypeId() const override { return m_editData.typeId; }
|
||||
int currentPartyId() const override { return m_editData.partyId > 1 ? m_editData.partyId : m_partyId; }
|
||||
private:
|
||||
ParticipantManagement::ParticipantAssignState getAssignmentState() const;
|
||||
|
||||
|
||||
+13
-12
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "participant_edit_item.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include "ui_participant_edit_item_widget_base.h"
|
||||
#include <ParticipantManagement/ppm_translation.h>
|
||||
#include <AdvancedSymbology/asb_data_plugin_interface.h>
|
||||
@@ -18,7 +19,7 @@ namespace ParticipantManagement
|
||||
|
||||
|
||||
|
||||
static int s_lastTypeClassUsed = ParticipantManagement::TypeClass::Human;
|
||||
static int s_lastTypeClassUsed = static_cast<int>(ParticipantManagement::TypeClass::Human);
|
||||
static int s_lastTypeUsed = -1;
|
||||
|
||||
ParticipantEditItemWidgetBase::ParticipantEditItemWidgetBase(bool asSupportService,
|
||||
@@ -56,7 +57,7 @@ ParticipantEditItemWidgetBase::ParticipantEditItemWidgetBase(bool asSupportServi
|
||||
const bool hasHlaInterface = (LtsUtils::ProjectSettings::isFunctionEnabled(QStringLiteral("Exercises"),
|
||||
QStringLiteral("HasHlaInterface"))
|
||||
&& exmDtc
|
||||
&& exmDtc->exercise(m_session->exerciseId()).hasHlaInterface());
|
||||
&& exmDtc->exercise(m_session->exerciseId()).hasHlaInterface);
|
||||
if (!hasHlaInterface)
|
||||
{
|
||||
m_ui->cbExternal->hide();
|
||||
@@ -169,22 +170,22 @@ void ParticipantEditItemWidgetBase::onFillTypeCb()
|
||||
void ParticipantEditItemWidgetBase::onChangeMinMax()
|
||||
{
|
||||
const ParticipantManagement::Type type = m_dtc->type(m_ui->cbType->currentData().toInt());
|
||||
const ParticipantManagement::EquipmentType eqType = m_dtc->equipmentType(type.equipmentTypeId());
|
||||
m_ui->lbMinMaxEquipNr->setText(QString::number(getUnsignedShortValue(eqType.minEquipNo())) + QLatin1Char(':') + QString::number(getUnsignedShortValue(eqType.maxEquipNo())));
|
||||
m_ui->sbEquipNr->setMaximum(getUnsignedShortValue(eqType.maxEquipNo()));
|
||||
m_typeMinimum = eqType.minEquipNo();
|
||||
bool isNoUnit = type.typeClass() != TypeClass::SupportUnit && type.typeClass() != TypeClass::Unit;
|
||||
const ParticipantManagement::EquipmentType eqType = m_dtc->equipmentType(type.equipmentTypeId);
|
||||
m_ui->lbMinMaxEquipNr->setText(QString::number(getUnsignedShortValue(eqType.minEquipNo)) + QLatin1Char(':') + QString::number(getUnsignedShortValue(eqType.maxEquipNo)));
|
||||
m_ui->sbEquipNr->setMaximum(getUnsignedShortValue(eqType.maxEquipNo));
|
||||
m_typeMinimum = eqType.minEquipNo;
|
||||
bool isNoUnit = type.typeClass != TypeClass::SupportUnit && type.typeClass != TypeClass::Unit;
|
||||
if (!isNoUnit)
|
||||
m_ui->sbEquipNr->setValue(0);
|
||||
m_ui->sbEquipNr->setEnabled(isNoUnit);
|
||||
m_ui->tbAssignment->setEnabled(isNoUnit);
|
||||
|
||||
|
||||
bool showVerein = m_dtc->isAdlerType(type.id());
|
||||
bool showVerein = m_dtc->isAdlerType(type.id);
|
||||
m_ui->lblVerein->setVisible(showVerein);
|
||||
m_ui->leVerein->setVisible(showVerein);
|
||||
|
||||
onChangeSymbol(QString::fromStdString(type.symbol()));
|
||||
onChangeSymbol(QString::fromStdString(type.symbol));
|
||||
}
|
||||
|
||||
void ParticipantEditItemWidgetBase::onSymbolSelection()
|
||||
@@ -230,8 +231,8 @@ void ParticipantEditItemWidgetBase::onChangeSymbol(const QString &sidc)
|
||||
|
||||
if (currentPartyId())
|
||||
{
|
||||
symDataToRender.role = AdvancedSymbology::roleToRole<>((m_dtc->party(currentPartyId()).role()));
|
||||
symDataToRender.fillColor = QColor::fromRgb(QRgb(m_dtc->party(currentPartyId()).color()));
|
||||
symDataToRender.role = AdvancedSymbology::roleToRole<>(m_dtc->party(currentPartyId()).role);
|
||||
symDataToRender.fillColor = QColor::fromRgb(QRgb(m_dtc->party(currentPartyId()).color));
|
||||
symDataToRender.fillColorReplace = true;
|
||||
} else {
|
||||
|
||||
@@ -269,7 +270,7 @@ ParticipantManagement::TypeClass ParticipantEditItemWidgetBase::typeClassIdFromT
|
||||
return it.value();
|
||||
auto cbTypes = [this](const ParticipantManagement::Type &type)
|
||||
{
|
||||
m_type2TypeClass[type.id()] = type.typeClass();
|
||||
m_type2TypeClass[type.id] = type.typeClass;
|
||||
};
|
||||
m_dtc->types(cbTypes);
|
||||
return m_type2TypeClass.value(typeId);
|
||||
|
||||
+1
@@ -4,6 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <Services/ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <QtWidgets/QWidget>
|
||||
|
||||
+156
-153
@@ -2,8 +2,10 @@
|
||||
|
||||
|
||||
#include "participant_edit_model.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <utility>
|
||||
#include <ParticipantManagement/ppm_translation.h>
|
||||
#include <ParticipantManagement/logger.h>
|
||||
#include <AdvancedSymbology/asb_data_plugin_interface.h>
|
||||
#include <Symbology/symbol_data_to_render_role.h>
|
||||
#include <nglwidgets/ngltreeitem.h>
|
||||
@@ -24,7 +26,7 @@ namespace core
|
||||
{
|
||||
static inline uint qHash(const ParticipantManagement::TypeClass &tc)
|
||||
{
|
||||
return ::qHash(tc.underlying());
|
||||
return ::qHash(tc);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,23 +42,23 @@ static QVariant participantToQVariant(const ParticipantData &pd)
|
||||
{
|
||||
QByteArray ba;
|
||||
QDataStream ds(&ba, QIODevice::WriteOnly);
|
||||
ds << pd.id()
|
||||
<< pd.partyId()
|
||||
<< pd.hierarchyNumber()
|
||||
<< (pd.equipmentNumber().is_set() ? pd.equipmentNumber().get() : -1)
|
||||
<< pd.typeId()
|
||||
<< pd.externalId()
|
||||
<< QString::fromStdString(pd.symbol())
|
||||
<< QString::fromStdString(pd.name())
|
||||
<< QString::fromStdString(pd.identification())
|
||||
<< QString::fromStdString(pd.designator())
|
||||
<< QString::fromStdString(pd.tacticalIdentifier())
|
||||
<< QString::fromStdString(pd.info())
|
||||
<< pd.assignState().underlying()
|
||||
<< pd.isSimulated()
|
||||
<< pd.isDeleted()
|
||||
<< pd.modId()
|
||||
<< pd.superiorModId();
|
||||
ds << pd.id
|
||||
<< pd.partyId
|
||||
<< pd.hierarchyNumber
|
||||
<< (pd.equipmentNumber.has_value() ? pd.equipmentNumber.get() : -1)
|
||||
<< pd.typeId
|
||||
<< static_cast<qint64>(pd.externalId)
|
||||
<< QString::fromStdString(pd.symbol)
|
||||
<< QString::fromStdString(pd.name)
|
||||
<< QString::fromStdString(pd.identification)
|
||||
<< QString::fromStdString(pd.designator)
|
||||
<< QString::fromStdString(pd.tacticalIdentifier)
|
||||
<< QString::fromStdString(pd.info)
|
||||
<< pd.assignState
|
||||
<< pd.isSimulated
|
||||
<< pd.isDeleted
|
||||
<< pd.modId
|
||||
<< pd.superiorModId;
|
||||
|
||||
return ba;
|
||||
}
|
||||
@@ -88,24 +90,24 @@ static ParticipantData qVariantToParticipant(const QVariant &data)
|
||||
>> modId
|
||||
>> superiorModId;
|
||||
|
||||
pd.id(id);
|
||||
pd.partyId(partyId);
|
||||
pd.hierarchyNumber(hierarchyNumber);
|
||||
pd.id = id;
|
||||
pd.partyId = partyId;
|
||||
pd.hierarchyNumber = hierarchyNumber;
|
||||
if (equipmentNumber >= 0)
|
||||
pd.equipmentNumber(equipmentNumber);
|
||||
pd.typeId(typeId);
|
||||
pd.externalId(externalId);
|
||||
pd.symbol(symbol.toStdString());
|
||||
pd.name(name.toStdString());
|
||||
pd.identification(identification.toStdString());
|
||||
pd.designator(designator.toStdString());
|
||||
pd.tacticalIdentifier(tacticalIdentifier.toStdString());
|
||||
pd.info(info.toStdString());
|
||||
pd.assignState(static_cast<ParticipantManagement::ParticipantAssignState>(assignState));
|
||||
pd.isSimulated(isSimulated);
|
||||
pd.isDeleted(isDeleted);
|
||||
pd.modId(modId);
|
||||
pd.superiorModId(superiorModId);
|
||||
pd.equipmentNumber = equipmentNumber;
|
||||
pd.typeId = typeId;
|
||||
pd.externalId = externalId;
|
||||
pd.symbol = symbol.toStdString();
|
||||
pd.name = name.toStdString();
|
||||
pd.identification = identification.toStdString();
|
||||
pd.designator = designator.toStdString();
|
||||
pd.tacticalIdentifier = tacticalIdentifier.toStdString();
|
||||
pd.info = info.toStdString();
|
||||
pd.assignState = static_cast<ParticipantManagement::ParticipantAssignState>(assignState);
|
||||
pd.isSimulated = isSimulated;
|
||||
pd.isDeleted = isDeleted;
|
||||
pd.modId = modId;
|
||||
pd.superiorModId = superiorModId;
|
||||
|
||||
return pd;
|
||||
}
|
||||
@@ -124,7 +126,7 @@ bool compareStrings(const std::string &s1, const std::string &s2,
|
||||
{
|
||||
const int iRet = strcmp(s1.c_str(), s2.c_str());
|
||||
if (iRet == 0)
|
||||
return p1->participant.hierarchyNumber() < p2->participant.hierarchyNumber();
|
||||
return p1->participant.hierarchyNumber < p2->participant.hierarchyNumber;
|
||||
return iRet < 0;
|
||||
}
|
||||
|
||||
@@ -156,6 +158,7 @@ ParticipantEditModel::ParticipantEditModel(QObject *parent,
|
||||
, m_bUnitsSelectable(true)
|
||||
, m_missingSuperiorIdTimer(new QTimer(this))
|
||||
, m_firingUnitValidator(new FiringUnitValidator(ppmDtc, this))
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
{
|
||||
connect(this, &ParticipantEditModel::signalDataDropped,
|
||||
this, &ParticipantEditModel::internalDataChanged);
|
||||
@@ -179,7 +182,7 @@ Qt::ItemFlags ParticipantEditModel::flags(const QModelIndex &index) const
|
||||
ret |= Qt::ItemIsUserCheckable;
|
||||
|
||||
|
||||
if (!m_bUnitsSelectable && isUnitType(privateData(index)->participant.typeId()))
|
||||
if (!m_bUnitsSelectable && isUnitType(privateData(index)->participant.typeId))
|
||||
ret &= ~Qt::ItemIsSelectable;
|
||||
|
||||
if (index.column() != 0 || !index.parent().isValid())
|
||||
@@ -205,7 +208,7 @@ QVariant ParticipantEditModel::headerData(int section, Qt::Orientation orientati
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -213,7 +216,7 @@ QVariant ParticipantEditModel::headerData(int section, Qt::Orientation orientati
|
||||
{
|
||||
for (const auto &typeClassId : m_usedTypeClassIds)
|
||||
{
|
||||
cfd.data = typeClassId.underlying();
|
||||
cfd.data = static_cast<int>(typeClassId);
|
||||
cfd.text = ParticipantManagement::toString(typeClassId);
|
||||
cfc.data.push_back(cfd);
|
||||
}
|
||||
@@ -267,38 +270,38 @@ QVariant ParticipantEditModel::data(const QModelIndex &index, int role) const
|
||||
switch (index.column())
|
||||
{
|
||||
case ColDesignator:
|
||||
return QString::fromStdString(participantData.designator());
|
||||
return QString::fromStdString(participantData.designator);
|
||||
|
||||
case ColIdentifier:
|
||||
return QString::fromStdString(participantData.tacticalIdentifier());
|
||||
return QString::fromStdString(participantData.tacticalIdentifier);
|
||||
|
||||
case ColTypeClass:
|
||||
return typeClassStringFromTypeId(participantData.typeId());
|
||||
return typeClassStringFromTypeId(participantData.typeId);
|
||||
|
||||
case ColType:
|
||||
return ParticipantManagement::trTypeName(m_types.value(participantData.typeId()).name());
|
||||
return ParticipantManagement::trTypeName(m_types.value(participantData.typeId).name);
|
||||
|
||||
case ColEquipmentNumber:
|
||||
if (!participantData.equipmentNumber().is_set())
|
||||
if (!participantData.equipmentNumber.has_value())
|
||||
{
|
||||
if (participantData.assignState() == ParticipantAssignState::HandoutExcon)
|
||||
if (participantData.assignState == ParticipantAssignState::HandoutExcon)
|
||||
return 0;
|
||||
return QVariant();
|
||||
}
|
||||
if (participantData.assignState() == ParticipantAssignState::ExconWmsOverruled)
|
||||
return tr("%1 (+)").arg(participantData.equipmentNumber().get());
|
||||
if (participantData.externalId() > 0)
|
||||
return tr("%1 (external)").arg(participantData.equipmentNumber().get());
|
||||
return participantData.equipmentNumber().get();
|
||||
if (participantData.assignState == ParticipantAssignState::ExconWmsOverruled)
|
||||
return tr("%1 (+)").arg(participantData.equipmentNumber.get());
|
||||
if (participantData.externalId > 0)
|
||||
return tr("%1 (external)").arg(participantData.equipmentNumber.get());
|
||||
return participantData.equipmentNumber.get();
|
||||
|
||||
case ColParticipantId:
|
||||
return participantData.id();
|
||||
return participantData.id;
|
||||
|
||||
case ColInfo:
|
||||
return QString::fromStdString(participantData.info());
|
||||
return QString::fromStdString(participantData.info);
|
||||
|
||||
case ColSign:
|
||||
return QString::fromStdString(participantData.identification());
|
||||
return QString::fromStdString(participantData.identification);
|
||||
|
||||
default:
|
||||
Q_UNREACHABLE();
|
||||
@@ -312,9 +315,9 @@ QVariant ParticipantEditModel::data(const QModelIndex &index, int role) const
|
||||
|
||||
case LtsWidgets::LtsColumnFilterProxyModel::ComboboxFilterRole:
|
||||
if (index.column() == ColTypeClass)
|
||||
return typeClassIdFromTypeId(participantData.typeId()).underlying();
|
||||
return static_cast<int>(typeClassIdFromTypeId(participantData.typeId));
|
||||
if (index.column() == ColType)
|
||||
return participantData.typeId();
|
||||
return participantData.typeId;
|
||||
return QVariant();
|
||||
|
||||
default:
|
||||
@@ -357,7 +360,7 @@ bool ParticipantEditModel::canDropMimeData(const QMimeData *data,
|
||||
return false;
|
||||
|
||||
const CheckedTreeItem *parentItem = privateData(parent);
|
||||
if (!isUnitType(parentItem->participant.typeId()))
|
||||
if (!isUnitType(parentItem->participant.typeId))
|
||||
return false;
|
||||
|
||||
DEBUG_LOG(m_logger) << "can drop on " << row << ", " << column << ", parent: "
|
||||
@@ -375,7 +378,7 @@ bool ParticipantEditModel::canDropMimeData(const QMimeData *data,
|
||||
const ParticipantData pdSource = static_cast<CheckedTreeItem *>(tiSources.first())->participant;
|
||||
qDeleteAll(tiSources);
|
||||
|
||||
TypeClass dataTypeClass = typeClassIdFromTypeId(pdSource.typeId());
|
||||
TypeClass dataTypeClass = typeClassIdFromTypeId(pdSource.typeId);
|
||||
bool isDataTypeClassSupport = dataTypeClass == TypeClass::SupportEntity || dataTypeClass == TypeClass::SupportUnit;
|
||||
bool isOwnTypeClassSupport = m_partyId == 1;
|
||||
|
||||
@@ -383,9 +386,9 @@ bool ParticipantEditModel::canDropMimeData(const QMimeData *data,
|
||||
return false;
|
||||
|
||||
|
||||
if (pdSource.partyId() == parentItem->participant.partyId())
|
||||
if (pdSource.partyId == parentItem->participant.partyId)
|
||||
{
|
||||
const int idSource = pdSource.id();
|
||||
const int idSource = pdSource.id;
|
||||
|
||||
if (idSource != 0 && isParentOf(parentItem, idSource))
|
||||
{
|
||||
@@ -399,11 +402,11 @@ bool ParticipantEditModel::canDropMimeData(const QMimeData *data,
|
||||
FiringUnitValidator::FiringUnitRestrictions restrictions = m_firingUnitValidator->getRestrictions(this, parent);
|
||||
|
||||
|
||||
if (m_dtc->isAdlerVerbund(pdSource.typeId()))
|
||||
if (m_dtc->isAdlerVerbund(pdSource.typeId))
|
||||
{
|
||||
const Type &type = m_dtc->type(pdSource.typeId());
|
||||
const Type &type = m_dtc->type(pdSource.typeId);
|
||||
|
||||
if (type.typeClass() != TypeClass::Unit)
|
||||
if (type.typeClass != TypeClass::Unit)
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -414,16 +417,16 @@ bool ParticipantEditModel::canDropMimeData(const QMimeData *data,
|
||||
|
||||
if (restrictions.testFlag(FiringUnitValidator::ONLY_SAME_GEAR_CLASS_ARTILLERY_ALLOWED))
|
||||
{
|
||||
if (!m_firingUnitValidator->isSameGearClassArtillery(parentItem->participant.typeId(), pdSource.typeId()))
|
||||
if (!m_firingUnitValidator->isSameGearClassArtillery(parentItem->participant.typeId, pdSource.typeId))
|
||||
return false;
|
||||
|
||||
if (m_firingUnitValidator->isArtilleryUnit(parentItem->participant.typeId()) && m_firingUnitValidator->isArtilleryUnit(pdSource.typeId()))
|
||||
if (m_firingUnitValidator->isArtilleryUnit(parentItem->participant.typeId) && m_firingUnitValidator->isArtilleryUnit(pdSource.typeId))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (restrictions.testFlag(FiringUnitValidator::NO_ARTILLERY_PARTICIPANTS_ALLOWED))
|
||||
{
|
||||
if (m_firingUnitValidator->isArtilleryWeaponSystem(pdSource.typeId()))
|
||||
if (m_firingUnitValidator->isArtilleryWeaponSystem(pdSource.typeId))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -431,17 +434,17 @@ bool ParticipantEditModel::canDropMimeData(const QMimeData *data,
|
||||
{
|
||||
const Type allowedType = m_firingUnitValidator->getAllowedType(this, parent);
|
||||
|
||||
if (pdSource.typeId() != allowedType.id())
|
||||
if (pdSource.typeId != allowedType.id)
|
||||
return false;
|
||||
|
||||
if (m_dtc->isAdlerVerbund(pdSource.typeId()))
|
||||
if (m_dtc->isAdlerVerbund(pdSource.typeId))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (m_dtc->isAdlerVerbund(pdSource.typeId()) && parentItem->participant.partyId() != pdSource.partyId())
|
||||
if (m_dtc->isAdlerVerbund(pdSource.typeId) && parentItem->participant.partyId != pdSource.partyId)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -463,7 +466,7 @@ bool ParticipantEditModel::dropMimeData(const QMimeData *data, Qt::DropAction ac
|
||||
{
|
||||
CheckedTreeItem *child = static_cast<CheckedTreeItem *>(cti->child(r));
|
||||
|
||||
child->participant.hierarchyNumber(r + 1);
|
||||
child->participant.hierarchyNumber = r + 1;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -480,8 +483,8 @@ bool ParticipantEditModel::onReinitModel(int partyId, const QSet<int> &checkedPa
|
||||
m_partyId = partyId;
|
||||
|
||||
const ParticipantManagement::Party &party = m_dtc->party(m_partyId);
|
||||
m_partyRole = AdvancedSymbology::roleToRole<>(party.role());
|
||||
m_partyColor = QColor::fromRgb(QRgb(party.color()));
|
||||
m_partyRole = AdvancedSymbology::roleToRole<>(party.role);
|
||||
m_partyColor = QColor::fromRgb(QRgb(party.color));
|
||||
|
||||
ParticipantIconModelBase::resetModel();
|
||||
|
||||
@@ -513,7 +516,7 @@ bool ParticipantEditModel::isRowRemovable(const CheckedTreeItem *parentItem) con
|
||||
if (!parentItem)
|
||||
return false;
|
||||
const ParticipantManagement::ParticipantData &participantData = parentItem->participant;
|
||||
if (participantData.equipmentNumber().is_set() && participantData.equipmentNumber().get() > 0)
|
||||
if (participantData.equipmentNumber.has_value() && participantData.equipmentNumber.get() > 0)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < parentItem->childCount(); i++)
|
||||
@@ -559,7 +562,7 @@ void ParticipantEditModel::processMissingSuperiorId()
|
||||
if (!tmap.contains(id))
|
||||
continue;
|
||||
const ParticipantManagement::Participant &p = m_dtc->participant(id);
|
||||
if (p.id() != id)
|
||||
if (p.id != id)
|
||||
continue;
|
||||
onParticipantChanged(p, DataModification::eModified);
|
||||
|
||||
@@ -570,7 +573,7 @@ void ParticipantEditModel::processMissingSuperiorId()
|
||||
for (int childId : std::as_const(childIds))
|
||||
{
|
||||
const ParticipantManagement::Participant &p = m_dtc->participant(childId);
|
||||
if (p.id() != childId)
|
||||
if (p.id != childId)
|
||||
continue;
|
||||
onParticipantChanged(p, DataModification::eModified);
|
||||
}
|
||||
@@ -588,7 +591,7 @@ void ParticipantEditModel::selectItemByParticipantId(int participantId, const st
|
||||
const ParticipantManagement::ParticipantData &data = privateData(idx)->participant;
|
||||
if (hasChildren(idx))
|
||||
selectItemByParticipantId(participantId, selectItem, idx);
|
||||
if (data.id() == participantId)
|
||||
if (data.id == participantId)
|
||||
return selectItem(idx);
|
||||
}
|
||||
return;
|
||||
@@ -605,7 +608,7 @@ QModelIndexList ParticipantEditModel::getIndexesByParticipantIds(const std::vect
|
||||
if (hasChildren(idx))
|
||||
indexes += getIndexesByParticipantIds(participantIds, idx);
|
||||
|
||||
auto it = std::find(participantIds.begin(), participantIds.end(), data.id());
|
||||
auto it = std::find(participantIds.begin(), participantIds.end(), data.id);
|
||||
if (it != participantIds.end())
|
||||
indexes.append(idx);
|
||||
}
|
||||
@@ -696,7 +699,7 @@ QString ParticipantEditModel::getHierarchyFromIndex(const QModelIndex &index) co
|
||||
if (!index.isValid())
|
||||
return QString();
|
||||
const ParticipantManagement::ParticipantData &participantData = privateData(index)->participant;
|
||||
return m_dtc->hierarchyFromParticipant(participantData.id());
|
||||
return m_dtc->hierarchyFromParticipant(participantData.id);
|
||||
}
|
||||
|
||||
|
||||
@@ -707,16 +710,16 @@ void ParticipantEditModel::gatherParticipants(QHash<int, ParticipantData> &tmap,
|
||||
{
|
||||
auto cb = [this, &tmap, &parentId2id](const Participant & part)
|
||||
{
|
||||
if (part.isDeleted())
|
||||
if (part.isDeleted)
|
||||
return;
|
||||
|
||||
if (part.partyId() != m_partyId)
|
||||
if (part.partyId != m_partyId)
|
||||
return;
|
||||
|
||||
|
||||
parentId2id[part.superiorId()] += part.id();
|
||||
parentId2id[part.superiorId] += part.id;
|
||||
|
||||
tmap.insert(part.id(), m_dtc->convertParticipantToParticipantData(part));
|
||||
tmap.insert(part.id, m_dtc->convertParticipantToParticipantData(part));
|
||||
};
|
||||
m_dtc->participants(cb);
|
||||
}
|
||||
@@ -730,16 +733,16 @@ std::vector<ParticipantData> ParticipantEditModel::getChildrenOf(NGLTreeItem *it
|
||||
std::vector<ParticipantData> ret;
|
||||
const CheckedTreeItem *cti = static_cast<CheckedTreeItem *>(item);
|
||||
ParticipantManagement::ParticipantData participantData = cti->participant;
|
||||
participantData.superiorModId(parentId);
|
||||
participantData.hierarchyNumber(hierarchyNumber);
|
||||
participantData.partyId(m_partyId);
|
||||
if (participantData.modId() == 0)
|
||||
participantData.modId(++highestModId);
|
||||
participantData.superiorModId = parentId;
|
||||
participantData.hierarchyNumber = hierarchyNumber;
|
||||
participantData.partyId = m_partyId;
|
||||
if (participantData.modId == 0)
|
||||
participantData.modId = ++highestModId;
|
||||
|
||||
|
||||
for (int i = 0; i < item->childCount(); i++)
|
||||
{
|
||||
const auto c = getChildrenOf(item->child(i), participantData.modId(), i + 1, bOnlyModifed, highestModId);
|
||||
const auto c = getChildrenOf(item->child(i), participantData.modId, i + 1, bOnlyModifed, highestModId);
|
||||
ret.insert(ret.end(), c.begin(), c.end());
|
||||
}
|
||||
|
||||
@@ -760,28 +763,28 @@ bool ParticipantEditModel::updateChildrenOf(int parentId,
|
||||
{
|
||||
ParticipantEditModel::CheckedTreeItem *childItem = static_cast<ParticipantEditModel::CheckedTreeItem *>(parent->child(i));
|
||||
ParticipantData &pdItem = childItem->participant;
|
||||
m_usedTypeIds += pdItem.typeId();
|
||||
m_usedTypeClassIds += typeClassIdFromTypeId(pdItem.typeId());
|
||||
if (pdItem.id() == 0)
|
||||
m_usedTypeIds += pdItem.typeId;
|
||||
m_usedTypeClassIds += typeClassIdFromTypeId(pdItem.typeId);
|
||||
if (pdItem.id == 0)
|
||||
{
|
||||
const QSet<int> &childIds = parentId2id.value(parentId);
|
||||
for (int childId : childIds)
|
||||
{
|
||||
const auto &childData = tmap.value(childId);
|
||||
if (childData.hierarchyNumber() - 1 == i)
|
||||
if (childData.hierarchyNumber - 1 == i)
|
||||
{
|
||||
pdItem.id(childData.id());
|
||||
pdItem.id = childData.id;
|
||||
childItem->setModified(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!pdItem.id())
|
||||
if (!pdItem.id)
|
||||
{
|
||||
bRet = false;
|
||||
continue;
|
||||
}
|
||||
if (!updateChildrenOf(pdItem.id(), childItem, parentId2id, tmap))
|
||||
if (!updateChildrenOf(pdItem.id, childItem, parentId2id, tmap))
|
||||
bRet = false;
|
||||
}
|
||||
return bRet;
|
||||
@@ -806,13 +809,13 @@ void ParticipantEditModel::insertChildrenOf(int parentId,
|
||||
continue;
|
||||
}
|
||||
const ParticipantData &data = it.value();
|
||||
m_usedTypeIds += data.typeId();
|
||||
m_usedTypeClassIds += typeClassIdFromTypeId(data.typeId());
|
||||
m_usedTypeIds += data.typeId;
|
||||
m_usedTypeClassIds += typeClassIdFromTypeId(data.typeId);
|
||||
|
||||
int insertPos = 0;
|
||||
if (data.hierarchyNumber() > 0)
|
||||
if (data.hierarchyNumber > 0)
|
||||
{
|
||||
auto hierIt = currentHierachyNumbers.insert(data.hierarchyNumber(), data.hierarchyNumber());
|
||||
auto hierIt = currentHierachyNumbers.insert(data.hierarchyNumber, data.hierarchyNumber);
|
||||
insertPos = std::distance(currentHierachyNumbers.begin(), hierIt);
|
||||
}
|
||||
else
|
||||
@@ -825,20 +828,20 @@ void ParticipantEditModel::insertChildrenOf(int parentId,
|
||||
|
||||
CheckedTreeItem *childItem = static_cast<CheckedTreeItem *>(createItem(QVariant(), QIcon()));
|
||||
childItem->participant = data;
|
||||
childItem->bIsChecked = isChecked(checkedParticipants.contains(data.id()), cs);
|
||||
childItem->bIsChecked = isChecked(checkedParticipants.contains(data.id), cs);
|
||||
|
||||
DEBUG_LOG(m_logger) << "insert Child " << childItem << "(" << data.id() << ", " << data.hierarchyNumber()
|
||||
DEBUG_LOG(m_logger) << "insert Child " << childItem << "(" << data.id << ", " << data.hierarchyNumber
|
||||
<< ") to parent " << parent << " at pos " << insertPos;
|
||||
if ( data.id() == 0 && data.hierarchyNumber() == 0)
|
||||
if ( data.id == 0 && data.hierarchyNumber == 0)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "avoid endless loop in recursion";
|
||||
return;
|
||||
}
|
||||
insertRow(insertPos, parentIdx, childItem);
|
||||
tryRenderSymbol(QString::fromStdString(data.symbol()), childItem);
|
||||
tryRenderSymbol(QString::fromStdString(data.symbol), childItem);
|
||||
|
||||
const QModelIndex childIdx = index(insertPos, 0, parentIdx);
|
||||
insertChildrenOf(data.id(), childItem, childIdx, parentId2id, tmap, checkedParticipants, cs);
|
||||
insertChildrenOf(data.id, childItem, childIdx, parentId2id, tmap, checkedParticipants, cs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -849,7 +852,7 @@ bool ParticipantEditModel::isParentOf(const NGLTreeItem *item, int participantId
|
||||
return false;
|
||||
|
||||
const CheckedTreeItem *cti = static_cast<const CheckedTreeItem *>(item);
|
||||
if (cti->participant.id() == participantId)
|
||||
if (cti->participant.id == participantId)
|
||||
return true;
|
||||
return isParentOf(item->parent(), participantId);
|
||||
}
|
||||
@@ -921,7 +924,7 @@ void ParticipantEditModel::setCheckState(CheckedTreeItem *parentItem, const QSet
|
||||
|
||||
QModelIndex ParticipantEditModel::indexFromParticipantId(int participantId, const CheckedTreeItem *cti) const
|
||||
{
|
||||
if (cti->participant.id() == participantId)
|
||||
if (cti->participant.id == participantId)
|
||||
return indexFromItem(cti);
|
||||
for (int row = 0; row < cti->childCount(); ++row)
|
||||
{
|
||||
@@ -935,13 +938,13 @@ QModelIndex ParticipantEditModel::indexFromParticipantId(int participantId, cons
|
||||
int ParticipantEditModel::participantIdFromItem(NGLTreeItem *item) const
|
||||
{
|
||||
const CheckedTreeItem *cti = static_cast<CheckedTreeItem *>(item);
|
||||
return cti->participant.id();
|
||||
return cti->participant.id;
|
||||
}
|
||||
|
||||
int ParticipantEditModel::equipmentNumberFromItem(NGLTreeItem *item) const
|
||||
{
|
||||
const CheckedTreeItem *cti = static_cast<CheckedTreeItem *>(item);
|
||||
return cti->participant.equipmentNumber().is_set() ? cti->participant.equipmentNumber().get() : 0;
|
||||
return cti->participant.equipmentNumber.has_value() ? cti->participant.equipmentNumber.get() : 0;
|
||||
}
|
||||
|
||||
ParticipantEditModel::CheckedTreeItem *ParticipantEditModel::searchParticipant(const NGLTreeItem *parentItem, int participantId) const
|
||||
@@ -950,7 +953,7 @@ ParticipantEditModel::CheckedTreeItem *ParticipantEditModel::searchParticipant(c
|
||||
for (int r = 0; r < rowCount; ++r)
|
||||
{
|
||||
CheckedTreeItem *child = static_cast<CheckedTreeItem *>(parentItem->child(r));
|
||||
if (child->participant.id() == participantId)
|
||||
if (child->participant.id == participantId)
|
||||
return child;
|
||||
child = searchParticipant(child, participantId);
|
||||
if (child)
|
||||
@@ -965,10 +968,10 @@ NGLTreeItem *ParticipantEditModel::createItem(const QVariant &data, const QIcon
|
||||
CheckedTreeItem *cti = new CheckedTreeItem(data, icon);
|
||||
cti->participant = qVariantToParticipant(data);
|
||||
|
||||
if (cti->participant.symbol().size() != 0)
|
||||
if (cti->participant.symbol.size() != 0)
|
||||
{
|
||||
auto *that = const_cast<ParticipantEditModel *>(this);
|
||||
that->tryRenderSymbol(QString::fromStdString(cti->participant.symbol()), cti);
|
||||
that->tryRenderSymbol(QString::fromStdString(cti->participant.symbol), cti);
|
||||
}
|
||||
|
||||
return cti;
|
||||
@@ -990,17 +993,17 @@ int ParticipantEditModel::insertParticipant(const QModelIndex &parent, Participa
|
||||
const int row = rowCount(parentCol0);
|
||||
if (bNewParticipant)
|
||||
{
|
||||
participantData.id(0);
|
||||
participantData.modId(0);
|
||||
participantData.id = 0;
|
||||
participantData.modId = 0;
|
||||
}
|
||||
participantData.partyId(m_partyId);
|
||||
participantData.hierarchyNumber(row + 1);
|
||||
participantData.partyId = m_partyId;
|
||||
participantData.hierarchyNumber = row + 1;
|
||||
|
||||
CheckedTreeItem *item = static_cast<CheckedTreeItem *>(createItem(participantToQVariant(participantData), QIcon()));
|
||||
item->setModified(true);
|
||||
if (!insertRow(row, parentCol0, item))
|
||||
return -1;
|
||||
tryRenderSymbol(QString::fromStdString(participantData.symbol()), item);
|
||||
tryRenderSymbol(QString::fromStdString(participantData.symbol), item);
|
||||
emit internalDataChanged();
|
||||
return row;
|
||||
}
|
||||
@@ -1020,8 +1023,8 @@ bool ParticipantEditModel::onUpdateRow(const QModelIndex &index, const Participa
|
||||
if (participantData == oldData)
|
||||
return true;
|
||||
|
||||
if (oldData.symbol() != participantData.symbol())
|
||||
tryRenderSymbol(QString::fromStdString(participantData.symbol()), item);
|
||||
if (oldData.symbol != participantData.symbol)
|
||||
tryRenderSymbol(QString::fromStdString(participantData.symbol), item);
|
||||
|
||||
emit internalDataChanged();
|
||||
item->participant = participantData;
|
||||
@@ -1036,10 +1039,10 @@ bool ParticipantEditModel::onDeleteRow(const QModelIndex &idx, bool isFirstItem)
|
||||
{
|
||||
CheckedTreeItem *item = privateData(idx);
|
||||
ParticipantManagement::ParticipantData data = item->participant;
|
||||
data.isDeleted(true);
|
||||
data.assignState() = ParticipantAssignState::NotAssigned;
|
||||
data.equipmentNumber().reset();
|
||||
if (data.modId() != 0)
|
||||
data.isDeleted = true;
|
||||
data.assignState = ParticipantAssignState::NotAssigned;
|
||||
data.equipmentNumber.reset();
|
||||
if (data.modId != 0)
|
||||
m_dataToDelete.push_back(std::move(data));
|
||||
}
|
||||
removeRow(idx.row(), idx.parent());
|
||||
@@ -1049,12 +1052,12 @@ bool ParticipantEditModel::onDeleteRow(const QModelIndex &idx, bool isFirstItem)
|
||||
|
||||
void ParticipantEditModel::onParticipantChanged(const ParticipantManagement::Participant &data, DataModification modType)
|
||||
{
|
||||
if (data.partyId() != m_partyId)
|
||||
if (data.partyId != m_partyId)
|
||||
return;
|
||||
|
||||
Q_UNUSED(modType);
|
||||
|
||||
CheckedTreeItem *cti = searchParticipant(m_rootItem, data.id());
|
||||
CheckedTreeItem *cti = searchParticipant(m_rootItem, data.id);
|
||||
if (cti)
|
||||
{
|
||||
cti->participant = m_dtc->convertParticipantToParticipantData(data);
|
||||
@@ -1062,16 +1065,16 @@ void ParticipantEditModel::onParticipantChanged(const ParticipantManagement::Par
|
||||
return;
|
||||
}
|
||||
|
||||
CheckedTreeItem *ctiParent = searchParticipant(m_rootItem, data.superiorId());
|
||||
CheckedTreeItem *ctiParent = searchParticipant(m_rootItem, data.superiorId);
|
||||
if (ctiParent)
|
||||
{
|
||||
int insertPos = 0;
|
||||
if (data.hierarchyNumber() > 0)
|
||||
if (data.hierarchyNumber > 0)
|
||||
{
|
||||
for (int i = 0; i < ctiParent->childCount(); ++i)
|
||||
{
|
||||
CheckedTreeItem *child = static_cast<CheckedTreeItem *>(ctiParent->child(i));
|
||||
if (child->participant.hierarchyNumber() > data.hierarchyNumber())
|
||||
if (child->participant.hierarchyNumber > data.hierarchyNumber)
|
||||
{
|
||||
insertPos = i;
|
||||
break;
|
||||
@@ -1086,17 +1089,17 @@ void ParticipantEditModel::onParticipantChanged(const ParticipantManagement::Par
|
||||
|
||||
CheckedTreeItem *childItem = static_cast<CheckedTreeItem *>(createItem(QVariant(), QIcon()));
|
||||
childItem->participant = m_dtc->convertParticipantToParticipantData(data);
|
||||
DEBUG_LOG(m_logger) << "insert Child " << childItem << "(" << data.id() << ", " << data.hierarchyNumber()
|
||||
DEBUG_LOG(m_logger) << "insert Child " << childItem << "(" << data.id << ", " << data.hierarchyNumber
|
||||
<< ") to parent " << ctiParent << " at pos " << insertPos;
|
||||
insertRow(insertPos, indexFromItem(ctiParent), childItem);
|
||||
tryRenderSymbol(QString::fromStdString(data.symbol()), childItem);
|
||||
tryRenderSymbol(QString::fromStdString(data.symbol), childItem);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
m_missingSuperiorId.insert(data.superiorId());
|
||||
m_missingSuperiorId.insert(data.superiorId);
|
||||
m_missingSuperiorIdTimer->start();
|
||||
}
|
||||
|
||||
@@ -1139,31 +1142,31 @@ bool ParticipantTreeFilterProxyModel::lessThan(const QModelIndex &source_left, c
|
||||
switch (source_left.column())
|
||||
{
|
||||
case ParticipantEditModel::ColDesignator:
|
||||
return left->participant.hierarchyNumber() < right->participant.hierarchyNumber();
|
||||
return left->participant.hierarchyNumber < right->participant.hierarchyNumber;
|
||||
case ParticipantEditModel::ColIdentifier:
|
||||
return compareStrings(left->participant.tacticalIdentifier(),
|
||||
right->participant.tacticalIdentifier(),
|
||||
return compareStrings(left->participant.tacticalIdentifier,
|
||||
right->participant.tacticalIdentifier,
|
||||
left, right);
|
||||
case ParticipantEditModel::ColTypeClass:
|
||||
case ParticipantEditModel::ColType:
|
||||
break;
|
||||
case ParticipantEditModel::ColEquipmentNumber:
|
||||
if (!left->participant.equipmentNumber().is_set() && !right->participant.equipmentNumber().is_set())
|
||||
return left->participant.hierarchyNumber() < right->participant.hierarchyNumber();
|
||||
if (!left->participant.equipmentNumber().is_set())
|
||||
if (!left->participant.equipmentNumber.has_value() && !right->participant.equipmentNumber.has_value())
|
||||
return left->participant.hierarchyNumber < right->participant.hierarchyNumber;
|
||||
if (!left->participant.equipmentNumber.has_value())
|
||||
return true;
|
||||
if (!right->participant.equipmentNumber().is_set())
|
||||
if (!right->participant.equipmentNumber.has_value())
|
||||
return false;
|
||||
return left->participant.equipmentNumber().get() < right->participant.equipmentNumber().get();
|
||||
return left->participant.equipmentNumber.get() < right->participant.equipmentNumber.get();
|
||||
case ParticipantEditModel::ColParticipantId:
|
||||
return left->participant.id() < right->participant.id();
|
||||
return left->participant.id < right->participant.id;
|
||||
case ParticipantEditModel::ColInfo:
|
||||
return compareStrings(left->participant.info(),
|
||||
right->participant.info(),
|
||||
return compareStrings(left->participant.info,
|
||||
right->participant.info,
|
||||
left, right);
|
||||
case ParticipantEditModel::ColSign:
|
||||
return compareStrings(left->participant.identification(),
|
||||
right->participant.identification(),
|
||||
return compareStrings(left->participant.identification,
|
||||
right->participant.identification,
|
||||
left, right);
|
||||
}
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::lessThan(source_left, source_right);
|
||||
@@ -1182,7 +1185,7 @@ bool ParticipantTreeFilterProxyModel::filterAcceptsRow(int source_row, const QMo
|
||||
return false;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
if (!m_allowedTypes.contains(childItem->participant.typeId()))
|
||||
if (!m_allowedTypes.contains(childItem->participant.typeId))
|
||||
return false;
|
||||
#else
|
||||
|
||||
@@ -1334,32 +1337,32 @@ bool ParticipantTableFilterProxyModel::lessThan(const QModelIndex &sourceLeft, c
|
||||
switch (sourceLeft.column())
|
||||
{
|
||||
case ParticipantEditModel::ColDesignator:
|
||||
return left->participant.hierarchyNumber() < right->participant.hierarchyNumber();
|
||||
return left->participant.hierarchyNumber < right->participant.hierarchyNumber;
|
||||
|
||||
case ParticipantEditModel::ColIdentifier:
|
||||
return compareStrings(left->participant.tacticalIdentifier(), right->participant.tacticalIdentifier(), left, right);
|
||||
return compareStrings(left->participant.tacticalIdentifier, right->participant.tacticalIdentifier, left, right);
|
||||
|
||||
case ParticipantEditModel::ColTypeClass:
|
||||
case ParticipantEditModel::ColType:
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::lessThan(sourceLeft, sourceRight);
|
||||
|
||||
case ParticipantEditModel::ColEquipmentNumber:
|
||||
if (!left->participant.equipmentNumber().is_set() && !right->participant.equipmentNumber().is_set())
|
||||
return left->participant.hierarchyNumber() < right->participant.hierarchyNumber();
|
||||
if (!left->participant.equipmentNumber().is_set())
|
||||
if (!left->participant.equipmentNumber.has_value() && !right->participant.equipmentNumber.has_value())
|
||||
return left->participant.hierarchyNumber < right->participant.hierarchyNumber;
|
||||
if (!left->participant.equipmentNumber.has_value())
|
||||
return true;
|
||||
if (!right->participant.equipmentNumber().is_set())
|
||||
if (!right->participant.equipmentNumber.has_value())
|
||||
return false;
|
||||
return left->participant.equipmentNumber().get() < right->participant.equipmentNumber().get();
|
||||
return left->participant.equipmentNumber.get() < right->participant.equipmentNumber.get();
|
||||
|
||||
case ParticipantEditModel::ColParticipantId:
|
||||
return left->participant.id() < right->participant.id();
|
||||
return left->participant.id < right->participant.id;
|
||||
|
||||
case ParticipantEditModel::ColInfo:
|
||||
return compareStrings(left->participant.info(), right->participant.info(), left, right);
|
||||
return compareStrings(left->participant.info, right->participant.info, left, right);
|
||||
|
||||
case ParticipantEditModel::ColSign:
|
||||
return compareStrings(left->participant.identification(), right->participant.identification(), left, right);
|
||||
return compareStrings(left->participant.identification, right->participant.identification, left, right);
|
||||
|
||||
default:
|
||||
return false;
|
||||
|
||||
+1
-2
@@ -177,7 +177,6 @@ public:
|
||||
int partyId() const { return m_sourceModel ? m_sourceModel->partyId() : -1; }
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
|
||||
|
||||
@@ -283,4 +282,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(ParticipantManagement::ParticipantData)
|
||||
// Q_DECLARE_METATYPE(ParticipantManagement::ParticipantData) omitted: Qt6 raises "specialization after instantiation / redefinition". ParticipantData is stored as a tree-item member and converted via participantToQVariant() (not QVariant-by-value), so the metatype is unneeded (legacy Qt5 tolerated the duplicate declaration).
|
||||
+11
-11
@@ -26,7 +26,7 @@ QVector<Type> FiringUnitValidator::artilleryParticipantTypes() const
|
||||
|
||||
std::function<void(const Type &)> getArtilleryType = [this, &artilleryParticipantTypes](const Type &type)
|
||||
{
|
||||
if (!m_artilleryParticipantTypeIds.contains(type.id()))
|
||||
if (!m_artilleryParticipantTypeIds.contains(type.id))
|
||||
return;
|
||||
|
||||
artilleryParticipantTypes.append(type);
|
||||
@@ -53,7 +53,7 @@ int FiringUnitValidator::getTypeId(const ParticipantEditModel *model, const QMod
|
||||
|
||||
const ParticipantData data = model->getParticipantData(index);
|
||||
|
||||
return data.typeId();
|
||||
return data.typeId;
|
||||
}
|
||||
|
||||
int FiringUnitValidator::getTypeId(const ParticipantTemplateEditModel *model, const QModelIndex &index) const
|
||||
@@ -63,7 +63,7 @@ int FiringUnitValidator::getTypeId(const ParticipantTemplateEditModel *model, co
|
||||
|
||||
const TemplateData data = model->getTemplateData(index);
|
||||
|
||||
return data.typeId();
|
||||
return data.typeId;
|
||||
}
|
||||
|
||||
void FiringUnitValidator::fetchArtilleryTypes()
|
||||
@@ -76,10 +76,10 @@ void FiringUnitValidator::fetchArtilleryTypes()
|
||||
if (!isArtilleryType(type))
|
||||
return;
|
||||
|
||||
if (type.typeClass() == ParticipantManagement::TypeClass::Unit)
|
||||
m_firingUnitTypeIds.insert(type.id());
|
||||
if (type.typeClass == ParticipantManagement::TypeClass::Unit)
|
||||
m_firingUnitTypeIds.insert(type.id);
|
||||
else
|
||||
m_artilleryParticipantTypeIds.insert(type.id());
|
||||
m_artilleryParticipantTypeIds.insert(type.id);
|
||||
};
|
||||
|
||||
m_ppmDtc->types(getArtilleryTypes);
|
||||
@@ -87,7 +87,7 @@ void FiringUnitValidator::fetchArtilleryTypes()
|
||||
|
||||
bool FiringUnitValidator::isArtilleryType(int typeId) const { return m_ppmDtc->isArtilleryType(typeId) && !m_ppmDtc->isAdlerVerbund(typeId); }
|
||||
|
||||
bool FiringUnitValidator::isArtilleryType(const Type &type) const { return isArtilleryType(type.id()); }
|
||||
bool FiringUnitValidator::isArtilleryType(const Type &type) const { return isArtilleryType(type.id); }
|
||||
|
||||
bool FiringUnitValidator::isArtilleryUnit(int typeId) const
|
||||
{
|
||||
@@ -96,7 +96,7 @@ bool FiringUnitValidator::isArtilleryUnit(int typeId) const
|
||||
|
||||
const ParticipantManagement::Type &type = m_ppmDtc->type(typeId);
|
||||
|
||||
return type.typeClass() == ParticipantManagement::TypeClass::Unit;
|
||||
return type.typeClass == ParticipantManagement::TypeClass::Unit;
|
||||
}
|
||||
|
||||
bool FiringUnitValidator::isArtilleryWeaponSystem(int typeId) const
|
||||
@@ -106,7 +106,7 @@ bool FiringUnitValidator::isArtilleryWeaponSystem(int typeId) const
|
||||
|
||||
const ParticipantManagement::Type &type = m_ppmDtc->type(typeId);
|
||||
|
||||
return type.typeClass() == ParticipantManagement::TypeClass::WeaponSystem;
|
||||
return type.typeClass == ParticipantManagement::TypeClass::WeaponSystem;
|
||||
}
|
||||
|
||||
bool FiringUnitValidator::isSameGearClassArtillery(int typeIdA, int typeIdB) const
|
||||
@@ -124,9 +124,9 @@ bool FiringUnitValidator::isSameGearClassArtillery(int typeIdA, int typeIdB) con
|
||||
ProjectDataManagement::GearClass FiringUnitValidator::getGearClassType(int typeId) const
|
||||
{
|
||||
const Type type = m_ppmDtc->type(typeId);
|
||||
const QJsonDocument properties = QJsonDocument::fromJson(QByteArray::fromStdString(type.properties()));
|
||||
const QJsonDocument properties = QJsonDocument::fromJson(QByteArray::fromStdString(type.properties));
|
||||
const QJsonObject propertiesObject = properties.object();
|
||||
const int gearClassId = propertiesObject.value(QStringLiteral("gearClassId")).toInt(ProjectDataManagement::GearClass::GearClass_Unknown);
|
||||
const int gearClassId = propertiesObject.value(QStringLiteral("gearClassId")).toInt(static_cast<int>(ProjectDataManagement::GearClass::GearClass_Unknown));
|
||||
|
||||
return static_cast<ProjectDataManagement::GearClass>(gearClassId);
|
||||
}
|
||||
|
||||
+1
@@ -6,6 +6,7 @@
|
||||
#include <memory>
|
||||
#include <ppmcommon_export.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include "participant_edit_model.h"
|
||||
#include "participant_template_edit_model.h"
|
||||
|
||||
|
||||
+6
-5
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "participant_icon_model_base.h"
|
||||
#include <ParticipantManagement/ppm_translation.h>
|
||||
#include <AdvancedSymbology/asb_data_plugin_interface.h>
|
||||
#include <nglwidgets/ngltreeitem.h>
|
||||
#include <QtCore/QHash>
|
||||
@@ -40,17 +41,17 @@ void ParticipantIconModelBase::onTypeChanged(const ParticipantManagement::Type &
|
||||
{
|
||||
if (modType == DataModification::eRemoved)
|
||||
{
|
||||
m_types.remove(data.id());
|
||||
m_types.remove(data.id);
|
||||
return;
|
||||
}
|
||||
|
||||
m_types[data.id()] = data;
|
||||
m_types[data.id] = data;
|
||||
}
|
||||
|
||||
|
||||
ParticipantManagement::TypeClass ParticipantIconModelBase::typeClassIdFromTypeId(int typeId) const
|
||||
{
|
||||
return m_types.value(typeId).typeClass();
|
||||
return m_types.value(typeId).typeClass;
|
||||
}
|
||||
|
||||
QString ParticipantIconModelBase::typeClassStringFromTypeId(int typeId) const
|
||||
@@ -58,7 +59,7 @@ QString ParticipantIconModelBase::typeClassStringFromTypeId(int typeId) const
|
||||
auto it = m_types.find(typeId);
|
||||
if (it == m_types.end())
|
||||
return QString();
|
||||
return ParticipantManagement::toString(it.value().typeClass());
|
||||
return ParticipantManagement::toString(it.value().typeClass);
|
||||
}
|
||||
|
||||
bool ParticipantIconModelBase::isUnitType(int typeId) const
|
||||
@@ -108,7 +109,7 @@ void ParticipantIconModelBase::tryRenderSymbol(const QString &symbol, NGLTreeIte
|
||||
SymbolResultData symResData;
|
||||
symResData.result = symRes;
|
||||
symResData.treeItems.push_back(item);
|
||||
m_symbolResultMapping.insertMulti(symResPtr, symResData);
|
||||
m_symbolResultMapping.insert(symResPtr, symResData);
|
||||
QPointer<AdvancedSymbology::SymbolResult> qPointer(symResPtr);
|
||||
|
||||
|
||||
|
||||
+1
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <ppmcommon_export.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <nglwidgets/ngltreemodel.h>
|
||||
|
||||
#include <QtGui/QColor>
|
||||
|
||||
+10
-10
@@ -32,11 +32,11 @@ bool ParticipantSearchModal::init(const std::shared_ptr<ParticipantManagement::I
|
||||
|
||||
auto cb = [this](const Participant &data)
|
||||
{
|
||||
if (!data.equipmentNumber().is_set())
|
||||
if (!data.equipmentNumber.has_value())
|
||||
return;
|
||||
const int newEqId = data.equipmentNumber().get();
|
||||
m_partId2EqId[data.id()] = newEqId;
|
||||
m_eqId2PartId[newEqId] = data.id();
|
||||
const int newEqId = data.equipmentNumber.get();
|
||||
m_partId2EqId[data.id] = newEqId;
|
||||
m_eqId2PartId[newEqId] = data.id;
|
||||
};
|
||||
dtc->participants(cb);
|
||||
connect(dtc.get(), &Interface::Dtc::participantChanged,
|
||||
@@ -63,27 +63,27 @@ void ParticipantSearchModal::onOkay()
|
||||
|
||||
void ParticipantSearchModal::onParticipantChanged(const ParticipantManagement::Participant &data, ::DataModification modType)
|
||||
{
|
||||
const int newEqId = data.equipmentNumber().is_set() ? data.equipmentNumber().get() : 0;
|
||||
const int newEqId = data.equipmentNumber.has_value() ? data.equipmentNumber.get() : 0;
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
{
|
||||
const int oldEqId = m_partId2EqId.value(data.id());
|
||||
const int oldEqId = m_partId2EqId.value(data.id);
|
||||
if (oldEqId == newEqId)
|
||||
return;
|
||||
if (oldEqId != 0)
|
||||
m_eqId2PartId.remove(oldEqId);
|
||||
if (newEqId == 0)
|
||||
return;
|
||||
m_partId2EqId[data.id()] = newEqId;
|
||||
m_eqId2PartId[newEqId] = data.id();
|
||||
m_partId2EqId[data.id] = newEqId;
|
||||
m_eqId2PartId[newEqId] = data.id;
|
||||
break;
|
||||
}
|
||||
case DataModification::eRemoved:
|
||||
{
|
||||
const int oldEqId = m_partId2EqId.value(data.id());
|
||||
m_partId2EqId.remove(data.id());
|
||||
const int oldEqId = m_partId2EqId.value(data.id);
|
||||
m_partId2EqId.remove(data.id);
|
||||
if (oldEqId != 0)
|
||||
m_eqId2PartId.remove(oldEqId);
|
||||
}
|
||||
|
||||
+29
-29
@@ -36,7 +36,7 @@ bool ParticipantTemplateEditItemWidget::init(const QModelIndex &workingIndex,
|
||||
{
|
||||
m_workingIndex = workingIndex;
|
||||
m_editData = data;
|
||||
m_bEditMode = m_editData.typeId() > 0;
|
||||
m_bEditMode = m_editData.typeId > 0;
|
||||
|
||||
return ParticipantEditItemWidgetBase::init(dtc, ppmGuiCbxIfc, asb, addItem);
|
||||
}
|
||||
@@ -59,8 +59,8 @@ void ParticipantTemplateEditItemWidget::setFiringUnitRestrictions(ParticipantTem
|
||||
if (allowedType == Type())
|
||||
return;
|
||||
|
||||
m_ui->cbTypeClass->setCurrentIndex(m_ui->cbTypeClass->findData(allowedType.typeClass().underlying()));
|
||||
m_ui->cbType->setCurrentIndex(m_ui->cbType->findData(allowedType.id()));
|
||||
m_ui->cbTypeClass->setCurrentIndex(m_ui->cbTypeClass->findData(static_cast<int>(allowedType.typeClass)));
|
||||
m_ui->cbType->setCurrentIndex(m_ui->cbType->findData(allowedType.id));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -73,7 +73,7 @@ void ParticipantTemplateEditItemWidget::setFiringUnitRestrictions(ParticipantTem
|
||||
const QVector<Type> allowedTypes = firingUnitValidator->artilleryParticipantTypes();
|
||||
|
||||
m_ui->cbTypeClass->setDisabled(true);
|
||||
m_ui->cbTypeClass->setCurrentIndex(m_ui->cbTypeClass->findData(allowedTypes.at(0).typeClass().underlying()));
|
||||
m_ui->cbTypeClass->setCurrentIndex(m_ui->cbTypeClass->findData(static_cast<int>(allowedTypes.at(0).typeClass)));
|
||||
|
||||
QSignalBlocker typeSignalBlocker(m_ui->cbType);
|
||||
|
||||
@@ -83,20 +83,20 @@ void ParticipantTemplateEditItemWidget::setFiringUnitRestrictions(ParticipantTem
|
||||
std::function<bool(Type)> funcIsSameGearType = [=](const Type &t)
|
||||
{
|
||||
if (m_isAdler)
|
||||
return m_dtc->isAdlerType(t.id()) && (firingUnitValidator->getGearClassType(t.id()) == unitGearClassType);
|
||||
return firingUnitValidator->getGearClassType(t.id()) == unitGearClassType;
|
||||
return m_dtc->isAdlerType(t.id) && (static_cast<int>(firingUnitValidator->getGearClassType(t.id)) == unitGearClassType);
|
||||
return static_cast<int>(firingUnitValidator->getGearClassType(t.id)) == unitGearClassType;
|
||||
};
|
||||
QVector<Type>::ConstIterator typeIterator = std::find_if(allowedTypes.begin(), allowedTypes.end(), funcIsSameGearType);
|
||||
|
||||
if(typeIterator != allowedTypes.end())
|
||||
{
|
||||
m_ui->cbType->setDisabled(true);
|
||||
m_ui->cbType->addItem(ParticipantManagement::trTypeName(typeIterator->name()), typeIterator->id());
|
||||
m_ui->cbType->addItem(ParticipantManagement::trTypeName(typeIterator->name), typeIterator->id);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (const Type ¤tType : allowedTypes)
|
||||
m_ui->cbType->addItem(ParticipantManagement::trTypeName(currentType.name()), currentType.id());
|
||||
m_ui->cbType->addItem(ParticipantManagement::trTypeName(currentType.name), currentType.id);
|
||||
m_ui->cbType->model()->sort(0);
|
||||
}
|
||||
|
||||
@@ -149,15 +149,15 @@ void ParticipantTemplateEditItemWidget::setFiringUnitRestrictions(ParticipantTem
|
||||
|
||||
void ParticipantTemplateEditItemWidget::setData()
|
||||
{
|
||||
m_ui->leDesignator->setText(QString::fromStdString(m_editData.designator()));
|
||||
m_ui->leTactIdent->setText(QString::fromStdString(m_editData.tacticalIdentifier()));
|
||||
m_ui->leDesignator->setText(QString::fromStdString(m_editData.designator));
|
||||
m_ui->leTactIdent->setText(QString::fromStdString(m_editData.tacticalIdentifier));
|
||||
|
||||
Type type = m_dtc->type(m_editData.typeId());
|
||||
m_ui->cbTypeClass->setCurrentIndex(m_ui->cbTypeClass->findData(type.typeClass().underlying()));
|
||||
m_ui->cbType->setCurrentIndex(m_ui->cbType->findData(type.id()));
|
||||
Type type = m_dtc->type(m_editData.typeId);
|
||||
m_ui->cbTypeClass->setCurrentIndex(m_ui->cbTypeClass->findData(static_cast<int>(type.typeClass)));
|
||||
m_ui->cbType->setCurrentIndex(m_ui->cbType->findData(type.id));
|
||||
|
||||
|
||||
m_ui->sbEquipNr->setValue(m_editData.equipmentNumber());
|
||||
m_ui->sbEquipNr->setValue(m_editData.equipmentNumber);
|
||||
|
||||
|
||||
m_ui->cbExternal->hide();
|
||||
@@ -165,27 +165,27 @@ void ParticipantTemplateEditItemWidget::setData()
|
||||
m_ui->lblExternal->hide();
|
||||
|
||||
|
||||
onChangeSymbol(QString::fromStdString(m_editData.symbol()));
|
||||
onChangeSymbol(QString::fromStdString(m_editData.symbol));
|
||||
}
|
||||
|
||||
void ParticipantTemplateEditItemWidget::setDesignatorData()
|
||||
{
|
||||
m_ui->leDesignator->setText(QString::fromStdString(m_editData.designator()));
|
||||
m_ui->leTactIdent->setText(QString::fromStdString(m_editData.tacticalIdentifier()));
|
||||
m_ui->leDesignator->setText(QString::fromStdString(m_editData.designator));
|
||||
m_ui->leTactIdent->setText(QString::fromStdString(m_editData.tacticalIdentifier));
|
||||
}
|
||||
|
||||
void ParticipantTemplateEditItemWidget::onAddItem()
|
||||
{
|
||||
ParticipantManagement::TemplateData newTemplateParticipant;
|
||||
newTemplateParticipant.designator() = m_ui->leDesignator->text().toStdString();
|
||||
newTemplateParticipant.tacticalIdentifier() = m_ui->leTactIdent->text().toStdString();
|
||||
newTemplateParticipant.symbol(m_sidc.toStdString());
|
||||
newTemplateParticipant.typeId(m_ui->cbType->currentData().toInt());
|
||||
newTemplateParticipant.designator = m_ui->leDesignator->text().toStdString();
|
||||
newTemplateParticipant.tacticalIdentifier = m_ui->leTactIdent->text().toStdString();
|
||||
newTemplateParticipant.symbol = m_sidc.toStdString();
|
||||
newTemplateParticipant.typeId = m_ui->cbType->currentData().toInt();
|
||||
|
||||
const int equipNo = m_ui->sbEquipNr->value();
|
||||
if (!checkEquipNo(equipNo))
|
||||
return;
|
||||
newTemplateParticipant.equipmentNumber(equipNo);
|
||||
newTemplateParticipant.equipmentNumber = equipNo;
|
||||
|
||||
DEBUG_LOG(m_logger) << "adding item: " << newTemplateParticipant;
|
||||
emit addItem(m_workingIndex, newTemplateParticipant);
|
||||
@@ -196,16 +196,16 @@ void ParticipantTemplateEditItemWidget::onAddItem()
|
||||
|
||||
bool ParticipantTemplateEditItemWidget::onEditItem()
|
||||
{
|
||||
m_editData.designator() = m_ui->leDesignator->text().toStdString();
|
||||
m_editData.tacticalIdentifier() = m_ui->leTactIdent->text().toStdString();
|
||||
m_editData.symbol(m_sidc.toStdString());
|
||||
m_editData.typeId(m_ui->cbType->currentData().toInt());
|
||||
m_editData.designator = m_ui->leDesignator->text().toStdString();
|
||||
m_editData.tacticalIdentifier = m_ui->leTactIdent->text().toStdString();
|
||||
m_editData.symbol = m_sidc.toStdString();
|
||||
m_editData.typeId = m_ui->cbType->currentData().toInt();
|
||||
|
||||
|
||||
const int equipNo = m_ui->sbEquipNr->value();
|
||||
if (!checkEquipNo(equipNo))
|
||||
return false;
|
||||
m_editData.equipmentNumber(equipNo);
|
||||
m_editData.equipmentNumber = equipNo;
|
||||
|
||||
DEBUG_LOG(m_logger) << "edit item: " << m_editData;
|
||||
emit updateItem(m_workingIndex, m_editData);
|
||||
@@ -223,7 +223,7 @@ bool ParticipantTemplateEditItemWidget::checkEquipNo(int equipNo)
|
||||
m_ui->lbMinMaxEquipNr->setText(QStringLiteral("<span style=\"color:#aa0000;\">%1</span>").arg(equipNo));
|
||||
return false;
|
||||
}
|
||||
if (m_editData.equipmentNumber() != equipNo)
|
||||
if (m_editData.equipmentNumber != equipNo)
|
||||
{
|
||||
|
||||
if (m_usedEquipmentNumbers.contains(equipNo))
|
||||
@@ -280,7 +280,7 @@ bool ParticipantTemplateEditItem::init(const QModelIndex &workingIndex,
|
||||
layout->addWidget(m_buttonBox);
|
||||
setLayout(layout);
|
||||
|
||||
if (data.typeId() > 0)
|
||||
if (data.typeId > 0)
|
||||
{
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, m_editItemWidget, &ParticipantTemplateEditItemWidget::onEditItem);
|
||||
m_buttonBox->getButton(LtsWidgets::DialogButton::Edit)->setText(tr("Apply"));
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ public:
|
||||
bool onEditItem() override;
|
||||
|
||||
protected:
|
||||
int editTypeId() const override { return m_editData.typeId(); }
|
||||
int editTypeId() const override { return m_editData.typeId; }
|
||||
int currentPartyId() const override { return 0; }
|
||||
|
||||
bool checkEquipNo(int equipNo);
|
||||
|
||||
+64
-63
@@ -4,6 +4,7 @@
|
||||
#include "participant_template_edit_model.h"
|
||||
#include <utility>
|
||||
#include <ParticipantManagement/ppm_translation.h>
|
||||
#include <ParticipantManagement/logger.h>
|
||||
#include "participant_firing_unit_validator.h"
|
||||
#include <nglwidgets/ngltreeitem.h>
|
||||
#include <QtCore/QSet>
|
||||
@@ -12,18 +13,18 @@ namespace ParticipantManagement
|
||||
{
|
||||
QDataStream &operator<<(QDataStream &ds, const TemplateData &td)
|
||||
{
|
||||
ds << td.templateId()
|
||||
<< td.hierarchyNumber()
|
||||
<< td.equipmentNumber()
|
||||
<< td.typeId()
|
||||
<< QString::fromStdString(td.symbol())
|
||||
<< QString::fromStdString(td.name())
|
||||
<< QString::fromStdString(td.designator())
|
||||
<< QString::fromStdString(td.tacticalIdentifier())
|
||||
<< QString::fromStdString(td.info())
|
||||
<< td.modId()
|
||||
<< td.superiorModId()
|
||||
<< td.isDeleted();
|
||||
ds << td.templateId
|
||||
<< td.hierarchyNumber
|
||||
<< td.equipmentNumber
|
||||
<< td.typeId
|
||||
<< QString::fromStdString(td.symbol)
|
||||
<< QString::fromStdString(td.name)
|
||||
<< QString::fromStdString(td.designator)
|
||||
<< QString::fromStdString(td.tacticalIdentifier)
|
||||
<< QString::fromStdString(td.info)
|
||||
<< td.modId
|
||||
<< td.superiorModId
|
||||
<< td.isDeleted;
|
||||
|
||||
return ds;
|
||||
}
|
||||
@@ -46,17 +47,17 @@ QDataStream &operator>>(QDataStream &ds, TemplateData &td)
|
||||
>> superiorModId
|
||||
>> isDeleted;
|
||||
|
||||
td.templateId(templateId);
|
||||
td.equipmentNumber(equipmentNumber);
|
||||
td.typeId(typeId);
|
||||
td.symbol(symbol.toStdString());
|
||||
td.name(name.toStdString());
|
||||
td.designator(designator.toStdString());
|
||||
td.tacticalIdentifier(tacticalIdentifier.toStdString());
|
||||
td.info(info.toStdString());
|
||||
td.modId(modId);
|
||||
td.superiorModId(superiorModId);
|
||||
td.isDeleted(isDeleted);
|
||||
td.templateId = templateId;
|
||||
td.equipmentNumber = equipmentNumber;
|
||||
td.typeId = typeId;
|
||||
td.symbol = symbol.toStdString();
|
||||
td.name = name.toStdString();
|
||||
td.designator = designator.toStdString();
|
||||
td.tacticalIdentifier = tacticalIdentifier.toStdString();
|
||||
td.info = info.toStdString();
|
||||
td.modId = modId;
|
||||
td.superiorModId = superiorModId;
|
||||
td.isDeleted = isDeleted;
|
||||
|
||||
return ds;
|
||||
}
|
||||
@@ -78,7 +79,7 @@ ParticipantTemplateEditModel::ParticipantTemplateEditModel(QObject *parent,
|
||||
{
|
||||
connect(this, &ParticipantTemplateEditModel::signalDataDropped,
|
||||
this, &ParticipantTemplateEditModel::internalDataChanged);
|
||||
qRegisterMetaTypeStreamOperators<ParticipantManagement::TemplateData>();
|
||||
qRegisterMetaType<ParticipantManagement::TemplateData>();
|
||||
setMimeType(QStringLiteral("ParticipantTemplateEditModel_%1").arg(qlonglong(this)));
|
||||
|
||||
init();
|
||||
@@ -97,19 +98,19 @@ QVariant ParticipantTemplateEditModel::data(const QModelIndex &index, int role)
|
||||
switch (index.column())
|
||||
{
|
||||
case ColDesignator:
|
||||
return QString::fromStdString(templateData.designator());
|
||||
return QString::fromStdString(templateData.designator);
|
||||
case ColIdentifier:
|
||||
return QString::fromStdString(templateData.tacticalIdentifier());
|
||||
return QString::fromStdString(templateData.tacticalIdentifier);
|
||||
case ColTypeClass:
|
||||
return typeClassStringFromTypeId(templateData.typeId());
|
||||
return typeClassStringFromTypeId(templateData.typeId);
|
||||
case ColType:
|
||||
return ParticipantManagement::trTypeName(m_types.value(templateData.typeId()).name());
|
||||
return ParticipantManagement::trTypeName(m_types.value(templateData.typeId).name);
|
||||
case ColEquipmentNumber:
|
||||
if (templateData.equipmentNumber() != 0)
|
||||
return templateData.equipmentNumber();
|
||||
if (templateData.equipmentNumber != 0)
|
||||
return templateData.equipmentNumber;
|
||||
return QVariant();
|
||||
case ColTemplateId:
|
||||
return templateData.templateId();
|
||||
return templateData.templateId;
|
||||
}
|
||||
}
|
||||
return NGLTreeModel::data(index, role);
|
||||
@@ -143,15 +144,15 @@ std::vector<TemplateData> ParticipantTemplateEditModel::getChildrenOf(NGLTreeIte
|
||||
|
||||
std::vector<TemplateData> ret;
|
||||
ParticipantManagement::TemplateData templateData = item->data().value<ParticipantManagement::TemplateData>();
|
||||
templateData.superiorModId(parentId);
|
||||
templateData.hierarchyNumber(hierarchyNumber);
|
||||
if (templateData.modId() == 0)
|
||||
templateData.modId(++highestModId);
|
||||
templateData.superiorModId = parentId;
|
||||
templateData.hierarchyNumber = hierarchyNumber;
|
||||
if (templateData.modId == 0)
|
||||
templateData.modId = ++highestModId;
|
||||
|
||||
|
||||
for (int i = 0; i < item->childCount(); i++)
|
||||
{
|
||||
const auto c = getChildrenOf(item->child(i), templateData.modId(), i + 1, bOnlyModified, highestModId);
|
||||
const auto c = getChildrenOf(item->child(i), templateData.modId, i + 1, bOnlyModified, highestModId);
|
||||
ret.insert(ret.end(), c.begin(), c.end());
|
||||
}
|
||||
|
||||
@@ -165,8 +166,8 @@ std::vector<TemplateData> ParticipantTemplateEditModel::getChildrenOf(NGLTreeIte
|
||||
|
||||
bool ParticipantTemplateEditModel::onInsertRow(const QModelIndex &parent, ParticipantManagement::TemplateData templateData)
|
||||
{
|
||||
templateData.templateId(0);
|
||||
templateData.modId(0);
|
||||
templateData.templateId = 0;
|
||||
templateData.modId = 0;
|
||||
|
||||
QVariant data;
|
||||
data.setValue(templateData);
|
||||
@@ -186,7 +187,7 @@ bool ParticipantTemplateEditModel::onUpdateRow(const QModelIndex &index, const P
|
||||
data.setValue(templateData);
|
||||
NGLTreeItem *item = privateData(index);
|
||||
item->setIcon(QIcon());
|
||||
tryRenderSymbol(QString::fromStdString(templateData.symbol()), item);
|
||||
tryRenderSymbol(QString::fromStdString(templateData.symbol), item);
|
||||
|
||||
emit internalDataChanged();
|
||||
return setItemData(index, data, item->icon());
|
||||
@@ -201,9 +202,9 @@ bool ParticipantTemplateEditModel::onDeleteRow(const QModelIndex &idx, bool isFi
|
||||
{
|
||||
NGLTreeItem *item = privateData(idx);
|
||||
ParticipantManagement::TemplateData data = item->data().value<ParticipantManagement::TemplateData>();
|
||||
if (data.modId() != 0)
|
||||
if (data.modId != 0)
|
||||
{
|
||||
data.isDeleted(true);
|
||||
data.isDeleted = true;
|
||||
m_dataToDelete.append(data);
|
||||
}
|
||||
}
|
||||
@@ -238,7 +239,7 @@ std::vector<ParticipantManagement::TemplateData> ParticipantTemplateEditModel::t
|
||||
{
|
||||
|
||||
for (auto &templ : templateDatas)
|
||||
templ.templateId(0);
|
||||
templ.templateId = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -268,8 +269,8 @@ QSet<int> ParticipantTemplateEditModel::usedEquipmentNumbers(NGLTreeItem *item)
|
||||
{
|
||||
QSet<int> ret;
|
||||
const TemplateData data = item->data().value<ParticipantManagement::TemplateData>();
|
||||
if (data.equipmentNumber() != 0)
|
||||
ret += data.equipmentNumber();
|
||||
if (data.equipmentNumber != 0)
|
||||
ret += data.equipmentNumber;
|
||||
|
||||
for (int i = 0; i < item->childCount(); ++i)
|
||||
ret += usedEquipmentNumbers(item->child(i));
|
||||
@@ -308,7 +309,7 @@ bool ParticipantTemplateEditModel::canDropMimeData(const QMimeData *data,
|
||||
return false;
|
||||
|
||||
const TemplateData &parentItem = getTemplateData(parent);
|
||||
if (!isUnitType(parentItem.typeId()))
|
||||
if (!isUnitType(parentItem.typeId))
|
||||
return false;
|
||||
|
||||
DEBUG_LOG(m_logger) << "can drop on " << row << ", " << column << ", parent: "
|
||||
@@ -337,16 +338,16 @@ bool ParticipantTemplateEditModel::canDropMimeData(const QMimeData *data,
|
||||
|
||||
if (restrictions.testFlag(FiringUnitValidator::ONLY_SAME_GEAR_CLASS_ARTILLERY_ALLOWED))
|
||||
{
|
||||
if (!m_firingUnitValidator->isSameGearClassArtillery(parentItem.typeId(), pdSource.typeId()))
|
||||
if (!m_firingUnitValidator->isSameGearClassArtillery(parentItem.typeId, pdSource.typeId))
|
||||
return false;
|
||||
|
||||
if (m_firingUnitValidator->isArtilleryUnit(parentItem.typeId()) && m_firingUnitValidator->isArtilleryUnit(pdSource.typeId()))
|
||||
if (m_firingUnitValidator->isArtilleryUnit(parentItem.typeId) && m_firingUnitValidator->isArtilleryUnit(pdSource.typeId))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (restrictions.testFlag(FiringUnitValidator::NO_ARTILLERY_PARTICIPANTS_ALLOWED))
|
||||
{
|
||||
if (m_firingUnitValidator->isArtilleryWeaponSystem(pdSource.typeId()))
|
||||
if (m_firingUnitValidator->isArtilleryWeaponSystem(pdSource.typeId))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -354,10 +355,10 @@ bool ParticipantTemplateEditModel::canDropMimeData(const QMimeData *data,
|
||||
{
|
||||
const Type allowedType = m_firingUnitValidator->getAllowedType(this, parent);
|
||||
|
||||
if (pdSource.typeId() != allowedType.id())
|
||||
if (pdSource.typeId != allowedType.id)
|
||||
return false;
|
||||
|
||||
if (m_dtc->isAdlerVerbund(pdSource.typeId()))
|
||||
if (m_dtc->isAdlerVerbund(pdSource.typeId))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -383,20 +384,20 @@ bool ParticipantTemplateEditModel::onInsertTemplate(int rootId,
|
||||
for (const ParticipantManagement::TemplateParticipant &tmpl : std::as_const(templateMap))
|
||||
{
|
||||
|
||||
if (!tmpl.templateId())
|
||||
if (!tmpl.templateId)
|
||||
continue;
|
||||
|
||||
parentId2id[tmpl.superiorTemplateId()] += tmpl.templateId();
|
||||
parentId2id[tmpl.superiorTemplateId] += tmpl.templateId;
|
||||
|
||||
auto data = m_dtc->convertFromParticipantTemplateToTemplateData(tmpl);
|
||||
if (asCopy)
|
||||
{
|
||||
data.templateId(0);
|
||||
data.modId(0);
|
||||
data.templateId = 0;
|
||||
data.modId = 0;
|
||||
}
|
||||
if (usedEquipNo.contains(data.equipmentNumber()))
|
||||
data.equipmentNumber(0);
|
||||
tmap.insert(tmpl.templateId(), data);
|
||||
if (usedEquipNo.contains(data.equipmentNumber))
|
||||
data.equipmentNumber = 0;
|
||||
tmap.insert(tmpl.templateId, data);
|
||||
}
|
||||
|
||||
NGLTreeItem *root = parentIndex.isValid() ? privateData(parentIndex) : m_rootItem;
|
||||
@@ -430,16 +431,16 @@ void ParticipantTemplateEditModel::insertChildrenOf(int parentId,
|
||||
const int templateId = it.key();
|
||||
const TemplateData &data = it.value();
|
||||
|
||||
if (data.hierarchyNumber() <= 0)
|
||||
if (data.hierarchyNumber <= 0)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Invalid / no hierarchy number set for participant " << data.templateId() << " - ignoring";
|
||||
WARNING_LOG(m_logger) << "Invalid / no hierarchy number set for participant " << data.templateId << " - ignoring";
|
||||
continue;
|
||||
}
|
||||
auto hierIt = currentHierachyNumbers.insert(data.hierarchyNumber(), data.hierarchyNumber());
|
||||
auto hierIt = currentHierachyNumbers.insert(data.hierarchyNumber, data.hierarchyNumber);
|
||||
const int insertPos = std::distance(currentHierachyNumbers.begin(), hierIt);
|
||||
|
||||
NGLTreeItem *childItem = createItem(QVariant::fromValue(data), QIcon());
|
||||
DEBUG_LOG(m_logger) << "insert Child " << childItem << "(" << data.templateId() << ", " << data.hierarchyNumber()
|
||||
DEBUG_LOG(m_logger) << "insert Child " << childItem << "(" << data.templateId << ", " << data.hierarchyNumber
|
||||
<< ") to parent " << parent << " at pos " << insertPos;
|
||||
insertRow(insertPos, parentIdx, childItem);
|
||||
const QModelIndex childIdx = index(insertPos, 0, parentIdx);
|
||||
@@ -452,11 +453,11 @@ NGLTreeItem *ParticipantTemplateEditModel::createItem(const QVariant &data, cons
|
||||
{
|
||||
auto ret = NGLTreeModel::createItem(data, icon);
|
||||
const TemplateData templateData = data.value<TemplateData>();
|
||||
if (templateData.symbol().size() != 0)
|
||||
if (templateData.symbol.size() != 0)
|
||||
{
|
||||
ParticipantTemplateEditModel *that = const_cast<ParticipantTemplateEditModel*>(this);
|
||||
|
||||
that->tryRenderSymbol(QString::fromStdString(templateData.symbol()), ret);
|
||||
that->tryRenderSymbol(QString::fromStdString(templateData.symbol), ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
+10
-10
@@ -40,7 +40,7 @@ bool ParticipantTimePointModel::onReinitModel(int partyId, const QSet<int> &chec
|
||||
return true;
|
||||
|
||||
m_partyId = partyId;
|
||||
m_partyColor = QColor::fromRgb(QRgb(m_dtc->party(m_partyId).color()));
|
||||
m_partyColor = QColor::fromRgb(QRgb(m_dtc->party(m_partyId).color));
|
||||
|
||||
m_checkedParticipantsTimepointModel = checkedParticipants;
|
||||
m_csTimePointModel = cs;
|
||||
@@ -52,8 +52,8 @@ bool ParticipantTimePointModel::onReinitModel(int partyId, const QSet<int> &chec
|
||||
void ParticipantTimePointModel::startRequest()
|
||||
{
|
||||
ParticipantManagement::GetParticipantsRequest req;
|
||||
req.partyId(partyId());
|
||||
req.timeStamp(m_currentTimePoint);
|
||||
req.partyId = partyId();
|
||||
req.timeStamp = m_currentTimePoint;
|
||||
|
||||
m_requestHelper.startSingleRequest([this, req]() { return m_ppmFtc->getParticipantsRequest(req, this); });
|
||||
}
|
||||
@@ -66,21 +66,21 @@ void ParticipantTimePointModel::onGetParticipantsReply(const GetParticipantsRepl
|
||||
|
||||
QHash<int, ParticipantData> tmap;
|
||||
QHash<int, QSet<int>> parentId2id;
|
||||
tmap.reserve(reply.participants().size());
|
||||
parentId2id.reserve(reply.participants().size());
|
||||
tmap.reserve(reply.participants.size());
|
||||
parentId2id.reserve(reply.participants.size());
|
||||
|
||||
for (const auto &part : reply.participants())
|
||||
for (const auto &part : reply.participants)
|
||||
{
|
||||
if (part.isDeleted())
|
||||
if (part.isDeleted)
|
||||
continue;
|
||||
|
||||
if (part.partyId() != m_partyId)
|
||||
if (part.partyId != m_partyId)
|
||||
continue;
|
||||
|
||||
|
||||
parentId2id[part.superiorId()] += part.id();
|
||||
parentId2id[part.superiorId] += part.id;
|
||||
|
||||
tmap.insert(part.id(), m_dtc->convertParticipantToParticipantData(part));
|
||||
tmap.insert(part.id, m_dtc->convertParticipantToParticipantData(part));
|
||||
};
|
||||
|
||||
|
||||
|
||||
+5
-5
@@ -53,14 +53,14 @@ bool ParticipantTreeEditHandler::isContainer() const
|
||||
const QModelIndex idx = selectedIndexView();
|
||||
if (!idx.isValid())
|
||||
return false;
|
||||
const int typeId = m_model->privateData(idx)->participant.typeId();
|
||||
const int typeId = m_model->privateData(idx)->participant.typeId;
|
||||
if (typeId <= 0)
|
||||
return false;
|
||||
|
||||
if (m_asSupportService)
|
||||
return m_dtc->type(typeId).typeClass() == ParticipantManagement::TypeClass::SupportUnit;
|
||||
return m_dtc->type(typeId).typeClass == ParticipantManagement::TypeClass::SupportUnit;
|
||||
|
||||
return m_dtc->type(typeId).typeClass() == ParticipantManagement::TypeClass::Unit;
|
||||
return m_dtc->type(typeId).typeClass == ParticipantManagement::TypeClass::Unit;
|
||||
}
|
||||
|
||||
QVector<int> ParticipantTreeEditHandler::usedEquipmentNumbers() const
|
||||
@@ -128,8 +128,8 @@ void ParticipantTreeEditHandler::partyHasChanged(int newPartyId, bool keepExpand
|
||||
bool ParticipantTreeEditHandler::onApplyChanges()
|
||||
{
|
||||
ModifyParticipantDataRequest req;
|
||||
req.data(m_model->participantData());
|
||||
if (req.data().size() == 0)
|
||||
req.data = m_model->participantData();
|
||||
if (req.data.size() == 0)
|
||||
return true;
|
||||
|
||||
if (!m_requestHelper)
|
||||
|
||||
+1
@@ -9,6 +9,7 @@
|
||||
#include <ppmcommon_export.h>
|
||||
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_ftc.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
|
||||
+5
-5
@@ -12,7 +12,7 @@ namespace ParticipantManagement
|
||||
|
||||
static ProjectDataManagement::VulnerabilityClass vulnerabilityClassFromTypeClass(TypeClass tc)
|
||||
{
|
||||
switch (tc.underlying())
|
||||
switch (tc)
|
||||
{
|
||||
case TypeClass::Human:
|
||||
return ProjectDataManagement::VulnerabilityClass::VulnerabilityClass_SoldierInjuries;
|
||||
@@ -54,7 +54,7 @@ QVector<ProjectDataManagement::VulnerabilityState> vulnerabilityStatesForTypeCla
|
||||
const bool hasVulnerabilityStateTemporarySeverance = ps->value(QStringLiteral("ppm"),
|
||||
QStringLiteral("hasVulnerabilityStateTemporarySeverance")).toBool();
|
||||
|
||||
switch (tc.underlying())
|
||||
switch (tc)
|
||||
{
|
||||
case TypeClass::Human:
|
||||
{
|
||||
@@ -128,7 +128,7 @@ QVector<ProjectDataManagement::OcCode> ocCodeForTypeClass(TypeClass tc)
|
||||
const bool hasOcCodeOptimalTreatment = ps->value(QStringLiteral("ppm"),
|
||||
QStringLiteral("hasOcCodeOptimalTreatment")).toBool();
|
||||
|
||||
switch (tc.underlying())
|
||||
switch (tc)
|
||||
{
|
||||
case TypeClass::Human:
|
||||
{
|
||||
@@ -165,12 +165,12 @@ void insertVulnerabilityStates(QComboBox *cbx, TypeClass tc)
|
||||
VulnerabilityClass cls = vulnerabilityClassFromTypeClass(tc);
|
||||
const auto vec = vulnerabilityStatesForTypeClass(tc);
|
||||
for (const auto vs : vec)
|
||||
cbx->addItem(toString(vs, cls), vs.underlying());
|
||||
cbx->addItem(toString(vs, cls), static_cast<int>(vs));
|
||||
|
||||
|
||||
const auto ocVec = ocCodeForTypeClass(tc);
|
||||
for (const auto vs : ocVec)
|
||||
cbx->addItem(toString(vs), vs.underlying()+100);
|
||||
cbx->addItem(toString(vs), static_cast<int>(vs)+100);
|
||||
}
|
||||
|
||||
}
|
||||
+1
@@ -10,6 +10,7 @@
|
||||
#include <OperatorManagement/opm_data_plugin_interface.h>
|
||||
#include <ExerciseManagement/exm_data_plugin_interface.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
|
||||
|
||||
class Ui_MSDLExport;
|
||||
|
||||
+1
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_ftc.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
|
||||
+2
-2
@@ -49,7 +49,7 @@ MappingDialog::MappingDialog(QWidget *parent, bool typeClassIsUnit, const QStrin
|
||||
}
|
||||
|
||||
for (const auto &typeclass : setTypeClasses)
|
||||
mUi->m_ltsComboBox_typeClass->addItem(ParticipantManagement::toString(typeclass), typeclass.underlying());
|
||||
mUi->m_ltsComboBox_typeClass->addItem(ParticipantManagement::toString(typeclass), typeclass);
|
||||
|
||||
slotClassTypeChanged();
|
||||
|
||||
@@ -72,7 +72,7 @@ void MappingDialog::slotClassTypeChanged()
|
||||
|
||||
for (const ParticipantManagement::Type &type : std::as_const(m_mapTypes))
|
||||
{
|
||||
if (type.typeClass().underlying() != currentClass)
|
||||
if (type.typeClass() != currentClass)
|
||||
continue;
|
||||
|
||||
if (!m_offerDatabaseEntriesWithoutDISType && (type.disEntities().size() == 0))
|
||||
|
||||
+1
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <LtsWidgets/lts_frameless_dialog.h>
|
||||
|
||||
class Ui_MSDLMappingDialog;
|
||||
|
||||
+1
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <ParticipantManagement/logger.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_ftc.h>
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
|
||||
+1
@@ -23,6 +23,7 @@ ParticipantShow::ParticipantShow(LtsSession::LtsSession *session,
|
||||
, m_session(session)
|
||||
, m_model(nullptr)
|
||||
, m_ui(new Ui::ParticipantShow)
|
||||
, m_logger(getLogger("ParticipantShow"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
|
||||
+1
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <ParticipantManagement/logger.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_ftc.h>
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
|
||||
+1
@@ -12,6 +12,7 @@ PartyModel::PartyModel(QObject *parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<PartyData>({tr("Id"),
|
||||
tr("Name")}, parent)
|
||||
, m_dtc(nullptr)
|
||||
, m_logger(getLogger("PartyModel"))
|
||||
{}
|
||||
|
||||
bool PartyModel::initModel(const std::shared_ptr<ParticipantManagement::Interface::Dtc> &dtc)
|
||||
|
||||
+3
-2
@@ -4,6 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/logger.h>
|
||||
#include <ParticipantManagement/ppm_translation.h>
|
||||
|
||||
@@ -18,8 +19,8 @@ struct PartyData
|
||||
QString name;
|
||||
PartyData() = default;
|
||||
explicit PartyData(const ParticipantManagement::Party &p)
|
||||
: id(p.id())
|
||||
, name(ParticipantManagement::trPartyName(p.name()))
|
||||
: id(p.id)
|
||||
, name(ParticipantManagement::trPartyName(p.name))
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
+1
@@ -22,6 +22,7 @@ PartyView::PartyView(const QString &menuGroup, LtsSession::LtsSession *session,
|
||||
, m_ftc(nullptr)
|
||||
, m_session(session)
|
||||
, m_ui(new Ui::PartyView)
|
||||
, m_logger(getLogger("PartyView"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->widget->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
|
||||
+2
-1
@@ -13,6 +13,7 @@ ParticipantPlanningModel::ParticipantPlanningModel(QObject *parent,
|
||||
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
||||
const std::shared_ptr<AdvancedSymbology::ForeignDataInterface> &asbIfc)
|
||||
: ParticipantManagement::ParticipantEditModel(parent, ppmDtc, asbIfc)
|
||||
, m_logger(getLogger("ParticipantPlanningModel"))
|
||||
{
|
||||
m_titles += tr("Hierarchy");
|
||||
|
||||
@@ -25,7 +26,7 @@ QVariant ParticipantPlanningModel::data(const QModelIndex &index, int role) cons
|
||||
const ParticipantManagement::ParticipantData &participantData = item->participant;
|
||||
|
||||
if (role == Qt::DisplayRole && index.column() == columnCount() - 1)
|
||||
return m_dtc->hierarchyFromParticipant(participantData.id());
|
||||
return m_dtc->hierarchyFromParticipant(participantData.id);
|
||||
|
||||
return ParticipantManagement::ParticipantEditModel::data(index, role);
|
||||
}
|
||||
|
||||
+7
-6
@@ -41,6 +41,7 @@ ParticipantEdit::ParticipantEdit(LtsSession::LtsSession *session, bool asSupport
|
||||
, m_pbTreeViewDummy(new QPushButton(m_pbTreeView->text()))
|
||||
, m_pbTableViewDummy(new QPushButton(m_pbTableView->text()))
|
||||
, m_ui(new Ui::ParticipantEdit)
|
||||
, m_logger(getLogger("ParticipantEdit"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
@@ -318,7 +319,7 @@ void ParticipantEdit::onEnaDisa()
|
||||
bool enableRemove = false;
|
||||
if (m_pTreehandler->isSelectedIndexValid())
|
||||
{
|
||||
if (m_dtc->isAdlerVerbund(m_pTreehandler->getSelectedData().typeId()))
|
||||
if (m_dtc->isAdlerVerbund(m_pTreehandler->getSelectedData().typeId))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Can't Edit Adler SAA Participants";
|
||||
enableEdit = true;
|
||||
@@ -349,8 +350,8 @@ void ParticipantEdit::onAddItem()
|
||||
ParticipantEditItem *newItemDlg = new ParticipantEditItem(m_asSupportService, m_session, this);
|
||||
ParticipantManagement::ParticipantData dataAll = m_pTreehandler->getSelectedData();
|
||||
ParticipantData data = ParticipantData();
|
||||
data.designator(dataAll.designator());
|
||||
data.tacticalIdentifier(dataAll.tacticalIdentifier());
|
||||
data.designator = dataAll.designator;
|
||||
data.tacticalIdentifier = dataAll.tacticalIdentifier;
|
||||
const bool addItem = true;
|
||||
newItemDlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
@@ -377,7 +378,7 @@ void ParticipantEdit::onAddItem()
|
||||
{
|
||||
|
||||
newItemDlg->setIsAdler(m_firingUnitValidator->isAdler(m_model, workingIndex));
|
||||
const int unitGearClassType = m_firingUnitValidator->getGearClassType(m_model, workingIndex);
|
||||
const int unitGearClassType = static_cast<int>(m_firingUnitValidator->getGearClassType(m_model, workingIndex));
|
||||
|
||||
newItemDlg->setFiringUnitRestrictions(m_model, false, m_firingUnitValidator->getRestrictions(m_model, workingIndex), m_firingUnitValidator, unitGearClassType);
|
||||
|
||||
@@ -403,7 +404,7 @@ void ParticipantEdit::onEditItem()
|
||||
return;
|
||||
|
||||
ParticipantManagement::ParticipantData data = m_pTreehandler->getSelectedData();
|
||||
if (data.isSimulated())
|
||||
if (data.isSimulated)
|
||||
showIsSimulated();
|
||||
|
||||
m_newItemDlg = new ParticipantEditItem(m_asSupportService, m_session, this);
|
||||
@@ -429,7 +430,7 @@ void ParticipantEdit::onEditItem()
|
||||
|
||||
if (m_firingUnitValidator)
|
||||
{
|
||||
const int unitGearClassType = m_firingUnitValidator->getGearClassType(m_model, workingIndex);
|
||||
const int unitGearClassType = static_cast<int>(m_firingUnitValidator->getGearClassType(m_model, workingIndex));
|
||||
m_newItemDlg->setFiringUnitRestrictions(m_model, true, m_firingUnitValidator->getRestrictions(m_model, workingIndex), m_firingUnitValidator, unitGearClassType);
|
||||
}
|
||||
|
||||
|
||||
+52
-52
@@ -30,7 +30,7 @@ ParticipantOrgaModel::ParticipantOrgaModel(PartyOrganisationType orgType,
|
||||
{
|
||||
connect(m_dtc.get(), &ParticipantManagement::Interface::Dtc::participantOrganisationChanged,
|
||||
this, &ParticipantOrgaModel::onParticipantOrganisationChanged);
|
||||
m_dtc->participantOrganisations([this](const ParticipantOrganisation &org) { m_participantOrganization[org.participantId()] = org;});
|
||||
m_dtc->participantOrganisations([this](const ParticipantOrganisation &org) { m_participantOrganization[org.participantId] = org;});
|
||||
}
|
||||
|
||||
QVariant ParticipantOrgaModel::data(const QModelIndex &index, int role) const
|
||||
@@ -45,10 +45,10 @@ QVariant ParticipantOrgaModel::data(const QModelIndex &index, int role) const
|
||||
switch (index.column())
|
||||
{
|
||||
case ColDescription:
|
||||
return QVariant(QString::fromStdString(participantData.designator()) + QLatin1Char('/') +
|
||||
QString::fromStdString(participantData.tacticalIdentifier()));
|
||||
return QVariant(QString::fromStdString(participantData.designator) + QLatin1Char('/') +
|
||||
QString::fromStdString(participantData.tacticalIdentifier));
|
||||
case ColParticipantId:
|
||||
return participantData.id();
|
||||
return participantData.id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -104,17 +104,17 @@ QMimeData *ParticipantOrgaModel::mimeData(const QModelIndexList &indexes) const
|
||||
}
|
||||
|
||||
const ParticipantData data = privateData(idx)->data().value<ParticipantManagement::ParticipantData>();
|
||||
if (data.id() == 0)
|
||||
if (data.id == 0)
|
||||
return nullptr;
|
||||
if (m_orgType == PartyOrganisationType::Detached)
|
||||
{
|
||||
|
||||
auto it = m_participantOrganization.find(data.id());
|
||||
if (it != m_participantOrganization.end() && it.value().currentPartyId() != 0)
|
||||
auto it = m_participantOrganization.find(data.id);
|
||||
if (it != m_participantOrganization.end() && it.value().currentPartyId != 0)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const QByteArray encodedData(QByteArray::number(data.id()));
|
||||
const QByteArray encodedData(QByteArray::number(data.id));
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
switch (m_orgType)
|
||||
{
|
||||
@@ -159,7 +159,7 @@ bool ParticipantOrgaModel::canDropMimeData(const QMimeData *data, Qt::DropAction
|
||||
{
|
||||
auto it = m_participantOrganization.find(participantId);
|
||||
if (it != m_participantOrganization.end() &&
|
||||
it.value().originPartyId() == m_partyId)
|
||||
it.value().originPartyId == m_partyId)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -209,8 +209,8 @@ bool ParticipantOrgaModel::dropMimeData(const QMimeData *data, Qt::DropAction ac
|
||||
return false;
|
||||
}
|
||||
|
||||
movedParticipants[0].superiorId(0);
|
||||
movedParticipants[0].hierarchyNumber(1);
|
||||
movedParticipants[0].superiorId = 0;
|
||||
movedParticipants[0].hierarchyNumber = 1;
|
||||
int rootParticipantId = 0;
|
||||
NGLTreeItem *rootItem = m_rootItem;
|
||||
QModelIndex rootModelIndex;
|
||||
@@ -224,15 +224,15 @@ bool ParticipantOrgaModel::dropMimeData(const QMimeData *data, Qt::DropAction ac
|
||||
if (!item->data().canConvert<ParticipantManagement::ParticipantData>())
|
||||
return false;
|
||||
const ParticipantManagement::ParticipantData participantData = item->data().value<ParticipantManagement::ParticipantData>();
|
||||
if (participantData.id() == 0)
|
||||
if (participantData.id == 0)
|
||||
return false;
|
||||
|
||||
rootParticipantId = participantData.id();
|
||||
rootParticipantId = participantData.id;
|
||||
rootItem = item;
|
||||
rootModelIndex = parent;
|
||||
|
||||
movedParticipants[0].superiorId(rootParticipantId);
|
||||
movedParticipants[0].hierarchyNumber(-1);
|
||||
movedParticipants[0].superiorId = rootParticipantId;
|
||||
movedParticipants[0].hierarchyNumber = -1;
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "Drop: #movedParticipants: " << movedParticipants.size();
|
||||
@@ -244,20 +244,20 @@ bool ParticipantOrgaModel::dropMimeData(const QMimeData *data, Qt::DropAction ac
|
||||
|
||||
for (const Participant &part : std::as_const(movedParticipants))
|
||||
{
|
||||
if (part.isDeleted())
|
||||
if (part.isDeleted)
|
||||
continue;
|
||||
|
||||
|
||||
parentId2id[part.superiorId()] += part.id();
|
||||
parentId2id[part.superiorId] += part.id;
|
||||
|
||||
tmap.insert(part.id(), m_dtc->convertParticipantToParticipantData(part));
|
||||
tmap.insert(part.id, m_dtc->convertParticipantToParticipantData(part));
|
||||
}
|
||||
|
||||
|
||||
insertChildrenOf(rootParticipantId, rootItem, rootModelIndex, parentId2id, tmap);
|
||||
|
||||
|
||||
emit participantDataChanged(movedParticipants.at(0).id());
|
||||
emit participantDataChanged(movedParticipants.at(0).id);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -274,7 +274,7 @@ bool ParticipantOrgaModel::isParticipantType(int source_row, const QModelIndex &
|
||||
if (!childItem->data().canConvert<ParticipantManagement::ParticipantData>())
|
||||
return false;
|
||||
const ParticipantManagement::ParticipantData participantData = childItem->data().value<ParticipantManagement::ParticipantData>();
|
||||
return !isUnitType(participantData.typeId());
|
||||
return !isUnitType(participantData.typeId);
|
||||
}
|
||||
|
||||
QVector<Participant> ParticipantOrgaModel::inferiorParticipants(int partId) const
|
||||
@@ -283,9 +283,9 @@ QVector<Participant> ParticipantOrgaModel::inferiorParticipants(int partId) cons
|
||||
|
||||
const Participant participant = m_dtc->participant(partId);
|
||||
|
||||
retVector.reserve(participant.inferiorIds().size() + retVector.size() + 1);
|
||||
retVector.reserve(participant.inferiorIds.size() + retVector.size() + 1);
|
||||
retVector.append(participant);
|
||||
for (int inferiorId : participant.inferiorIds())
|
||||
for (int inferiorId : participant.inferiorIds)
|
||||
retVector.append(inferiorParticipants(inferiorId));
|
||||
|
||||
return retVector;
|
||||
@@ -298,14 +298,14 @@ QVector<ParticipantData> ParticipantOrgaModel::getChildrenOf(NGLTreeItem *parent
|
||||
return ret;
|
||||
|
||||
ParticipantManagement::ParticipantData participantData = parentItem->data().value<ParticipantManagement::ParticipantData>();
|
||||
participantData.superiorModId(parentId);
|
||||
participantData.hierarchyNumber(hierarchyNumber);
|
||||
if (participantData.modId() == 0)
|
||||
participantData.modId(++highestModId);
|
||||
participantData.superiorModId = parentId;
|
||||
participantData.hierarchyNumber = hierarchyNumber;
|
||||
if (participantData.modId == 0)
|
||||
participantData.modId = ++highestModId;
|
||||
ret += participantData;
|
||||
|
||||
for (int i = 0; i < parentItem->childCount(); i++)
|
||||
ret.append(getChildrenOf(parentItem->child(i), participantData.modId(), i + 1, highestModId));
|
||||
ret.append(getChildrenOf(parentItem->child(i), participantData.modId, i + 1, highestModId));
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -321,7 +321,7 @@ QVector<ParticipantData> ParticipantOrgaModel::participantData(int partyId) cons
|
||||
ret += getChildrenOf(rootKnot, 0, 1, modId);
|
||||
}
|
||||
for (int i = 0; i < ret.size(); ++i)
|
||||
ret[i].partyId(partyId);
|
||||
ret[i].partyId = partyId;
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -335,9 +335,9 @@ QVector<int> ParticipantOrgaModel::rootParticipantIds() const
|
||||
const NGLTreeItem *rootKnot = m_rootItem->child(i);
|
||||
const ParticipantManagement::ParticipantData participantData = rootKnot->data().value<ParticipantManagement::ParticipantData>();
|
||||
|
||||
if (participantData.id() == 0)
|
||||
if (participantData.id == 0)
|
||||
continue;
|
||||
ret += participantData.id();
|
||||
ret += participantData.id;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -347,8 +347,8 @@ void ParticipantOrgaModel::onReinitModel(int partyId)
|
||||
{
|
||||
m_partyId = partyId;
|
||||
const ParticipantManagement::Party &party = m_dtc->party(m_partyId);
|
||||
m_partyRole = AdvancedSymbology::roleToRole<>(party.role());
|
||||
m_partyColor = QColor::fromRgb(QRgb(party.color()));
|
||||
m_partyRole = AdvancedSymbology::roleToRole<>(party.role);
|
||||
m_partyColor = QColor::fromRgb(QRgb(party.color));
|
||||
m_symbolResultMapping.clear();
|
||||
|
||||
NGLTreeModel::resetModel();
|
||||
@@ -357,19 +357,19 @@ void ParticipantOrgaModel::onReinitModel(int partyId)
|
||||
QHash<int, QSet<int>> parentId2id;
|
||||
auto cb = [this, &tmap, &parentId2id](const Participant & part)
|
||||
{
|
||||
if (part.isDeleted())
|
||||
if (part.isDeleted)
|
||||
return;
|
||||
if (m_orgType != PartyOrganisationType::Detached && part.partyId() != m_partyId)
|
||||
if (m_orgType != PartyOrganisationType::Detached && part.partyId != m_partyId)
|
||||
return;
|
||||
if (m_orgType == PartyOrganisationType::Detached && part.partyId() == m_partyId)
|
||||
if (m_orgType == PartyOrganisationType::Detached && part.partyId == m_partyId)
|
||||
return;
|
||||
if (part.superiorId() == 0 && !isRootParticipantRelevant(part, m_partyId))
|
||||
if (part.superiorId == 0 && !isRootParticipantRelevant(part, m_partyId))
|
||||
return;
|
||||
|
||||
|
||||
parentId2id[part.superiorId()] += part.id();
|
||||
parentId2id[part.superiorId] += part.id;
|
||||
|
||||
tmap.insert(part.id(), m_dtc->convertParticipantToParticipantData(part));
|
||||
tmap.insert(part.id, m_dtc->convertParticipantToParticipantData(part));
|
||||
};
|
||||
m_dtc->participants(cb);
|
||||
|
||||
@@ -383,10 +383,10 @@ void ParticipantOrgaModel::onParticipantOrganisationChanged(const ParticipantOrg
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
m_participantOrganization[data.participantId()] = data;
|
||||
m_participantOrganization[data.participantId] = data;
|
||||
break;
|
||||
case DataModification::eRemoved:
|
||||
m_participantOrganization.remove(data.participantId());
|
||||
m_participantOrganization.remove(data.participantId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -410,9 +410,9 @@ void ParticipantOrgaModel::insertChildrenOf(int parentId,
|
||||
const ParticipantData &data = it.value();
|
||||
|
||||
int insertPos = 0;
|
||||
if (data.hierarchyNumber() > 0)
|
||||
if (data.hierarchyNumber > 0)
|
||||
{
|
||||
auto hierIt = currentHierachyNumbers.insert(data.hierarchyNumber(), data.hierarchyNumber());
|
||||
auto hierIt = currentHierachyNumbers.insert(data.hierarchyNumber, data.hierarchyNumber);
|
||||
insertPos = std::distance(currentHierachyNumbers.begin(), hierIt);
|
||||
}
|
||||
else
|
||||
@@ -424,11 +424,11 @@ void ParticipantOrgaModel::insertChildrenOf(int parentId,
|
||||
}
|
||||
|
||||
NGLTreeItem *childItem = createItem(QVariant::fromValue(data), QIcon());
|
||||
DEBUG_LOG(m_logger) << "insert Child " << childItem << "(" << data.id() << ", " << data.hierarchyNumber()
|
||||
DEBUG_LOG(m_logger) << "insert Child " << childItem << "(" << data.id << ", " << data.hierarchyNumber
|
||||
<< ") to parent " << parent << " at pos " << insertPos;
|
||||
insertRow(insertPos, parentIdx, childItem);
|
||||
const QModelIndex childIdx = index(insertPos, 0, parentIdx);
|
||||
insertChildrenOf(data.id(), childItem, childIdx, parentId2id, tmap);
|
||||
insertChildrenOf(data.id, childItem, childIdx, parentId2id, tmap);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,20 +452,20 @@ QString ParticipantOrgaModel::headerFromOrganisationType(PartyOrganisationType o
|
||||
bool ParticipantOrgaModel::isRootParticipantRelevant(const Participant &participant, int partyId) const
|
||||
{
|
||||
|
||||
const int participantId = participant.id();
|
||||
const int participantPartyId = participant.partyId();
|
||||
const int participantId = participant.id;
|
||||
const int participantPartyId = participant.partyId;
|
||||
const ParticipantOrganisation org = m_participantOrganization.value(participantId);
|
||||
|
||||
switch (m_orgType)
|
||||
{
|
||||
case PartyOrganisationType::Party:
|
||||
return participantPartyId == partyId && org.participantId() == 0;
|
||||
return participantPartyId == partyId && org.participantId == 0;
|
||||
case PartyOrganisationType::Attached:
|
||||
return participantPartyId == partyId && org.participantId() == participantId && org.isAttached();
|
||||
return participantPartyId == partyId && org.participantId == participantId && org.isAttached;
|
||||
case PartyOrganisationType::Detached:
|
||||
return org.participantId() == participantId && org.originPartyId() == partyId;
|
||||
return org.participantId == participantId && org.originPartyId == partyId;
|
||||
case PartyOrganisationType::Cooperate:
|
||||
return participantPartyId == partyId && org.participantId() == participantId && org.isCooperate();
|
||||
return participantPartyId == partyId && org.participantId == participantId && org.isCooperate;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -474,11 +474,11 @@ NGLTreeItem *ParticipantOrgaModel::createItem(const QVariant &data, const QIcon
|
||||
{
|
||||
auto ret = NGLTreeModel::createItem(data, icon);
|
||||
const ParticipantData participantData = data.value<ParticipantData>();
|
||||
if (participantData.symbol().size() != 0)
|
||||
if (participantData.symbol.size() != 0)
|
||||
{
|
||||
ParticipantOrgaModel *that = const_cast<ParticipantOrgaModel*>(this);
|
||||
|
||||
that->tryRenderSymbol(QString::fromStdString(participantData.symbol()), ret);
|
||||
that->tryRenderSymbol(QString::fromStdString(participantData.symbol), ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
+1
@@ -6,6 +6,7 @@
|
||||
#include <ParticipantManagement/Gui/Common/participant_icon_model_base.h>
|
||||
#include <ParticipantManagement/logger.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
|
||||
#include <QtCore/QSortFilterProxyModel>
|
||||
#include <QtCore/QSet>
|
||||
|
||||
+33
-31
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "participant_organisation.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include "ui_participant_organisation.h"
|
||||
|
||||
#include "participant_unit_namer.h"
|
||||
@@ -38,6 +39,7 @@ ParticipantOrganisationDialog::ParticipantOrganisationDialog(LtsSession::LtsSess
|
||||
, m_session(session)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_ui(new Ui::ParticipantOrganisation)
|
||||
, m_logger(getLogger("ParticipantOrganisation"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->splitter->setStretchFactor(0, 1);
|
||||
@@ -232,16 +234,16 @@ void ParticipantOrganisationDialog::onPoolParticipantsChanged(const QVector<Part
|
||||
return;
|
||||
|
||||
ModifyParticipantDataRequest req;
|
||||
req.data(LtsUtils::convert<std::vector<ParticipantData>>(participants));
|
||||
req.data = LtsUtils::convert<std::vector<ParticipantData>>(participants);
|
||||
|
||||
if (originatorMimeType == ParticipantPartyAttached)
|
||||
{
|
||||
ParticipantOrganisation orga;
|
||||
orga.participantId(participants.first().id());
|
||||
orga.currentPartyId(0);
|
||||
orga.isAttached(false);
|
||||
orga.isCooperate(false);
|
||||
req.participantOrganisation(orga);
|
||||
orga.participantId = participants.first().id;
|
||||
orga.currentPartyId = 0;
|
||||
orga.isAttached = false;
|
||||
orga.isCooperate = false;
|
||||
req.participantOrganisation = orga;
|
||||
}
|
||||
|
||||
saveParticipantData(req);
|
||||
@@ -264,14 +266,14 @@ void ParticipantOrganisationDialog::onPartyParticipantsChanged(int addedParticip
|
||||
|
||||
|
||||
ParticipantOrganisation orga;
|
||||
orga.participantId(addedParticipantId);
|
||||
orga.originPartyId(curPartyId);
|
||||
orga.currentPartyId(curPartyId);
|
||||
req.participantOrganisation(orga);
|
||||
orga.participantId = addedParticipantId;
|
||||
orga.originPartyId = curPartyId;
|
||||
orga.currentPartyId = curPartyId;
|
||||
req.participantOrganisation = orga;
|
||||
}
|
||||
|
||||
const QVector<ParticipantData> participantData = m_partyModel->participantData(curPartyId);
|
||||
req.data(LtsUtils::convert<std::vector<ParticipantData>>(participantData));
|
||||
req.data = LtsUtils::convert<std::vector<ParticipantData>>(participantData);
|
||||
|
||||
saveParticipantData(req);
|
||||
}
|
||||
@@ -284,14 +286,14 @@ void ParticipantOrganisationDialog::onAttachedParticipantsChanged(int addedParti
|
||||
|
||||
ModifyParticipantDataRequest req;
|
||||
ParticipantOrganisation orga;
|
||||
orga.participantId(addedParticipantId);
|
||||
orga.currentPartyId(curPartyId);
|
||||
orga.isAttached(true);
|
||||
orga.isCooperate(false);
|
||||
req.participantOrganisation(orga);
|
||||
orga.participantId = addedParticipantId;
|
||||
orga.currentPartyId = curPartyId;
|
||||
orga.isAttached = true;
|
||||
orga.isCooperate = false;
|
||||
req.participantOrganisation = orga;
|
||||
|
||||
const QVector<ParticipantData> attachedtData = m_attachedModel->participantData(curPartyId);
|
||||
req.data(LtsUtils::convert<std::vector<ParticipantData>>(attachedtData));
|
||||
req.data = LtsUtils::convert<std::vector<ParticipantData>>(attachedtData);
|
||||
|
||||
saveParticipantData(req);
|
||||
}
|
||||
@@ -304,14 +306,14 @@ void ParticipantOrganisationDialog::onDetachedParticipantsChanged(int addedParti
|
||||
|
||||
ModifyParticipantDataRequest req;
|
||||
ParticipantOrganisation orga;
|
||||
orga.participantId(addedParticipantId);
|
||||
orga.originPartyId(curPartyId);
|
||||
orga.currentPartyId(0);
|
||||
req.participantOrganisation(orga);
|
||||
orga.participantId = addedParticipantId;
|
||||
orga.originPartyId = curPartyId;
|
||||
orga.currentPartyId = 0;
|
||||
req.participantOrganisation = orga;
|
||||
|
||||
const QVector<ParticipantData> participantData = m_partyModel->participantData(curPartyId);
|
||||
const QVector<ParticipantData> detachedtData = m_detachedModel->participantData(0);
|
||||
req.data(LtsUtils::convert<std::vector<ParticipantData>>(participantData + detachedtData));
|
||||
req.data = LtsUtils::convert<std::vector<ParticipantData>>(participantData + detachedtData);
|
||||
|
||||
saveParticipantData(req);
|
||||
}
|
||||
@@ -323,14 +325,14 @@ void ParticipantOrganisationDialog::onCooperateParticipantsChanged(int addedPart
|
||||
|
||||
ModifyParticipantDataRequest req;
|
||||
ParticipantOrganisation orga;
|
||||
orga.participantId(addedParticipantId);
|
||||
orga.currentPartyId(curPartyId);
|
||||
orga.isAttached(false);
|
||||
orga.isCooperate(true);
|
||||
req.participantOrganisation(orga);
|
||||
orga.participantId = addedParticipantId;
|
||||
orga.currentPartyId = curPartyId;
|
||||
orga.isAttached = false;
|
||||
orga.isCooperate = true;
|
||||
req.participantOrganisation = orga;
|
||||
|
||||
const QVector<ParticipantData> attachedtData = m_cooperateModel->participantData(curPartyId);
|
||||
req.data(LtsUtils::convert<std::vector<ParticipantData>>(attachedtData));
|
||||
req.data = LtsUtils::convert<std::vector<ParticipantData>>(attachedtData);
|
||||
|
||||
saveParticipantData(req);
|
||||
}
|
||||
@@ -342,7 +344,7 @@ void ParticipantOrganisationDialog::onStartTemplateUnitNamer(int templateId)
|
||||
{
|
||||
const TemplateParticipant tempPart = m_dtc->templateParticipant(templateId);
|
||||
|
||||
ParticipantUnitNamer *namer = new ParticipantUnitNamer(QString::fromStdString(tempPart.designator()), QString::fromStdString(tempPart.tacticalIdentifier()), this);
|
||||
ParticipantUnitNamer *namer = new ParticipantUnitNamer(QString::fromStdString(tempPart.designator), QString::fromStdString(tempPart.tacticalIdentifier), this);
|
||||
connect(namer, &ParticipantUnitNamer::newUnitNames, this, [this, templateId](const QString & designator, const QString & tactIdentifer)
|
||||
{
|
||||
m_poolModel->addNewTemplateToPool(templateId, designator, tactIdentifer);
|
||||
@@ -421,8 +423,8 @@ void ParticipantOrganisationDialog::showContextMenu(const QPoint &position)
|
||||
|
||||
|
||||
|
||||
DeleteDelegate::DeleteDelegate(QObject *parent) : QItemDelegate(parent),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger()) {
|
||||
DeleteDelegate::DeleteDelegate(QObject *parent) : QItemDelegate(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void DeleteDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
|
||||
+60
-59
@@ -28,6 +28,7 @@ ParticipantPoolModel::ParticipantPoolModel(QObject *parent,
|
||||
, AdvancedSymbology::TableModelSymbolRenderer<ParticipantPoolModel>(ColDesignatorIdentifier)
|
||||
, m_asSupportService(asSupportService)
|
||||
, m_dtc(dtc)
|
||||
, m_logger(getLogger("ParticipantPoolModel"))
|
||||
{
|
||||
|
||||
std::shared_ptr<AdvancedSymbology::ForeignDataInterface> asb;
|
||||
@@ -42,8 +43,8 @@ ParticipantPoolModel::ParticipantPoolModel(QObject *parent,
|
||||
m_dtc->participantOrganisations([this](const ParticipantOrganisation &org) { onParticipantOrganisationChanged(org, DataModification::eAdded); });
|
||||
|
||||
const ParticipantManagement::Party &party = m_dtc->party(poolPartyId());
|
||||
setDefaultRoleAndColor(AdvancedSymbology::roleToRole<>(party.role()),
|
||||
QColor::fromRgb(QRgb(party.color())));
|
||||
setDefaultRoleAndColor(AdvancedSymbology::roleToRole<>(party.role),
|
||||
QColor::fromRgb(QRgb(party.color)));
|
||||
}
|
||||
|
||||
bool ParticipantPoolModel::canRemoveRow(int row) const
|
||||
@@ -61,11 +62,11 @@ bool ParticipantPoolModel::removeRow(int row)
|
||||
return false;
|
||||
QVector<ParticipantData> datasToDelete;
|
||||
ParticipantManagement::ParticipantData dataToDelete = getRowData(row);
|
||||
removeRenderedSymbol(dataToDelete.id());
|
||||
removeRenderedSymbol(dataToDelete.id);
|
||||
|
||||
if (dataToDelete.id() != 0)
|
||||
if (dataToDelete.id != 0)
|
||||
{
|
||||
dataToDelete.isDeleted(true);
|
||||
dataToDelete.isDeleted = true;
|
||||
datasToDelete.append(dataToDelete);
|
||||
}
|
||||
|
||||
@@ -83,21 +84,21 @@ QVariant ParticipantPoolModel::data(const QModelIndex &index, int role) const
|
||||
|
||||
const ParticipantManagement::ParticipantData &participantData = m_vecData.at(index.row());
|
||||
if (role == Qt::DecorationRole)
|
||||
return decorationData(index, participantData.id());
|
||||
return decorationData(index, participantData.id);
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
case ColRemove:
|
||||
break;
|
||||
case ColDesignatorIdentifier:
|
||||
return QString(QString::fromStdString(participantData.designator()) + QLatin1Char('/') +
|
||||
QString::fromStdString(participantData.tacticalIdentifier()));
|
||||
return QString(QString::fromStdString(participantData.designator) + QLatin1Char('/') +
|
||||
QString::fromStdString(participantData.tacticalIdentifier));
|
||||
case ColTypeClass:
|
||||
return ParticipantManagement::toString(m_dtc->type(participantData.typeId()).typeClass());
|
||||
return ParticipantManagement::toString(m_dtc->type(participantData.typeId).typeClass);
|
||||
case ColType:
|
||||
return ParticipantManagement::trTypeName(m_dtc->type(participantData.typeId()).name());
|
||||
return ParticipantManagement::trTypeName(m_dtc->type(participantData.typeId).name);
|
||||
case ColParticipantId:
|
||||
return participantData.id();
|
||||
return participantData.id;
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
@@ -124,12 +125,12 @@ QMimeData *ParticipantPoolModel::mimeData(const QModelIndexList &indexes) const
|
||||
return nullptr;
|
||||
|
||||
const ParticipantData &data = m_vecData.at(idx.row());
|
||||
if (data.id() == 0)
|
||||
if (data.id == 0)
|
||||
return nullptr;
|
||||
|
||||
const QByteArray encodedData(QByteArray::number(data.id()));
|
||||
const QByteArray encodedData(QByteArray::number(data.id));
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
const QString mimeType = m_participantOrganization.contains(data.id()) ? ParticipantPoolDetached : ParticipantPoolRoot;
|
||||
const QString mimeType = m_participantOrganization.contains(data.id) ? ParticipantPoolDetached : ParticipantPoolRoot;
|
||||
mimeData->setData(mimeType, encodedData);
|
||||
return mimeData;
|
||||
}
|
||||
@@ -199,9 +200,9 @@ bool ParticipantPoolModel::onReinitModel()
|
||||
|
||||
for (const ParticipantManagement::Participant &part : participantMap)
|
||||
{
|
||||
if (part.superiorId() > 0 || part.partyId() != poolPartyId() || part.isDeleted())
|
||||
if (part.superiorId > 0 || part.partyId != poolPartyId() || part.isDeleted)
|
||||
continue;
|
||||
if (!isValidTypeClass(part.typeId()))
|
||||
if (!isValidTypeClass(part.typeId))
|
||||
continue;
|
||||
insertRow(part);
|
||||
}
|
||||
@@ -216,10 +217,10 @@ bool ParticipantPoolModel::addNewTemplateToPool(int id, const QString &designato
|
||||
|
||||
|
||||
TemplateParticipant &root = templateDatas[0];
|
||||
root.superiorTemplateId(0);
|
||||
root.hierarchyNumber(1);
|
||||
root.designator(designator.toStdString());
|
||||
root.tacticalIdentifier(tactIdentifier.toStdString());
|
||||
root.superiorTemplateId = 0;
|
||||
root.hierarchyNumber = 1;
|
||||
root.designator = designator.toStdString();
|
||||
root.tacticalIdentifier = tactIdentifier.toStdString();
|
||||
|
||||
|
||||
QVector<ParticipantManagement::ParticipantData> newPool;
|
||||
@@ -236,10 +237,10 @@ bool ParticipantPoolModel::addNewTemplateToPool(int id, const QString &designato
|
||||
|
||||
void ParticipantPoolModel::onParticipantDataChanged(const Participant &data, DataModification modType)
|
||||
{
|
||||
if (!isValidTypeClass(data.typeId()))
|
||||
if (!isValidTypeClass(data.typeId))
|
||||
return;
|
||||
|
||||
if (data.isDeleted())
|
||||
if (data.isDeleted)
|
||||
modType = DataModification::eRemoved;
|
||||
|
||||
switch (modType)
|
||||
@@ -248,17 +249,17 @@ void ParticipantPoolModel::onParticipantDataChanged(const Participant &data, Dat
|
||||
for (int i = 0; i < m_vecData.size(); ++i)
|
||||
{
|
||||
const ParticipantData &part = m_vecData.at(i);
|
||||
if (part.id() == data.id())
|
||||
if (part.id == data.id)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Modifed participant " << data.id() << ", old party: " << part.partyId() << ", new: " << data.partyId();
|
||||
DEBUG_LOG(m_logger) << "Modifed participant " << data.id << ", old party: " << part.partyId << ", new: " << data.partyId;
|
||||
|
||||
if (data.partyId() != poolPartyId())
|
||||
if (data.partyId != poolPartyId())
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
const int participantId = data.id();
|
||||
const int participantId = data.id;
|
||||
QTimer::singleShot(100, this, [this, participantId]() { tryRemoveParticipantFromModel(participantId); });
|
||||
}
|
||||
else
|
||||
@@ -271,16 +272,16 @@ void ParticipantPoolModel::onParticipantDataChanged(const Participant &data, Dat
|
||||
|
||||
Q_FALLTHROUGH();
|
||||
case DataModification::eAdded:
|
||||
if (data.superiorId() != 0 && !m_participantOrganization.contains(data.id()))
|
||||
if (data.superiorId != 0 && !m_participantOrganization.contains(data.id))
|
||||
return;
|
||||
if (data.partyId() != poolPartyId())
|
||||
if (data.partyId != poolPartyId())
|
||||
return;
|
||||
insertRow(data);
|
||||
break;
|
||||
case DataModification::eRemoved:
|
||||
if (data.partyId() != poolPartyId())
|
||||
if (data.partyId != poolPartyId())
|
||||
return;
|
||||
tryRemoveParticipantFromModel(data.id());
|
||||
tryRemoveParticipantFromModel(data.id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -291,10 +292,10 @@ void ParticipantPoolModel::onParticipantOrganisationChanged(const ParticipantOrg
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
m_participantOrganization[data.participantId()] = data;
|
||||
m_participantOrganization[data.participantId] = data;
|
||||
break;
|
||||
case DataModification::eRemoved:
|
||||
m_participantOrganization.remove(data.participantId());
|
||||
m_participantOrganization.remove(data.participantId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -304,18 +305,18 @@ bool ParticipantPoolModel::moveFromPartyToPool(int rootParticipantId, const QStr
|
||||
ERROR_LOG(m_logger) << "Moving participant " << rootParticipantId << " from party to root with mime type " << mimeType;
|
||||
|
||||
const Participant part = m_dtc->participant(rootParticipantId);
|
||||
const QVector<Participant> newParticipants = getSuperiorParticipants(part.id());
|
||||
const QVector<Participant> newParticipants = getSuperiorParticipants(part.id);
|
||||
QVector<ParticipantData> dataToSend;
|
||||
dataToSend.reserve(newParticipants.size());
|
||||
for (const Participant &part : newParticipants)
|
||||
{
|
||||
ParticipantData data = m_dtc->convertParticipantToParticipantData(part);
|
||||
data.partyId(poolPartyId());
|
||||
if (data.id() == rootParticipantId)
|
||||
data.partyId = poolPartyId();
|
||||
if (data.id == rootParticipantId)
|
||||
{
|
||||
|
||||
data.superiorModId(0);
|
||||
data.hierarchyNumber(1);
|
||||
data.superiorModId = 0;
|
||||
data.hierarchyNumber = 1;
|
||||
}
|
||||
dataToSend.append(data);
|
||||
}
|
||||
@@ -333,7 +334,7 @@ QVector<Participant> ParticipantPoolModel::getSuperiorParticipants(int participa
|
||||
Participant part = m_dtc->participant(participantId);
|
||||
QVector<Participant> retParticipants;
|
||||
retParticipants.append(part);
|
||||
for (auto const &inferierPart : part.inferiorIds())
|
||||
for (auto const &inferierPart : part.inferiorIds)
|
||||
retParticipants.append(getSuperiorParticipants(inferierPart));
|
||||
return retParticipants;
|
||||
}
|
||||
@@ -341,39 +342,39 @@ QVector<Participant> ParticipantPoolModel::getSuperiorParticipants(int participa
|
||||
bool ParticipantPoolModel::convertFromParticipantTemplateToParticipantData(const TemplateParticipant &inputParticipant, ParticipantData &outPutData)
|
||||
{
|
||||
|
||||
outPutData.assignState(ParticipantManagement::ParticipantAssignState::NotAssigned);
|
||||
outPutData.assignState = ParticipantManagement::ParticipantAssignState::NotAssigned;
|
||||
|
||||
outPutData.id(0);
|
||||
outPutData.id = 0;
|
||||
|
||||
outPutData.partyId(poolPartyId());
|
||||
outPutData.partyId = poolPartyId();
|
||||
|
||||
|
||||
if (inputParticipant.equipmentNumber() != 0)
|
||||
if (inputParticipant.equipmentNumber != 0)
|
||||
{
|
||||
outPutData.equipmentNumber(inputParticipant.equipmentNumber());
|
||||
outPutData.assignState(ParticipantAssignState::HandoutExcon);
|
||||
outPutData.equipmentNumber = inputParticipant.equipmentNumber;
|
||||
outPutData.assignState = ParticipantAssignState::HandoutExcon;
|
||||
}
|
||||
outPutData.hierarchyNumber(inputParticipant.hierarchyNumber());
|
||||
outPutData.hierarchyNumber = inputParticipant.hierarchyNumber;
|
||||
|
||||
outPutData.info() = inputParticipant.info();
|
||||
outPutData.name() = inputParticipant.name();
|
||||
outPutData.designator() = inputParticipant.designator();
|
||||
outPutData.tacticalIdentifier(inputParticipant.tacticalIdentifier());
|
||||
outPutData.symbol(inputParticipant.symbol());
|
||||
outPutData.info = inputParticipant.info;
|
||||
outPutData.name = inputParticipant.name;
|
||||
outPutData.designator = inputParticipant.designator;
|
||||
outPutData.tacticalIdentifier = inputParticipant.tacticalIdentifier;
|
||||
outPutData.symbol = inputParticipant.symbol;
|
||||
|
||||
outPutData.typeId(inputParticipant.typeId());
|
||||
outPutData.isSimulated(false);
|
||||
outPutData.typeId = inputParticipant.typeId;
|
||||
outPutData.isSimulated = false;
|
||||
|
||||
outPutData.modId(inputParticipant.templateId());
|
||||
outPutData.superiorModId(inputParticipant.superiorTemplateId());
|
||||
outPutData.hierarchyNumber(inputParticipant.hierarchyNumber());
|
||||
outPutData.modId = inputParticipant.templateId;
|
||||
outPutData.superiorModId = inputParticipant.superiorTemplateId;
|
||||
outPutData.hierarchyNumber = inputParticipant.hierarchyNumber;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParticipantPoolModel::isValidTypeClass(int typeId) const
|
||||
{
|
||||
const TypeClass tc = m_dtc->type(typeId).typeClass();
|
||||
switch (tc.underlying())
|
||||
const TypeClass tc = m_dtc->type(typeId).typeClass;
|
||||
switch (tc)
|
||||
{
|
||||
case TypeClass::Unit:
|
||||
return !m_asSupportService;
|
||||
@@ -387,7 +388,7 @@ bool ParticipantPoolModel::isValidTypeClass(int typeId) const
|
||||
|
||||
void ParticipantPoolModel::insertRow(const Participant &participant)
|
||||
{
|
||||
tryRenderSymbol(QString::fromStdString(participant.symbol()), participant.id());
|
||||
tryRenderSymbol(QString::fromStdString(participant.symbol), participant.id);
|
||||
|
||||
LtsWidgets::LtsAbstractTableModel<ParticipantManagement::ParticipantData>::insertRow(
|
||||
m_dtc->convertParticipantToParticipantData(participant));
|
||||
@@ -398,7 +399,7 @@ void ParticipantPoolModel::tryRemoveParticipantFromModel(int participantId)
|
||||
for (int i = 0; i < m_vecData.size(); ++i)
|
||||
{
|
||||
const ParticipantData &part = m_vecData.at(i);
|
||||
if (part.id() == participantId)
|
||||
if (part.id == participantId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Removing participant " << participantId;
|
||||
|
||||
|
||||
+1
@@ -14,6 +14,7 @@ ParticipantUnitNamer::ParticipantUnitNamer(const QString &designator, const QStr
|
||||
: LtsWidgets::LtsFramelessDialog(parent, LtsWidgets::Behaviour::Modal)
|
||||
, m_ui(new Ui::ParticipantUnitNamer)
|
||||
, m_validator(new QRegularExpressionValidator(QRegularExpression(QStringLiteral("[^,;\"'´`]*")), this))
|
||||
, m_logger(getLogger("ParticipantTemplateChooser"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
|
||||
+14
-13
@@ -28,6 +28,7 @@ TacticalOrganisation::TacticalOrganisation(LtsSession::LtsSession *session, QWid
|
||||
, m_tvContextMenu(nullptr)
|
||||
, m_newItemDlg(nullptr)
|
||||
, m_ui(new Ui::TacticalOrganisation)
|
||||
, m_logger(getLogger("TacticalOrganisation"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
connect(m_addEquipmentNumberAction, &QAction::triggered,
|
||||
@@ -116,14 +117,14 @@ void TacticalOrganisation::retranslate()
|
||||
bool TacticalOrganisation::apply()
|
||||
{
|
||||
ModifyParticipantDataRequest req;
|
||||
std::vector<ParticipantData> &dataToSend = req.data();
|
||||
std::vector<ParticipantData> &dataToSend = req.data;
|
||||
for (const ParticipantEditModel *model : std::as_const(m_participantModels))
|
||||
{
|
||||
const auto c = model->participantData();
|
||||
dataToSend.insert(dataToSend.end(), c.begin(), c.end());
|
||||
}
|
||||
|
||||
if (req.data().size() == 0)
|
||||
if (req.data.size() == 0)
|
||||
return true;
|
||||
|
||||
return m_requestHelper->startSingleRequest([this, req]()
|
||||
@@ -196,11 +197,11 @@ void TacticalOrganisation::onParticipantSelected(int participantId)
|
||||
return;
|
||||
|
||||
Participant participant = m_dtc->participant(participantId);
|
||||
if (participant.id() != participantId)
|
||||
if (participant.id != participantId)
|
||||
return;
|
||||
|
||||
ParticipantTreeFilterProxyModel *newModel = static_cast<ParticipantTreeFilterProxyModel *>(m_tvContextMenu->model());
|
||||
ParticipantEditModel *oldPem = editModelForParty(participant.partyId());
|
||||
ParticipantEditModel *oldPem = editModelForParty(participant.partyId);
|
||||
ParticipantEditModel *newPem = editModelForParty(newModel->partyId());
|
||||
|
||||
QModelIndex oldIdx = oldPem->indexFromParticipantId(participantId);
|
||||
@@ -348,18 +349,18 @@ void TacticalOrganisation::initLockedState()
|
||||
{
|
||||
Core::TryLockEntityRequest lockRequest;
|
||||
|
||||
lockRequest.id(0);
|
||||
lockRequest.entityTypeName(QString(QStringLiteral("PpmTacticalOrganisation")).toStdString());
|
||||
lockRequest.entityId(m_entityId);
|
||||
lockRequest.exerciseId(m_session->exerciseId());
|
||||
lockRequest.operatorId(LtsSessionData::LtsSessionData::getInstance()->getOperatorId());
|
||||
lockRequest.workstationId(LtsSessionData::LtsSessionData::getInstance()->getWorkstationId());
|
||||
lockRequest.id = 0;
|
||||
lockRequest.entityTypeName = QString(QStringLiteral("PpmTacticalOrganisation")).toStdString();
|
||||
lockRequest.entityId = m_entityId;
|
||||
lockRequest.exerciseId = m_session->exerciseId();
|
||||
lockRequest.operatorId = LtsSessionData::LtsSessionData::getInstance()->getOperatorId();
|
||||
lockRequest.workstationId = LtsSessionData::LtsSessionData::getInstance()->getWorkstationId();
|
||||
|
||||
Core::TryLockEntityReply lockReply = m_coreFtc->tryLockEntityRequest(lockRequest);
|
||||
|
||||
if (lockReply.alreadyLocked().is_set() && QString::fromStdString(lockReply.alreadyLocked().get().operatorName()) != LtsSessionData::LtsSessionData::getInstance()->getOperatorName())
|
||||
if (lockReply.alreadyLocked.has_value() && QString::fromStdString(lockReply.alreadyLocked.get().operatorName) != LtsSessionData::LtsSessionData::getInstance()->getOperatorName())
|
||||
{
|
||||
m_topicLockedBy = QString::fromStdString(lockReply.alreadyLocked().get().operatorName());
|
||||
m_topicLockedBy = QString::fromStdString(lockReply.alreadyLocked.get().operatorName);
|
||||
|
||||
setUnchangeable(true);
|
||||
retranslate();
|
||||
@@ -367,7 +368,7 @@ void TacticalOrganisation::initLockedState()
|
||||
return;
|
||||
}
|
||||
|
||||
m_unlockId = lockReply.id();
|
||||
m_unlockId = lockReply.id;
|
||||
}
|
||||
|
||||
void TacticalOrganisation::tableColumnOrganiserSetting()
|
||||
|
||||
+1
@@ -6,6 +6,7 @@
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <ParticipantManagement/logger.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_ftc.h>
|
||||
#include <ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
+37
-36
@@ -24,6 +24,7 @@ ParticipantBiteDialog::ParticipantBiteDialog(int ddsId, QWidget *parent)
|
||||
, m_ui(new Ui::ParticipantBiteDialog)
|
||||
, m_ccsMap()
|
||||
, m_bctMap()
|
||||
, m_logger(getLogger("ParticipantBiteDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
setUnchangeable();
|
||||
@@ -62,8 +63,8 @@ bool ParticipantBiteDialog::init(const std::shared_ptr<Interface::Dtc> &dtc,
|
||||
if (detailData.isEmpty())
|
||||
{
|
||||
Participant participant = m_dtc->participant(m_ddsId);
|
||||
if (participant.equipmentNumber().is_set())
|
||||
m_eqipNr = participant.equipmentNumber().get();
|
||||
if (participant.equipmentNumber.has_value())
|
||||
m_eqipNr = participant.equipmentNumber.get();
|
||||
|
||||
|
||||
connect(m_dtc.get(), &Interface::Dtc::biteChanged, this, &ParticipantBiteDialog::onBiteChanged);
|
||||
@@ -85,21 +86,21 @@ bool ParticipantBiteDialog::init(const std::shared_ptr<Interface::Dtc> &dtc,
|
||||
const QJsonArray biteErrors(detailData[QStringLiteral("BiteErrors")].toArray());
|
||||
|
||||
Bite bite;
|
||||
bite.batteryState(detailData[QStringLiteral("BatteryState")].toInt());
|
||||
bite.biteState(detailData[QStringLiteral("BiteState")].toInt());
|
||||
bite.configState(detailData[QStringLiteral("ConfigState")].toInt());
|
||||
bite.batteryState = detailData[QStringLiteral("BatteryState")].toInt();
|
||||
bite.biteState = detailData[QStringLiteral("BiteState")].toInt();
|
||||
bite.configState = detailData[QStringLiteral("ConfigState")].toInt();
|
||||
|
||||
BiteError biteError;
|
||||
bite.biteErrors().reserve(biteErrors.size());
|
||||
bite.biteErrors.reserve(biteErrors.size());
|
||||
for (const QJsonValue &biteErrorValue : biteErrors)
|
||||
{
|
||||
const QJsonObject biteErrorObject(biteErrorValue.toObject());
|
||||
biteError.errorNumber(biteErrorObject[QStringLiteral("ErrorNo")].toInt());
|
||||
biteError.canDeviceNumber(biteErrorObject[QStringLiteral("CanDeviceNumber")].toInt());
|
||||
biteError.subdeviceNumber(biteErrorObject[QStringLiteral("SubdeviceNumber")].toInt());
|
||||
biteError.uniqueId(biteErrorObject[QStringLiteral("UniqueId")].toInt());
|
||||
biteError.errorNumber = biteErrorObject[QStringLiteral("ErrorNo")].toInt();
|
||||
biteError.canDeviceNumber = biteErrorObject[QStringLiteral("CanDeviceNumber")].toInt();
|
||||
biteError.subdeviceNumber = biteErrorObject[QStringLiteral("SubdeviceNumber")].toInt();
|
||||
biteError.uniqueId = biteErrorObject[QStringLiteral("UniqueId")].toInt();
|
||||
|
||||
bite.biteErrors().push_back(biteError);
|
||||
bite.biteErrors.push_back(biteError);
|
||||
}
|
||||
onBiteChanged(bite);
|
||||
}
|
||||
@@ -116,9 +117,9 @@ int ParticipantBiteDialog::checkArguments(bool available, bool statusOk, qint64
|
||||
QString name;
|
||||
for (const ProjectDataManagement::CanComponentString &ccs : std::as_const(m_ccsMap))
|
||||
{
|
||||
if (ccs.bitMask() == bitValue)
|
||||
if (ccs.pdm_bitMask == bitValue)
|
||||
{
|
||||
name = m_pdmDtc->trCanComponentStringName(ccs.id());
|
||||
name = m_pdmDtc->trCanComponentStringName(ccs.id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -172,10 +173,10 @@ void ParticipantBiteDialog::addLabel(const QString &text, int row, int column, L
|
||||
|
||||
void ParticipantBiteDialog::onBiteChanged(const Bite &bite)
|
||||
{
|
||||
if (bite.equipmentNumber() != m_eqipNr && !m_fromDetailData)
|
||||
if (bite.equipmentNumber != m_eqipNr && !m_fromDetailData)
|
||||
return;
|
||||
|
||||
m_ui->lblLastChange->setText(DTG::toStringMSec(bite.sampleTime()));
|
||||
m_ui->lblLastChange->setText(DTG::toStringMSec(bite.sampleTime));
|
||||
delete m_ui->scrollAreaWidgetContents->layout();
|
||||
m_layout = new QGridLayout(m_ui->scrollAreaWidgetContents);
|
||||
|
||||
@@ -187,30 +188,30 @@ void ParticipantBiteDialog::onBiteChanged(const Bite &bite)
|
||||
for (int it = 0 ; it < 32; it++)
|
||||
{
|
||||
quint32 bitValue = 1U << it;
|
||||
row = checkArguments(((bite.biteState() & bitValue) == bitValue),
|
||||
((bite.configState() & bitValue) == bitValue), bitValue, row);
|
||||
row = checkArguments(((bite.biteState & bitValue) == bitValue),
|
||||
((bite.configState & bitValue) == bitValue), bitValue, row);
|
||||
}
|
||||
|
||||
row = checkArgument(bite.configError() != 0, tr("Configcheck error", "BITE CAN"), row);
|
||||
row = checkArgument(bite.configError != 0, tr("Configcheck error", "BITE CAN"), row);
|
||||
if (row > 0)
|
||||
m_layout->addItem(new QSpacerItem(10, 10, QSizePolicy::Fixed, QSizePolicy::Fixed), row++, 0);
|
||||
row = checkArgument(bite.batteryState() != 0, tr("Battery Warning", "BITE CAN"), row);
|
||||
row = checkArgument(bite.batteryState != 0, tr("Battery Warning", "BITE CAN"), row);
|
||||
m_layout->addItem(new QSpacerItem(10, 10, QSizePolicy::Fixed, QSizePolicy::Fixed), row++, 0);
|
||||
|
||||
for (const auto &bitEr : bite.biteErrors())
|
||||
for (const auto &bitEr : bite.biteErrors)
|
||||
{
|
||||
QLabel *labl = nullptr;
|
||||
if (bitEr.subdeviceNumber() != 0)
|
||||
if (bitEr.subdeviceNumber != 0)
|
||||
labl = new QLabel(tr("Error: %1 \nComponent: %2 \nSubdev: %3 \nUId: %4 ")
|
||||
.arg(getErrorString(bitEr),
|
||||
getCanDeviceName(bitEr.canDeviceNumber()),
|
||||
getSubDeviceName(bitEr.subdeviceNumber()))
|
||||
.arg(QString::number( bitEr.uniqueId(), 16 ).toUpper()));
|
||||
getCanDeviceName(bitEr.canDeviceNumber),
|
||||
getSubDeviceName(bitEr.subdeviceNumber))
|
||||
.arg(QString::number( bitEr.uniqueId, 16 ).toUpper()));
|
||||
|
||||
else if (bitEr.canDeviceNumber() != 0)
|
||||
else if (bitEr.canDeviceNumber != 0)
|
||||
labl = new QLabel(tr("Error: %1 \nComponent: %2")
|
||||
.arg(getErrorString(bitEr),
|
||||
getCanDeviceName(bitEr.canDeviceNumber())));
|
||||
getCanDeviceName(bitEr.canDeviceNumber)));
|
||||
|
||||
if (labl)
|
||||
{
|
||||
@@ -224,23 +225,23 @@ void ParticipantBiteDialog::onBiteChanged(const Bite &bite)
|
||||
|
||||
QString ParticipantBiteDialog::getErrorString(const ParticipantManagement::BiteError &error) const
|
||||
{
|
||||
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()))
|
||||
return m_pdmDtc->trBiteComponentTextName(bct.id());
|
||||
if (((subDevice && bct.subDeviceId == error.subdeviceNumber) ||
|
||||
(bct.canDeviceId == error.canDeviceNumber)) &&
|
||||
(bct.errorNumber == error.errorNumber))
|
||||
return m_pdmDtc->trBiteComponentTextName(bct.id);
|
||||
}
|
||||
return tr("Unknown (%1)").arg(error.errorNumber());
|
||||
return tr("Unknown (%1)").arg(error.errorNumber);
|
||||
}
|
||||
|
||||
QString ParticipantBiteDialog::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 (%1)").arg(id);
|
||||
}
|
||||
@@ -249,8 +250,8 @@ QString ParticipantBiteDialog::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 (%1)").arg(id);
|
||||
}
|
||||
|
||||
+1
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <ParticipantManagement/logger.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_ftc.h>
|
||||
|
||||
#include <ProjectDataManagement/pdm_data_plugin_interface.h>
|
||||
|
||||
+53
-52
@@ -33,6 +33,7 @@ ParticipantConfigDialog::ParticipantConfigDialog(int ddsId, DialogType type, QWi
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_ui(new Ui::ParticipantConfigDialog)
|
||||
, m_isTarget(false)
|
||||
, m_logger(getLogger("ParticipantConfigDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
connect(m_ui->cbStatus, &LtsWidgets::LtsComboBox::currentTextChanged, this, &ParticipantConfigDialog::onStateAreaChanged);
|
||||
@@ -85,7 +86,7 @@ ParticipantConfigDialog::ParticipantConfigDialog(int ddsId, DialogType type, QWi
|
||||
m_buttonBox->getButton(LtsWidgets::DialogButton::Apply)->setText(tr("Send"));
|
||||
m_ui->lblCharsLeft->setText(tr("Characters left: %1").arg(m_maxChars));
|
||||
QFontMetricsF fm(m_ui->lblCharsLeft->font());
|
||||
m_ui->lblCharsLeft->setFixedWidth(fm.width(m_ui->lblCharsLeft->text()));
|
||||
m_ui->lblCharsLeft->setFixedWidth(fm.horizontalAdvance(m_ui->lblCharsLeft->text()));
|
||||
|
||||
const bool bEnableProtectionLevel = LtsUtils::ProjectSettings::isFunctionEnabled(QStringLiteral("ParticipantStatus"),
|
||||
QStringLiteral("ProtectionLevel"));
|
||||
@@ -203,11 +204,11 @@ bool ParticipantConfigDialog::init(LtsSession::LtsSession *session,
|
||||
if (m_ddsId > 0)
|
||||
{
|
||||
const Participant participant = m_dtc->participant(m_ddsId);
|
||||
if (participant.equipmentNumber().is_set())
|
||||
m_eqId = participant.equipmentNumber().get();
|
||||
if (participant.equipmentNumber.has_value())
|
||||
m_eqId = participant.equipmentNumber.get();
|
||||
if (!m_eqId && (m_dialogType == Config || m_dialogType == Message))
|
||||
return false;
|
||||
m_typeClass = m_dtc->type(participant.typeId()).typeClass();
|
||||
m_typeClass = m_dtc->type(participant.typeId).typeClass;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -238,7 +239,7 @@ bool ParticipantConfigDialog::init(LtsSession::LtsSession *session,
|
||||
m_maxChars = 16;
|
||||
m_ui->lblCharsLeft->setText(tr("Characters left: %1").arg(m_maxChars));
|
||||
QFontMetricsF fm(m_ui->lblCharsLeft->font());
|
||||
m_ui->lblCharsLeft->setFixedWidth(fm.width(m_ui->lblCharsLeft->text()));
|
||||
m_ui->lblCharsLeft->setFixedWidth(fm.horizontalAdvance(m_ui->lblCharsLeft->text()));
|
||||
}
|
||||
|
||||
if (m_dialogType == MessageMulti)
|
||||
@@ -246,7 +247,7 @@ bool ParticipantConfigDialog::init(LtsSession::LtsSession *session,
|
||||
m_maxChars = 16;
|
||||
m_ui->lblCharsLeft->setText(tr("Characters left: %1").arg(m_maxChars));
|
||||
QFontMetricsF fm(m_ui->lblCharsLeft->font());
|
||||
m_ui->lblCharsLeft->setFixedWidth(fm.width(m_ui->lblCharsLeft->text()));
|
||||
m_ui->lblCharsLeft->setFixedWidth(fm.horizontalAdvance(m_ui->lblCharsLeft->text()));
|
||||
}
|
||||
|
||||
m_modeChanged = false;
|
||||
@@ -278,12 +279,12 @@ bool ParticipantConfigDialog::init(LtsSession::LtsSession *session,
|
||||
|
||||
{
|
||||
const Participant participant = m_dtc->participant(m_ddsId);
|
||||
if (participant.equipmentNumber().is_set())
|
||||
if (participant.equipmentNumber.has_value())
|
||||
{
|
||||
const Type type = m_dtc->type(participant.typeId());
|
||||
const EquipmentType eqType = m_dtc->equipmentType(type.equipmentTypeId());
|
||||
if (eqType.wmsTypeClass() == WmsTypeClass::TargetHuman ||
|
||||
eqType.wmsTypeClass() == WmsTypeClass::TargetVehicle)
|
||||
const Type type = m_dtc->type(participant.typeId);
|
||||
const EquipmentType eqType = m_dtc->equipmentType(type.equipmentTypeId);
|
||||
if (eqType.wmsTypeClass == WmsTypeClass::TargetHuman ||
|
||||
eqType.wmsTypeClass == WmsTypeClass::TargetVehicle)
|
||||
{
|
||||
NOTICE_LOG(m_logger) << "isTarget = true";
|
||||
m_ui->gbMode->setHidden(true);
|
||||
@@ -292,7 +293,7 @@ bool ParticipantConfigDialog::init(LtsSession::LtsSession *session,
|
||||
}
|
||||
}
|
||||
|
||||
if (m_dtc->isTypeUas(participant.typeId()) && m_ddsId > 0)
|
||||
if (m_dtc->isTypeUas(participant.typeId) && m_ddsId > 0)
|
||||
{
|
||||
m_ui->cbResetManipulation->hide();
|
||||
m_ui->cbResetGearCharge->hide();
|
||||
@@ -348,7 +349,7 @@ void ParticipantConfigDialog::onSelectionChanged()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "setChildrenSelected row =" << index.row() << " column=" << index.column();
|
||||
ParticipantManagement::ParticipantData data = m_model->getParticipantData(index);
|
||||
TypeClass tc = m_dtc->type(data.typeId()).typeClass();
|
||||
TypeClass tc = m_dtc->type(data.typeId).typeClass;
|
||||
if (tc != TypeClass::Human && tc != TypeClass::Unit)
|
||||
{
|
||||
|
||||
@@ -381,8 +382,8 @@ void ParticipantConfigDialog::fillCbx()
|
||||
m_ui->cbStatus->addItem(tr("No Change"), -1);
|
||||
if ( m_isTarget)
|
||||
{
|
||||
m_ui->cbStatus->addItem(tr("CombatReady"), ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady);
|
||||
m_ui->cbStatus->addItem(tr("Catastrophic Kill / Killed"), ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill);
|
||||
m_ui->cbStatus->addItem(tr("CombatReady"), static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady));
|
||||
m_ui->cbStatus->addItem(tr("Catastrophic Kill / Killed"), static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill));
|
||||
}
|
||||
else
|
||||
insertVulnerabilityStates(m_ui->cbStatus, m_typeClass);
|
||||
@@ -424,7 +425,7 @@ void ParticipantConfigDialog::fillVitalityCbx()
|
||||
return;
|
||||
|
||||
bool setEnabled = false;
|
||||
if (m_dialogType == Config && m_dtc->type(m_dtc->participant(m_ddsId).typeId()).typeClass() == TypeClass::Human)
|
||||
if (m_dialogType == Config && m_dtc->type(m_dtc->participant(m_ddsId).typeId).typeClass == TypeClass::Human)
|
||||
setEnabled = true;
|
||||
switch (m_ui->cbStatus->currentData().toInt())
|
||||
{
|
||||
@@ -433,25 +434,25 @@ void ParticipantConfigDialog::fillVitalityCbx()
|
||||
m_ui->cbVitality->setEnabled(false);
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_LightDamage:
|
||||
case static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_LightDamage):
|
||||
{
|
||||
for (int i = 90 ; i >= 70; i -= 10)
|
||||
m_ui->cbVitality->addItem(QString::number(i), i);
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_MediumDamage:
|
||||
case static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_MediumDamage):
|
||||
{
|
||||
for (int i = 60 ; i >= 40; i -= 10)
|
||||
m_ui->cbVitality->addItem(QString::number(i), i);
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_HeavyDamage:
|
||||
case static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_HeavyDamage):
|
||||
{
|
||||
for (int i = 30 ; i >= 10; i -= 10)
|
||||
m_ui->cbVitality->addItem(QString::number(i), i);
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady:
|
||||
case static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady):
|
||||
{
|
||||
m_ui->cbVitality->removeItem(0);
|
||||
m_ui->cbVitality->addItem(QString::number(100), 100);
|
||||
@@ -501,29 +502,29 @@ void ParticipantConfigDialog::fillCbxWithActualValue()
|
||||
int partId = m_dtc->participantIdByEquipmentNumber(m_eqId);
|
||||
|
||||
ParticipantManagement::ParticipantMode mode = m_dtc->participantMode(partId);
|
||||
m_ui->cbHelmet->setCurrentIndex(m_ui->cbHelmet->findData(mode.modeHelmet().underlying()));
|
||||
m_ui->cbLanguage->setCurrentIndex(m_ui->cbLanguage->findData(mode.language().underlying()));
|
||||
m_ui->cbPersonalProtection->setCurrentIndex(m_ui->cbPersonalProtection->findData(mode.modePersonalProtection().underlying()));
|
||||
m_ui->cbProtectionLevel->setCurrentIndex(m_ui->cbProtectionLevel->findData(mode.protectionLevel().underlying()));
|
||||
m_ui->cbGrenadeSearchMode->setCurrentIndex(m_ui->cbGrenadeSearchMode->findData(mode.handgrenadeSearchMode().underlying()));
|
||||
m_ui->cbInternationalMode->setCurrentIndex(m_ui->cbInternationalMode->findData(mode.internationalMode().underlying()));
|
||||
m_ui->cbABCProtectionMode->setCurrentIndex(m_ui->cbABCProtectionMode->findData(mode.abcProtectionMode().underlying()));
|
||||
m_ui->cbVest->setCurrentIndex(m_ui->cbVest->findData(mode.modeVest().underlying()));
|
||||
m_ui->cbHelmet->setCurrentIndex(m_ui->cbHelmet->findData(static_cast<int>(mode.modeHelmet)));
|
||||
m_ui->cbLanguage->setCurrentIndex(m_ui->cbLanguage->findData(static_cast<int>(mode.language)));
|
||||
m_ui->cbPersonalProtection->setCurrentIndex(m_ui->cbPersonalProtection->findData(static_cast<int>(mode.modePersonalProtection)));
|
||||
m_ui->cbProtectionLevel->setCurrentIndex(m_ui->cbProtectionLevel->findData(static_cast<int>(mode.protectionLevel)));
|
||||
m_ui->cbGrenadeSearchMode->setCurrentIndex(m_ui->cbGrenadeSearchMode->findData(static_cast<int>(mode.handgrenadeSearchMode)));
|
||||
m_ui->cbInternationalMode->setCurrentIndex(m_ui->cbInternationalMode->findData(static_cast<int>(mode.internationalMode)));
|
||||
m_ui->cbABCProtectionMode->setCurrentIndex(m_ui->cbABCProtectionMode->findData(static_cast<int>(mode.abcProtectionMode)));
|
||||
m_ui->cbVest->setCurrentIndex(m_ui->cbVest->findData(static_cast<int>(mode.modeVest)));
|
||||
m_modeChanged = false;
|
||||
|
||||
m_ui->cbStatus->setCurrentIndex(0);
|
||||
m_ui->cbVitality->setCurrentIndex(0);
|
||||
|
||||
std::vector< ParticipantManagement::StateInformation> stateHistory = m_dtc->dynamicParticipantData(partId).stateHistory();
|
||||
std::vector< ParticipantManagement::StateInformation> stateHistory = m_dtc->dynamicParticipantData(partId).stateHistory;
|
||||
if (stateHistory.size() > 0)
|
||||
{
|
||||
auto stateInfo = m_dtc->youngestStateInformation(stateHistory);
|
||||
|
||||
int statusIndex = m_ui->cbStatus->findData(stateInfo.vulnerabilityState().underlying());
|
||||
int statusIndex = m_ui->cbStatus->findData(static_cast<int>(stateInfo.vulnerabilityState));
|
||||
if(statusIndex != -1)
|
||||
m_ui->cbStatus->setCurrentIndex(statusIndex);
|
||||
|
||||
int vitalityIndex = m_ui->cbVitality->findData(stateInfo.vitality());
|
||||
int vitalityIndex = m_ui->cbVitality->findData(stateInfo.vitality);
|
||||
if(vitalityIndex != -1)
|
||||
m_ui->cbVitality->setCurrentIndex(vitalityIndex);
|
||||
|
||||
@@ -578,8 +579,8 @@ bool ParticipantConfigDialog::apply()
|
||||
{
|
||||
OcCommandRequest req;
|
||||
|
||||
req.action(m_ui->cbStatus->currentData().toInt() - 100);
|
||||
req.participantIds(participantIds);
|
||||
req.action = m_ui->cbStatus->currentData().toInt() - 100;
|
||||
req.participantIds = participantIds;
|
||||
|
||||
m_ftc->ocCommandRequest(req);
|
||||
}
|
||||
@@ -592,12 +593,12 @@ bool ParticipantConfigDialog::apply()
|
||||
m_ui->cbResetManipulation->isChecked())
|
||||
{
|
||||
InitParticipantRequest req;
|
||||
req.workstationId(LtsSessionData::LtsSessionData::getInstance()->getWorkstationId());
|
||||
req.restockCharges(m_ui->cbResetGearCharge->isChecked());
|
||||
req.resetManipulation(m_ui->cbResetManipulation->isChecked());
|
||||
req.resetVulnerabilityState(state == ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady);
|
||||
req.restockSanitationMaterial(m_ui->cbResetMedSupplies->isChecked());
|
||||
req.participantIds(participantIds);
|
||||
req.workstationId = LtsSessionData::LtsSessionData::getInstance()->getWorkstationId();
|
||||
req.restockCharges = m_ui->cbResetGearCharge->isChecked();
|
||||
req.resetManipulation = m_ui->cbResetManipulation->isChecked();
|
||||
req.resetVulnerabilityState = state == ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady;
|
||||
req.restockSanitationMaterial = m_ui->cbResetMedSupplies->isChecked();
|
||||
req.participantIds = participantIds;
|
||||
m_requestHelper->addRequest([req, this]()
|
||||
{
|
||||
return m_ftc->initParticipantRequest(req, this);
|
||||
@@ -609,12 +610,12 @@ bool ParticipantConfigDialog::apply()
|
||||
if (m_ui->cbStatus->currentData().toInt() != -1 || m_ui->cbVitality->currentData().toInt() != 0)
|
||||
{
|
||||
ModifyStateRequest req;
|
||||
req.workstationId(LtsSessionData::LtsSessionData::getInstance()->getWorkstationId());
|
||||
req.vulnerabilityState(state == ProjectDataManagement::VulnerabilityState::VulnerabilityState_NoChange ? ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady : state);
|
||||
req.participantIds(participantIds);
|
||||
req.vitality(m_ui->cbVitality->currentData().toInt());
|
||||
if(req.vitality() > 0)
|
||||
req.vulnerabilityKind(2048);
|
||||
req.workstationId = LtsSessionData::LtsSessionData::getInstance()->getWorkstationId();
|
||||
req.vulnerabilityState = state == ProjectDataManagement::VulnerabilityState::VulnerabilityState_NoChange ? ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady : state;
|
||||
req.participantIds = participantIds;
|
||||
req.vitality = m_ui->cbVitality->currentData().toInt();
|
||||
if(req.vitality > 0)
|
||||
req.vulnerabilityKind = 2048;
|
||||
m_requestHelper->addRequest([req, this]()
|
||||
{
|
||||
return m_ftc->modifyStateRequest(req, this);
|
||||
@@ -639,7 +640,7 @@ bool ParticipantConfigDialog::apply()
|
||||
}
|
||||
else
|
||||
{
|
||||
grenadeSearch = ProjectDataManagement::HandgrenadeSearchMode::NoChange;
|
||||
grenadeSearch = ProjectDataManagement::HandgrenadeSearchMode::HandgrenadeSearchMode_NoChange;
|
||||
}
|
||||
|
||||
ProjectDataManagement::InternationalMode internationalMode = static_cast<ProjectDataManagement::InternationalMode>(m_ui->cbInternationalMode->currentData().toInt());
|
||||
@@ -667,11 +668,11 @@ bool ParticipantConfigDialog::apply()
|
||||
if(participantId != 0)
|
||||
{
|
||||
auto data = m_dtc->participant(participantId);
|
||||
TypeClass tc = m_dtc->type(data.typeId()).typeClass();
|
||||
TypeClass tc = m_dtc->type(data.typeId).typeClass;
|
||||
if (tc != TypeClass::Human)
|
||||
continue;
|
||||
}
|
||||
req.participantId(participantId);
|
||||
req.participantId = participantId;
|
||||
m_requestHelper->addRequest([req, this]()
|
||||
{
|
||||
return m_ftc->setParticipantModeRequest(req, this);
|
||||
@@ -686,8 +687,8 @@ bool ParticipantConfigDialog::apply()
|
||||
case MessageMulti:
|
||||
{
|
||||
SendMessageRequest req;
|
||||
req.message(m_ui->teMail->toPlainText().toStdString());
|
||||
req.participantIds(participantIds);
|
||||
req.message = m_ui->teMail->toPlainText().toStdString();
|
||||
req.participantIds = participantIds;
|
||||
m_requestHelper->addRequest([req, this]()
|
||||
{
|
||||
return m_ftc->sendMessageRequest(req, this);
|
||||
@@ -793,8 +794,8 @@ QVector<int> ParticipantConfigDialog::getParticipantIds(const QModelIndex &paren
|
||||
QVector<int> ret;
|
||||
|
||||
const ParticipantManagement::ParticipantData dataParent(m_model->getParticipantData(parent));
|
||||
if (dataParent.equipmentNumber().is_set())
|
||||
ret.append(dataParent.id());
|
||||
if (dataParent.equipmentNumber.has_value())
|
||||
ret.append(dataParent.id);
|
||||
|
||||
|
||||
|
||||
|
||||
+1
@@ -19,6 +19,7 @@
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_ftc.h>
|
||||
#include <ProjectDataManagement/pdm_gui_plugin_interface.h>
|
||||
#include <ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
|
||||
|
||||
+156
-155
@@ -23,7 +23,7 @@ namespace core
|
||||
{
|
||||
static inline uint qHash(const ParticipantManagement::TypeClass &tc)
|
||||
{
|
||||
return ::qHash(tc.underlying());
|
||||
return ::qHash(tc);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,23 +39,23 @@ static QVariant participantToQVariant(const ParticipantData &pd)
|
||||
{
|
||||
QByteArray ba;
|
||||
QDataStream ds(&ba, QIODevice::WriteOnly);
|
||||
ds << pd.id()
|
||||
<< pd.partyId()
|
||||
<< pd.hierarchyNumber()
|
||||
<< (pd.equipmentNumber().is_set() ? pd.equipmentNumber().get() : -1)
|
||||
<< pd.typeId()
|
||||
<< pd.externalId()
|
||||
<< QString::fromStdString(pd.symbol())
|
||||
<< QString::fromStdString(pd.name())
|
||||
<< QString::fromStdString(pd.identification())
|
||||
<< QString::fromStdString(pd.designator())
|
||||
<< QString::fromStdString(pd.tacticalIdentifier())
|
||||
<< QString::fromStdString(pd.info())
|
||||
<< pd.assignState().underlying()
|
||||
<< pd.isSimulated()
|
||||
<< pd.isDeleted()
|
||||
<< pd.modId()
|
||||
<< pd.superiorModId();
|
||||
ds << pd.id
|
||||
<< pd.partyId
|
||||
<< pd.hierarchyNumber
|
||||
<< (pd.equipmentNumber.has_value() ? pd.equipmentNumber.get() : -1)
|
||||
<< pd.typeId
|
||||
<< static_cast<long long>(pd.externalId)
|
||||
<< QString::fromStdString(pd.symbol)
|
||||
<< QString::fromStdString(pd.name)
|
||||
<< QString::fromStdString(pd.identification)
|
||||
<< QString::fromStdString(pd.designator)
|
||||
<< QString::fromStdString(pd.tacticalIdentifier)
|
||||
<< QString::fromStdString(pd.info)
|
||||
<< pd.assignState
|
||||
<< pd.isSimulated
|
||||
<< pd.isDeleted
|
||||
<< pd.modId
|
||||
<< pd.superiorModId;
|
||||
|
||||
return ba;
|
||||
}
|
||||
@@ -87,24 +87,24 @@ static ParticipantData qVariantToParticipant(const QVariant &data)
|
||||
>> modId
|
||||
>> superiorModId;
|
||||
|
||||
pd.id(id);
|
||||
pd.partyId(partyId);
|
||||
pd.hierarchyNumber(hierarchyNumber);
|
||||
pd.id = id;
|
||||
pd.partyId = partyId;
|
||||
pd.hierarchyNumber = hierarchyNumber;
|
||||
if (equipmentNumber >= 0)
|
||||
pd.equipmentNumber(equipmentNumber);
|
||||
pd.typeId(typeId);
|
||||
pd.externalId(externalId);
|
||||
pd.symbol(symbol.toStdString());
|
||||
pd.name(name.toStdString());
|
||||
pd.identification(identification.toStdString());
|
||||
pd.designator(designator.toStdString());
|
||||
pd.tacticalIdentifier(tacticalIdentifier.toStdString());
|
||||
pd.info(info.toStdString());
|
||||
pd.assignState(static_cast<ParticipantManagement::ParticipantAssignState>(assignState));
|
||||
pd.isSimulated(isSimulated);
|
||||
pd.isDeleted(isDeleted);
|
||||
pd.modId(modId);
|
||||
pd.superiorModId(superiorModId);
|
||||
pd.equipmentNumber = equipmentNumber;
|
||||
pd.typeId = typeId;
|
||||
pd.externalId = externalId;
|
||||
pd.symbol = symbol.toStdString();
|
||||
pd.name = name.toStdString();
|
||||
pd.identification = identification.toStdString();
|
||||
pd.designator = designator.toStdString();
|
||||
pd.tacticalIdentifier = tacticalIdentifier.toStdString();
|
||||
pd.info = info.toStdString();
|
||||
pd.assignState = static_cast<ParticipantManagement::ParticipantAssignState>(assignState);
|
||||
pd.isSimulated = isSimulated;
|
||||
pd.isDeleted = isDeleted;
|
||||
pd.modId = modId;
|
||||
pd.superiorModId = superiorModId;
|
||||
|
||||
return pd;
|
||||
}
|
||||
@@ -123,7 +123,7 @@ bool compareStrings(const std::string &s1, const std::string &s2,
|
||||
{
|
||||
const int iRet = strcmp(s1.c_str(), s2.c_str());
|
||||
if (iRet == 0)
|
||||
return p1->participant.hierarchyNumber() < p2->participant.hierarchyNumber();
|
||||
return p1->participant.hierarchyNumber < p2->participant.hierarchyNumber;
|
||||
return iRet < 0;
|
||||
}
|
||||
|
||||
@@ -151,6 +151,7 @@ ParticipantConfigModel::ParticipantConfigModel(QObject *parent,
|
||||
parent,
|
||||
getLogger("ParticipantConfigModel")
|
||||
)
|
||||
, m_logger(getLogger("ParticipantConfigModel"))
|
||||
, m_partyId(-1)
|
||||
, m_bRowsAreCheckable(false)
|
||||
, m_bUnitsSelectable(true)
|
||||
@@ -178,7 +179,7 @@ Qt::ItemFlags ParticipantConfigModel::flags(const QModelIndex &index) const
|
||||
ret |= Qt::ItemIsUserCheckable;
|
||||
|
||||
|
||||
if (!m_bUnitsSelectable && isUnitType(privateData(index)->participant.typeId()))
|
||||
if (!m_bUnitsSelectable && isUnitType(privateData(index)->participant.typeId))
|
||||
ret &= ~Qt::ItemIsSelectable;
|
||||
|
||||
if (index.column() != 0 || !index.parent().isValid())
|
||||
@@ -204,7 +205,7 @@ QVariant ParticipantConfigModel::headerData(int section, Qt::Orientation orienta
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -212,7 +213,7 @@ QVariant ParticipantConfigModel::headerData(int section, Qt::Orientation orienta
|
||||
{
|
||||
for (const auto &typeClassId : m_usedTypeClassIds)
|
||||
{
|
||||
cfd.data = typeClassId.underlying();
|
||||
cfd.data = static_cast<int>(typeClassId);
|
||||
cfd.text = ParticipantManagement::toString(typeClassId);
|
||||
cfc.data.push_back(cfd);
|
||||
}
|
||||
@@ -266,47 +267,47 @@ QVariant ParticipantConfigModel::data(const QModelIndex &index, int role) const
|
||||
switch (index.column())
|
||||
{
|
||||
case ColDesignator:
|
||||
return QString::fromStdString(participantData.designator());
|
||||
return QString::fromStdString(participantData.designator);
|
||||
|
||||
case ColIdentifier:
|
||||
return QString::fromStdString(participantData.tacticalIdentifier());
|
||||
return QString::fromStdString(participantData.tacticalIdentifier);
|
||||
|
||||
case ColTypeClass:
|
||||
return typeClassStringFromTypeId(participantData.typeId());
|
||||
return typeClassStringFromTypeId(participantData.typeId);
|
||||
|
||||
case ColType:
|
||||
return ParticipantManagement::trTypeName(m_types.value(participantData.typeId()).name());
|
||||
return ParticipantManagement::trTypeName(m_types.value(participantData.typeId).name);
|
||||
|
||||
case ColEquipmentNumber:
|
||||
if (!participantData.equipmentNumber().is_set())
|
||||
if (!participantData.equipmentNumber.has_value())
|
||||
{
|
||||
if (participantData.assignState() == ParticipantAssignState::HandoutExcon)
|
||||
if (participantData.assignState == ParticipantAssignState::HandoutExcon)
|
||||
return 0;
|
||||
return QVariant();
|
||||
}
|
||||
if (participantData.assignState() == ParticipantAssignState::ExconWmsOverruled)
|
||||
return tr("%1 (+)").arg(participantData.equipmentNumber().get());
|
||||
if (participantData.externalId() > 0)
|
||||
return tr("%1 (external)").arg(participantData.equipmentNumber().get());
|
||||
return participantData.equipmentNumber().get();
|
||||
if (participantData.assignState == ParticipantAssignState::ExconWmsOverruled)
|
||||
return tr("%1 (+)").arg(participantData.equipmentNumber.get());
|
||||
if (participantData.externalId > 0)
|
||||
return tr("%1 (external)").arg(participantData.equipmentNumber.get());
|
||||
return participantData.equipmentNumber.get();
|
||||
|
||||
case ColInfo:
|
||||
return QString::fromStdString(participantData.info());
|
||||
return QString::fromStdString(participantData.info);
|
||||
|
||||
case ColSign:
|
||||
return QString::fromStdString(participantData.identification());
|
||||
return QString::fromStdString(participantData.identification);
|
||||
|
||||
|
||||
case ColProtection:
|
||||
if (participantData.equipmentNumber().is_set() && m_dtc->type(participantData.typeId()).typeClass() == TypeClass::Human)
|
||||
if (participantData.equipmentNumber.has_value() && m_dtc->type(participantData.typeId).typeClass == TypeClass::Human)
|
||||
{
|
||||
return buildProtectionString(m_dtc->participantMode(participantData.id()));
|
||||
return buildProtectionString(m_dtc->participantMode(participantData.id));
|
||||
}
|
||||
else return QVariant();
|
||||
case ColInternationalMode:
|
||||
if (participantData.equipmentNumber().is_set() && m_dtc->type(participantData.typeId()).typeClass() == TypeClass::Human)
|
||||
if (participantData.equipmentNumber.has_value() && m_dtc->type(participantData.typeId).typeClass == TypeClass::Human)
|
||||
{
|
||||
return buildInternationalModeString(m_dtc->participantMode(participantData.id()).internationalMode());
|
||||
return buildInternationalModeString(m_dtc->participantMode(participantData.id).internationalMode);
|
||||
}
|
||||
else
|
||||
return QVariant();
|
||||
@@ -322,9 +323,9 @@ QVariant ParticipantConfigModel::data(const QModelIndex &index, int role) const
|
||||
|
||||
case LtsWidgets::LtsColumnFilterProxyModel::ComboboxFilterRole:
|
||||
if (index.column() == ColTypeClass)
|
||||
return typeClassIdFromTypeId(participantData.typeId()).underlying();
|
||||
return static_cast<int>(typeClassIdFromTypeId(participantData.typeId));
|
||||
if (index.column() == ColType)
|
||||
return participantData.typeId();
|
||||
return participantData.typeId;
|
||||
return QVariant();
|
||||
|
||||
default:
|
||||
@@ -367,7 +368,7 @@ bool ParticipantConfigModel::canDropMimeData(const QMimeData *data,
|
||||
return false;
|
||||
|
||||
const CheckedTreeItem *parentItem = privateData(parent);
|
||||
if (!isUnitType(parentItem->participant.typeId()))
|
||||
if (!isUnitType(parentItem->participant.typeId))
|
||||
return false;
|
||||
|
||||
DEBUG_LOG(m_logger) << "can drop on " << row << ", " << column << ", parent: "
|
||||
@@ -385,7 +386,7 @@ bool ParticipantConfigModel::canDropMimeData(const QMimeData *data,
|
||||
const ParticipantData pdSource = static_cast<CheckedTreeItem *>(tiSources.first())->participant;
|
||||
qDeleteAll(tiSources);
|
||||
|
||||
TypeClass dataTypeClass = typeClassIdFromTypeId(pdSource.typeId());
|
||||
TypeClass dataTypeClass = typeClassIdFromTypeId(pdSource.typeId);
|
||||
bool isDataTypeClassSupport = dataTypeClass == TypeClass::SupportEntity || dataTypeClass == TypeClass::SupportUnit;
|
||||
bool isOwnTypeClassSupport = m_partyId == 1;
|
||||
|
||||
@@ -393,9 +394,9 @@ bool ParticipantConfigModel::canDropMimeData(const QMimeData *data,
|
||||
return false;
|
||||
|
||||
|
||||
if (pdSource.partyId() == parentItem->participant.partyId())
|
||||
if (pdSource.partyId == parentItem->participant.partyId)
|
||||
{
|
||||
const int idSource = pdSource.id();
|
||||
const int idSource = pdSource.id;
|
||||
|
||||
if (idSource != 0 && isParentOf(parentItem, idSource))
|
||||
{
|
||||
@@ -425,7 +426,7 @@ bool ParticipantConfigModel::dropMimeData(const QMimeData *data, Qt::DropAction
|
||||
{
|
||||
CheckedTreeItem *child = static_cast<CheckedTreeItem *>(cti->child(r));
|
||||
|
||||
child->participant.hierarchyNumber(r + 1);
|
||||
child->participant.hierarchyNumber = r + 1;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -442,8 +443,8 @@ bool ParticipantConfigModel::onReinitModel(int partyId, const QSet<int> &checked
|
||||
m_partyId = partyId;
|
||||
|
||||
const ParticipantManagement::Party &party = m_dtc->party(m_partyId);
|
||||
m_partyRole = AdvancedSymbology::roleToRole<>(party.role());
|
||||
m_partyColor = QColor::fromRgb(QRgb(party.color()));
|
||||
m_partyRole = AdvancedSymbology::roleToRole<>(party.role);
|
||||
m_partyColor = QColor::fromRgb(QRgb(party.color));
|
||||
|
||||
ParticipantIconModelBase::resetModel();
|
||||
|
||||
@@ -475,7 +476,7 @@ bool ParticipantConfigModel::isRowRemovable(const CheckedTreeItem *parentItem) c
|
||||
if (!parentItem)
|
||||
return false;
|
||||
const ParticipantManagement::ParticipantData &participantData = parentItem->participant;
|
||||
if (participantData.equipmentNumber().is_set() && participantData.equipmentNumber().get() > 0)
|
||||
if (participantData.equipmentNumber.has_value() && participantData.equipmentNumber.get() > 0)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < parentItem->childCount(); i++)
|
||||
@@ -521,7 +522,7 @@ void ParticipantConfigModel::processMissingSuperiorId()
|
||||
if (!tmap.contains(id))
|
||||
continue;
|
||||
const ParticipantManagement::Participant &participant = m_dtc->participant(id);
|
||||
if (participant.id() != id)
|
||||
if (participant.id != id)
|
||||
continue;
|
||||
onParticipantChanged(participant, DataModification::eModified);
|
||||
|
||||
@@ -532,7 +533,7 @@ void ParticipantConfigModel::processMissingSuperiorId()
|
||||
for (int childId : std::as_const(childIds))
|
||||
{
|
||||
const ParticipantManagement::Participant &p = m_dtc->participant(childId);
|
||||
if (p.id() != childId)
|
||||
if (p.id != childId)
|
||||
continue;
|
||||
onParticipantChanged(p, DataModification::eModified);
|
||||
}
|
||||
@@ -550,7 +551,7 @@ void ParticipantConfigModel::selectItemByParticipantId(int participantId, const
|
||||
const ParticipantManagement::ParticipantData &data = privateData(idx)->participant;
|
||||
if (hasChildren(idx))
|
||||
selectItemByParticipantId(participantId, selectItem, idx);
|
||||
if (data.id() == participantId)
|
||||
if (data.id == participantId)
|
||||
return selectItem(idx);
|
||||
}
|
||||
return;
|
||||
@@ -567,7 +568,7 @@ QModelIndexList ParticipantConfigModel::getIndexesByParticipantIds(const std::ve
|
||||
if (hasChildren(idx))
|
||||
indexes += getIndexesByParticipantIds(participantIds, idx);
|
||||
|
||||
auto it = std::find(participantIds.begin(), participantIds.end(), data.id());
|
||||
auto it = std::find(participantIds.begin(), participantIds.end(), data.id);
|
||||
if (it != participantIds.end())
|
||||
indexes.append(idx);
|
||||
}
|
||||
@@ -653,7 +654,7 @@ QString ParticipantConfigModel::getHierarchyFromIndex(const QModelIndex &index)
|
||||
if (!index.isValid())
|
||||
return QString();
|
||||
const ParticipantManagement::ParticipantData &participantData = privateData(index)->participant;
|
||||
return m_dtc->hierarchyFromParticipant(participantData.id());
|
||||
return m_dtc->hierarchyFromParticipant(participantData.id);
|
||||
}
|
||||
|
||||
|
||||
@@ -664,16 +665,16 @@ void ParticipantConfigModel::gatherParticipants(QHash<int, ParticipantData> &tma
|
||||
{
|
||||
auto cb = [this, &tmap, &parentId2id](const Participant & part)
|
||||
{
|
||||
if (part.isDeleted())
|
||||
if (part.isDeleted)
|
||||
return;
|
||||
|
||||
if (part.partyId() != m_partyId)
|
||||
if (part.partyId != m_partyId)
|
||||
return;
|
||||
|
||||
|
||||
parentId2id[part.superiorId()] += part.id();
|
||||
parentId2id[part.superiorId] += part.id;
|
||||
|
||||
tmap.insert(part.id(), m_dtc->convertParticipantToParticipantData(part));
|
||||
tmap.insert(part.id, m_dtc->convertParticipantToParticipantData(part));
|
||||
};
|
||||
m_dtc->participants(cb);
|
||||
}
|
||||
@@ -687,16 +688,16 @@ std::vector<ParticipantData> ParticipantConfigModel::getChildrenOf(NGLTreeItem *
|
||||
std::vector<ParticipantData> ret;
|
||||
const CheckedTreeItem *cti = static_cast<CheckedTreeItem *>(item);
|
||||
ParticipantManagement::ParticipantData participantData = cti->participant;
|
||||
participantData.superiorModId(parentId);
|
||||
participantData.hierarchyNumber(hierarchyNumber);
|
||||
participantData.partyId(m_partyId);
|
||||
if (participantData.modId() == 0)
|
||||
participantData.modId(++highestModId);
|
||||
participantData.superiorModId = parentId;
|
||||
participantData.hierarchyNumber = hierarchyNumber;
|
||||
participantData.partyId = m_partyId;
|
||||
if (participantData.modId == 0)
|
||||
participantData.modId = ++highestModId;
|
||||
|
||||
|
||||
for (int i = 0; i < item->childCount(); i++)
|
||||
{
|
||||
const auto c = getChildrenOf(item->child(i), participantData.modId(), i + 1, bOnlyModifed, highestModId);
|
||||
const auto c = getChildrenOf(item->child(i), participantData.modId, i + 1, bOnlyModifed, highestModId);
|
||||
ret.insert(ret.end(), c.begin(), c.end());
|
||||
}
|
||||
|
||||
@@ -717,28 +718,28 @@ bool ParticipantConfigModel::updateChildrenOf(int parentId,
|
||||
{
|
||||
ParticipantConfigModel::CheckedTreeItem *childItem = static_cast<ParticipantConfigModel::CheckedTreeItem *>(parent->child(i));
|
||||
ParticipantData &pdItem = childItem->participant;
|
||||
m_usedTypeIds += pdItem.typeId();
|
||||
m_usedTypeClassIds += typeClassIdFromTypeId(pdItem.typeId());
|
||||
if (pdItem.id() == 0)
|
||||
m_usedTypeIds += pdItem.typeId;
|
||||
m_usedTypeClassIds += typeClassIdFromTypeId(pdItem.typeId);
|
||||
if (pdItem.id == 0)
|
||||
{
|
||||
const QSet<int> &childIds = parentId2id.value(parentId);
|
||||
for (int childId : childIds)
|
||||
{
|
||||
const auto &childData = tmap.value(childId);
|
||||
if (childData.hierarchyNumber() - 1 == i)
|
||||
if (childData.hierarchyNumber - 1 == i)
|
||||
{
|
||||
pdItem.id(childData.id());
|
||||
pdItem.id = childData.id;
|
||||
childItem->setModified(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!pdItem.id())
|
||||
if (!pdItem.id)
|
||||
{
|
||||
bRet = false;
|
||||
continue;
|
||||
}
|
||||
if (!updateChildrenOf(pdItem.id(), childItem, parentId2id, tmap))
|
||||
if (!updateChildrenOf(pdItem.id, childItem, parentId2id, tmap))
|
||||
bRet = false;
|
||||
}
|
||||
return bRet;
|
||||
@@ -763,13 +764,13 @@ void ParticipantConfigModel::insertChildrenOf(int parentId,
|
||||
continue;
|
||||
}
|
||||
const ParticipantData &data = it.value();
|
||||
m_usedTypeIds += data.typeId();
|
||||
m_usedTypeClassIds += typeClassIdFromTypeId(data.typeId());
|
||||
m_usedTypeIds += data.typeId;
|
||||
m_usedTypeClassIds += typeClassIdFromTypeId(data.typeId);
|
||||
|
||||
int insertPos = 0;
|
||||
if (data.hierarchyNumber() > 0)
|
||||
if (data.hierarchyNumber > 0)
|
||||
{
|
||||
auto hierIt = currentHierachyNumbers.insert(data.hierarchyNumber(), data.hierarchyNumber());
|
||||
auto hierIt = currentHierachyNumbers.insert(data.hierarchyNumber, data.hierarchyNumber);
|
||||
insertPos = std::distance(currentHierachyNumbers.begin(), hierIt);
|
||||
}
|
||||
else
|
||||
@@ -782,15 +783,15 @@ void ParticipantConfigModel::insertChildrenOf(int parentId,
|
||||
|
||||
CheckedTreeItem *childItem = static_cast<CheckedTreeItem *>(createItem(QVariant(), QIcon()));
|
||||
childItem->participant = data;
|
||||
childItem->bIsChecked = isChecked(checkedParticipants.contains(data.id()), cs);
|
||||
childItem->bIsChecked = isChecked(checkedParticipants.contains(data.id), cs);
|
||||
|
||||
DEBUG_LOG(m_logger) << "insert Child " << childItem << "(" << data.id() << ", " << data.hierarchyNumber()
|
||||
DEBUG_LOG(m_logger) << "insert Child " << childItem << "(" << data.id << ", " << data.hierarchyNumber
|
||||
<< ") to parent " << parent << " at pos " << insertPos;
|
||||
insertRow(insertPos, parentIdx, childItem);
|
||||
tryRenderSymbol(QString::fromStdString(data.symbol()), childItem);
|
||||
tryRenderSymbol(QString::fromStdString(data.symbol), childItem);
|
||||
|
||||
const QModelIndex childIdx = index(insertPos, 0, parentIdx);
|
||||
insertChildrenOf(data.id(), childItem, childIdx, parentId2id, tmap, checkedParticipants, cs);
|
||||
insertChildrenOf(data.id, childItem, childIdx, parentId2id, tmap, checkedParticipants, cs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -801,7 +802,7 @@ bool ParticipantConfigModel::isParentOf(const NGLTreeItem *item, int participant
|
||||
return false;
|
||||
|
||||
const CheckedTreeItem *cti = static_cast<const CheckedTreeItem *>(item);
|
||||
if (cti->participant.id() == participantId)
|
||||
if (cti->participant.id == participantId)
|
||||
return true;
|
||||
return isParentOf(item->parent(), participantId);
|
||||
}
|
||||
@@ -856,7 +857,7 @@ void ParticipantConfigModel::setCheckState(CheckedTreeItem *parentItem, const QS
|
||||
|
||||
QModelIndex ParticipantConfigModel::indexFromParticipantId(int participantId, const CheckedTreeItem *cti) const
|
||||
{
|
||||
if (cti->participant.id() == participantId)
|
||||
if (cti->participant.id == participantId)
|
||||
return indexFromItem(cti);
|
||||
for (int row = 0; row < cti->childCount(); ++row)
|
||||
{
|
||||
@@ -870,7 +871,7 @@ QModelIndex ParticipantConfigModel::indexFromParticipantId(int participantId, co
|
||||
int ParticipantConfigModel::participantIdFromItem(NGLTreeItem *item) const
|
||||
{
|
||||
const CheckedTreeItem *cti = static_cast<CheckedTreeItem *>(item);
|
||||
return cti->participant.id();
|
||||
return cti->participant.id;
|
||||
}
|
||||
|
||||
ParticipantConfigModel::CheckedTreeItem *ParticipantConfigModel::searchParticipant(const NGLTreeItem *parentItem, int participantId) const
|
||||
@@ -879,7 +880,7 @@ ParticipantConfigModel::CheckedTreeItem *ParticipantConfigModel::searchParticipa
|
||||
for (int r = 0; r < rowCount; ++r)
|
||||
{
|
||||
CheckedTreeItem *child = static_cast<CheckedTreeItem *>(parentItem->child(r));
|
||||
if (child->participant.id() == participantId)
|
||||
if (child->participant.id == participantId)
|
||||
return child;
|
||||
child = searchParticipant(child, participantId);
|
||||
if (child)
|
||||
@@ -894,10 +895,10 @@ NGLTreeItem *ParticipantConfigModel::createItem(const QVariant &data, const QIco
|
||||
CheckedTreeItem *cti = new CheckedTreeItem(data, icon);
|
||||
cti->participant = qVariantToParticipant(data);
|
||||
|
||||
if (cti->participant.symbol().size() != 0)
|
||||
if (cti->participant.symbol.size() != 0)
|
||||
{
|
||||
auto *that = const_cast<ParticipantConfigModel *>(this);
|
||||
that->tryRenderSymbol(QString::fromStdString(cti->participant.symbol()), cti);
|
||||
that->tryRenderSymbol(QString::fromStdString(cti->participant.symbol), cti);
|
||||
}
|
||||
|
||||
return cti;
|
||||
@@ -913,21 +914,21 @@ QVariant ParticipantConfigModel::getItemData(const NGLTreeItem *item) const
|
||||
QString ParticipantConfigModel::buildProtectionString(const ParticipantMode &mode) const
|
||||
{
|
||||
QString protLevel;
|
||||
switch(mode.protectionLevel().underlying())
|
||||
switch(mode.protectionLevel)
|
||||
{
|
||||
case ProjectDataManagement::ProtectionLevel::IdzEs:
|
||||
case ProjectDataManagement::ProtectionLevel::ProtectionLevel_IdzEs:
|
||||
protLevel = tr("IdzEs");
|
||||
break;
|
||||
case ProjectDataManagement::ProtectionLevel::IdzBs:
|
||||
case ProjectDataManagement::ProtectionLevel::ProtectionLevel_IdzBs:
|
||||
protLevel = tr("IdzBs");
|
||||
break;
|
||||
case ProjectDataManagement::ProtectionLevel::Ksk:
|
||||
case ProjectDataManagement::ProtectionLevel::ProtectionLevel_Ksk:
|
||||
protLevel = tr("Ksk");
|
||||
break;
|
||||
case ProjectDataManagement::ProtectionLevel::SoldierWithBodyArmor:
|
||||
case ProjectDataManagement::ProtectionLevel::ProtectionLevel_SoldierWithBodyArmor:
|
||||
protLevel = tr("SoldierWithBodyArmor");
|
||||
break;
|
||||
case ProjectDataManagement::ProtectionLevel::SoldierActor:
|
||||
case ProjectDataManagement::ProtectionLevel::ProtectionLevel_SoldierActor:
|
||||
protLevel = tr("SoldierActor");
|
||||
break;
|
||||
default:
|
||||
@@ -936,18 +937,18 @@ QString ParticipantConfigModel::buildProtectionString(const ParticipantMode &mod
|
||||
}
|
||||
|
||||
return tr("%1 / %2 / %3")
|
||||
.arg(buildWphModeString(mode.modeHelmet()))
|
||||
.arg(buildWphModeString(mode.modeVest()))
|
||||
.arg(buildWphModeString(mode.modeHelmet))
|
||||
.arg(buildWphModeString(mode.modeVest))
|
||||
.arg(protLevel);
|
||||
}
|
||||
|
||||
QString ParticipantConfigModel::buildWphModeString(const ProjectDataManagement::WphMode &wphMode) const
|
||||
{
|
||||
switch(wphMode.underlying())
|
||||
switch(wphMode)
|
||||
{
|
||||
case ProjectDataManagement::WphMode::Without:
|
||||
case ProjectDataManagement::WphMode::WphMode_Without:
|
||||
return tr("Without");
|
||||
case ProjectDataManagement::WphMode::With:
|
||||
case ProjectDataManagement::WphMode::WphMode_With:
|
||||
return tr("With");
|
||||
default:
|
||||
return tr("No Change");
|
||||
@@ -957,7 +958,7 @@ QString ParticipantConfigModel::buildWphModeString(const ProjectDataManagement::
|
||||
|
||||
QString ParticipantConfigModel::buildInternationalModeString(const ProjectDataManagement::InternationalMode &inMode) const
|
||||
{
|
||||
switch(inMode.underlying())
|
||||
switch(inMode)
|
||||
{
|
||||
case ProjectDataManagement::InternationalMode::InternationalMode_On:
|
||||
return tr("On");
|
||||
@@ -978,17 +979,17 @@ int ParticipantConfigModel::insertParticipant(const QModelIndex &parent, Partici
|
||||
const int row = rowCount(parentCol0);
|
||||
if (bNewParticipant)
|
||||
{
|
||||
participantData.id(0);
|
||||
participantData.modId(0);
|
||||
participantData.id = 0;
|
||||
participantData.modId = 0;
|
||||
}
|
||||
participantData.partyId(m_partyId);
|
||||
participantData.hierarchyNumber(row + 1);
|
||||
participantData.partyId = m_partyId;
|
||||
participantData.hierarchyNumber = row + 1;
|
||||
|
||||
CheckedTreeItem *item = static_cast<CheckedTreeItem *>(createItem(participantToQVariant(participantData), QIcon()));
|
||||
item->setModified(true);
|
||||
if (!insertRow(row, parentCol0, item))
|
||||
return -1;
|
||||
tryRenderSymbol(QString::fromStdString(participantData.symbol()), item);
|
||||
tryRenderSymbol(QString::fromStdString(participantData.symbol), item);
|
||||
emit internalDataChanged();
|
||||
return row;
|
||||
}
|
||||
@@ -1008,8 +1009,8 @@ bool ParticipantConfigModel::onUpdateRow(const QModelIndex &index, const Partici
|
||||
if (participantData == oldData)
|
||||
return true;
|
||||
|
||||
if (oldData.symbol() != participantData.symbol())
|
||||
tryRenderSymbol(QString::fromStdString(participantData.symbol()), item);
|
||||
if (oldData.symbol != participantData.symbol)
|
||||
tryRenderSymbol(QString::fromStdString(participantData.symbol), item);
|
||||
|
||||
emit internalDataChanged();
|
||||
item->participant = participantData;
|
||||
@@ -1024,10 +1025,10 @@ bool ParticipantConfigModel::onDeleteRow(const QModelIndex &idx, bool isFirstIte
|
||||
{
|
||||
CheckedTreeItem *item = privateData(idx);
|
||||
ParticipantManagement::ParticipantData data = item->participant;
|
||||
data.isDeleted(true);
|
||||
data.assignState() = ParticipantAssignState::NotAssigned;
|
||||
data.equipmentNumber().reset();
|
||||
if (data.modId() != 0)
|
||||
data.isDeleted = true;
|
||||
data.assignState = ParticipantAssignState::NotAssigned;
|
||||
data.equipmentNumber.reset();
|
||||
if (data.modId != 0)
|
||||
m_dataToDelete.push_back(std::move(data));
|
||||
}
|
||||
removeRow(idx.row(), idx.parent());
|
||||
@@ -1037,12 +1038,12 @@ bool ParticipantConfigModel::onDeleteRow(const QModelIndex &idx, bool isFirstIte
|
||||
|
||||
void ParticipantConfigModel::onParticipantChanged(const ParticipantManagement::Participant &data, DataModification modType)
|
||||
{
|
||||
if (data.partyId() != m_partyId)
|
||||
if (data.partyId != m_partyId)
|
||||
return;
|
||||
|
||||
Q_UNUSED(modType);
|
||||
|
||||
CheckedTreeItem *cti = searchParticipant(m_rootItem, data.id());
|
||||
CheckedTreeItem *cti = searchParticipant(m_rootItem, data.id);
|
||||
if (cti)
|
||||
{
|
||||
cti->participant = m_dtc->convertParticipantToParticipantData(data);
|
||||
@@ -1050,16 +1051,16 @@ void ParticipantConfigModel::onParticipantChanged(const ParticipantManagement::P
|
||||
return;
|
||||
}
|
||||
|
||||
CheckedTreeItem *ctiParent = searchParticipant(m_rootItem, data.superiorId());
|
||||
CheckedTreeItem *ctiParent = searchParticipant(m_rootItem, data.superiorId);
|
||||
if (ctiParent)
|
||||
{
|
||||
int insertPos = 0;
|
||||
if (data.hierarchyNumber() > 0)
|
||||
if (data.hierarchyNumber > 0)
|
||||
{
|
||||
for (int i = 0; i < ctiParent->childCount(); ++i)
|
||||
{
|
||||
CheckedTreeItem *child = static_cast<CheckedTreeItem *>(ctiParent->child(i));
|
||||
if (child->participant.hierarchyNumber() > data.hierarchyNumber())
|
||||
if (child->participant.hierarchyNumber > data.hierarchyNumber)
|
||||
{
|
||||
insertPos = i;
|
||||
break;
|
||||
@@ -1074,17 +1075,17 @@ void ParticipantConfigModel::onParticipantChanged(const ParticipantManagement::P
|
||||
|
||||
CheckedTreeItem *childItem = static_cast<CheckedTreeItem *>(createItem(QVariant(), QIcon()));
|
||||
childItem->participant = m_dtc->convertParticipantToParticipantData(data);
|
||||
DEBUG_LOG(m_logger) << "insert Child " << childItem << "(" << data.id() << ", " << data.hierarchyNumber()
|
||||
DEBUG_LOG(m_logger) << "insert Child " << childItem << "(" << data.id << ", " << data.hierarchyNumber
|
||||
<< ") to parent " << ctiParent << " at pos " << insertPos;
|
||||
insertRow(insertPos, indexFromItem(ctiParent), childItem);
|
||||
tryRenderSymbol(QString::fromStdString(data.symbol()), childItem);
|
||||
tryRenderSymbol(QString::fromStdString(data.symbol), childItem);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
m_missingSuperiorId.insert(data.superiorId());
|
||||
m_missingSuperiorId.insert(data.superiorId);
|
||||
m_missingSuperiorIdTimer->start();
|
||||
}
|
||||
|
||||
@@ -1127,30 +1128,30 @@ bool ParticipantTreeFilterProxyConfigModel::lessThan(const QModelIndex &source_l
|
||||
switch (source_left.column())
|
||||
{
|
||||
case ParticipantConfigModel::ColDesignator:
|
||||
return left->participant.hierarchyNumber() < right->participant.hierarchyNumber();
|
||||
return left->participant.hierarchyNumber < right->participant.hierarchyNumber;
|
||||
case ParticipantConfigModel::ColIdentifier:
|
||||
return compareStrings(left->participant.tacticalIdentifier(),
|
||||
right->participant.tacticalIdentifier(),
|
||||
return compareStrings(left->participant.tacticalIdentifier,
|
||||
right->participant.tacticalIdentifier,
|
||||
left, right);
|
||||
case ParticipantConfigModel::ColTypeClass:
|
||||
case ParticipantConfigModel::ColType:
|
||||
break;
|
||||
case ParticipantConfigModel::ColEquipmentNumber:
|
||||
if (!left->participant.equipmentNumber().is_set() && !right->participant.equipmentNumber().is_set())
|
||||
return left->participant.hierarchyNumber() < right->participant.hierarchyNumber();
|
||||
if (!left->participant.equipmentNumber().is_set())
|
||||
if (!left->participant.equipmentNumber.has_value() && !right->participant.equipmentNumber.has_value())
|
||||
return left->participant.hierarchyNumber < right->participant.hierarchyNumber;
|
||||
if (!left->participant.equipmentNumber.has_value())
|
||||
return true;
|
||||
if (!right->participant.equipmentNumber().is_set())
|
||||
if (!right->participant.equipmentNumber.has_value())
|
||||
return false;
|
||||
return left->participant.equipmentNumber().get() < right->participant.equipmentNumber().get();
|
||||
return left->participant.equipmentNumber.get() < right->participant.equipmentNumber.get();
|
||||
|
||||
case ParticipantConfigModel::ColInfo:
|
||||
return compareStrings(left->participant.info(),
|
||||
right->participant.info(),
|
||||
return compareStrings(left->participant.info,
|
||||
right->participant.info,
|
||||
left, right);
|
||||
case ParticipantConfigModel::ColSign:
|
||||
return compareStrings(left->participant.identification(),
|
||||
right->participant.identification(),
|
||||
return compareStrings(left->participant.identification,
|
||||
right->participant.identification,
|
||||
left, right);
|
||||
}
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::lessThan(source_left, source_right);
|
||||
@@ -1169,7 +1170,7 @@ bool ParticipantTreeFilterProxyConfigModel::filterAcceptsRow(int source_row, con
|
||||
return false;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
if (!m_allowedTypes.contains(childItem->participant.typeId()))
|
||||
if (!m_allowedTypes.contains(childItem->participant.typeId))
|
||||
return false;
|
||||
#else
|
||||
|
||||
@@ -1321,29 +1322,29 @@ bool ParticipantTableFilterProxyConfigModel::lessThan(const QModelIndex &sourceL
|
||||
switch (sourceLeft.column())
|
||||
{
|
||||
case ParticipantConfigModel::ColDesignator:
|
||||
return left->participant.hierarchyNumber() < right->participant.hierarchyNumber();
|
||||
return left->participant.hierarchyNumber < right->participant.hierarchyNumber;
|
||||
|
||||
case ParticipantConfigModel::ColIdentifier:
|
||||
return compareStrings(left->participant.tacticalIdentifier(), right->participant.tacticalIdentifier(), left, right);
|
||||
return compareStrings(left->participant.tacticalIdentifier, right->participant.tacticalIdentifier, left, right);
|
||||
|
||||
case ParticipantConfigModel::ColTypeClass:
|
||||
case ParticipantConfigModel::ColType:
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::lessThan(sourceLeft, sourceRight);
|
||||
|
||||
case ParticipantConfigModel::ColEquipmentNumber:
|
||||
if (!left->participant.equipmentNumber().is_set() && !right->participant.equipmentNumber().is_set())
|
||||
return left->participant.hierarchyNumber() < right->participant.hierarchyNumber();
|
||||
if (!left->participant.equipmentNumber().is_set())
|
||||
if (!left->participant.equipmentNumber.has_value() && !right->participant.equipmentNumber.has_value())
|
||||
return left->participant.hierarchyNumber < right->participant.hierarchyNumber;
|
||||
if (!left->participant.equipmentNumber.has_value())
|
||||
return true;
|
||||
if (!right->participant.equipmentNumber().is_set())
|
||||
if (!right->participant.equipmentNumber.has_value())
|
||||
return false;
|
||||
return left->participant.equipmentNumber().get() < right->participant.equipmentNumber().get();
|
||||
return left->participant.equipmentNumber.get() < right->participant.equipmentNumber.get();
|
||||
|
||||
case ParticipantConfigModel::ColInfo:
|
||||
return compareStrings(left->participant.info(), right->participant.info(), left, right);
|
||||
return compareStrings(left->participant.info, right->participant.info, left, right);
|
||||
|
||||
case ParticipantConfigModel::ColSign:
|
||||
return compareStrings(left->participant.identification(), right->participant.identification(), left, right);
|
||||
return compareStrings(left->participant.identification, right->participant.identification, left, right);
|
||||
|
||||
default:
|
||||
return false;
|
||||
|
||||
+9
-8
@@ -21,6 +21,7 @@ ParticipantFollowDialog::ParticipantFollowDialog(QWidget *parent)
|
||||
, m_ui(new Ui::ParticipantFollowDialog)
|
||||
, m_followParticipantId(-1)
|
||||
, m_followEquipmentNo(-1)
|
||||
, m_logger(getLogger("ParticipantFollowDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->leEquipNo->setValidator(new QIntValidator(0, 100000, m_ui->leEquipNo));
|
||||
@@ -185,7 +186,7 @@ void ParticipantFollowDialog::updateObjectIndicator()
|
||||
enadisa();
|
||||
}
|
||||
|
||||
void ParticipantFollowDialog::enterEvent(QEvent *e)
|
||||
void ParticipantFollowDialog::enterEvent(QEnterEvent *e)
|
||||
{
|
||||
BaseClass::enterEvent(e);
|
||||
updateObjectIndicator();
|
||||
@@ -211,11 +212,11 @@ int ParticipantFollowDialog::onSelectionChanged()
|
||||
|
||||
ParticipantManagement::ParticipantData data;
|
||||
data = m_model->getParticipantData(index);
|
||||
if (!data.equipmentNumber().is_set())
|
||||
if (!data.equipmentNumber.has_value())
|
||||
return -1;
|
||||
|
||||
enadisa();
|
||||
return data.equipmentNumber().get();
|
||||
return data.equipmentNumber.get();
|
||||
}
|
||||
|
||||
void ParticipantFollowDialog::onDoubleClicked()
|
||||
@@ -224,7 +225,7 @@ void ParticipantFollowDialog::onDoubleClicked()
|
||||
|
||||
ParticipantManagement::ParticipantData data;
|
||||
data = m_model->getParticipantData(index);
|
||||
m_followParticipantId = data.id();
|
||||
m_followParticipantId = data.id;
|
||||
m_followEquipmentNo = getEquipmentNumber(m_followParticipantId);
|
||||
enadisa();
|
||||
DEBUG_LOG(m_logger) << "onDoubleClicked follow Participant Id =" << m_followParticipantId
|
||||
@@ -271,8 +272,8 @@ void ParticipantFollowDialog::fillMapFromDtc()
|
||||
m_participantMap.clear();
|
||||
auto cb = [this](const Participant & data)
|
||||
{
|
||||
if (data.equipmentNumber().is_set())
|
||||
m_participantMap.insert(data.equipmentNumber().get(), data.id());
|
||||
if (data.equipmentNumber.has_value())
|
||||
m_participantMap.insert(data.equipmentNumber.get(), data.id);
|
||||
};
|
||||
m_dtc->participants(cb);
|
||||
}
|
||||
@@ -331,8 +332,8 @@ void ParticipantFollowDialog::fillParticipantMapFromTree(const QModelIndex &pare
|
||||
fillParticipantMapFromTree(m_model->index(row, 0, parent));
|
||||
|
||||
const ParticipantManagement::ParticipantData data(m_model->getParticipantData(parent));
|
||||
if (data.equipmentNumber().is_set())
|
||||
m_participantMap.insert(data.equipmentNumber().get(), data.id());
|
||||
if (data.equipmentNumber.has_value())
|
||||
m_participantMap.insert(data.equipmentNumber.get(), data.id);
|
||||
}
|
||||
|
||||
int ParticipantFollowDialog::getEquipmentNumber(const int participantId)
|
||||
|
||||
+2
-1
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
|
||||
|
||||
|
||||
@@ -54,7 +55,7 @@ Q_SIGNALS:
|
||||
private slots:
|
||||
void slotLookup();
|
||||
void updateObjectIndicator();
|
||||
void enterEvent(QEvent *e) override;
|
||||
void enterEvent(QEnterEvent *e) override;
|
||||
void leaveEvent(QEvent *e) override;
|
||||
|
||||
private:
|
||||
|
||||
+13
-12
@@ -21,6 +21,7 @@ ParticipantGearRestock::ParticipantGearRestock(int gearId, int gearTypeId, const
|
||||
, m_participant(participant)
|
||||
, m_dialogMode(dialogMode)
|
||||
, m_ui(new Ui::ParticipantGearRestock)
|
||||
, m_logger(getLogger("ParticipantGearRestock"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
@@ -36,10 +37,10 @@ ParticipantGearRestock::~ParticipantGearRestock()
|
||||
void ParticipantGearRestock::retranslate()
|
||||
{
|
||||
QString eqNoString;
|
||||
if (m_participant.equipmentNumber().is_set())
|
||||
eqNoString = QString::number(m_participant.equipmentNumber().get());
|
||||
if (m_participant.equipmentNumber.has_value())
|
||||
eqNoString = QString::number(m_participant.equipmentNumber.get());
|
||||
else
|
||||
eqNoString = tr("[Participant Id: %1]").arg(m_participant.id());
|
||||
eqNoString = tr("[Participant Id: %1]").arg(m_participant.id);
|
||||
|
||||
if (m_dialogMode == DM_Restock)
|
||||
translate(m_ui, tr("Set %1's Restock Defaults of Participant %2").arg(m_pdmDtc->trGearTypeName(m_gearTypeId), eqNoString));
|
||||
@@ -101,10 +102,10 @@ bool ParticipantGearRestock::init(LtsSession::LtsSession *session, bool showAllO
|
||||
|
||||
for (const ProjectDataManagement::GearTypeChargeType &gearType2ChargeType : m_pdmDtc->gearTypeChargeTypes())
|
||||
{
|
||||
if (gearType2ChargeType.gearTypeId() != m_gearTypeId)
|
||||
if (gearType2ChargeType.gearTypeId != m_gearTypeId)
|
||||
continue;
|
||||
|
||||
int chargeTypeId = gearType2ChargeType.chargeTypeId();
|
||||
int chargeTypeId = gearType2ChargeType.chargeTypeId;
|
||||
int maxCharge = m_pdmDtc->maxCharge(m_gearTypeId, chargeTypeId);
|
||||
|
||||
DEBUG_LOG(m_logger) << "maxCharge = " << maxCharge;
|
||||
@@ -136,17 +137,17 @@ bool ParticipantGearRestock::init(LtsSession::LtsSession *session, bool showAllO
|
||||
bool ParticipantGearRestock::apply()
|
||||
{
|
||||
SelectiveReammunitionRequest req;
|
||||
req.id(m_participant.id());
|
||||
req.gearId(m_gearId);
|
||||
req.id = m_participant.id;
|
||||
req.gearId = m_gearId;
|
||||
for (ParticipantGearRestockCharge* pgrc : m_ui->scrollArea->findChildren<ParticipantGearRestockCharge*>())
|
||||
{
|
||||
Reammunition ra;
|
||||
ra.chargeTypeId(pgrc->chargeTypeId());
|
||||
ra.tracerRatio(0);
|
||||
ra.newStock((m_dialogMode == DM_Restock || m_ui->cbRestockNow->isChecked()) ? pgrc->value() : 0xfffe);
|
||||
ra.newDefaultStock(m_dialogMode == DM_SetRestockDefaults ? pgrc->value() : 0xfffe);
|
||||
ra.chargeTypeId = pgrc->chargeTypeId();
|
||||
ra.tracerRatio = 0;
|
||||
ra.newStock = (m_dialogMode == DM_Restock || m_ui->cbRestockNow->isChecked()) ? pgrc->value() : 0xfffe;
|
||||
ra.newDefaultStock = m_dialogMode == DM_SetRestockDefaults ? pgrc->value() : 0xfffe;
|
||||
|
||||
req.reammunition().push_back(ra);
|
||||
req.reammunition.push_back(ra);
|
||||
}
|
||||
|
||||
return m_requestHelper->startSingleRequest([req, this]()
|
||||
|
||||
+4
-3
@@ -14,6 +14,7 @@ ParticipantHistoryDialog::ParticipantHistoryDialog(QWidget *parent)
|
||||
, m_proxyModel(new ParticipantHistorySortModel(this))
|
||||
, m_dtc(nullptr)
|
||||
, m_ui(new Ui::ParticipantHistoryDialog)
|
||||
, m_logger(getLogger("ParticipantHistoryDialog"))
|
||||
{
|
||||
m_proxyModel->setSourceModel(m_model);
|
||||
m_ui->setupUi(this);
|
||||
@@ -40,8 +41,8 @@ ParticipantHistoryDialog::~ParticipantHistoryDialog()
|
||||
|
||||
void ParticipantHistoryDialog::retranslate()
|
||||
{
|
||||
const dds::core::optional<int32_t> eqId = m_dtc->participant(m_ddsId).equipmentNumber();
|
||||
const QString id = (eqId.is_set() ? QString::number(eqId.get()) : QString());
|
||||
const dds::core::optional<int32_t> eqId = m_dtc->participant(m_ddsId).equipmentNumber;
|
||||
const QString id = (eqId.has_value() ? QString::number(eqId.get()) : QString());
|
||||
|
||||
translate(m_ui, id, false, tr("Participant History"));
|
||||
}
|
||||
@@ -62,7 +63,7 @@ bool ParticipantHistoryDialog::init(int ddsId,
|
||||
if (m_model->initModel(m_ddsId, m_dtc, pdmDtc, aesDtc))
|
||||
{
|
||||
m_ui->tvHistory->syncSearchHeaderAndTableContentColumnSize();
|
||||
bool isHuman = m_dtc->type(m_dtc->participant(m_ddsId).typeId()).typeClass() == ParticipantManagement::TypeClass::Human;
|
||||
bool isHuman = m_dtc->type(m_dtc->participant(m_ddsId).typeId).typeClass == ParticipantManagement::TypeClass::Human;
|
||||
const bool showPvSan = LtsUtils::ProjectSettings::isFunctionEnabled(QStringLiteral("ParticipantInformation"),
|
||||
QStringLiteral("HasPvSan"));
|
||||
|
||||
|
||||
+1
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <ParticipantManagement/logger.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ProjectDataManagement/pdm_data_plugin_interface.h>
|
||||
#include <AreaEffectSimulation/aes_data_plugin_interface.h>
|
||||
#include "participant_history_dialog_model.h"
|
||||
|
||||
+74
-73
@@ -30,6 +30,7 @@ ParticipantHistoryDialogModel::ParticipantHistoryDialogModel(QObject *parent)
|
||||
, m_vulnerabilityClass(ProjectDataManagement::VulnerabilityClass::VulnerabilityClass_SoldierInjuries)
|
||||
, m_dtc(nullptr)
|
||||
, m_pdmDtc(nullptr)
|
||||
, m_logger(getLogger("ParticipantHistoryDialogModel"))
|
||||
{}
|
||||
|
||||
bool ParticipantHistoryDialogModel::initModel(int dds_id,
|
||||
@@ -46,13 +47,13 @@ bool ParticipantHistoryDialogModel::initModel(int dds_id,
|
||||
this, &ParticipantHistoryDialogModel::onDynamicParticipantDataChanged);
|
||||
|
||||
const auto &part = m_dtc->participant(m_ddsId);
|
||||
const auto typeClass = dtc->type(part.typeId()).typeClass();
|
||||
const auto typeClass = dtc->type(part.typeId).typeClass;
|
||||
|
||||
m_vulnerabilityClass = (typeClass == TypeClass::Human) ?
|
||||
ProjectDataManagement::VulnerabilityClass::SoldierInjuries :
|
||||
ProjectDataManagement::VulnerabilityClass::VehicleDamages;
|
||||
ProjectDataManagement::VulnerabilityClass::VulnerabilityClass_SoldierInjuries :
|
||||
ProjectDataManagement::VulnerabilityClass::VulnerabilityClass_VehicleDamages;
|
||||
|
||||
reinitModel(m_dtc->dynamicParticipantData(m_ddsId).stateHistory());
|
||||
reinitModel(m_dtc->dynamicParticipantData(m_ddsId).stateHistory);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -62,19 +63,19 @@ QVariant ParticipantHistoryDialogModel::dataInternal(const QModelIndex &index) c
|
||||
switch (index.column())
|
||||
{
|
||||
case Time:
|
||||
return QDateTime::fromMSecsSinceEpoch(data.stateTime());
|
||||
return QDateTime::fromMSecsSinceEpoch(data.stateTime);
|
||||
case VulnerabilityState:
|
||||
{
|
||||
if(data.originatorType().underlying() == ProjectDataManagement::StateChangeOriginator::Sanitation)
|
||||
if(data.originatorType == ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Sanitation)
|
||||
return {};
|
||||
|
||||
if (data.vulnerabilityState() == ProjectDataManagement::VulnerabilityState::VulnerabilityState_NotReady)
|
||||
if (data.vulnerabilityState == ProjectDataManagement::VulnerabilityState::VulnerabilityState_NotReady)
|
||||
return {};
|
||||
|
||||
std::bitset<sizeof(data.vulnerabilityBits()) * 8> bits(data.vulnerabilityBits());
|
||||
bits.set(data.vulnerabilityState().underlying());
|
||||
std::bitset<sizeof(data.vulnerabilityBits) * 8> bits(data.vulnerabilityBits);
|
||||
bits.set(static_cast<int>(data.vulnerabilityState));
|
||||
|
||||
for (int i = ProjectDataManagement::VulnerabilityState::HeavyDamage; i >= 0; --i)
|
||||
for (int i = static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_HeavyDamage); i >= 0; --i)
|
||||
{
|
||||
if (!bits.test(i))
|
||||
continue;
|
||||
@@ -83,15 +84,15 @@ QVariant ParticipantHistoryDialogModel::dataInternal(const QModelIndex &index) c
|
||||
break;
|
||||
}
|
||||
|
||||
if (bits.test(ProjectDataManagement::VulnerabilityState::CatastrophicKill))
|
||||
if (bits.test(static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill)))
|
||||
{
|
||||
for (int j = 0; j < ProjectDataManagement::VulnerabilityState::CatastrophicKill; ++j)
|
||||
for (int j = 0; j < static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill); ++j)
|
||||
bits.reset(j);
|
||||
bits.reset(ProjectDataManagement::VulnerabilityState::TemporarySeverance);
|
||||
bits.reset(static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_TemporarySeverance));
|
||||
}
|
||||
|
||||
QStringList sl;
|
||||
for (int i = 0; i <= ProjectDataManagement::VulnerabilityState::CContamination; ++i)
|
||||
for (int i = 0; i <= static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_CContamination); ++i)
|
||||
{
|
||||
if (!bits.test(i))
|
||||
continue;
|
||||
@@ -103,36 +104,36 @@ QVariant ParticipantHistoryDialogModel::dataInternal(const QModelIndex &index) c
|
||||
}
|
||||
case Originator:
|
||||
{
|
||||
QString originatorType(ProjectDataManagement::toString(data.originatorType()));
|
||||
QString originatorType(ProjectDataManagement::toString(data.originatorType));
|
||||
QString originator;
|
||||
switch (data.originatorType().underlying())
|
||||
switch (data.originatorType)
|
||||
{
|
||||
case ProjectDataManagement::StateChangeOriginator::DusMine:
|
||||
case ProjectDataManagement::StateChangeOriginator::ImprovisedExplosiveDevice:
|
||||
originator = QString::number(data.originatorId() < 0 ? 0 - data.originatorId() : data.originatorId());
|
||||
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_DusMine:
|
||||
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_ImprovisedExplosiveDevice:
|
||||
originator = QString::number(data.originatorId < 0 ? 0 - data.originatorId : data.originatorId);
|
||||
break;
|
||||
case ProjectDataManagement::StateChangeOriginator::Participant:
|
||||
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Participant:
|
||||
{
|
||||
if (data.originatorId() < 0)
|
||||
if (data.originatorId < 0)
|
||||
{
|
||||
originator = QString::number(-data.originatorId());
|
||||
originator = QString::number(-data.originatorId);
|
||||
}
|
||||
else
|
||||
{
|
||||
const Participant participant = m_dtc->participant(data.originatorId());
|
||||
if (participant.equipmentNumber().is_set())
|
||||
originator = QString::number(participant.equipmentNumber().get());
|
||||
const Participant participant = m_dtc->participant(data.originatorId);
|
||||
if (participant.equipmentNumber.has_value())
|
||||
originator = QString::number(participant.equipmentNumber.get());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::StateChangeOriginator::Party:
|
||||
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Party:
|
||||
{
|
||||
const Party party = m_dtc->party(data.originatorId());
|
||||
originator = QString::fromStdString(party.name());
|
||||
const Party party = m_dtc->party(data.originatorId);
|
||||
originator = QString::fromStdString(party.name);
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::StateChangeOriginator::AreaEffectSimulation:
|
||||
case ProjectDataManagement::StateChangeOriginator::FunctionalArea:
|
||||
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_AreaEffectSimulation:
|
||||
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_FunctionalArea:
|
||||
{
|
||||
if (m_aesDtc)
|
||||
{
|
||||
@@ -140,10 +141,10 @@ QVariant ParticipantHistoryDialogModel::dataInternal(const QModelIndex &index) c
|
||||
|
||||
|
||||
|
||||
originator = m_aesDtc->aesItemNameFromEntityId(data.originatorId());
|
||||
originator = m_aesDtc->aesItemNameFromEntityId(data.originatorId);
|
||||
|
||||
}
|
||||
if (data.originatorId() == 0 && data.originatorType().underlying() == ProjectDataManagement::StateChangeOriginator::FunctionalArea)
|
||||
if (data.originatorId == 0 && data.originatorType == ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_FunctionalArea)
|
||||
{
|
||||
|
||||
originatorType = tr("Autoreset");
|
||||
@@ -151,45 +152,45 @@ QVariant ParticipantHistoryDialogModel::dataInternal(const QModelIndex &index) c
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ProjectDataManagement::StateChangeOriginator::Sanitation:
|
||||
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Sanitation:
|
||||
{
|
||||
const Participant participant = m_dtc->participant(data.originatorId());
|
||||
if (participant.equipmentNumber().is_set())
|
||||
originator = QString::number(participant.equipmentNumber().get());
|
||||
else if (data.originatorId() < 0)
|
||||
originator = QString::number(-data.originatorId());
|
||||
else if (data.originatorId() == 0)
|
||||
const Participant participant = m_dtc->participant(data.originatorId);
|
||||
if (participant.equipmentNumber.has_value())
|
||||
originator = QString::number(participant.equipmentNumber.get());
|
||||
else if (data.originatorId < 0)
|
||||
originator = QString::number(-data.originatorId);
|
||||
else if (data.originatorId == 0)
|
||||
originator = tr("Exercise Control");
|
||||
QStringList san;
|
||||
san += QStringLiteral("%1 (%2 - %3) - ").arg(tr("Treatment"), originator, ParticipantManagement::toString(static_cast<Qualification>(data.originatorChargeTypeId())));
|
||||
san += m_pdmDtc->sanitationProceduresList(data.sanitationProceduresTaken());
|
||||
san += QStringLiteral("%1 (%2 - %3) - ").arg(tr("Treatment"), originator, ParticipantManagement::toString(static_cast<Qualification>(data.originatorChargeTypeId)));
|
||||
san += m_pdmDtc->sanitationProceduresList(data.sanitationProceduresTaken);
|
||||
return san;
|
||||
}
|
||||
case ProjectDataManagement::StateChangeOriginator::ObserverController:
|
||||
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_ObserverController:
|
||||
{
|
||||
QString oc;
|
||||
if (data.originatorChargeTypeId() == 1 )
|
||||
if (data.originatorChargeTypeId == 1 )
|
||||
{
|
||||
oc = tr ("9-Liner created");
|
||||
}
|
||||
else if (data.originatorChargeTypeId() == 2)
|
||||
else if (data.originatorChargeTypeId == 2)
|
||||
{
|
||||
oc = tr("Qualif. Transport initiated");
|
||||
}
|
||||
else
|
||||
oc = ProjectDataManagement::toString(data.originatorType());
|
||||
oc = ProjectDataManagement::toString(data.originatorType);
|
||||
|
||||
if (data.originatorChargeTypeId() == 8)
|
||||
if (data.originatorChargeTypeId == 8)
|
||||
oc.append(tr( " - Wound increase paused"));
|
||||
else if (data.originatorChargeTypeId() == 35)
|
||||
else if (data.originatorChargeTypeId == 35)
|
||||
oc.append(tr( " - Wound increase continued"));
|
||||
return oc;
|
||||
}
|
||||
#ifdef GUEZ_MODE
|
||||
case ProjectDataManagement::StateChangeOriginator::MedicalTimeout:
|
||||
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_MedicalTimeout:
|
||||
{
|
||||
QString mo = tr("Injury increased - ");
|
||||
switch(data.sanitationResult().underlying())
|
||||
switch(data.sanitationResult)
|
||||
{
|
||||
case SanitationResult::Unhandled:
|
||||
mo.append(tr("No Care"));
|
||||
@@ -204,20 +205,20 @@ QVariant ParticipantHistoryDialogModel::dataInternal(const QModelIndex &index) c
|
||||
mo.append(tr("Optimal Care"));
|
||||
break;
|
||||
default:
|
||||
mo.append(ProjectDataManagement::toString(data.originatorType()));
|
||||
mo.append(ProjectDataManagement::toString(data.originatorType));
|
||||
}
|
||||
return mo;
|
||||
}
|
||||
#endif
|
||||
case ProjectDataManagement::StateChangeOriginator::ExerciseControl:
|
||||
case ProjectDataManagement::StateChangeOriginator::WoundTreatmentDevice:
|
||||
case ProjectDataManagement::StateChangeOriginator::MaintainanceDevice:
|
||||
case ProjectDataManagement::StateChangeOriginator::Initialization:
|
||||
case ProjectDataManagement::StateChangeOriginator::Unknown:
|
||||
return ProjectDataManagement::toString(data.originatorType());
|
||||
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_ExerciseControl:
|
||||
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_WoundTreatmentDevice:
|
||||
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_MaintainanceDevice:
|
||||
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Initialization:
|
||||
case ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Unknown:
|
||||
return ProjectDataManagement::toString(data.originatorType);
|
||||
}
|
||||
|
||||
QString chargeType = m_pdmDtc->trChargeTypeShortName(data.originatorChargeTypeId());
|
||||
QString chargeType = m_pdmDtc->trChargeTypeShortName(data.originatorChargeTypeId);
|
||||
if (!originator.isEmpty() && !chargeType.isEmpty())
|
||||
originatorType += QStringLiteral("(%1 - %2)").arg(originator, chargeType);
|
||||
else if (!originator.isEmpty())
|
||||
@@ -227,21 +228,21 @@ QVariant ParticipantHistoryDialogModel::dataInternal(const QModelIndex &index) c
|
||||
return originatorType;
|
||||
}
|
||||
case Vulnerability:
|
||||
if(data.originatorType().underlying() == ProjectDataManagement::StateChangeOriginator::Sanitation)
|
||||
if(data.originatorType == ProjectDataManagement::StateChangeOriginator::StateChangeOriginator_Sanitation)
|
||||
return {};
|
||||
|
||||
if (data.vulnerabilityKindId() == 459286 && !((data.vulnerabilityBits() >> 7) & 1))
|
||||
if (data.vulnerabilityKindId == 459286 && !((data.vulnerabilityBits >> 7) & 1))
|
||||
return QLatin1String("-");
|
||||
return m_pdmDtc->trVulnerabilityKindName(data.vulnerabilityKindId(), m_vulnerabilityClass);
|
||||
return m_pdmDtc->trVulnerabilityKindName(data.vulnerabilityKindId, m_vulnerabilityClass);
|
||||
case VulnerabilityBits:
|
||||
return QString::number(data.vulnerabilityBits(), 16).toUpper().prepend(QStringLiteral("0x"));
|
||||
return QString::number(data.vulnerabilityBits, 16).toUpper().prepend(QStringLiteral("0x"));
|
||||
case Vitality:
|
||||
|
||||
|
||||
|
||||
|
||||
if (data.vitality() <= 100)
|
||||
return QString::number(data.vitality());
|
||||
if (data.vitality <= 100)
|
||||
return QString::number(data.vitality);
|
||||
return QStringLiteral("--");
|
||||
}
|
||||
return {};
|
||||
@@ -281,7 +282,7 @@ QVariant ParticipantHistoryDialogModel::data(const QModelIndex &index, int role)
|
||||
|
||||
void ParticipantHistoryDialogModel::onDynamicParticipantDataChanged(const DynamicParticipantData &data, DataModification modType)
|
||||
{
|
||||
if (m_ddsId != data.participantId())
|
||||
if (m_ddsId != data.participantId)
|
||||
return;
|
||||
|
||||
if (modType == DataModification::eRemoved)
|
||||
@@ -290,7 +291,7 @@ void ParticipantHistoryDialogModel::onDynamicParticipantDataChanged(const Dynami
|
||||
return;
|
||||
}
|
||||
|
||||
reinitModel(data.stateHistory());
|
||||
reinitModel(data.stateHistory);
|
||||
}
|
||||
|
||||
void ParticipantHistoryDialogModel::reinitModel(const std::vector<ParticipantManagement::StateInformation> &newData)
|
||||
@@ -321,20 +322,20 @@ bool ParticipantHistorySortModel::lessThan(const QModelIndex &source_left, const
|
||||
const StateInformation &siRight = m_sourceModel->m_vecData.at(source_right.row());
|
||||
if (source_left.column() == ParticipantHistoryDialogModel::Time)
|
||||
{
|
||||
if (siLeft.stateTime() != siRight.stateTime())
|
||||
return siLeft.stateTime() < siRight.stateTime();
|
||||
if (siLeft.stateTime != siRight.stateTime)
|
||||
return siLeft.stateTime < siRight.stateTime;
|
||||
|
||||
if ( siRight.vulnerabilityState().underlying() == 8)
|
||||
if ( static_cast<int>(siRight.vulnerabilityState) == 8)
|
||||
return true;
|
||||
if ( siLeft.vulnerabilityState().underlying() == 8)
|
||||
if ( static_cast<int>(siLeft.vulnerabilityState) == 8)
|
||||
return false;
|
||||
return siLeft.vulnerabilityState() < siRight.vulnerabilityState();
|
||||
return siLeft.vulnerabilityState < siRight.vulnerabilityState;
|
||||
}
|
||||
if (source_left.column() == ParticipantHistoryDialogModel::Vulnerability)
|
||||
{
|
||||
if (siLeft.vulnerabilityState() != siRight.vulnerabilityState())
|
||||
return siLeft.vulnerabilityState() < siRight.vulnerabilityState();
|
||||
return siLeft.stateTime() < siRight.stateTime();
|
||||
if (siLeft.vulnerabilityState != siRight.vulnerabilityState)
|
||||
return siLeft.vulnerabilityState < siRight.vulnerabilityState;
|
||||
return siLeft.stateTime < siRight.stateTime;
|
||||
}
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::lessThan(source_left, source_right);
|
||||
}
|
||||
|
||||
+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 <ParticipantManagement/logger.h>
|
||||
#include <ProjectDataManagement/pdm_dtc.h>
|
||||
#include <ProjectDataManagement/pdm_data_plugin_interface.h>
|
||||
|
||||
+36
-35
@@ -22,6 +22,7 @@ HitLineInfoDialog::HitLineInfoDialog(int hitLineId, QWidget *parent)
|
||||
, m_pdmDtc(nullptr)
|
||||
, m_sitMapGuiIfc(nullptr)
|
||||
, m_ui(new Ui::HitLineInfoDialog)
|
||||
, m_logger(getLogger("ParticipantHitLineInfoDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
@@ -67,14 +68,14 @@ bool HitLineInfoDialog::init(const std::shared_ptr<ParticipantManagement::Interf
|
||||
|
||||
m_dtc->hitLineInfos([this](const ParticipantManagement::HitLineInfo & data)
|
||||
{
|
||||
if (data.id() == m_hitLineId)
|
||||
if (data.id == m_hitLineId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Found HitLine Id: " << data.id();
|
||||
DEBUG_LOG(m_logger) << "Found HitLine Id: " << data.id;
|
||||
m_hitLineInfo = data;
|
||||
|
||||
|
||||
m_participantOriginator = m_dtc->participant(data.originatorParticipantId());
|
||||
m_participantInjury = m_dtc->participant(data.injuryParticipantId());
|
||||
m_participantOriginator = m_dtc->participant(data.originatorParticipantId);
|
||||
m_participantInjury = m_dtc->participant(data.injuryParticipantId);
|
||||
|
||||
showHitLineInfos();
|
||||
}
|
||||
@@ -90,66 +91,66 @@ void HitLineInfoDialog::showHitLineInfos()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " id:" << m_hitLineId;
|
||||
|
||||
if (m_participantOriginator.id() <= 0 || m_participantInjury.id() <= 0)
|
||||
if (m_participantOriginator.id <= 0 || m_participantInjury.id <= 0)
|
||||
return;
|
||||
|
||||
m_ui->lblHitLineId->setText(QString::number(m_hitLineId));
|
||||
|
||||
|
||||
m_ui->lblSampleTime->setText(DTG::toStringMSec(m_hitLineInfo.sampleTime()));
|
||||
m_ui->lblSampleTime->setText(DTG::toStringMSec(m_hitLineInfo.sampleTime));
|
||||
|
||||
|
||||
Participant participant = m_dtc->participant(m_participantOriginator.id());
|
||||
m_ui->lblOriginatorEquipNr->setText(QString::number(participant.equipmentNumber().get()));
|
||||
Participant participant = m_dtc->participant(m_participantOriginator.id);
|
||||
m_ui->lblOriginatorEquipNr->setText(QString::number(participant.equipmentNumber.get()));
|
||||
|
||||
m_ui->lblOriginatorParty->setText(ParticipantManagement::trPartyName(m_dtc->party(m_hitLineInfo.originatorPartyId()).name()));
|
||||
m_ui->lblOriginatorParty->setText(ParticipantManagement::trPartyName(m_dtc->party(m_hitLineInfo.originatorPartyId).name));
|
||||
|
||||
m_ui->lblOriginatorDesignator->setText(QString::fromStdString(m_participantOriginator.designator()));
|
||||
m_ui->lblOriginatorDesignator->setText(QString::fromStdString(m_participantOriginator.designator));
|
||||
|
||||
m_ui->lblOriginatorTactIdentifier->setText(QString::fromStdString(m_participantOriginator.tacticalIdentifier()));
|
||||
m_ui->lblOriginatorTactIdentifier->setText(QString::fromStdString(m_participantOriginator.tacticalIdentifier));
|
||||
|
||||
m_ui->lblOriginatorType->setText(ParticipantManagement::trTypeName(m_dtc->type(m_participantOriginator.typeId()).name()));
|
||||
m_ui->lblOriginatorType->setText(ParticipantManagement::trTypeName(m_dtc->type(m_participantOriginator.typeId).name));
|
||||
|
||||
QString mgrs = LtsCoordTrans::mgrsFromGeographic(m_hitLineInfo.originatorPos().lon(), m_hitLineInfo.originatorPos().lat());
|
||||
if (qFuzzyIsNull(m_hitLineInfo.originatorPos().z()))
|
||||
QString mgrs = LtsCoordTrans::mgrsFromGeographic(m_hitLineInfo.originatorPos.lon, m_hitLineInfo.originatorPos.lat);
|
||||
if (qFuzzyIsNull(m_hitLineInfo.originatorPos.z))
|
||||
m_ui->lblOriginatorPos->setText(tr("Position: %1").arg(mgrs));
|
||||
else
|
||||
m_ui->lblOriginatorPos->setText(tr("Position: %1 %2").arg(mgrs).arg(m_hitLineInfo.originatorPos().z()));
|
||||
m_ui->lblOriginatorPos->setText(tr("Position: %1 %2").arg(mgrs).arg(m_hitLineInfo.originatorPos.z));
|
||||
|
||||
|
||||
participant = m_dtc->participant(m_participantInjury.id());
|
||||
m_ui->lblInjuryEquipNr->setText(QString::number(participant.equipmentNumber().get()));
|
||||
participant = m_dtc->participant(m_participantInjury.id);
|
||||
m_ui->lblInjuryEquipNr->setText(QString::number(participant.equipmentNumber.get()));
|
||||
|
||||
m_ui->lblInjuryParty->setText(ParticipantManagement::trPartyName(m_dtc->party(m_participantInjury.partyId()).name()));
|
||||
m_ui->lblInjuryParty->setText(ParticipantManagement::trPartyName(m_dtc->party(m_participantInjury.partyId).name));
|
||||
|
||||
m_ui->lblInjuryDesignator->setText(QString::fromStdString(m_participantInjury.designator()));
|
||||
m_ui->lblInjuryDesignator->setText(QString::fromStdString(m_participantInjury.designator));
|
||||
|
||||
m_ui->lblInjuryTactIdentifier->setText(QString::fromStdString(m_participantInjury.tacticalIdentifier()));
|
||||
m_ui->lblInjuryTactIdentifier->setText(QString::fromStdString(m_participantInjury.tacticalIdentifier));
|
||||
|
||||
m_ui->lblInjuryType->setText(ParticipantManagement::trTypeName(m_dtc->type(m_participantInjury.typeId()).name()));
|
||||
m_ui->lblInjuryType->setText(ParticipantManagement::trTypeName(m_dtc->type(m_participantInjury.typeId).name));
|
||||
|
||||
mgrs = LtsCoordTrans::mgrsFromGeographic(m_hitLineInfo.injuryPos().lon(), m_hitLineInfo.injuryPos().lat());
|
||||
if (qFuzzyIsNull(m_hitLineInfo.injuryPos().z()))
|
||||
mgrs = LtsCoordTrans::mgrsFromGeographic(m_hitLineInfo.injuryPos.lon, m_hitLineInfo.injuryPos.lat);
|
||||
if (qFuzzyIsNull(m_hitLineInfo.injuryPos.z))
|
||||
m_ui->lblInjuryPos->setText(tr("Position: %1").arg(mgrs));
|
||||
else
|
||||
m_ui->lblInjuryPos->setText(tr("Position: %1 %2").arg(mgrs).arg(m_hitLineInfo.injuryPos().z()));
|
||||
m_ui->lblInjuryPos->setText(tr("Position: %1 %2").arg(mgrs).arg(m_hitLineInfo.injuryPos.z));
|
||||
|
||||
m_typeClass = m_dtc->type(m_participantInjury.typeId()).typeClass();
|
||||
m_typeClass = m_dtc->type(m_participantInjury.typeId).typeClass;
|
||||
|
||||
ParticipantManagement::DynamicParticipantData data = m_dtc->dynamicParticipantData(m_participantInjury.id());
|
||||
ParticipantManagement::DynamicParticipantData data = m_dtc->dynamicParticipantData(m_participantInjury.id);
|
||||
|
||||
const ProjectDataManagement::VulnerabilityClass vc = m_typeClass == TypeClass::Human ?
|
||||
ProjectDataManagement::VulnerabilityClass::SoldierInjuries :
|
||||
ProjectDataManagement::VulnerabilityClass::VehicleDamages;
|
||||
ProjectDataManagement::VulnerabilityClass::VulnerabilityClass_SoldierInjuries :
|
||||
ProjectDataManagement::VulnerabilityClass::VulnerabilityClass_VehicleDamages;
|
||||
|
||||
const StateInformation &lastState = m_dtc->youngestStateInformation(data.stateHistory());
|
||||
m_ui->lblInjuryStatus->setText(ProjectDataManagement::toString(lastState.vulnerabilityState(), vc));
|
||||
const StateInformation &lastState = m_dtc->youngestStateInformation(data.stateHistory);
|
||||
m_ui->lblInjuryStatus->setText(ProjectDataManagement::toString(lastState.vulnerabilityState, vc));
|
||||
|
||||
|
||||
m_ui->lblChargeTypeId->setText(QString::number(m_hitLineInfo.chargeTypeId()));
|
||||
m_ui->lblChargeTypeId->setText(QString::number(m_hitLineInfo.chargeTypeId));
|
||||
|
||||
m_ui->lblChargeType->setText(m_pdmDtc->trChargeTypeShortName(m_hitLineInfo.chargeTypeId()));
|
||||
m_ui->lblChargeType->setToolTip(m_pdmDtc->trChargeTypeName(m_hitLineInfo.chargeTypeId()));
|
||||
m_ui->lblChargeType->setText(m_pdmDtc->trChargeTypeShortName(m_hitLineInfo.chargeTypeId));
|
||||
m_ui->lblChargeType->setToolTip(m_pdmDtc->trChargeTypeName(m_hitLineInfo.chargeTypeId));
|
||||
|
||||
m_isInitialized = true;
|
||||
}
|
||||
@@ -157,13 +158,13 @@ void HitLineInfoDialog::showHitLineInfos()
|
||||
|
||||
void HitLineInfoDialog::onFindOriginatorOnMap()
|
||||
{
|
||||
findOnMap(m_participantOriginator.id());
|
||||
findOnMap(m_participantOriginator.id);
|
||||
}
|
||||
|
||||
|
||||
void HitLineInfoDialog::onFindInjuryOnMap()
|
||||
{
|
||||
findOnMap(m_participantInjury.id());
|
||||
findOnMap(m_participantInjury.id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <ParticipantManagement/logger.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
|
||||
|
||||
#include <ProjectDataManagement/pdm_dtc.h>
|
||||
|
||||
+228
-228
File diff suppressed because it is too large.
Load diff
+14
-14
@@ -479,43 +479,43 @@ void InterfaceImpl::onNewFollowEquipment(const int equipmentNumber, const int pa
|
||||
|
||||
void InterfaceImpl::onParticipantPositionChanged(const ParticipantManagement::ParticipantPosition &data, DataModification modType)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onParticipantPositionChanged id=" << data.participantId()
|
||||
DEBUG_LOG(m_logger) << "onParticipantPositionChanged id=" << data.participantId
|
||||
<< " m_followParticipantId=" << m_followParticipantId ;
|
||||
if (m_followParticipantId == 0)
|
||||
return;
|
||||
if (modType == DataModification::eRemoved)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "m_participantsOutsideMap.remove participantId: " << data.participantId();
|
||||
DEBUG_LOG(m_logger) << "m_participantsOutsideMap.remove participantId: " << data.participantId;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (data.participantId() == m_followParticipantId)
|
||||
if (data.participantId == m_followParticipantId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Center Map to participantId=" << data.participantId();
|
||||
DEBUG_LOG(m_logger) << "Center Map to participantId=" << data.participantId;
|
||||
DEBUG_LOG(m_logger) << "onParticipantPositionChanged()"
|
||||
<< " participantId; " << data.participantId()
|
||||
<< " participantTypeId: " << data.participantTypeId()
|
||||
<< " partyId: " << data.partyId();
|
||||
<< " participantId; " << data.participantId
|
||||
<< " participantTypeId: " << data.participantTypeId
|
||||
<< " partyId: " << data.partyId;
|
||||
if (m_sitMapGuiIfc)
|
||||
m_sitMapGuiIfc->setCenterPoint(QPointF(data.pos().lon(), data.pos().lat()));
|
||||
m_sitMapGuiIfc->setCenterPoint(QPointF(data.pos.lon, data.pos.lat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InterfaceImpl::onUnitPositionChanged(const ParticipantManagement::UnitPosition &data, DataModification modType)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onUnitPositionChanged id=" << data.participantId()
|
||||
DEBUG_LOG(m_logger) << "onUnitPositionChanged id=" << data.participantId
|
||||
<< " m_followParticipantId=" << m_followParticipantId ;
|
||||
if (m_followParticipantId == 0)
|
||||
return;
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
if (data.participantId() == m_followParticipantId)
|
||||
if (data.participantId == m_followParticipantId)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "Center Map to participantId=" << data.participantId()
|
||||
DEBUG_LOG(m_logger) << "Center Map to participantId=" << data.participantId
|
||||
<< ", onUnitPositionChanged()"
|
||||
<< " participantId; " << data.participantId();
|
||||
<< " participantId; " << data.participantId;
|
||||
if (m_sitMapGuiIfc)
|
||||
{
|
||||
const int operatorId = LtsSessionData::LtsSessionData::getInstance()->getOperatorId();
|
||||
@@ -525,9 +525,9 @@ void InterfaceImpl::onUnitPositionChanged(const ParticipantManagement::UnitPosit
|
||||
const bool bCenter = m_symbolAppearanceSettings &&
|
||||
(m_symbolAppearanceSettings->settings().symbolSettings.unitSymbolPosition == FilterManagement::SymbolAppearanceSettings::UnitSymbolPosition::Center);
|
||||
if (bCenter)
|
||||
m_sitMapGuiIfc->setCenterPoint(QPointF(data.positionCenter().lon(), data.positionCenter().lat()));
|
||||
m_sitMapGuiIfc->setCenterPoint(QPointF(data.positionCenter.lon, data.positionCenter.lat));
|
||||
else
|
||||
m_sitMapGuiIfc->setCenterPoint(QPointF(data.positionLeader().lon(), data.positionLeader().lat()));
|
||||
m_sitMapGuiIfc->setCenterPoint(QPointF(data.positionLeader.lon, data.positionLeader.lat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-4
@@ -3,6 +3,7 @@
|
||||
|
||||
#pragma once
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
|
||||
|
||||
namespace ParticipantManagement
|
||||
@@ -11,15 +12,15 @@ namespace ParticipantManagement
|
||||
inline bool compareGear(const GearInformation &a,
|
||||
const GearInformation &b)
|
||||
{
|
||||
if (a.gearId() != b.gearId())
|
||||
return a.gearId() < b.gearId();
|
||||
return a.chargeTypeId() < b.chargeTypeId();
|
||||
if (a.gearId != b.gearId)
|
||||
return a.gearId < b.gearId;
|
||||
return a.chargeTypeId < b.chargeTypeId;
|
||||
}
|
||||
|
||||
inline bool compareSanMat(const SanitationMaterial &a,
|
||||
const SanitationMaterial &b)
|
||||
{
|
||||
return a.materialId() < b.materialId();
|
||||
return a.materialId < b.materialId;
|
||||
}
|
||||
|
||||
}
|
||||
+7
-5
@@ -2,9 +2,11 @@
|
||||
|
||||
|
||||
#include "participant_info_ltd_gear_component.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
#include <QtWidgets/QTableWidget>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
|
||||
#include <LtsWidgets/lts_led_widget.h>
|
||||
|
||||
@@ -26,7 +28,7 @@ void ParticipantInfoLtdGearComponent::updateData(const std::vector<LaserDesignat
|
||||
|
||||
for (const LaserDesignation &laserDesignation : newData)
|
||||
{
|
||||
if (m_rowPerGearId.contains(laserDesignation.gearId()))
|
||||
if (m_rowPerGearId.contains(laserDesignation.gearId))
|
||||
updateRow(laserDesignation);
|
||||
}
|
||||
|
||||
@@ -61,11 +63,11 @@ void ParticipantInfoLtdGearComponent::updateRow(const LaserDesignation &laserDes
|
||||
{
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << ": " << laserDesignation;
|
||||
|
||||
if (!m_rowPerGearId.contains(laserDesignation.gearId()) || !m_rowPerGearId.value(laserDesignation.gearId()).isValid())
|
||||
if (!m_rowPerGearId.contains(laserDesignation.gearId) || !m_rowPerGearId.value(laserDesignation.gearId).isValid())
|
||||
return;
|
||||
|
||||
m_rowPerGearId.value(laserDesignation.gearId()).chargeType->setText(QString::number(laserDesignation.code()));
|
||||
m_rowPerGearId.value(laserDesignation.gearId()).remain->setStatus(laserDesignation.outputPower());
|
||||
m_rowPerGearId.value(laserDesignation.gearId).chargeType->setText(QString::number(laserDesignation.code));
|
||||
m_rowPerGearId.value(laserDesignation.gearId).remain->setStatus(laserDesignation.outputPower);
|
||||
}
|
||||
|
||||
void ParticipantInfoLtdGearComponent::removeOutdatedData(const std::vector<LaserDesignation> &newData)
|
||||
@@ -77,7 +79,7 @@ void ParticipantInfoLtdGearComponent::removeOutdatedData(const std::vector<Laser
|
||||
|
||||
for (auto it = m_rowPerGearId.constBegin(); it != m_rowPerGearId.constEnd(); ++it)
|
||||
{
|
||||
auto findIt = std::find_if(newData.begin(), newData.end(), [it](const LaserDesignation &laserDesignation) { return laserDesignation.gearId() == it.key(); });
|
||||
auto findIt = std::find_if(newData.begin(), newData.end(), [it](const LaserDesignation &laserDesignation) { return laserDesignation.gearId == it.key(); });
|
||||
|
||||
if (findIt == newData.end())
|
||||
updateRow({it.key(), {}, 0, .0});
|
||||
|
||||
+1
@@ -21,6 +21,7 @@ ParticipantInfoTableDialog::ParticipantInfoTableDialog(const QString &menuGroup,
|
||||
, m_infoTableModel(nullptr)
|
||||
, m_sortFilterProxyModel(nullptr)
|
||||
, m_visibleColumns()
|
||||
, m_logger(getLogger("ParticipantInfoTableDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
|
||||
+1
@@ -13,6 +13,7 @@
|
||||
|
||||
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_participant_info_gui_plugin_interface.h>
|
||||
|
||||
|
||||
|
||||
+37
-36
@@ -28,6 +28,7 @@ ParticipantInfoTableModel::ParticipantInfoTableModel(QObject *parent)
|
||||
, m_partitionTime(0)
|
||||
, m_timeoutCheckTimer(new QTimer(this))
|
||||
, m_bWithPositionandBiteResult(true)
|
||||
, m_logger(getLogger("ParticipantInfoTableModel"))
|
||||
{
|
||||
m_timeoutCheckTimer->setSingleShot(false);
|
||||
connect(m_timeoutCheckTimer, &QTimer::timeout,
|
||||
@@ -83,7 +84,7 @@ void ParticipantInfoTableModel::initializeDataView()
|
||||
m_vecData.clear();
|
||||
auto cb = [this](const Participant &p)
|
||||
{
|
||||
if (!p.equipmentNumber().is_set() || p.equipmentNumber().get() == 0)
|
||||
if (!p.equipmentNumber.has_value() || p.equipmentNumber.get() == 0)
|
||||
return;
|
||||
m_vecData += setInfoData(p);
|
||||
};
|
||||
@@ -131,7 +132,7 @@ QVariant ParticipantInfoTableModel::data(const QModelIndex &index, int role) con
|
||||
static const QIcon yellow(QLatin1String("icon:yellow_light.svg"));
|
||||
static const QIcon red(QLatin1String("icon:red_light.svg"));
|
||||
|
||||
switch (data.vulnerabilityState.underlying())
|
||||
switch (data.vulnerabilityState)
|
||||
{
|
||||
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady:
|
||||
return green;
|
||||
@@ -194,7 +195,7 @@ void ParticipantInfoTableModel::updateDataView(const QSet<int> &participantIds)
|
||||
std::function<bool(const ParticipantManagement::Participant &)> cb =
|
||||
[this, &participantIdsToAdd](const ParticipantManagement::Participant &part)
|
||||
{
|
||||
auto it = participantIdsToAdd.find(part.id());
|
||||
auto it = participantIdsToAdd.find(part.id);
|
||||
if (it != participantIdsToAdd.end())
|
||||
{
|
||||
participantIdsToAdd.erase(it);
|
||||
@@ -212,7 +213,7 @@ void ParticipantInfoTableModel::onParticipantChanged(const ParticipantManagement
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "**** participantDataChanged";
|
||||
|
||||
const int row = findRowForId(data.participantId());
|
||||
const int row = findRowForId(data.participantId);
|
||||
if (row < 0)
|
||||
return;
|
||||
|
||||
@@ -222,11 +223,11 @@ void ParticipantInfoTableModel::onParticipantChanged(const ParticipantManagement
|
||||
case DataModification::eModified:
|
||||
{
|
||||
ParticipantInfo info = getRowData(row);
|
||||
if (info.participantId != data.participantId())
|
||||
if (info.participantId != data.participantId)
|
||||
fillParticipantContent(info, data);
|
||||
|
||||
info.vulnerabilityState = m_ppmDtc->youngestStateInformation(data.stateHistory()).vulnerabilityState();
|
||||
info.isManipulated = data.manipulation().size();
|
||||
info.vulnerabilityState = m_ppmDtc->youngestStateInformation(data.stateHistory).vulnerabilityState;
|
||||
info.isManipulated = data.manipulation.size();
|
||||
setRowData(row, info);
|
||||
break;
|
||||
}
|
||||
@@ -240,7 +241,7 @@ ParticipantInfo ParticipantInfoTableModel::setInfoData(const Participant &part)
|
||||
{
|
||||
ParticipantInfo data;
|
||||
|
||||
const int participantId = part.id();
|
||||
const int participantId = part.id;
|
||||
fillParticipantContent(data, part);
|
||||
|
||||
if (m_bWithPositionandBiteResult)
|
||||
@@ -249,19 +250,19 @@ ParticipantInfo ParticipantInfoTableModel::setInfoData(const Participant &part)
|
||||
std::function<bool(const ParticipantManagement::Bite &)> cbBite =
|
||||
[&participantBite, participantId](const ParticipantManagement::Bite &bite)
|
||||
{
|
||||
if (participantId != bite.participantId())
|
||||
if (participantId != bite.participantId)
|
||||
return false;
|
||||
participantBite = bite;
|
||||
return true;
|
||||
};
|
||||
m_ppmDtc->bites(cbBite);
|
||||
data.biteResult = biteStringFromBite(participantBite);
|
||||
data.biteSampleTime = participantBite.sampleTime();
|
||||
data.biteSampleTime = participantBite.sampleTime;
|
||||
|
||||
std::function<bool(const ParticipantManagement::ParticipantPosition &data)> cbPos =
|
||||
[this, &data, participantId](const ParticipantManagement::ParticipantPosition &pos)
|
||||
{
|
||||
if (participantId != pos.participantId())
|
||||
if (participantId != pos.participantId)
|
||||
return false;
|
||||
updatePosition(data, pos);
|
||||
return true;
|
||||
@@ -270,10 +271,10 @@ ParticipantInfo ParticipantInfoTableModel::setInfoData(const Participant &part)
|
||||
}
|
||||
|
||||
const auto dynPart = m_ppmDtc->dynamicParticipantData(participantId);
|
||||
data.vulnerabilityState = m_ppmDtc->youngestStateInformation(dynPart.stateHistory()).vulnerabilityState();
|
||||
data.isManipulated = dynPart.manipulation().size() != 0;
|
||||
data.designator = QString::fromStdString(part.designator());
|
||||
data.tacticalIdentifier = QString::fromStdString(part.tacticalIdentifier());
|
||||
data.vulnerabilityState = m_ppmDtc->youngestStateInformation(dynPart.stateHistory).vulnerabilityState;
|
||||
data.isManipulated = dynPart.manipulation.size() != 0;
|
||||
data.designator = QString::fromStdString(part.designator);
|
||||
data.tacticalIdentifier = QString::fromStdString(part.tacticalIdentifier);
|
||||
|
||||
return data;
|
||||
}
|
||||
@@ -285,7 +286,7 @@ void ParticipantInfoTableModel::onPositionChanged(const ParticipantManagement::P
|
||||
(modType != DataModification::eModified))
|
||||
return;
|
||||
|
||||
const int row = findRowForId(position.participantId());
|
||||
const int row = findRowForId(position.participantId);
|
||||
if (row < 0)
|
||||
return;
|
||||
ParticipantInfo &info = m_vecData[row];
|
||||
@@ -300,11 +301,11 @@ void ParticipantInfoTableModel::onBiteChanged(const ParticipantManagement::Bite
|
||||
(modType != DataModification::eModified))
|
||||
return;
|
||||
|
||||
const int row = findRowForId(bite.participantId());
|
||||
const int row = findRowForId(bite.participantId);
|
||||
if (row < 0)
|
||||
return;
|
||||
ParticipantInfo &info = m_vecData[row];
|
||||
info.biteSampleTime = bite.sampleTime();
|
||||
info.biteSampleTime = bite.sampleTime;
|
||||
info.biteResult = biteStringFromBite(bite);
|
||||
|
||||
emit dataChanged(index(row, BiteResult), index(row, BiteResult), {Qt::BackgroundRole, Qt::DisplayRole});
|
||||
@@ -321,7 +322,7 @@ void ParticipantInfoTableModel::onPartyChanged(const ParticipantManagement::Part
|
||||
if (modType == DataModification::eRemoved)
|
||||
return;
|
||||
if (m_ppmGuiCbxIfc)
|
||||
m_partyIcons[party.id()] = m_ppmGuiCbxIfc->pixmapFromParty(QColor::fromRgb(QRgb(party.color())));
|
||||
m_partyIcons[party.id] = m_ppmGuiCbxIfc->pixmapFromParty(QColor::fromRgb(QRgb(party.color)));
|
||||
}
|
||||
|
||||
void ParticipantInfoTableModel::onTimeoutCheck()
|
||||
@@ -343,32 +344,32 @@ void ParticipantInfoTableModel::onTimeoutCheck()
|
||||
void ParticipantInfoTableModel::fillParticipantContent(ParticipantInfo &info,
|
||||
const ParticipantManagement::DynamicParticipantData &data) const
|
||||
{
|
||||
fillParticipantContent(info, m_ppmDtc->participant(data.participantId()));
|
||||
fillParticipantContent(info, m_ppmDtc->participant(data.participantId));
|
||||
}
|
||||
|
||||
void ParticipantInfoTableModel::fillParticipantContent(ParticipantInfo &info,
|
||||
const ParticipantManagement::Participant &part) const
|
||||
|
||||
{
|
||||
info.participantId = part.id();
|
||||
info.equipmentNumber = part.equipmentNumber().is_set() ? part.equipmentNumber().get() : 0;
|
||||
info.partyId = part.partyId();
|
||||
info.typeClass = m_ppmDtc->type(part.typeId()).typeClass();
|
||||
info.participantId = part.id;
|
||||
info.equipmentNumber = part.equipmentNumber.has_value() ? part.equipmentNumber.get() : 0;
|
||||
info.partyId = part.partyId;
|
||||
info.typeClass = m_ppmDtc->type(part.typeId).typeClass;
|
||||
}
|
||||
|
||||
void ParticipantInfoTableModel::updatePosition(ParticipantInfo &info,
|
||||
const ParticipantManagement::ParticipantPosition &position) const
|
||||
{
|
||||
if (!std::isnan(position.pos().lon()) && !std::isnan(position.pos().lat()))
|
||||
if (!std::isnan(position.pos.lon) && !std::isnan(position.pos.lat))
|
||||
{
|
||||
info.positionString = LtsCoordTrans::mgrsFromGeographic(position.pos().lon(),
|
||||
position.pos().lat());
|
||||
if (!qFuzzyIsNull(position.pos().z()))
|
||||
info.positionString.append(QStringLiteral(" ") + QString::number(position.pos().z(), 'f', 2));
|
||||
info.positionString = LtsCoordTrans::mgrsFromGeographic(position.pos.lon,
|
||||
position.pos.lat);
|
||||
if (!qFuzzyIsNull(position.pos.z))
|
||||
info.positionString.append(QStringLiteral(" ") + QString::number(position.pos.z, 'f', 2));
|
||||
}
|
||||
else
|
||||
info.positionString = tr("Invalid position");
|
||||
info.positionSampleTime = position.sampleTime();
|
||||
info.positionSampleTime = position.sampleTime;
|
||||
info.isOutdated = isOutdated(info.positionSampleTime);
|
||||
}
|
||||
|
||||
@@ -379,12 +380,12 @@ bool ParticipantInfoTableModel::isOutdated(qint64 sampleTime) const
|
||||
|
||||
QString ParticipantInfoTableModel::biteStringFromBite(const ParticipantManagement::Bite &bite) const
|
||||
{
|
||||
if (!(bite.sampleTime() > 0))
|
||||
if (!(bite.sampleTime > 0))
|
||||
return tr("--");
|
||||
|
||||
bool bitStat = bite.biteState() != bite.configState();
|
||||
bool batW = bite.batteryState() > 0;
|
||||
bool confError = bite.configError();
|
||||
bool bitStat = bite.biteState != bite.configState;
|
||||
bool batW = bite.batteryState > 0;
|
||||
bool confError = bite.configError;
|
||||
if (!bitStat && !batW && !confError )
|
||||
return tr("Ok");
|
||||
|
||||
@@ -401,8 +402,8 @@ QString ParticipantInfoTableModel::biteStringFromBite(const ParticipantManagemen
|
||||
QString ParticipantInfoTableModel::vulnerabilityStateString(const ParticipantInfo &data)
|
||||
{
|
||||
const ProjectDataManagement::VulnerabilityClass vc = data.typeClass == ParticipantManagement::TypeClass::Human ?
|
||||
ProjectDataManagement::VulnerabilityClass::SoldierInjuries :
|
||||
ProjectDataManagement::VulnerabilityClass::VehicleDamages;
|
||||
ProjectDataManagement::VulnerabilityClass::VulnerabilityClass_SoldierInjuries :
|
||||
ProjectDataManagement::VulnerabilityClass::VulnerabilityClass_VehicleDamages;
|
||||
|
||||
return ProjectDataManagement::toString(data.vulnerabilityState, vc);
|
||||
}
|
||||
|
||||
+10
-9
@@ -19,6 +19,7 @@ ParticipantSearchDialog::ParticipantSearchDialog(QWidget *parent)
|
||||
, m_dtc(nullptr)
|
||||
, m_ppmCbxIfc(nullptr)
|
||||
, m_ui(new Ui::ParticipantSearchDialog)
|
||||
, m_logger(getLogger("ParticipantSearchDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->leEquipNo->setValidator(new QIntValidator(0, 100000, m_ui->leEquipNo));
|
||||
@@ -172,7 +173,7 @@ void ParticipantSearchDialog::updateObjectIndicator()
|
||||
m_sitMapGuiIfc->removeObjectIndicator();
|
||||
}
|
||||
|
||||
void ParticipantSearchDialog::enterEvent(QEvent *e)
|
||||
void ParticipantSearchDialog::enterEvent(QEnterEvent *e)
|
||||
{
|
||||
BaseClass::enterEvent(e);
|
||||
updateObjectIndicator();
|
||||
@@ -198,10 +199,10 @@ int ParticipantSearchDialog::onSelectionChanged()
|
||||
|
||||
ParticipantManagement::ParticipantData data;
|
||||
data = m_model->getParticipantData(index);
|
||||
if (!data.equipmentNumber().is_set())
|
||||
if (!data.equipmentNumber.has_value())
|
||||
return -1;
|
||||
|
||||
return data.equipmentNumber().get();
|
||||
return data.equipmentNumber.get();
|
||||
}
|
||||
|
||||
void ParticipantSearchDialog::onDoubleClicked()
|
||||
@@ -212,9 +213,9 @@ void ParticipantSearchDialog::onDoubleClicked()
|
||||
data = m_model->getParticipantData(index);
|
||||
|
||||
if (m_ppmGuiIfc)
|
||||
m_ppmGuiIfc->showParticipantInfoWindow(data.id());
|
||||
m_ppmGuiIfc->showParticipantInfoWindow(data.id);
|
||||
if (m_ocParticipantInfoIfc)
|
||||
m_ocParticipantInfoIfc->showOcParticipantInfoWindow(data.id());
|
||||
m_ocParticipantInfoIfc->showOcParticipantInfoWindow(data.id);
|
||||
}
|
||||
|
||||
void ParticipantSearchDialog::clearSelections()
|
||||
@@ -257,8 +258,8 @@ void ParticipantSearchDialog::fillMapFromDtc()
|
||||
m_participantMap.clear();
|
||||
auto cb = [this](const Participant & data)
|
||||
{
|
||||
if (data.equipmentNumber().is_set())
|
||||
m_participantMap.insert(data.equipmentNumber().get(), data.id());
|
||||
if (data.equipmentNumber.has_value())
|
||||
m_participantMap.insert(data.equipmentNumber.get(), data.id);
|
||||
};
|
||||
m_dtc->participants(cb);
|
||||
}
|
||||
@@ -317,8 +318,8 @@ void ParticipantSearchDialog::fillParticipantMapFromTree(const QModelIndex &pare
|
||||
fillParticipantMapFromTree(m_model->index(row, 0, parent));
|
||||
|
||||
const ParticipantManagement::ParticipantData data(m_model->getParticipantData(parent));
|
||||
if (data.equipmentNumber().is_set())
|
||||
m_participantMap.insert(data.equipmentNumber().get(), data.id());
|
||||
if (data.equipmentNumber.has_value())
|
||||
m_participantMap.insert(data.equipmentNumber.get(), data.id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+2
-1
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
|
||||
|
||||
|
||||
@@ -52,7 +53,7 @@ public:
|
||||
private slots:
|
||||
void slotLookup();
|
||||
void updateObjectIndicator();
|
||||
void enterEvent(QEvent *e) override;
|
||||
void enterEvent(QEnterEvent *e) override;
|
||||
void leaveEvent(QEvent *e) override;
|
||||
|
||||
private:
|
||||
|
||||
+10
-10
@@ -25,27 +25,27 @@ void ParticipantSearchWidget::onOkay()
|
||||
}
|
||||
void ParticipantSearchWidget::onParticipantChanged(const ParticipantManagement::Participant &data, DataModification modType)
|
||||
{
|
||||
const int newEqId = data.equipmentNumber().is_set() ? data.equipmentNumber().get() : 0;
|
||||
const int newEqId = data.equipmentNumber.has_value() ? data.equipmentNumber.get() : 0;
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
{
|
||||
const int oldEqId = m_partId2EqId.value(data.id());
|
||||
const int oldEqId = m_partId2EqId.value(data.id);
|
||||
if (oldEqId == newEqId)
|
||||
return;
|
||||
if (oldEqId != 0)
|
||||
m_eqId2PartId.remove(oldEqId);
|
||||
if (newEqId == 0)
|
||||
return;
|
||||
m_partId2EqId[data.id()] = newEqId;
|
||||
m_eqId2PartId[newEqId] = data.id();
|
||||
m_partId2EqId[data.id] = newEqId;
|
||||
m_eqId2PartId[newEqId] = data.id;
|
||||
break;
|
||||
}
|
||||
case DataModification::eRemoved:
|
||||
{
|
||||
const int oldEqId = m_partId2EqId.value(data.id());
|
||||
m_partId2EqId.remove(data.id());
|
||||
const int oldEqId = m_partId2EqId.value(data.id);
|
||||
m_partId2EqId.remove(data.id);
|
||||
if (oldEqId != 0)
|
||||
m_eqId2PartId.remove(oldEqId);
|
||||
}
|
||||
@@ -59,11 +59,11 @@ bool ParticipantSearchWidget::init(const std::shared_ptr<ParticipantManagement::
|
||||
|
||||
auto cb = [this](const Participant &data)
|
||||
{
|
||||
if (!data.equipmentNumber().is_set())
|
||||
if (!data.equipmentNumber.has_value())
|
||||
return;
|
||||
const int newEqId = data.equipmentNumber().get();
|
||||
m_partId2EqId[data.id()] = newEqId;
|
||||
m_eqId2PartId[newEqId] = data.id();
|
||||
const int newEqId = data.equipmentNumber.get();
|
||||
m_partId2EqId[data.id] = newEqId;
|
||||
m_eqId2PartId[newEqId] = data.id;
|
||||
};
|
||||
dtc->participants(cb);
|
||||
connect(dtc.get(), &Interface::Dtc::participantChanged,
|
||||
|
||||
+1
@@ -6,6 +6,7 @@
|
||||
#include <QtCore/QMap>
|
||||
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_ftc.h>
|
||||
|
||||
enum class DataModification;
|
||||
|
||||
+34
-33
@@ -27,6 +27,7 @@ ParticipantSetInjuryDialog::ParticipantSetInjuryDialog(int participantId, QWidge
|
||||
, m_bgBodypart(nullptr)
|
||||
, m_bgSide(nullptr)
|
||||
, m_ui(new Ui::ParticipantSetInjuryDialog)
|
||||
, m_logger(getLogger("ParticipantSetInjuryDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
@@ -57,10 +58,10 @@ bool ParticipantSetInjuryDialog::init(LtsSession::LtsSession *session,
|
||||
m_dtcPdm->waitForHistoricalDataSanitationInjuryPlace2(1000);
|
||||
|
||||
const Participant participant = m_dtc->participant(m_participantId);
|
||||
if (participant.equipmentNumber().is_set())
|
||||
m_eqId = participant.equipmentNumber().get();
|
||||
if (participant.equipmentNumber.has_value())
|
||||
m_eqId = participant.equipmentNumber.get();
|
||||
|
||||
if (m_dtc->type(participant.typeId()).typeClass() != TypeClass::Human)
|
||||
if (m_dtc->type(participant.typeId).typeClass != TypeClass::Human)
|
||||
return false;
|
||||
auto vec = vulnerabilityStatesForTypeClass(TypeClass::Human);
|
||||
if (!vec.contains(ProjectDataManagement::VulnerabilityState::VulnerabilityState_LightDamage)
|
||||
@@ -127,8 +128,8 @@ void ParticipantSetInjuryDialog::createButtonGroups()
|
||||
m_bgInjury = new QButtonGroup(this);
|
||||
for (const auto &injuryKind : std::as_const(m_injuryKind))
|
||||
{
|
||||
rb = new QRadioButton(ProjectDataManagement::trSanitationInjuryKindName(injuryKind.name()), this);
|
||||
m_bgInjury->addButton(rb, injuryKind.id());
|
||||
rb = new QRadioButton(ProjectDataManagement::trSanitationInjuryKindName(injuryKind.name), this);
|
||||
m_bgInjury->addButton(rb, injuryKind.id);
|
||||
m_ui->gbInjury->layout()->addWidget(rb);
|
||||
}
|
||||
|
||||
@@ -139,8 +140,8 @@ void ParticipantSetInjuryDialog::createButtonGroups()
|
||||
m_bgBodypart = new QButtonGroup(this);
|
||||
for (const auto &injuryplace1 : std::as_const(m_injuryPlace1))
|
||||
{
|
||||
rb = new QRadioButton(ProjectDataManagement::trSanitationInjuryPlace1Name(injuryplace1.name()), this);
|
||||
m_bgBodypart->addButton(rb, injuryplace1.id());
|
||||
rb = new QRadioButton(ProjectDataManagement::trSanitationInjuryPlace1Name(injuryplace1.name), this);
|
||||
m_bgBodypart->addButton(rb, injuryplace1.id);
|
||||
m_ui->gbBodyPart->layout()->addWidget(rb);
|
||||
}
|
||||
|
||||
@@ -151,29 +152,29 @@ void ParticipantSetInjuryDialog::createButtonGroups()
|
||||
m_bgSide = new QButtonGroup(this);
|
||||
for (const auto &injuryplace2 : std::as_const(m_injuryPlace2))
|
||||
{
|
||||
rb = new QRadioButton(ProjectDataManagement::trSanitationInjuryPlace2Name(injuryplace2.name()), this);
|
||||
m_bgSide->addButton(rb, injuryplace2.id());
|
||||
rb = new QRadioButton(ProjectDataManagement::trSanitationInjuryPlace2Name(injuryplace2.name), this);
|
||||
m_bgSide->addButton(rb, injuryplace2.id);
|
||||
m_ui->gbSide->layout()->addWidget(rb);
|
||||
}
|
||||
|
||||
item = new QSpacerItem(2,2,QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
|
||||
m_ui->gbSide->layout()->addItem(item);
|
||||
|
||||
connect(m_bgInjury, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &ParticipantSetInjuryDialog::checkRadioStatesBody);
|
||||
connect(m_bgBodypart, QOverload<int>::of(&QButtonGroup::buttonClicked), this, &ParticipantSetInjuryDialog::checkRadioStatesSides);
|
||||
connect(m_bgInjury, &QButtonGroup::buttonClicked, this, &ParticipantSetInjuryDialog::checkRadioStatesBody);
|
||||
connect(m_bgBodypart, &QButtonGroup::buttonClicked, this, &ParticipantSetInjuryDialog::checkRadioStatesSides);
|
||||
|
||||
}
|
||||
|
||||
void ParticipantSetInjuryDialog::setOldData(const DynamicParticipantData &data)
|
||||
{
|
||||
if (data.stateHistory().size() == 0)
|
||||
if (data.stateHistory.size() == 0)
|
||||
return;
|
||||
|
||||
const StateInformation &lastState = m_dtc->youngestStateInformation(data.stateHistory());
|
||||
const StateInformation &lastState = m_dtc->youngestStateInformation(data.stateHistory);
|
||||
|
||||
|
||||
|
||||
int index = m_ui->cbState->findData(lastState.vulnerabilityState().underlying());
|
||||
int index = m_ui->cbState->findData(static_cast<int>(lastState.vulnerabilityState));
|
||||
|
||||
DEBUG_LOG(m_logger) << "Old vulnerability state = " << index;
|
||||
|
||||
@@ -206,14 +207,14 @@ void ParticipantSetInjuryDialog::checkRadioStatesBody()
|
||||
bool firstAvailable = true;
|
||||
for (const ProjectDataManagement::SanitationInjury& injury : std::as_const(m_injuries))
|
||||
{
|
||||
if (injury.kind() == m_bgInjury->checkedId())
|
||||
if (injury.kind == m_bgInjury->checkedId())
|
||||
{
|
||||
if (firstAvailable)
|
||||
{
|
||||
m_bgBodypart->button(injury.place1())->setChecked(true);
|
||||
m_bgBodypart->button(injury.place1)->setChecked(true);
|
||||
firstAvailable = false;
|
||||
}
|
||||
m_bgBodypart->button(injury.place1())->setEnabled(true);
|
||||
m_bgBodypart->button(injury.place1)->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,8 +231,8 @@ void ParticipantSetInjuryDialog::checkRadioStatesSides()
|
||||
|
||||
for (const ProjectDataManagement::SanitationInjury& injury : std::as_const(m_injuries))
|
||||
{
|
||||
if (injury.kind() == m_bgInjury->checkedId() && injury.place1() == m_bgBodypart->checkedId())
|
||||
m_bgSide->button(injury.place2())->setEnabled(true);
|
||||
if (injury.kind == m_bgInjury->checkedId() && injury.place1 == m_bgBodypart->checkedId())
|
||||
m_bgSide->button(injury.place2)->setEnabled(true);
|
||||
}
|
||||
if(!m_bgSide->button(1)->isEnabled())
|
||||
m_bgSide->button(0)->setChecked(true);
|
||||
@@ -261,27 +262,27 @@ void ParticipantSetInjuryDialog::checkState()
|
||||
|
||||
for (const ProjectDataManagement::SanitationInjury& injury : std::as_const(m_injuries))
|
||||
{
|
||||
if (injury.kind() == m_bgInjury->checkedId() && injury.place1() == m_bgBodypart->checkedId() && injury.place2() == m_bgSide->checkedId())
|
||||
if (injury.kind == m_bgInjury->checkedId() && injury.place1 == m_bgBodypart->checkedId() && injury.place2 == m_bgSide->checkedId())
|
||||
{
|
||||
|
||||
switch (injury.vbg())
|
||||
switch (injury.vbg)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
if (m_ui->cbState->findData(ProjectDataManagement::VulnerabilityState::LightDamage) < 1)
|
||||
m_ui->cbState->addItem(lightDamage, ProjectDataManagement::VulnerabilityState::LightDamage);
|
||||
if (m_ui->cbState->findData(static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_LightDamage)) < 1)
|
||||
m_ui->cbState->addItem(lightDamage, static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_LightDamage));
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
if (m_ui->cbState->findData(ProjectDataManagement::VulnerabilityState::MediumDamage) < 1)
|
||||
m_ui->cbState->addItem(mediumDamage, ProjectDataManagement::VulnerabilityState::MediumDamage);
|
||||
if (m_ui->cbState->findData(static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_MediumDamage)) < 1)
|
||||
m_ui->cbState->addItem(mediumDamage, static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_MediumDamage));
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
if (m_ui->cbState->findData(ProjectDataManagement::VulnerabilityState::HeavyDamage) < 1)
|
||||
m_ui->cbState->addItem(heavyDamage, ProjectDataManagement::VulnerabilityState::HeavyDamage);
|
||||
if (m_ui->cbState->findData(static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_HeavyDamage)) < 1)
|
||||
m_ui->cbState->addItem(heavyDamage, static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_HeavyDamage));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -323,13 +324,13 @@ bool ParticipantSetInjuryDialog::apply()
|
||||
const ProjectDataManagement::VulnerabilityState state = static_cast<ProjectDataManagement::VulnerabilityState>(m_ui->cbState->currentData().toInt());
|
||||
|
||||
ModifyStateRequest req;
|
||||
req.workstationId(LtsSessionData::LtsSessionData::getInstance()->getWorkstationId());
|
||||
req.vulnerabilityState(state);
|
||||
req.participantIds({m_participantId});
|
||||
req.vulnerabilityKind(getInjuryBit());
|
||||
req.workstationId = LtsSessionData::LtsSessionData::getInstance()->getWorkstationId();
|
||||
req.vulnerabilityState = state;
|
||||
req.participantIds = {m_participantId};
|
||||
req.vulnerabilityKind = getInjuryBit();
|
||||
|
||||
DEBUG_LOG(m_logger) << "Saving vulnerability state = " << req.vulnerabilityState();
|
||||
DEBUG_LOG(m_logger) << "Saving vulnerability kind = " << req.vulnerabilityKind();
|
||||
DEBUG_LOG(m_logger) << "Saving vulnerability state = " << req.vulnerabilityState;
|
||||
DEBUG_LOG(m_logger) << "Saving vulnerability kind = " << req.vulnerabilityKind;
|
||||
|
||||
return m_requestHelper->startSingleRequest([req, this]()
|
||||
{
|
||||
|
||||
+1
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_ftc.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
|
||||
+14
-13
@@ -18,6 +18,7 @@ ParticipantSetSanitationDialog::ParticipantSetSanitationDialog(int participantId
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_participantId(participantId)
|
||||
, m_ui(new Ui::ParticipantSetSanitationDialog)
|
||||
, m_logger(getLogger("ParticipantSetSanitationDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_uiRequirements->addRequirement({ m_ui->lbl, [this]()
|
||||
@@ -60,8 +61,8 @@ bool ParticipantSetSanitationDialog::init(LtsSession::LtsSession *session, const
|
||||
dtcPdm->waitForHistoricalDataSanitationProcedure(2000);
|
||||
|
||||
const Participant participant = m_dtc->participant(m_participantId);
|
||||
if (participant.equipmentNumber().is_set())
|
||||
m_eqId = participant.equipmentNumber().get();
|
||||
if (participant.equipmentNumber.has_value())
|
||||
m_eqId = participant.equipmentNumber.get();
|
||||
|
||||
fillCb();
|
||||
connect(m_ui->cbQualification, qOverload<int>(&QComboBox::currentIndexChanged), this, &ParticipantSetSanitationDialog::onQualificationChanged);
|
||||
@@ -95,14 +96,14 @@ void ParticipantSetSanitationDialog::fillCb()
|
||||
|
||||
for (const auto &proc : procs)
|
||||
{
|
||||
QGroupBox *box = getGroupBox(proc.type());
|
||||
QGroupBox *box = getGroupBox(proc.type);
|
||||
if (!box)
|
||||
continue;
|
||||
QCheckBox *cbx = new QCheckBox(this);
|
||||
|
||||
cbx->setText(ProjectDataManagement::trSanitationProcedureName(proc.name()));
|
||||
cbx->setProperty("dataCode",proc.dataCode());
|
||||
cbx->setProperty("qualification",proc.minimumQualification());
|
||||
cbx->setText(ProjectDataManagement::trSanitationProcedureName(proc.name));
|
||||
cbx->setProperty("dataCode",static_cast<qint64>(proc.dataCode));
|
||||
cbx->setProperty("qualification",proc.minimumQualification);
|
||||
box->layout()->addWidget(cbx);
|
||||
m_procedures.append(cbx);
|
||||
}
|
||||
@@ -190,15 +191,15 @@ bool ParticipantSetSanitationDialog::apply()
|
||||
{
|
||||
|
||||
SetSanitationRequest req;
|
||||
req.id(m_participantId);
|
||||
req.id = m_participantId;
|
||||
SanitationData sanDat;
|
||||
sanDat.sanitationProceduresTaken(getProcedures());
|
||||
sanDat.qualification(static_cast<Qualification>(m_ui->cbQualification->currentData().toInt()));
|
||||
sanDat.originatorEquipmentNumber(0);
|
||||
req.data(sanDat);
|
||||
sanDat.sanitationProceduresTaken = getProcedures();
|
||||
sanDat.qualification = static_cast<Qualification>(m_ui->cbQualification->currentData().toInt());
|
||||
sanDat.originatorEquipmentNumber = 0;
|
||||
req.data = sanDat;
|
||||
|
||||
DEBUG_LOG(m_logger) << "Medic treatment: qualification = " << sanDat.qualification();
|
||||
DEBUG_LOG(m_logger) << "Medic treatment: procedures = " << sanDat.sanitationProceduresTaken();
|
||||
DEBUG_LOG(m_logger) << "Medic treatment: qualification = " << sanDat.qualification;
|
||||
DEBUG_LOG(m_logger) << "Medic treatment: procedures = " << sanDat.sanitationProceduresTaken;
|
||||
|
||||
return m_requestHelper->startSingleRequest([req, this]()
|
||||
{
|
||||
|
||||
+1
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <ParticipantManagement/logger.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_ftc.h>
|
||||
#include <LtsUtils/LtsUtilsGui/LtsUtilsGuiDds/request_helper.h>
|
||||
|
||||
|
||||
+7
-6
@@ -27,15 +27,16 @@ AreaModel::AreaModel(QObject *parent)
|
||||
tr("Coords")
|
||||
},
|
||||
parent)
|
||||
, m_logger(getLogger("AreaModel"))
|
||||
{}
|
||||
|
||||
|
||||
bool AreaModel::initModel(const TargetInformation &targetInformation)
|
||||
{
|
||||
|
||||
INFO_LOG(m_logger) << "initModel - #AreaModel: " << targetInformation.shootbackAreas().size();
|
||||
INFO_LOG(m_logger) << "initModel - #AreaModel: " << targetInformation.shootbackAreas.size();
|
||||
|
||||
for (auto singleArea : std::as_const(targetInformation.shootbackAreas()))
|
||||
for (auto singleArea : std::as_const(targetInformation.shootbackAreas))
|
||||
onShootbackAreaChanged(singleArea, DataModification::eAdded);
|
||||
|
||||
|
||||
@@ -95,7 +96,7 @@ QVariant AreaModel::data(const QModelIndex &index, int role) const
|
||||
if (role == LtsWidgets::LtsColumnFilterProxyModel::ComboboxFilterRole)
|
||||
{
|
||||
if (index.column() == Name)
|
||||
return QString::fromStdString(shootbackArea.identifier());
|
||||
return QString::fromStdString(shootbackArea.identifier);
|
||||
}
|
||||
|
||||
switch (index.column())
|
||||
@@ -103,7 +104,7 @@ QVariant AreaModel::data(const QModelIndex &index, int role) const
|
||||
case Id:
|
||||
return 0;
|
||||
case Name:
|
||||
return QString::fromStdString(shootbackArea.identifier());
|
||||
return QString::fromStdString(shootbackArea.identifier);
|
||||
case Coords:
|
||||
{
|
||||
return QVariant();
|
||||
@@ -126,7 +127,7 @@ void AreaModel::updateColumnFilter()
|
||||
{
|
||||
m_usedNames.clear();
|
||||
for (const ShootbackArea &item : std::as_const(m_vecData))
|
||||
m_usedNames.insert(QString::fromStdString(item.identifier()));
|
||||
m_usedNames.insert(QString::fromStdString(item.identifier));
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +156,7 @@ bool AreaProxyModel::lessThan(const QModelIndex &source_left, const QModelIndex
|
||||
|
||||
|
||||
case AreaModel::Columns::Name:
|
||||
return left.identifier() < right.identifier();
|
||||
return left.identifier < right.identifier;
|
||||
|
||||
|
||||
|
||||
|
||||
+1
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <ParticipantManagement/logger.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
#include <LtsWidgets/lts_column_filter_proxy_model.h>
|
||||
|
||||
|
||||
+58
-56
@@ -1,6 +1,7 @@
|
||||
|
||||
|
||||
#include "participant_target_config_dialog.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <utility>
|
||||
#include "ui_participant_target_config_dialog.h"
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
@@ -26,7 +27,7 @@ Core::GeoPosition2D convert(const QPointF &coord)
|
||||
|
||||
QPointF convert(const Core::GeoPosition2D &geoPos)
|
||||
{
|
||||
return QPointF(geoPos.lon(), geoPos.lat());
|
||||
return QPointF(geoPos.lon, geoPos.lat);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +36,7 @@ ParticipantTargetConfigurationDialog::ParticipantTargetConfigurationDialog(QWidg
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_ui(new Ui::ParticipantTargetConfigurationDialog)
|
||||
, m_logger(getLogger("ParticipantTargetConfigurationDialog"))
|
||||
{
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
m_ui->setupUi(this);
|
||||
@@ -50,8 +52,8 @@ ParticipantTargetConfigurationDialog::~ParticipantTargetConfigurationDialog()
|
||||
|
||||
void ParticipantTargetConfigurationDialog::retranslate()
|
||||
{
|
||||
const dds::core::optional<int32_t> eqId = m_dtc->participant(m_participantId).equipmentNumber();
|
||||
const QString id = (eqId.is_set() ? QString::number(eqId.get()) : QString());
|
||||
const dds::core::optional<int32_t> eqId = m_dtc->participant(m_participantId).equipmentNumber;
|
||||
const QString id = (eqId.has_value() ? QString::number(eqId.get()) : QString());
|
||||
|
||||
translate(m_ui, id, false, tr("Target Configuration"));
|
||||
}
|
||||
@@ -61,7 +63,7 @@ bool ParticipantTargetConfigurationDialog::apply()
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " START";
|
||||
|
||||
ModifyTargetInformationRequest req;
|
||||
req.targetInfo(m_targetInformation);
|
||||
req.targetInfo = m_targetInformation;
|
||||
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " update m_targetInformation: " << m_targetInformation;
|
||||
|
||||
@@ -129,7 +131,7 @@ bool ParticipantTargetConfigurationDialog::init(int participantId,
|
||||
|
||||
|
||||
|
||||
pdd.participantId(m_participantId);
|
||||
pdd.participantId = m_participantId;
|
||||
|
||||
connect(m_dtc.get(), &ParticipantManagement::Interface::Dtc::dynamicParticipantDataChanged,
|
||||
this, &ParticipantTargetConfigurationDialog::onDynamicParticipantDataChanged);
|
||||
@@ -143,7 +145,7 @@ bool ParticipantTargetConfigurationDialog::init(int participantId,
|
||||
|
||||
const std::function<bool(const TargetInformation &data)> cb = [this](const TargetInformation & data) -> bool
|
||||
{
|
||||
if (data.participantId() == m_participantId)
|
||||
if (data.participantId == m_participantId)
|
||||
{
|
||||
m_targetInformation = data;
|
||||
return true;
|
||||
@@ -152,13 +154,13 @@ bool ParticipantTargetConfigurationDialog::init(int participantId,
|
||||
};
|
||||
m_dtc->targetInformations(cb);
|
||||
|
||||
if (m_targetInformation.participantId() > 0)
|
||||
if (m_targetInformation.participantId > 0)
|
||||
{
|
||||
onTargetInformationChanged(m_targetInformation, DataModification::eAdded);
|
||||
} else {
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " targetInformation not found for participantId = " << m_participantId
|
||||
<< " - use default.";
|
||||
m_targetInformation.participantId(m_participantId);
|
||||
m_targetInformation.participantId = m_participantId;
|
||||
}
|
||||
|
||||
setupConnections();
|
||||
@@ -174,7 +176,7 @@ bool ParticipantTargetConfigurationDialog::init(int participantId,
|
||||
|
||||
void ParticipantTargetConfigurationDialog::onDynamicParticipantDataChanged(const DynamicParticipantData &dynData, DataModification modType)
|
||||
{
|
||||
if (m_participantId != dynData.participantId())
|
||||
if (m_participantId != dynData.participantId)
|
||||
return;
|
||||
|
||||
switch (modType)
|
||||
@@ -185,11 +187,11 @@ void ParticipantTargetConfigurationDialog::onDynamicParticipantDataChanged(const
|
||||
case DataModification::eAdded:
|
||||
case DataModification::eModified:
|
||||
{
|
||||
const ParticipantManagement::StateInformation &lastState = m_dtc->youngestStateInformation(dynData.stateHistory());
|
||||
const ProjectDataManagement::VulnerabilityState &vulState = lastState.vulnerabilityState();
|
||||
const ParticipantManagement::StateInformation &lastState = m_dtc->youngestStateInformation(dynData.stateHistory);
|
||||
const ProjectDataManagement::VulnerabilityState &vulState = lastState.vulnerabilityState;
|
||||
const ProjectDataManagement::VulnerabilityState vulStateType = static_cast<ProjectDataManagement::VulnerabilityState>(vulState);
|
||||
|
||||
int idx = m_ui->cb_status->findData(vulStateType);
|
||||
int idx = m_ui->cb_status->findData(static_cast<int>(vulStateType));
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " cb_status: vulState=" << vulState;
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " cb_status: setCurrentIndex idx=" << idx;
|
||||
m_ui->cb_status->setCurrentIndex(idx);
|
||||
@@ -201,7 +203,7 @@ void ParticipantTargetConfigurationDialog::onDynamicParticipantDataChanged(const
|
||||
|
||||
void ParticipantTargetConfigurationDialog::onTargetInformationChanged(const TargetInformation &data, DataModification modType)
|
||||
{
|
||||
if (m_participantId != data.participantId())
|
||||
if (m_participantId != data.participantId)
|
||||
return;
|
||||
|
||||
switch (modType)
|
||||
@@ -233,21 +235,21 @@ void ParticipantTargetConfigurationDialog::onStatusChanged()
|
||||
if (newParticipantState == ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady)
|
||||
{
|
||||
InitParticipantRequest req;
|
||||
req.workstationId(LtsSessionData::LtsSessionData::getInstance()->getWorkstationId());
|
||||
req.restockCharges(true);
|
||||
req.resetManipulation(true);
|
||||
req.resetVulnerabilityState(true);
|
||||
req.participantIds({m_participantId});
|
||||
req.workstationId = LtsSessionData::LtsSessionData::getInstance()->getWorkstationId();
|
||||
req.restockCharges = true;
|
||||
req.resetManipulation = true;
|
||||
req.resetVulnerabilityState = true;
|
||||
req.participantIds = {m_participantId};
|
||||
m_requestHelper->addRequest([req, this]()
|
||||
{
|
||||
return m_ftc->initParticipantRequest(req, this);
|
||||
});
|
||||
} else {
|
||||
ModifyStateRequest req;
|
||||
req.workstationId(LtsSessionData::LtsSessionData::getInstance()->getWorkstationId());
|
||||
req.vulnerabilityState(newParticipantState);
|
||||
req.workstationId = LtsSessionData::LtsSessionData::getInstance()->getWorkstationId();
|
||||
req.vulnerabilityState = newParticipantState;
|
||||
|
||||
req.participantIds({m_participantId});
|
||||
req.participantIds = {m_participantId};
|
||||
m_requestHelper->addRequest([req, this]()
|
||||
{
|
||||
return m_ftc->modifyStateRequest(req, this);
|
||||
@@ -301,16 +303,16 @@ void ParticipantTargetConfigurationDialog::fillStatusComboBox()
|
||||
{
|
||||
std::list<ProjectDataManagement::VulnerabilityState> cont;
|
||||
cont = {
|
||||
ProjectDataManagement::VulnerabilityState::NoChange,
|
||||
ProjectDataManagement::VulnerabilityState::CombatReady,
|
||||
ProjectDataManagement::VulnerabilityState::CatastrophicKill
|
||||
ProjectDataManagement::VulnerabilityState::VulnerabilityState_NoChange,
|
||||
ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady,
|
||||
ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill
|
||||
};
|
||||
|
||||
m_ui->cb_status->clear();
|
||||
for (auto item : std::as_const(cont))
|
||||
{
|
||||
ProjectDataManagement::VulnerabilityState st = item;
|
||||
QString str = ProjectDataManagement::toString(st, ProjectDataManagement::VulnerabilityClass::VehicleDamages);
|
||||
QString str = ProjectDataManagement::toString(st, ProjectDataManagement::VulnerabilityClass::VulnerabilityClass_VehicleDamages);
|
||||
m_ui->cb_status->addItem(str, static_cast<int>(item));
|
||||
}
|
||||
|
||||
@@ -320,17 +322,17 @@ void ParticipantTargetConfigurationDialog::fillPrewarningEffectComboBox()
|
||||
{
|
||||
std::list<ProjectDataManagement::VulnerabilityState> cont;
|
||||
cont = {
|
||||
ProjectDataManagement::VulnerabilityState::NoChange,
|
||||
ProjectDataManagement::VulnerabilityState::MobilityKill,
|
||||
ProjectDataManagement::VulnerabilityState::NearMiss,
|
||||
ProjectDataManagement::VulnerabilityState::CatastrophicKill
|
||||
ProjectDataManagement::VulnerabilityState::VulnerabilityState_NoChange,
|
||||
ProjectDataManagement::VulnerabilityState::VulnerabilityState_MobilityKill,
|
||||
ProjectDataManagement::VulnerabilityState::VulnerabilityState_NearMiss,
|
||||
ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill
|
||||
};
|
||||
|
||||
m_ui->cb_prewarningEffect->clear();
|
||||
for (auto item : std::as_const(cont))
|
||||
{
|
||||
ProjectDataManagement::VulnerabilityState st = item;
|
||||
QString str = ProjectDataManagement::toString(st, ProjectDataManagement::VulnerabilityClass::VehicleDamages);
|
||||
QString str = ProjectDataManagement::toString(st, ProjectDataManagement::VulnerabilityClass::VulnerabilityClass_VehicleDamages);
|
||||
m_ui->cb_prewarningEffect->addItem(str, static_cast<int>(item));
|
||||
}
|
||||
m_ui->cb_prewarningEffect->setCurrentIndex(1);
|
||||
@@ -340,15 +342,15 @@ void ParticipantTargetConfigurationDialog::fillTakeDownEffectComboBox()
|
||||
{
|
||||
std::list<ProjectDataManagement::VulnerabilityState> cont;
|
||||
cont = {
|
||||
ProjectDataManagement::VulnerabilityState::MobilityKill,
|
||||
ProjectDataManagement::VulnerabilityState::CatastrophicKill
|
||||
ProjectDataManagement::VulnerabilityState::VulnerabilityState_MobilityKill,
|
||||
ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill
|
||||
};
|
||||
|
||||
m_ui->cb_takeDownEffect->clear();
|
||||
for (auto item : std::as_const(cont))
|
||||
{
|
||||
ProjectDataManagement::VulnerabilityState st = item;
|
||||
QString str = ProjectDataManagement::toString(st, ProjectDataManagement::VulnerabilityClass::VehicleDamages);
|
||||
QString str = ProjectDataManagement::toString(st, ProjectDataManagement::VulnerabilityClass::VulnerabilityClass_VehicleDamages);
|
||||
m_ui->cb_takeDownEffect->addItem(str, static_cast<int>(item));
|
||||
}
|
||||
m_ui->cb_takeDownEffect->setCurrentIndex(1);
|
||||
@@ -408,24 +410,24 @@ void ParticipantTargetConfigurationDialog::onGuiChanged()
|
||||
|
||||
|
||||
|
||||
hasChanged |= updateValue(m_targetInformation.silhouette(), m_ui->cb_silhouette->currentData().toInt());
|
||||
hasChanged |= updateValue(m_targetInformation.silhouette, m_ui->cb_silhouette->currentData().toInt());
|
||||
|
||||
|
||||
hasChanged |= updateValue(m_targetInformation.prewarningEffect(), static_cast<ProjectDataManagement::VulnerabilityState>(m_ui->cb_prewarningEffect->currentData().toInt()) );
|
||||
hasChanged |= updateValue(m_targetInformation.prewarningInterval(), m_ui->sb_prewarningInterval->value());
|
||||
hasChanged |= updateValue(m_targetInformation.prewarningEffect, static_cast<ProjectDataManagement::VulnerabilityState>(m_ui->cb_prewarningEffect->currentData().toInt()) );
|
||||
hasChanged |= updateValue(m_targetInformation.prewarningInterval, m_ui->sb_prewarningInterval->value());
|
||||
|
||||
hasChanged |= updateValue(m_targetInformation.takedownEffect(), static_cast<ProjectDataManagement::VulnerabilityState>(m_ui->cb_takeDownEffect->currentData().toInt()) );
|
||||
hasChanged |= updateValue(m_targetInformation.takedownInterval(), m_ui->sb_takeDownInterval->value());
|
||||
hasChanged |= updateValue(m_targetInformation.takedownEffect, static_cast<ProjectDataManagement::VulnerabilityState>(m_ui->cb_takeDownEffect->currentData().toInt()) );
|
||||
hasChanged |= updateValue(m_targetInformation.takedownInterval, m_ui->sb_takeDownInterval->value());
|
||||
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " hasChanged=" << hasChanged;
|
||||
|
||||
|
||||
const std::vector<ParticipantManagement::ShootbackArea> &modelAreasStdVec = m_areaModel.getDataStdVector();
|
||||
if (modelAreasStdVec != m_targetInformation.shootbackAreas())
|
||||
if (modelAreasStdVec != m_targetInformation.shootbackAreas)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " hasChanged=" << hasChanged;
|
||||
hasChanged = true;
|
||||
m_targetInformation.shootbackAreas(modelAreasStdVec);
|
||||
m_targetInformation.shootbackAreas = modelAreasStdVec;
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " slotChangesMade sChanged=" << hasChanged;
|
||||
@@ -444,20 +446,20 @@ void ParticipantTargetConfigurationDialog::onDataChanged()
|
||||
|
||||
|
||||
|
||||
idx = m_ui->cb_silhouette->findData(QVariant(m_targetInformation.silhouette()));
|
||||
idx = m_ui->cb_silhouette->findData(QVariant(m_targetInformation.silhouette));
|
||||
m_ui->cb_silhouette->setCurrentIndex(idx);
|
||||
|
||||
|
||||
m_ui->sb_prewarningInterval->setValue(m_targetInformation.prewarningInterval());
|
||||
idx = m_ui->cb_prewarningEffect->findData(QVariant(m_targetInformation.prewarningEffect().underlying()));
|
||||
m_ui->sb_prewarningInterval->setValue(m_targetInformation.prewarningInterval);
|
||||
idx = m_ui->cb_prewarningEffect->findData(QVariant(static_cast<int>(m_targetInformation.prewarningEffect)));
|
||||
m_ui->cb_prewarningEffect->setCurrentIndex(idx);
|
||||
|
||||
m_ui->sb_takeDownInterval->setValue(m_targetInformation.takedownInterval());
|
||||
idx = m_ui->cb_takeDownEffect->findData(QVariant(m_targetInformation.takedownEffect().underlying()));
|
||||
m_ui->sb_takeDownInterval->setValue(m_targetInformation.takedownInterval);
|
||||
idx = m_ui->cb_takeDownEffect->findData(QVariant(static_cast<int>(m_targetInformation.takedownEffect)));
|
||||
m_ui->cb_takeDownEffect->setCurrentIndex(idx);
|
||||
|
||||
|
||||
const std::vector<ShootbackArea>& areas = m_targetInformation.shootbackAreas();
|
||||
const std::vector<ShootbackArea>& areas = m_targetInformation.shootbackAreas;
|
||||
QVector<ShootbackArea> qVec = QVector<ShootbackArea>(areas.begin(), areas.end());
|
||||
m_areaModel.setData(qVec);
|
||||
|
||||
@@ -485,19 +487,19 @@ QPolygonF areaToPolygon(const ShootbackArea &area)
|
||||
QPolygonF coordinates;
|
||||
QPointF point;
|
||||
|
||||
point = convert(area.coord1());
|
||||
point = convert(area.coord1);
|
||||
if (!point.isNull())
|
||||
coordinates.append(point);
|
||||
|
||||
point = convert(area.coord2());
|
||||
point = convert(area.coord2);
|
||||
if (!point.isNull())
|
||||
coordinates.append(point);
|
||||
|
||||
point = convert(area.coord3());
|
||||
point = convert(area.coord3);
|
||||
if (!point.isNull())
|
||||
coordinates.append(point);
|
||||
|
||||
point = convert(area.coord4());
|
||||
point = convert(area.coord4);
|
||||
if (!point.isNull())
|
||||
coordinates.append(point);
|
||||
return coordinates;
|
||||
@@ -613,12 +615,12 @@ void ParticipantTargetConfigurationDialog::onPolygonData(const QPolygonF &poly)
|
||||
ShootbackArea newArea;
|
||||
|
||||
|
||||
newArea.coord1( convert(poly.at(0)) );
|
||||
newArea.coord2( convert(poly.at(1)) );
|
||||
newArea.coord1 = convert(poly.at(0));
|
||||
newArea.coord2 = convert(poly.at(1));
|
||||
if (poly.size() > 2)
|
||||
newArea.coord3( convert(poly.at(2)) );
|
||||
newArea.coord3 = convert(poly.at(2));
|
||||
if (poly.size() > 3)
|
||||
newArea.coord4( convert(poly.at(3)) );
|
||||
newArea.coord4 = convert(poly.at(3));
|
||||
|
||||
if (m_rubberbandEditMode)
|
||||
{
|
||||
@@ -626,13 +628,13 @@ void ParticipantTargetConfigurationDialog::onPolygonData(const QPolygonF &poly)
|
||||
if (!curIdx.isValid())
|
||||
return;
|
||||
ShootbackArea temp = m_areaModel.getRowData(curIdx.row());
|
||||
newArea.identifier(temp.identifier());
|
||||
newArea.identifier = temp.identifier;
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << "updating newArea = " << newArea;
|
||||
m_areaModel.setRowData(curIdx.row(), newArea);
|
||||
} else {
|
||||
|
||||
int size = m_areaModel.rowCount();
|
||||
newArea.identifier(QString(QStringLiteral("Area_%1")).arg(size).toStdString());
|
||||
newArea.identifier = QString(QStringLiteral("Area_%1")).arg(size).toStdString();
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " adding tempArea = " << newArea;
|
||||
m_areaModel.insertRow(newArea);
|
||||
|
||||
|
||||
+1
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <ParticipantManagement/logger.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_ftc.h>
|
||||
#include <ProjectDataManagement/pdm_data_plugin_interface.h>
|
||||
#include <AreaEffectSimulation/aes_data_plugin_interface.h>
|
||||
|
||||
+4
-3
@@ -13,6 +13,7 @@ ParticipantsMountedTableDialog::ParticipantsMountedTableDialog(int32_t carrierId
|
||||
, m_ppmGuiIfc(nullptr)
|
||||
, m_mountedTableModel(nullptr)
|
||||
, m_ui(new Ui::ParticipantsMountedTableDialog)
|
||||
, m_logger(getLogger("ParticipantsMountedTableDialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
@@ -47,14 +48,14 @@ void ParticipantsMountedTableDialog::onShowTlnInfo()
|
||||
|
||||
DEBUG_LOG(m_logger) << "onDoubleClick --> showTlnInfo";
|
||||
const QModelIndex idx = m_ui->tvMountedParticipants->currentIndex();
|
||||
const int id = m_mountedTableModel->getRowData(idx.row()).id();
|
||||
const int id = m_mountedTableModel->getRowData(idx.row()).id;
|
||||
m_ppmGuiIfc->showParticipantInfoWindow(id);
|
||||
}
|
||||
|
||||
void ParticipantsMountedTableDialog::retranslate()
|
||||
{
|
||||
const dds::core::optional<int32_t> eqId = m_dtc->participant(m_carrierId).equipmentNumber();
|
||||
const QString id = (eqId.is_set() ? QString::number(eqId.get()) : QString());
|
||||
const dds::core::optional<int32_t> eqId = m_dtc->participant(m_carrierId).equipmentNumber;
|
||||
const QString id = (eqId.has_value() ? QString::number(eqId.get()) : QString());
|
||||
|
||||
translate(m_ui, id, false, tr("participants on vehicle"));
|
||||
}
|
||||
|
||||
+8
-8
@@ -37,9 +37,9 @@ void ParticipantsMountedTableModel::reInitModel()
|
||||
|
||||
ParticipantPosition pos = m_dtc->participantPosition(m_carrierId);
|
||||
|
||||
if (pos.mountedParticipants().is_set())
|
||||
for (size_t idx = 0; idx < pos.mountedParticipants().get().size(); ++idx)
|
||||
insertRow(m_dtc->participant(pos.mountedParticipants().get().at(idx)));
|
||||
if (pos.mountedParticipants.has_value())
|
||||
for (size_t idx = 0; idx < pos.mountedParticipants.get().size(); ++idx)
|
||||
insertRow(m_dtc->participant(pos.mountedParticipants.get().at(idx)));
|
||||
}
|
||||
|
||||
QVariant ParticipantsMountedTableModel::data(const QModelIndex &index, int role) const
|
||||
@@ -51,13 +51,13 @@ QVariant ParticipantsMountedTableModel::data(const QModelIndex &index, int role)
|
||||
switch (index.column())
|
||||
{
|
||||
case 0:
|
||||
return participant.equipmentNumber().is_set()?participant.equipmentNumber().get():0;
|
||||
return participant.equipmentNumber.has_value()?participant.equipmentNumber.get():0;
|
||||
case 1:
|
||||
return ParticipantManagement::trPartyName(m_dtc->party(participant.partyId()).name());
|
||||
return ParticipantManagement::trPartyName(m_dtc->party(participant.partyId).name);
|
||||
case 2:
|
||||
return QString::fromStdString(participant.designator());
|
||||
return QString::fromStdString(participant.designator);
|
||||
case 3:
|
||||
return QString::fromStdString(participant.tacticalIdentifier());
|
||||
return QString::fromStdString(participant.tacticalIdentifier);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -68,7 +68,7 @@ QVariant ParticipantsMountedTableModel::data(const QModelIndex &index, int role)
|
||||
void ParticipantsMountedTableModel::onPositionChanged(const ParticipantPosition &data, DataModification modType)
|
||||
{
|
||||
if (modType != DataModification::eRemoved)
|
||||
if (data.participantId() == m_carrierId)
|
||||
if (data.participantId == m_carrierId)
|
||||
reInitModel();
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
|
||||
namespace ParticipantManagement {
|
||||
|
||||
|
||||
+6
-4
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "combat_power.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include "ui_combat_power.h"
|
||||
|
||||
namespace ParticipantManagement
|
||||
@@ -16,6 +17,7 @@ CombatPower::CombatPower(QWidget *parent)
|
||||
, m_ppmGuiCbxIfc(nullptr)
|
||||
, m_ppmGuiInfoIfc(nullptr)
|
||||
, m_ui(new Ui::CombatPower)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("CombatPower"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
@@ -92,10 +94,10 @@ void CombatPower::onOpenInfo(int id)
|
||||
void CombatPower::onUpdateParticipant(const Participant &data, DataModification modType)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onUpdateParticipant - parties: " << m_ui->cbParty->count();
|
||||
if (data.partyId() != m_ui->cbParty->currentData().toInt())
|
||||
if (data.partyId != m_ui->cbParty->currentData().toInt())
|
||||
return;
|
||||
if (modType == DataModification::eModified)
|
||||
m_orgChart->updateParticipant(data.id());
|
||||
m_orgChart->updateParticipant(data.id);
|
||||
else
|
||||
onPartyChanged();
|
||||
}
|
||||
@@ -103,10 +105,10 @@ void CombatPower::onUpdateParticipant(const Participant &data, DataModification
|
||||
void CombatPower::onUpdateDynamicParticipantData(const DynamicParticipantData &data, DataModification modType)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onUpdateDynamicParticipantData - parties: " << m_ui->cbParty->count();
|
||||
if (m_dtc->participant(data.participantId()).partyId() != m_ui->cbParty->currentData().toInt())
|
||||
if (m_dtc->participant(data.participantId).partyId != m_ui->cbParty->currentData().toInt())
|
||||
return;
|
||||
if (modType == DataModification::eModified)
|
||||
m_orgChart->updateParticipant(data.participantId());
|
||||
m_orgChart->updateParticipant(data.participantId);
|
||||
else
|
||||
onPartyChanged();
|
||||
}
|
||||
|
||||
+106
-104
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "org_chart_main.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <utility>
|
||||
#include "ui_org_chart_main.h"
|
||||
#include <QtCore/QBuffer>
|
||||
@@ -34,6 +35,7 @@ OrgChartMain::OrgChartMain(LtsSession::LtsSession *session
|
||||
, m_isTemplate(false)
|
||||
, m_party(-1)
|
||||
, m_ui(new Ui::OrgChartMain)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("OrgChartMain"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_buttonBox->getButton(LtsWidgets::DialogButton::Close)->hide();
|
||||
@@ -89,8 +91,8 @@ void OrgChartMain::updateButtonMimeData()
|
||||
if (partyId > 0)
|
||||
{
|
||||
AdvancedSymbology::SymbolDataToRender symDataToRender(symbolString);
|
||||
symDataToRender.role = AdvancedSymbology::roleToRole(m_dtc->party(m_party).role());
|
||||
symDataToRender.fillColor = QColor::fromRgb(QRgb(m_dtc->party(partyId).color()));
|
||||
symDataToRender.role = AdvancedSymbology::roleToRole(m_dtc->party(m_party).role);
|
||||
symDataToRender.fillColor = QColor::fromRgb(QRgb(m_dtc->party(partyId).color));
|
||||
symDataToRender.fillColorReplace = true;
|
||||
symbolWatcher->setSymbolResult(m_asbIfc->findImage(symDataToRender));
|
||||
}
|
||||
@@ -109,7 +111,7 @@ QColor OrgChartMain::currentPartyColor()
|
||||
partyId = m_ui->cbParty->currentData().toInt();
|
||||
|
||||
if (partyId > 0)
|
||||
color = QColor::fromRgb(QRgb(m_dtc->party(partyId).color()));
|
||||
color = QColor::fromRgb(QRgb(m_dtc->party(partyId).color));
|
||||
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " color=" << color.name()
|
||||
<< " (partyId = " << partyId << ")"
|
||||
@@ -129,7 +131,7 @@ AdvancedSymbology::Role OrgChartMain::currentPartyRole()
|
||||
partyId = m_ui->cbParty->currentData().toInt();
|
||||
|
||||
if (partyId > 0)
|
||||
role = AdvancedSymbology::roleToRole<>(m_dtc->party(partyId).role());
|
||||
role = AdvancedSymbology::roleToRole<>(m_dtc->party(partyId).role);
|
||||
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << " role=" << role
|
||||
<< " (partyId = " << partyId << ")"
|
||||
@@ -281,12 +283,12 @@ bool OrgChartMain::initButtons()
|
||||
const QMap<qint32, Type> mapTypes = m_dtc->types();
|
||||
for (const Type &type : mapTypes)
|
||||
{
|
||||
if ((!m_asSupportService && (type.typeClass() == TypeClass::SupportUnit || type.typeClass() == TypeClass::SupportEntity))
|
||||
|| (m_asSupportService && (type.typeClass() != TypeClass::SupportUnit && type.typeClass() != TypeClass::SupportEntity)))
|
||||
if ((!m_asSupportService && (type.typeClass == TypeClass::SupportUnit || type.typeClass == TypeClass::SupportEntity))
|
||||
|| (m_asSupportService && (type.typeClass != TypeClass::SupportUnit && type.typeClass != TypeClass::SupportEntity)))
|
||||
continue;
|
||||
plAction.menuGroup = ParticipantManagement::toString(type.typeClass());
|
||||
plAction.identifier = QString::fromStdString(type.name()) + QString::number(type.equipmentTypeId());
|
||||
plAction.menuText = QString::fromStdString(type.name());
|
||||
plAction.menuGroup = ParticipantManagement::toString(type.typeClass);
|
||||
plAction.identifier = QString::fromStdString(type.name) + QString::number(type.equipmentTypeId);
|
||||
plAction.menuText = QString::fromStdString(type.name);
|
||||
plAction.directFunc = [](const LtsWidgets::PluginData &) { return; };
|
||||
|
||||
LtsWidgets::LtsDragIcon *icon = m_session->addAction(plAction);
|
||||
@@ -312,7 +314,7 @@ bool OrgChartMain::initButtons()
|
||||
}
|
||||
});
|
||||
|
||||
QString symbolString = QString::fromStdString(type.symbol());
|
||||
QString symbolString = QString::fromStdString(type.symbol);
|
||||
symbolWatcher->setSymbolResult(m_asbIfc->findPreview(symbolString));
|
||||
m_buttonMap.insert(icon, std::tuple<QString, AdvancedSymbology::SymbolResultWatcher *>(symbolString, mimeDataSymbolWatcher));
|
||||
}
|
||||
@@ -328,13 +330,13 @@ bool OrgChartMain::initButtons()
|
||||
return true;
|
||||
for (const ParticipantManagement::TemplateParticipant &templateData : std::as_const(templates))
|
||||
{
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " templateId = " << templateData.templateId()
|
||||
<< " typeId = " << templateData.typeId()
|
||||
<< " designator= " << templateData.designator().c_str()
|
||||
<< " tactIdent= " << templateData.tacticalIdentifier().c_str();
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " templateId = " << templateData.templateId
|
||||
<< " typeId = " << templateData.typeId
|
||||
<< " designator= " << templateData.designator.c_str()
|
||||
<< " tactIdent= " << templateData.tacticalIdentifier.c_str();
|
||||
|
||||
const Type &type = m_dtc->type(templateData.typeId());
|
||||
const TypeClass &tc = type.typeClass();
|
||||
const Type &type = m_dtc->type(templateData.typeId);
|
||||
const TypeClass &tc = type.typeClass;
|
||||
if ((m_asSupportService &&
|
||||
(tc == TypeClass::SupportEntity || tc == TypeClass::SupportUnit))
|
||||
||
|
||||
@@ -344,22 +346,22 @@ bool OrgChartMain::initButtons()
|
||||
{
|
||||
|
||||
|
||||
plAction.identifier = QString::fromStdString(templateData.designator()) + QString::number(templateData.templateId());
|
||||
QString templateText = QString::fromStdString(templateData.designator());
|
||||
if (!templateText.isEmpty() && templateData.tacticalIdentifier().size() > 0)
|
||||
plAction.identifier = QString::fromStdString(templateData.designator) + QString::number(templateData.templateId);
|
||||
QString templateText = QString::fromStdString(templateData.designator);
|
||||
if (!templateText.isEmpty() && templateData.tacticalIdentifier.size() > 0)
|
||||
templateText.append(QStringLiteral(" / "));
|
||||
templateText.append(QString::fromStdString(templateData.tacticalIdentifier()));
|
||||
templateText.append(QString::fromStdString(templateData.tacticalIdentifier));
|
||||
|
||||
plAction.menuText = templateText;
|
||||
plAction.directFunc = [](const LtsWidgets::PluginData &) { return; };
|
||||
|
||||
const int templateId = templateData.templateId();
|
||||
const int templateId = templateData.templateId;
|
||||
LtsWidgets::LtsDragIcon *icon = m_session->addAction(plAction);
|
||||
|
||||
|
||||
AdvancedSymbology::SymbolResultWatcherQWidgetBase *symbolWatcher =
|
||||
new AdvancedSymbology::SymbolResultWatcherQWidget<LtsWidgets::LtsDragIcon>(icon);
|
||||
QString symbolString = QString::fromStdString(type.symbol());
|
||||
QString symbolString = QString::fromStdString(type.symbol);
|
||||
symbolWatcher->setSymbolResult(m_asbIfc->findPreview(symbolString));
|
||||
|
||||
|
||||
@@ -383,8 +385,8 @@ bool OrgChartMain::initButtons()
|
||||
int partyId = m_ui->cbParty->currentData().toInt();
|
||||
if (partyId > 0)
|
||||
{
|
||||
color = QColor::fromRgb(QRgb(m_dtc->party(partyId).color()));
|
||||
role = AdvancedSymbology::roleToRole<>(m_dtc->party(partyId).role());
|
||||
color = QColor::fromRgb(QRgb(m_dtc->party(partyId).color));
|
||||
role = AdvancedSymbology::roleToRole<>(m_dtc->party(partyId).role);
|
||||
}
|
||||
}
|
||||
mimeDataHelper->run(role, color);
|
||||
@@ -400,18 +402,18 @@ bool OrgChartMain::initButtons()
|
||||
QByteArray OrgChartMain::getMimeData(const Type &type, const QImage &image)
|
||||
{
|
||||
QJsonObject retObj;
|
||||
QString isUnit = (type.typeClass() == ParticipantManagement::TypeClass::Unit
|
||||
|| type.typeClass() == ParticipantManagement::TypeClass::SupportUnit)
|
||||
QString isUnit = (type.typeClass == ParticipantManagement::TypeClass::Unit
|
||||
|| type.typeClass == ParticipantManagement::TypeClass::SupportUnit)
|
||||
? QStringLiteral("true") : QString();
|
||||
|
||||
retObj.insert(QStringLiteral("name"), QString::fromStdString(type.name()));
|
||||
retObj.insert(QStringLiteral("title"), QString::fromStdString(type.name()));
|
||||
retObj.insert(QStringLiteral("typeId"), type.id());
|
||||
retObj.insert(QStringLiteral("symbol"), QString::fromStdString(type.symbol()));
|
||||
retObj.insert(QStringLiteral("name"), QString::fromStdString(type.name));
|
||||
retObj.insert(QStringLiteral("title"), QString::fromStdString(type.name));
|
||||
retObj.insert(QStringLiteral("typeId"), type.id);
|
||||
retObj.insert(QStringLiteral("symbol"), QString::fromStdString(type.symbol));
|
||||
retObj.insert(QStringLiteral("eqNr"), 0);
|
||||
retObj.insert(QStringLiteral("info"), QString());
|
||||
retObj.insert(QStringLiteral("sign"), QString());
|
||||
retObj.insert(QStringLiteral("tactIdentifier"), QString::fromStdString(type.name()));
|
||||
retObj.insert(QStringLiteral("tactIdentifier"), QString::fromStdString(type.name));
|
||||
retObj.insert(QStringLiteral("designator"), QString());
|
||||
retObj.insert(QStringLiteral("isUnit"), isUnit);
|
||||
retObj.insert(QStringLiteral("ddsId"), 0);
|
||||
@@ -435,27 +437,27 @@ QVector<ParticipantData> OrgChartMain::getDataOf(const QJsonObject &obj, int sup
|
||||
{
|
||||
QVector<ParticipantData> ret;
|
||||
ParticipantData pData;
|
||||
pData.designator() = obj.value(QStringLiteral("designator")).toString().toStdString();
|
||||
pData.designator = obj.value(QStringLiteral("designator")).toString().toStdString();
|
||||
if (obj.value(QStringLiteral("eqNr")).toInt() > 0)
|
||||
pData.equipmentNumber().set(obj.value(QStringLiteral("eqNr")).toInt());
|
||||
pData.equipmentNumber.set(obj.value(QStringLiteral("eqNr")).toInt());
|
||||
|
||||
pData.info() = obj.value(QStringLiteral("info")).toString().toStdString();
|
||||
pData.name() = obj.value(QStringLiteral("sign")).toString().toStdString();
|
||||
pData.modId(obj.value(QStringLiteral("id")).toInt());
|
||||
pData.id(obj.value(QStringLiteral("ddsId")).toInt() < 0 ? 0 : obj.value(QStringLiteral("ddsId")).toInt());
|
||||
pData.partyId(m_party);
|
||||
pData.superiorModId(superiorModId);
|
||||
pData.hierarchyNumber(hierarchyNr);
|
||||
pData.symbol() = obj.value(QStringLiteral("symbol")).toString().toStdString();
|
||||
pData.tacticalIdentifier() = obj.value(QStringLiteral("tactIdentifier")).toString().toStdString();
|
||||
pData.typeId(obj.value(QStringLiteral("typeId")).toInt());
|
||||
pData.info = obj.value(QStringLiteral("info")).toString().toStdString();
|
||||
pData.name = obj.value(QStringLiteral("sign")).toString().toStdString();
|
||||
pData.modId = obj.value(QStringLiteral("id")).toInt();
|
||||
pData.id = obj.value(QStringLiteral("ddsId")).toInt() < 0 ? 0 : obj.value(QStringLiteral("ddsId")).toInt();
|
||||
pData.partyId = m_party;
|
||||
pData.superiorModId = superiorModId;
|
||||
pData.hierarchyNumber = hierarchyNr;
|
||||
pData.symbol = obj.value(QStringLiteral("symbol")).toString().toStdString();
|
||||
pData.tacticalIdentifier = obj.value(QStringLiteral("tactIdentifier")).toString().toStdString();
|
||||
pData.typeId = obj.value(QStringLiteral("typeId")).toInt();
|
||||
if (obj.value(QStringLiteral("assignState")).toInt() >= 0)
|
||||
pData.assignState(static_cast<ParticipantAssignState>(obj.value(QStringLiteral("assignState")).toInt()));
|
||||
pData.assignState = static_cast<ParticipantAssignState>(obj.value(QStringLiteral("assignState")).toInt());
|
||||
QJsonArray arr = obj.value(QStringLiteral("children")).toArray();
|
||||
int hierarNr = 1;
|
||||
for (auto arrItem = arr.constBegin(); arrItem != arr.constEnd(); ++arrItem)
|
||||
{
|
||||
ret.append(getDataOf((*arrItem).toObject(), pData.modId(), hierarNr));
|
||||
ret.append(getDataOf((*arrItem).toObject(), pData.modId, hierarNr));
|
||||
hierarNr++;
|
||||
}
|
||||
ret.append(pData);
|
||||
@@ -466,24 +468,24 @@ QVector<TemplateData> OrgChartMain::getTemplateDataOf(const QJsonObject &obj, in
|
||||
{
|
||||
QVector<TemplateData> ret;
|
||||
TemplateData tData;
|
||||
tData.designator() = obj.value(QStringLiteral("designator")).toString().toStdString();
|
||||
tData.equipmentNumber(obj.value(QStringLiteral("eqNr")).toInt());
|
||||
tData.designator = obj.value(QStringLiteral("designator")).toString().toStdString();
|
||||
tData.equipmentNumber = obj.value(QStringLiteral("eqNr")).toInt();
|
||||
|
||||
tData.info() = obj.value(QStringLiteral("info")).toString().toStdString();
|
||||
tData.name() = obj.value(QStringLiteral("sign")).toString().toStdString();
|
||||
tData.modId(obj.value(QStringLiteral("id")).toInt());
|
||||
tData.info = obj.value(QStringLiteral("info")).toString().toStdString();
|
||||
tData.name = obj.value(QStringLiteral("sign")).toString().toStdString();
|
||||
tData.modId = obj.value(QStringLiteral("id")).toInt();
|
||||
if (obj.value(QStringLiteral("ddsId")).toInt() > 0)
|
||||
tData.templateId(obj.value(QStringLiteral("ddsId")).toInt());
|
||||
tData.superiorModId(superiorModId);
|
||||
tData.hierarchyNumber(hierarchyNr);
|
||||
tData.symbol() = obj.value(QStringLiteral("symbol")).toString().toStdString();
|
||||
tData.tacticalIdentifier() = obj.value(QStringLiteral("tactIdentifier")).toString().toStdString();
|
||||
tData.typeId(obj.value(QStringLiteral("typeId")).toInt());
|
||||
tData.templateId = obj.value(QStringLiteral("ddsId")).toInt();
|
||||
tData.superiorModId = superiorModId;
|
||||
tData.hierarchyNumber = hierarchyNr;
|
||||
tData.symbol = obj.value(QStringLiteral("symbol")).toString().toStdString();
|
||||
tData.tacticalIdentifier = obj.value(QStringLiteral("tactIdentifier")).toString().toStdString();
|
||||
tData.typeId = obj.value(QStringLiteral("typeId")).toInt();
|
||||
QJsonArray arr = obj.value(QStringLiteral("children")).toArray();
|
||||
int hierarNr = 1;
|
||||
for (auto arrItem = arr.constBegin(); arrItem != arr.constEnd(); ++arrItem)
|
||||
{
|
||||
ret.append(getTemplateDataOf((*arrItem).toObject(), tData.modId(), hierarNr));
|
||||
ret.append(getTemplateDataOf((*arrItem).toObject(), tData.modId, hierarNr));
|
||||
hierarNr++;
|
||||
}
|
||||
ret.append(tData);
|
||||
@@ -500,34 +502,34 @@ bool OrgChartMain::apply()
|
||||
ParticipantData OrgChartMain::convertFromJson(const QJsonObject &obj)
|
||||
{
|
||||
ParticipantData pData;
|
||||
pData.designator(obj.value(QStringLiteral("designator")).toString().toStdString());
|
||||
pData.tacticalIdentifier(obj.value(QStringLiteral("tactIdentifier")).toString().toStdString());
|
||||
pData.info(obj.value(QStringLiteral("info")).toString().toStdString());
|
||||
pData.equipmentNumber().set(obj.value(QStringLiteral("eqNr")).toInt());
|
||||
pData.typeId(obj.value(QStringLiteral("typeId")).toInt());
|
||||
pData.modId(obj.value(QStringLiteral("ddsId")).toInt());
|
||||
pData.name(obj.value(QStringLiteral("sign")).toString().toStdString());
|
||||
pData.partyId(m_party);
|
||||
pData.id(obj.value(QStringLiteral("ddsId")).toInt());
|
||||
pData.designator = obj.value(QStringLiteral("designator")).toString().toStdString();
|
||||
pData.tacticalIdentifier = obj.value(QStringLiteral("tactIdentifier")).toString().toStdString();
|
||||
pData.info = obj.value(QStringLiteral("info")).toString().toStdString();
|
||||
pData.equipmentNumber.set(obj.value(QStringLiteral("eqNr")).toInt());
|
||||
pData.typeId = obj.value(QStringLiteral("typeId")).toInt();
|
||||
pData.modId = obj.value(QStringLiteral("ddsId")).toInt();
|
||||
pData.name = obj.value(QStringLiteral("sign")).toString().toStdString();
|
||||
pData.partyId = m_party;
|
||||
pData.id = obj.value(QStringLiteral("ddsId")).toInt();
|
||||
if (obj.value(QStringLiteral("assignState")).toInt() >= 0)
|
||||
pData.assignState(static_cast<ParticipantAssignState>(obj.value(QStringLiteral("assignState")).toInt()));
|
||||
pData.symbol(obj.value(QStringLiteral("symbol")).toString().toStdString());
|
||||
pData.assignState = static_cast<ParticipantAssignState>(obj.value(QStringLiteral("assignState")).toInt());
|
||||
pData.symbol = obj.value(QStringLiteral("symbol")).toString().toStdString();
|
||||
return pData;
|
||||
}
|
||||
|
||||
TemplateData OrgChartMain::fromParticipantData(const ParticipantData &data)
|
||||
{
|
||||
TemplateData ret;
|
||||
ret.name() = data.name();
|
||||
ret.isDeleted(data.isDeleted());
|
||||
ret.modId(data.modId());
|
||||
ret.superiorModId(data.superiorModId());
|
||||
ret.equipmentNumber(data.hierarchyNumber());
|
||||
ret.info() = data.info();
|
||||
ret.symbol() = data.symbol();
|
||||
ret.tacticalIdentifier() = data.tacticalIdentifier();
|
||||
ret.templateId(ret.modId());
|
||||
ret.typeId(data.typeId());
|
||||
ret.name = data.name;
|
||||
ret.isDeleted = data.isDeleted;
|
||||
ret.modId = data.modId;
|
||||
ret.superiorModId = data.superiorModId;
|
||||
ret.equipmentNumber = data.hierarchyNumber;
|
||||
ret.info = data.info;
|
||||
ret.symbol = data.symbol;
|
||||
ret.tacticalIdentifier = data.tacticalIdentifier;
|
||||
ret.templateId = ret.modId;
|
||||
ret.typeId = data.typeId;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -621,7 +623,7 @@ void OrgChartMain::onEdit(const QString &data)
|
||||
{
|
||||
m_session->addWidget(tab,
|
||||
group,
|
||||
QStringLiteral("Edit %1").arg(pData.modId()),
|
||||
QStringLiteral("Edit %1").arg(pData.modId),
|
||||
LtsWidgets::LayoutArea::eDialogTab);
|
||||
connect(tab, &ParticipantEditItemTab::updateItem, this, &OrgChartMain::onUpdateItem);
|
||||
}
|
||||
@@ -640,7 +642,7 @@ void OrgChartMain::onDelete(const QString &data)
|
||||
return;
|
||||
|
||||
ParticipantData pData = convertFromJson(obj);
|
||||
pData.isDeleted(true);
|
||||
pData.isDeleted = true;
|
||||
if (!m_isTemplate)
|
||||
m_participantsToDelete.append(pData);
|
||||
else
|
||||
@@ -656,26 +658,26 @@ void OrgChartMain::onUpdateItem(const QModelIndex &parent, const ParticipantData
|
||||
Q_UNUSED(parent);
|
||||
|
||||
QJsonObject obj;
|
||||
Type type = m_dtc->type(editData.typeId());
|
||||
Type type = m_dtc->type(editData.typeId);
|
||||
|
||||
QString isUnit = (type.typeClass() == ParticipantManagement::TypeClass::Unit
|
||||
|| type.typeClass() == ParticipantManagement::TypeClass::SupportUnit)
|
||||
QString isUnit = (type.typeClass == ParticipantManagement::TypeClass::Unit
|
||||
|| type.typeClass == ParticipantManagement::TypeClass::SupportUnit)
|
||||
? QStringLiteral("true") : QString();
|
||||
|
||||
QString name = QString::fromStdString(editData.designator()) + QLatin1Char(' ') + QString::fromStdString(editData.tacticalIdentifier());
|
||||
QString name = QString::fromStdString(editData.designator) + QLatin1Char(' ') + QString::fromStdString(editData.tacticalIdentifier);
|
||||
obj.insert(QStringLiteral("name"), name);
|
||||
obj.insert(QStringLiteral("designator"), QString::fromStdString(editData.designator()));
|
||||
obj.insert(QStringLiteral("tactIdentifier"), QString::fromStdString(editData.tacticalIdentifier()));
|
||||
obj.insert(QStringLiteral("info"), QString::fromStdString(editData.info()));
|
||||
obj.insert(QStringLiteral("sign"), QString::fromStdString(editData.name()));
|
||||
obj.insert(QStringLiteral("title"), QString::fromStdString(type.name()));
|
||||
obj.insert(QStringLiteral("typeId"), editData.typeId());
|
||||
obj.insert(QStringLiteral("symbol"), QString::fromStdString(editData.symbol()));
|
||||
obj.insert(QStringLiteral("eqNr"), editData.equipmentNumber().is_set() ? editData.equipmentNumber().get() : 0);
|
||||
obj.insert(QStringLiteral("designator"), QString::fromStdString(editData.designator));
|
||||
obj.insert(QStringLiteral("tactIdentifier"), QString::fromStdString(editData.tacticalIdentifier));
|
||||
obj.insert(QStringLiteral("info"), QString::fromStdString(editData.info));
|
||||
obj.insert(QStringLiteral("sign"), QString::fromStdString(editData.name));
|
||||
obj.insert(QStringLiteral("title"), QString::fromStdString(type.name));
|
||||
obj.insert(QStringLiteral("typeId"), editData.typeId);
|
||||
obj.insert(QStringLiteral("symbol"), QString::fromStdString(editData.symbol));
|
||||
obj.insert(QStringLiteral("eqNr"), editData.equipmentNumber.is_set() ? editData.equipmentNumber.get() : 0);
|
||||
obj.insert(QStringLiteral("isUnit"), isUnit);
|
||||
obj.insert(QStringLiteral("assignState"), editData.assignState().underlying());
|
||||
obj.insert(QStringLiteral("ddsId"), editData.id());
|
||||
obj.insert(QStringLiteral("id"), editData.modId());
|
||||
obj.insert(QStringLiteral("assignState"), static_cast<int>(editData.assignState));
|
||||
obj.insert(QStringLiteral("ddsId"), editData.id);
|
||||
obj.insert(QStringLiteral("id"), editData.modId);
|
||||
|
||||
|
||||
|
||||
@@ -694,21 +696,21 @@ void OrgChartMain::onUpdateItem(const QModelIndex &parent, const ParticipantData
|
||||
QString imageAdd = QStringLiteral("<img src=\"data:image/png;base64,%1\">")
|
||||
.arg(QString::fromLatin1(data.toBase64()));
|
||||
obj.insert(QStringLiteral("image"), imageAdd);
|
||||
m_orgChart->sendToOrgChart(editData.modId(), obj);
|
||||
m_orgChart->sendToOrgChart(editData.modId, obj);
|
||||
slotChangesMade();
|
||||
}
|
||||
});
|
||||
|
||||
if (m_ui->cbParty->isVisible())
|
||||
{
|
||||
AdvancedSymbology::SymbolDataToRender symDataToRender(QString::fromStdString(editData.symbol()));
|
||||
symDataToRender.role = AdvancedSymbology::roleToRole(m_dtc->party(m_party).role());
|
||||
symDataToRender.fillColor = QColor::fromRgb(QRgb(m_dtc->party(m_party).color()));
|
||||
AdvancedSymbology::SymbolDataToRender symDataToRender(QString::fromStdString(editData.symbol));
|
||||
symDataToRender.role = AdvancedSymbology::roleToRole(m_dtc->party(m_party).role);
|
||||
symDataToRender.fillColor = QColor::fromRgb(QRgb(m_dtc->party(m_party).color));
|
||||
symDataToRender.fillColorReplace = true;
|
||||
watcher->setSymbolResult(m_asbIfc->findImage(symDataToRender));
|
||||
}
|
||||
else
|
||||
watcher->setSymbolResult(m_asbIfc->findBaseSymbol(QString::fromStdString(editData.symbol())));
|
||||
watcher->setSymbolResult(m_asbIfc->findBaseSymbol(QString::fromStdString(editData.symbol)));
|
||||
}
|
||||
|
||||
void OrgChartMain::onNewHierarchy(const QString &data)
|
||||
@@ -727,7 +729,7 @@ void OrgChartMain::onNewHierarchy(const QString &data)
|
||||
return;
|
||||
|
||||
ModifyParticipantDataRequest req;
|
||||
LtsUtils::convert(sendTo, req.data());
|
||||
LtsUtils::convert(sendTo, req.data);
|
||||
m_requestHelper->addRequest([this, req]()
|
||||
{
|
||||
return m_ftc->modifyParticipantDataRequest(req, this);
|
||||
@@ -741,7 +743,7 @@ void OrgChartMain::onNewHierarchy(const QString &data)
|
||||
return;
|
||||
|
||||
ModifyTemplateDataRequest req;
|
||||
LtsUtils::convert(sendTo, req.data());
|
||||
LtsUtils::convert(sendTo, req.data);
|
||||
m_requestHelper->addRequest([this, req]()
|
||||
{
|
||||
return m_ftc->modifyTemplateDataRequest(req, this);
|
||||
@@ -773,10 +775,10 @@ void OrgChartMain::onReload()
|
||||
|
||||
void OrgChartMain::onUpdateParticipant(const Participant &data, DataModification modType)
|
||||
{
|
||||
if (data.partyId() != m_party)
|
||||
if (data.partyId != m_party)
|
||||
return;
|
||||
if (modType == DataModification::eModified)
|
||||
m_orgChart->updateParticipant(data.id());
|
||||
m_orgChart->updateParticipant(data.id);
|
||||
else
|
||||
onPartyChanged();
|
||||
}
|
||||
|
||||
+18
-16
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "org_chart_main_helper.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
#include <QtCore/QBuffer>
|
||||
|
||||
@@ -11,6 +12,7 @@ namespace ParticipantManagement
|
||||
|
||||
OrgChartMain_MimeDataHelper::OrgChartMain_MimeDataHelper(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("OrgChartMain_MimeDataHelper"))
|
||||
{
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << "START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << "END";
|
||||
@@ -94,7 +96,7 @@ void OrgChartMain_MimeDataHelper::prepareBulkRenderer(int templateId)
|
||||
const TemplateParticipant &tPart = m_dtc->templateParticipant(templateId);
|
||||
|
||||
const AdvancedSymbology::SymbolDataToRender &symDataToRender =
|
||||
symbolDataToRender(QString::fromStdString(tPart.symbol()));
|
||||
symbolDataToRender(QString::fromStdString(tPart.symbol));
|
||||
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " addRequest for templateId = " << templateId << ": "
|
||||
<< " tPart = " << tPart
|
||||
@@ -105,9 +107,9 @@ void OrgChartMain_MimeDataHelper::prepareBulkRenderer(int templateId)
|
||||
|
||||
|
||||
|
||||
if (tPart.inferiorIds().is_set())
|
||||
if (tPart.inferiorIds.is_set())
|
||||
{
|
||||
const std::vector<int> &inferior = tPart.inferiorIds().get();
|
||||
const std::vector<int> &inferior = tPart.inferiorIds.get();
|
||||
for (int infId : inferior)
|
||||
prepareBulkRenderer(infId);
|
||||
}
|
||||
@@ -120,26 +122,26 @@ QJsonObject OrgChartMain_MimeDataHelper::getMimeData(int templateId)
|
||||
QJsonObject retObj;
|
||||
|
||||
const TemplateParticipant &tPart = m_dtc->templateParticipant(templateId);
|
||||
const Type &type = m_dtc->type(tPart.typeId());
|
||||
QString isUnit = (type.typeClass() == ParticipantManagement::TypeClass::Unit
|
||||
|| type.typeClass() == ParticipantManagement::TypeClass::SupportUnit)
|
||||
const Type &type = m_dtc->type(tPart.typeId);
|
||||
QString isUnit = (type.typeClass == ParticipantManagement::TypeClass::Unit
|
||||
|| type.typeClass == ParticipantManagement::TypeClass::SupportUnit)
|
||||
? QLatin1String("true") : QLatin1String("");
|
||||
|
||||
retObj.insert(QLatin1String("name"), QString::fromStdString(tPart.designator()));
|
||||
retObj.insert(QLatin1String("title"), QString::fromStdString(tPart.designator()));
|
||||
retObj.insert(QLatin1String("typeId"), tPart.typeId());
|
||||
retObj.insert(QLatin1String("symbol"), QString::fromStdString(tPart.symbol()));
|
||||
retObj.insert(QLatin1String("name"), QString::fromStdString(tPart.designator));
|
||||
retObj.insert(QLatin1String("title"), QString::fromStdString(tPart.designator));
|
||||
retObj.insert(QLatin1String("typeId"), tPart.typeId);
|
||||
retObj.insert(QLatin1String("symbol"), QString::fromStdString(tPart.symbol));
|
||||
retObj.insert(QLatin1String("eqNr"), 0);
|
||||
retObj.insert(QLatin1String("info"), QString::fromStdString(tPart.info()));
|
||||
retObj.insert(QLatin1String("sign"), QString::fromStdString(tPart.name()));
|
||||
retObj.insert(QLatin1String("tactIdentifier"), QString::fromStdString(tPart.tacticalIdentifier()));
|
||||
retObj.insert(QLatin1String("info"), QString::fromStdString(tPart.info));
|
||||
retObj.insert(QLatin1String("sign"), QString::fromStdString(tPart.name));
|
||||
retObj.insert(QLatin1String("tactIdentifier"), QString::fromStdString(tPart.tacticalIdentifier));
|
||||
retObj.insert(QLatin1String("isUnit"), isUnit);
|
||||
retObj.insert(QLatin1String("ddsId"), -1);
|
||||
retObj.insert(QLatin1String("id"), -1);
|
||||
retObj.insert(QLatin1String("assignState"), -1);
|
||||
|
||||
const AdvancedSymbology::SymbolDataToRender &symDataToRender =
|
||||
symbolDataToRender(QString::fromStdString(tPart.symbol()));
|
||||
symbolDataToRender(QString::fromStdString(tPart.symbol));
|
||||
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " getResult for templateId = " << templateId
|
||||
<< " symDataToRender=" << symDataToRender.toString();
|
||||
@@ -165,11 +167,11 @@ QJsonObject OrgChartMain_MimeDataHelper::getMimeData(int templateId)
|
||||
|
||||
|
||||
|
||||
if (tPart.inferiorIds().is_set())
|
||||
if (tPart.inferiorIds.is_set())
|
||||
{
|
||||
QJsonArray arr;
|
||||
|
||||
const std::vector<int> &inferior = tPart.inferiorIds().get();
|
||||
const std::vector<int> &inferior = tPart.inferiorIds.get();
|
||||
for (int infId : inferior)
|
||||
arr.append(getMimeData(infId));
|
||||
retObj.insert(QLatin1String("children"), arr);
|
||||
|
||||
+3
-3
@@ -2,13 +2,13 @@
|
||||
|
||||
#include "participant_org_chart.h"
|
||||
#include "ui_participant_org_chart.h"
|
||||
#include <QtWebEngineWidgets/QWebEngineSettings>
|
||||
#include <QtWebEngineCore/QWebEngineSettings>
|
||||
|
||||
#include <Symbology/symbol_data_to_render_role.h>
|
||||
|
||||
#include <QtCore/QFile>
|
||||
#include <QtWebEngine/QtWebEngine>
|
||||
#include <QtWebEngineWidgets/QWebEnginePage>
|
||||
#include <QtWebEngineWidgets/QtWebEngineWidgets>
|
||||
#include <QtWebEngineCore/QWebEnginePage>
|
||||
#include <QtCore/QJsonArray>
|
||||
|
||||
namespace ParticipantManagement
|
||||
|
||||
+50
-48
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "participant_org_chart_helper.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
#include <QtCore/QBuffer>
|
||||
#include <QtCore/QJsonArray>
|
||||
@@ -12,6 +13,7 @@ namespace ParticipantManagement
|
||||
|
||||
ParticipantOrgChart_MimeDataHelper::ParticipantOrgChart_MimeDataHelper(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("ParticipantOrgChart_MimeDataHelper"))
|
||||
{
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << "START";
|
||||
TRACE_LOG(m_logger) << Q_FUNC_INFO << "END";
|
||||
@@ -104,19 +106,19 @@ bool ParticipantOrgChart_MimeDataHelper::prepareBulkRenderer(int participantId,
|
||||
if (m_participantMode)
|
||||
{
|
||||
const Participant &part = m_dtc->participant(participantId);
|
||||
if (part.id() != participantId)
|
||||
if (part.id != participantId)
|
||||
return false;
|
||||
inferior = part.inferiorIds();
|
||||
sidc = QString::fromStdString(part.symbol());
|
||||
inferior = part.inferiorIds;
|
||||
sidc = QString::fromStdString(part.symbol);
|
||||
}else
|
||||
{
|
||||
const TemplateParticipant &part = m_dtc->templateParticipant(participantId);
|
||||
if (part.templateId() != participantId)
|
||||
if (part.templateId != participantId)
|
||||
return false;
|
||||
|
||||
sidc = QString::fromStdString(part.symbol());
|
||||
if (part.inferiorIds().is_set())
|
||||
inferior = part.inferiorIds().get();
|
||||
sidc = QString::fromStdString(part.symbol);
|
||||
if (part.inferiorIds.is_set())
|
||||
inferior = part.inferiorIds.get();
|
||||
}
|
||||
|
||||
if (m_bulkRendererFindImage)
|
||||
@@ -150,33 +152,33 @@ QJsonObject ParticipantOrgChart_MimeDataHelper::getMimeData(int participantId, b
|
||||
<< ", single=" << single;
|
||||
|
||||
ParticipantManagement::Participant part = m_dtc->participant(participantId);
|
||||
if (part.id() != participantId)
|
||||
if (part.id != participantId)
|
||||
return QJsonObject();
|
||||
ParticipantManagement::Type type = m_dtc->type(part.typeId());
|
||||
ParticipantManagement::Type type = m_dtc->type(part.typeId);
|
||||
|
||||
int eqNr = part.equipmentNumber().is_set() ? part.equipmentNumber().get() : 0;
|
||||
QString isUnit = (type.typeClass() == ParticipantManagement::TypeClass::Unit
|
||||
|| type.typeClass() == ParticipantManagement::TypeClass::SupportUnit)
|
||||
int eqNr = part.equipmentNumber.is_set() ? part.equipmentNumber.get() : 0;
|
||||
QString isUnit = (type.typeClass == ParticipantManagement::TypeClass::Unit
|
||||
|| type.typeClass == ParticipantManagement::TypeClass::SupportUnit)
|
||||
? QLatin1String("true") : QString();
|
||||
|
||||
QJsonObject retObj;
|
||||
QString name = QString::fromStdString(part.designator()) + QLatin1Char(' ') + QString::fromStdString(part.tacticalIdentifier());
|
||||
QString name = QString::fromStdString(part.designator) + QLatin1Char(' ') + QString::fromStdString(part.tacticalIdentifier);
|
||||
retObj.insert(QLatin1String("name"), name);
|
||||
retObj.insert(QLatin1String("designator"), QString::fromStdString(part.designator()));
|
||||
retObj.insert(QLatin1String("tactIdentifier"), QString::fromStdString(part.tacticalIdentifier()));
|
||||
retObj.insert(QLatin1String("title"), QString::fromStdString(type.name()));
|
||||
retObj.insert(QLatin1String("info"), QString::fromStdString(part.info()));
|
||||
retObj.insert(QLatin1String("sign"), QString::fromStdString(part.name()));
|
||||
retObj.insert(QLatin1String("typeId"), part.typeId());
|
||||
retObj.insert(QLatin1String("symbol"), QString::fromStdString(part.symbol()));
|
||||
retObj.insert(QLatin1String("designator"), QString::fromStdString(part.designator));
|
||||
retObj.insert(QLatin1String("tactIdentifier"), QString::fromStdString(part.tacticalIdentifier));
|
||||
retObj.insert(QLatin1String("title"), QString::fromStdString(type.name));
|
||||
retObj.insert(QLatin1String("info"), QString::fromStdString(part.info));
|
||||
retObj.insert(QLatin1String("sign"), QString::fromStdString(part.name));
|
||||
retObj.insert(QLatin1String("typeId"), part.typeId);
|
||||
retObj.insert(QLatin1String("symbol"), QString::fromStdString(part.symbol));
|
||||
retObj.insert(QLatin1String("eqNr"), eqNr);
|
||||
retObj.insert(QLatin1String("isUnit"), isUnit);
|
||||
retObj.insert(QLatin1String("ddsId"), part.id());
|
||||
retObj.insert(QLatin1String("id"), part.id());
|
||||
retObj.insert(QLatin1String("assignState"), part.assignState().underlying());
|
||||
retObj.insert(QLatin1String("ddsId"), part.id);
|
||||
retObj.insert(QLatin1String("id"), part.id);
|
||||
retObj.insert(QLatin1String("assignState"), static_cast<int>(part.assignState));
|
||||
|
||||
|
||||
const QString &sidc = QString::fromStdString(part.symbol());
|
||||
const QString &sidc = QString::fromStdString(part.symbol);
|
||||
QSharedPointer<AdvancedSymbology::SymbolResultWatcher> watcher;
|
||||
|
||||
if (m_bulkRendererFindImage)
|
||||
@@ -206,11 +208,11 @@ QJsonObject ParticipantOrgChart_MimeDataHelper::getMimeData(int participantId, b
|
||||
|
||||
|
||||
|
||||
if (part.inferiorIds().size() > 0 && !single)
|
||||
if (part.inferiorIds.size() > 0 && !single)
|
||||
{
|
||||
QJsonArray arr;
|
||||
|
||||
const std::vector<int> &inferior = part.inferiorIds();
|
||||
const std::vector<int> &inferior = part.inferiorIds;
|
||||
for (int infId : inferior)
|
||||
arr.append(getMimeData(infId));
|
||||
retObj.insert(QLatin1String("children"), arr);
|
||||
@@ -228,33 +230,33 @@ QJsonObject ParticipantOrgChart_MimeDataHelper::getTemplateMimeData(int particip
|
||||
<< ", single=" << single;
|
||||
|
||||
ParticipantManagement::TemplateParticipant part = m_dtc->templateParticipant(participantId);
|
||||
if (part.templateId() != participantId)
|
||||
if (part.templateId != participantId)
|
||||
return QJsonObject();
|
||||
ParticipantManagement::Type type = m_dtc->type(part.typeId());
|
||||
ParticipantManagement::Type type = m_dtc->type(part.typeId);
|
||||
|
||||
int eqNr = part.equipmentNumber();
|
||||
QString isUnit = (type.typeClass() == ParticipantManagement::TypeClass::Unit
|
||||
|| type.typeClass() == ParticipantManagement::TypeClass::SupportUnit)
|
||||
int eqNr = part.equipmentNumber;
|
||||
QString isUnit = (type.typeClass == ParticipantManagement::TypeClass::Unit
|
||||
|| type.typeClass == ParticipantManagement::TypeClass::SupportUnit)
|
||||
? QLatin1String("true") : QString();
|
||||
|
||||
QJsonObject retObj;
|
||||
QString name = QString::fromStdString(part.designator()) + QLatin1Char(' ') + QString::fromStdString(part.tacticalIdentifier());
|
||||
QString name = QString::fromStdString(part.designator) + QLatin1Char(' ') + QString::fromStdString(part.tacticalIdentifier);
|
||||
retObj.insert(QLatin1String("name"), name);
|
||||
retObj.insert(QLatin1String("designator"), QString::fromStdString(part.designator()));
|
||||
retObj.insert(QLatin1String("tactIdentifier"), QString::fromStdString(part.tacticalIdentifier()));
|
||||
retObj.insert(QLatin1String("title"), QString::fromStdString(type.name()));
|
||||
retObj.insert(QLatin1String("info"), QString::fromStdString(part.info()));
|
||||
retObj.insert(QLatin1String("sign"), QString::fromStdString(part.name()));
|
||||
retObj.insert(QLatin1String("typeId"), part.typeId());
|
||||
retObj.insert(QLatin1String("symbol"), QString::fromStdString(part.symbol()));
|
||||
retObj.insert(QLatin1String("designator"), QString::fromStdString(part.designator));
|
||||
retObj.insert(QLatin1String("tactIdentifier"), QString::fromStdString(part.tacticalIdentifier));
|
||||
retObj.insert(QLatin1String("title"), QString::fromStdString(type.name));
|
||||
retObj.insert(QLatin1String("info"), QString::fromStdString(part.info));
|
||||
retObj.insert(QLatin1String("sign"), QString::fromStdString(part.name));
|
||||
retObj.insert(QLatin1String("typeId"), part.typeId);
|
||||
retObj.insert(QLatin1String("symbol"), QString::fromStdString(part.symbol));
|
||||
retObj.insert(QLatin1String("eqNr"), eqNr);
|
||||
retObj.insert(QLatin1String("isUnit"), isUnit);
|
||||
retObj.insert(QLatin1String("ddsId"), part.templateId());
|
||||
retObj.insert(QLatin1String("id"), part.templateId());
|
||||
retObj.insert(QLatin1String("ddsId"), part.templateId);
|
||||
retObj.insert(QLatin1String("id"), part.templateId);
|
||||
retObj.insert(QLatin1String("assignState"), -1);
|
||||
|
||||
|
||||
const QString &sidc = QString::fromStdString(part.symbol());
|
||||
const QString &sidc = QString::fromStdString(part.symbol);
|
||||
QSharedPointer<AdvancedSymbology::SymbolResultWatcher> watcher;
|
||||
|
||||
if (m_bulkRendererFindImage)
|
||||
@@ -284,11 +286,11 @@ QJsonObject ParticipantOrgChart_MimeDataHelper::getTemplateMimeData(int particip
|
||||
|
||||
|
||||
|
||||
if (part.inferiorIds().is_set() && part.inferiorIds().get().size() > 0 && !single)
|
||||
if (part.inferiorIds.is_set() && part.inferiorIds.get().size() > 0 && !single)
|
||||
{
|
||||
QJsonArray arr;
|
||||
|
||||
const std::vector<int> &inferior = part.inferiorIds().get();
|
||||
const std::vector<int> &inferior = part.inferiorIds.get();
|
||||
for (int infId : inferior)
|
||||
arr.append(getTemplateMimeData(infId));
|
||||
retObj.insert(QLatin1String("children"), arr);
|
||||
@@ -299,7 +301,7 @@ QJsonObject ParticipantOrgChart_MimeDataHelper::getTemplateMimeData(int particip
|
||||
|
||||
AdvancedSymbology::Injury ParticipantOrgChart_MimeDataHelper::stateToInjury(const ProjectDataManagement::VulnerabilityState &state)
|
||||
{
|
||||
switch (state.underlying())
|
||||
switch (state)
|
||||
{
|
||||
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady:
|
||||
case ProjectDataManagement::VulnerabilityState::VulnerabilityState_TemporarySeverance:
|
||||
@@ -334,10 +336,10 @@ AdvancedSymbology::SymbolDataToRender ParticipantOrgChart_MimeDataHelper::symbol
|
||||
AdvancedSymbology::SymbolDataToRender symDataToRender(sidc);
|
||||
|
||||
DynamicParticipantData dData = m_dtc->dynamicParticipantData(participantId);
|
||||
if (dData.participantId() == participantId && !m_isMenuEnabled)
|
||||
if (dData.participantId == participantId && !m_isMenuEnabled)
|
||||
{
|
||||
const StateInformation &lastState = m_dtc->youngestStateInformation(dData.stateHistory());
|
||||
symDataToRender.injury = stateToInjury(lastState.vulnerabilityState());
|
||||
const StateInformation &lastState = m_dtc->youngestStateInformation(dData.stateHistory);
|
||||
symDataToRender.injury = stateToInjury(lastState.vulnerabilityState);
|
||||
symDataToRender.injuryColor = Qt::black;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -42,6 +42,7 @@ ParticipantSelection::ParticipantSelection(LtsSession::LtsSession *session, QWid
|
||||
, m_ppmGuiCbxIfc(nullptr)
|
||||
, m_session(session)
|
||||
, m_ui(new Ui::ParticipantSelection)
|
||||
, m_logger(getLogger("ParticipantSelection"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
@@ -229,7 +230,7 @@ void ParticipantSelection::accept()
|
||||
QModelIndex sourceIndex = m_proxyTable->mapToSource(index);
|
||||
if (index.column() != 0)
|
||||
continue;
|
||||
participantIds << m_model->privateData(sourceIndex)->participant.id();
|
||||
participantIds << m_model->privateData(sourceIndex)->participant.id;
|
||||
}
|
||||
emit selectedParticipants(participantIds);
|
||||
}
|
||||
|
||||
+13
-13
@@ -23,7 +23,7 @@ namespace core
|
||||
{
|
||||
static inline uint qHash(const ParticipantManagement::TypeClass &tc)
|
||||
{
|
||||
return ::qHash(tc.underlying());
|
||||
return ::qHash(tc);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,7 @@ static QVariant participantToQVariant(const ParticipantData &pd)
|
||||
ds << pd.id()
|
||||
<< pd.partyId()
|
||||
<< pd.hierarchyNumber()
|
||||
<< (pd.equipmentNumber().is_set() ? pd.equipmentNumber().get() : -1)
|
||||
<< (pd.equipmentNumber().has_value() ? pd.equipmentNumber().get() : -1)
|
||||
<< pd.typeId()
|
||||
<< pd.externalId()
|
||||
<< QString::fromStdString(pd.symbol())
|
||||
@@ -51,7 +51,7 @@ static QVariant participantToQVariant(const ParticipantData &pd)
|
||||
<< QString::fromStdString(pd.designator())
|
||||
<< QString::fromStdString(pd.tacticalIdentifier())
|
||||
<< QString::fromStdString(pd.info())
|
||||
<< pd.assignState().underlying()
|
||||
<< pd.assignState()
|
||||
<< pd.isSimulated()
|
||||
<< pd.isDeleted()
|
||||
<< pd.modId()
|
||||
@@ -203,7 +203,7 @@ QVariant ParticipantSelectionModel::headerData(int section, Qt::Orientation orie
|
||||
{
|
||||
for (const auto &typeClassId : m_usedTypeClassIds)
|
||||
{
|
||||
cfd.data = typeClassId.underlying();
|
||||
cfd.data = typeClassId;
|
||||
cfd.text = ParticipantManagement::toString(typeClassId);
|
||||
cfc.data.push_back(cfd);
|
||||
}
|
||||
@@ -269,7 +269,7 @@ QVariant ParticipantSelectionModel::data(const QModelIndex &index, int role) con
|
||||
return ParticipantManagement::trTypeName(m_types.value(participantData.typeId()).name());
|
||||
|
||||
case ColEquipmentNumber:
|
||||
if (!participantData.equipmentNumber().is_set())
|
||||
if (!participantData.equipmentNumber().has_value())
|
||||
{
|
||||
if (participantData.assignState() == ParticipantAssignState::HandoutExcon)
|
||||
return 0;
|
||||
@@ -302,7 +302,7 @@ QVariant ParticipantSelectionModel::data(const QModelIndex &index, int role) con
|
||||
|
||||
case LtsWidgets::LtsColumnFilterProxyModel::ComboboxFilterRole:
|
||||
if (index.column() == ColTypeClass)
|
||||
return typeClassIdFromTypeId(participantData.typeId()).underlying();
|
||||
return typeClassIdFromTypeId(participantData.typeId());
|
||||
if (index.column() == ColType)
|
||||
return participantData.typeId();
|
||||
return QVariant();
|
||||
@@ -373,7 +373,7 @@ bool ParticipantSelectionModel::isRowRemovable(const CheckedTreeItem *parentItem
|
||||
if (!parentItem)
|
||||
return false;
|
||||
const ParticipantManagement::ParticipantData &participantData = parentItem->participant;
|
||||
if (participantData.equipmentNumber().is_set() && participantData.equipmentNumber().get() > 0)
|
||||
if (participantData.equipmentNumber().has_value() && participantData.equipmentNumber().get() > 0)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < parentItem->childCount(); i++)
|
||||
@@ -975,11 +975,11 @@ bool ParticipantTreeFilterProxyModel::lessThan(const QModelIndex &source_left, c
|
||||
case ParticipantSelectionModel::ColType:
|
||||
break;
|
||||
case ParticipantSelectionModel::ColEquipmentNumber:
|
||||
if (!left->participant.equipmentNumber().is_set() && !right->participant.equipmentNumber().is_set())
|
||||
if (!left->participant.equipmentNumber().has_value() && !right->participant.equipmentNumber().has_value())
|
||||
return left->participant.hierarchyNumber() < right->participant.hierarchyNumber();
|
||||
if (!left->participant.equipmentNumber().is_set())
|
||||
if (!left->participant.equipmentNumber().has_value())
|
||||
return true;
|
||||
if (!right->participant.equipmentNumber().is_set())
|
||||
if (!right->participant.equipmentNumber().has_value())
|
||||
return false;
|
||||
return left->participant.equipmentNumber().get() < right->participant.equipmentNumber().get();
|
||||
case ParticipantSelectionModel::ColParticipantId:
|
||||
@@ -1171,11 +1171,11 @@ bool ParticipantTableFilterProxyModel::lessThan(const QModelIndex &sourceLeft, c
|
||||
return LtsWidgets::LtsColumnFilterProxyModel::lessThan(sourceLeft, sourceRight);
|
||||
|
||||
case ParticipantSelectionModel::ColEquipmentNumber:
|
||||
if (!left->participant.equipmentNumber().is_set() && !right->participant.equipmentNumber().is_set())
|
||||
if (!left->participant.equipmentNumber().has_value() && !right->participant.equipmentNumber().has_value())
|
||||
return left->participant.hierarchyNumber() < right->participant.hierarchyNumber();
|
||||
if (!left->participant.equipmentNumber().is_set())
|
||||
if (!left->participant.equipmentNumber().has_value())
|
||||
return true;
|
||||
if (!right->participant.equipmentNumber().is_set())
|
||||
if (!right->participant.equipmentNumber().has_value())
|
||||
return false;
|
||||
return left->participant.equipmentNumber().get() < right->participant.equipmentNumber().get();
|
||||
|
||||
|
||||
+1
-3
@@ -272,6 +272,4 @@ private:
|
||||
ParticipantSelectionModel *m_sourceModel{nullptr};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(ParticipantManagement::ParticipantData)
|
||||
}
|
||||
+7
-6
@@ -38,6 +38,7 @@ ParticipantTemplateChooser::ParticipantTemplateChooser(const QString &menuGroup,
|
||||
, m_session(session)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_ui(new Ui::ParticipantTemplateChooser)
|
||||
, m_logger(getLogger("ParticipantTemplateChooser"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->widget->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
@@ -125,7 +126,7 @@ void ParticipantTemplateChooser::onAddTemplate()
|
||||
QObject::connect(namer, &TemplateUnitNamer::newUnitTemplateRoot, this, [this](const ParticipantManagement::TemplateData &tempData)
|
||||
{
|
||||
ModifyTemplateDataRequest req;
|
||||
req.data({tempData});
|
||||
req.data = {tempData};
|
||||
|
||||
m_requestHelper->addRequest([this,req]()
|
||||
{
|
||||
@@ -145,13 +146,13 @@ void ParticipantTemplateChooser::onEditTemplate()
|
||||
return;
|
||||
|
||||
TemplateParticipant data = m_model->getRowData(m_ui->widget->currentIndex().row());
|
||||
ParticipantTemplateEdit *edit = new ParticipantTemplateEdit(m_session, data.templateId(), m_asSupportService, this);
|
||||
ParticipantTemplateEdit *edit = new ParticipantTemplateEdit(m_session, data.templateId, m_asSupportService, this);
|
||||
if (!edit->init(m_dtc, m_ftc, m_ppmGuiCbxIfc, m_asbIfc))
|
||||
{
|
||||
delete edit;
|
||||
return;
|
||||
}
|
||||
addDialog(edit, m_menuGroup, QLatin1String("editTemplate") + QString::number(data.templateId()), LtsWidgets::LayoutArea::eDialogTab);
|
||||
addDialog(edit, m_menuGroup, QLatin1String("editTemplate") + QString::number(data.templateId), LtsWidgets::LayoutArea::eDialogTab);
|
||||
}
|
||||
|
||||
void ParticipantTemplateChooser::onEditTemplateOrgChart()
|
||||
@@ -192,7 +193,7 @@ void ParticipantTemplateChooser::onEditTemplateOrgChart()
|
||||
return;
|
||||
}
|
||||
|
||||
m_ppmGuiOrgChartIfc->loadTemplate(data.templateId(), m_asSupportService);
|
||||
m_ppmGuiOrgChartIfc->loadTemplate(data.templateId, m_asSupportService);
|
||||
});
|
||||
|
||||
|
||||
@@ -206,10 +207,10 @@ void ParticipantTemplateChooser::onRemoveTemplate()
|
||||
|
||||
const TemplateParticipant tmplParticipant = m_model->getRowData(idx.row());
|
||||
auto tmplData = m_dtc->convertFromParticipantTemplateToTemplateData(tmplParticipant);
|
||||
tmplData.isDeleted(true);
|
||||
tmplData.isDeleted = true;
|
||||
|
||||
ModifyTemplateDataRequest req;
|
||||
req.data({tmplData});
|
||||
req.data = {tmplData};
|
||||
|
||||
m_requestHelper->startSingleRequest([this, req]()
|
||||
{
|
||||
|
||||
+2
-1
@@ -16,6 +16,7 @@ ParticipantTemplateChooserFrameless::ParticipantTemplateChooserFrameless(LtsSess
|
||||
, m_dtc(nullptr)
|
||||
, m_session(session)
|
||||
, m_ui(new Ui::ParticipantTemplateChooserFrameless)
|
||||
, m_logger(getLogger("ParticipantTemplateChooser"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->widget->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
@@ -53,7 +54,7 @@ void ParticipantTemplateChooserFrameless::onAddTemplate()
|
||||
if (!idx.isValid())
|
||||
return;
|
||||
TemplateParticipant data = m_model->getRowData(m_ui->widget->currentIndex().row());
|
||||
emit selectedTemplate(data.templateId());
|
||||
emit selectedTemplate(data.templateId);
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
+13
-12
@@ -22,6 +22,7 @@ ParticipantTemplateChooserModel::ParticipantTemplateChooserModel(bool asSupportS
|
||||
, AdvancedSymbology::TableModelSymbolRenderer<ParticipantTemplateChooserModel>(ColDesignatorIdentifier)
|
||||
, m_asSupportService(asSupportService)
|
||||
, m_dtc(nullptr)
|
||||
, m_logger(getLogger("ParticipantTemplateChooserModel"))
|
||||
{}
|
||||
|
||||
ParticipantTemplateChooserModel::~ParticipantTemplateChooserModel()
|
||||
@@ -47,7 +48,7 @@ bool ParticipantTemplateChooserModel::initModel(LtsSession::LtsSessionDataDds *s
|
||||
auto cb = [this](const ParticipantManagement::TemplateParticipant &templateData)
|
||||
{
|
||||
if (insertRow(templateData))
|
||||
tryRenderSymbol(QString::fromStdString(templateData.symbol()), templateData.templateId());
|
||||
tryRenderSymbol(QString::fromStdString(templateData.symbol), templateData.templateId);
|
||||
};
|
||||
m_dtc->templateParticipants(cb);
|
||||
|
||||
@@ -63,21 +64,21 @@ QVariant ParticipantTemplateChooserModel::data(const QModelIndex &index, int rol
|
||||
|
||||
const ParticipantManagement::TemplateParticipant &templateData = m_vecData.at(index.row());
|
||||
if (role == Qt::DecorationRole)
|
||||
return decorationData(index, templateData.templateId());
|
||||
return decorationData(index, templateData.templateId);
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
case ColDesignatorIdentifier:
|
||||
{
|
||||
if (templateData.designator().size() == 0)
|
||||
return QString::fromStdString(templateData.tacticalIdentifier());
|
||||
return QString(QString::fromStdString(templateData.designator()) + QLatin1Char('/') +
|
||||
QString::fromStdString(templateData.tacticalIdentifier()));
|
||||
if (templateData.designator.size() == 0)
|
||||
return QString::fromStdString(templateData.tacticalIdentifier);
|
||||
return QString(QString::fromStdString(templateData.designator) + QLatin1Char('/') +
|
||||
QString::fromStdString(templateData.tacticalIdentifier));
|
||||
}
|
||||
case ColTypeClass:
|
||||
return ParticipantManagement::toString(m_dtc->type(templateData.typeId()).typeClass());
|
||||
return ParticipantManagement::toString(m_dtc->type(templateData.typeId).typeClass);
|
||||
case ColType:
|
||||
return ParticipantManagement::trTypeName(m_dtc->type(templateData.typeId()).name());
|
||||
return ParticipantManagement::trTypeName(m_dtc->type(templateData.typeId).name);
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
@@ -98,7 +99,7 @@ QMimeData *ParticipantTemplateChooserModel::mimeData(const QModelIndexList &inde
|
||||
{
|
||||
if (index.isValid())
|
||||
{
|
||||
QByteArray encodedData = QByteArray::number(getRowData(index.row()).templateId());
|
||||
QByteArray encodedData = QByteArray::number(getRowData(index.row()).templateId);
|
||||
mimeData->setData(ParticipantManagement::ParticipantTemplateRoot, encodedData);
|
||||
return mimeData;
|
||||
}
|
||||
@@ -118,7 +119,7 @@ void ParticipantTemplateChooserModel::onTemplateChanged(const ParticipantManagem
|
||||
DataModification modType)
|
||||
{
|
||||
if (onDataChanged(data, modType) && modType != DataModification::eRemoved)
|
||||
tryRenderSymbol(QString::fromStdString(data.symbol()), data.templateId());
|
||||
tryRenderSymbol(QString::fromStdString(data.symbol), data.templateId);
|
||||
}
|
||||
|
||||
|
||||
@@ -126,9 +127,9 @@ bool ParticipantTemplateChooserModel::isFiltered(const TemplateParticipant &data
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
|
||||
if (data.superiorTemplateId() != 0)
|
||||
if (data.superiorTemplateId != 0)
|
||||
return true;
|
||||
const TypeClass &tc = m_dtc->type(data.typeId()).typeClass();
|
||||
const TypeClass &tc = m_dtc->type(data.typeId).typeClass;
|
||||
|
||||
if (m_asSupportService)
|
||||
return (tc != TypeClass::SupportEntity && tc != TypeClass::SupportUnit);
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/logger.h>
|
||||
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
@@ -50,7 +51,7 @@ protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
int getId(const TemplateParticipant &data) const override
|
||||
{
|
||||
return data.templateId();
|
||||
return data.templateId;
|
||||
}
|
||||
|
||||
private slots:
|
||||
|
||||
+16
-15
@@ -36,6 +36,7 @@ ParticipantTemplateEdit::ParticipantTemplateEdit(LtsSession::LtsSession *session
|
||||
, m_ppmGuiCbxIfc(nullptr)
|
||||
, m_session(session)
|
||||
, m_ui(new Ui::ParticipantTemplateEdit)
|
||||
, m_logger(getLogger("ParticipantTemplateEdit"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
@@ -164,14 +165,14 @@ bool ParticipantTemplateEdit::isContainer(const QModelIndex &index)
|
||||
Q_UNUSED(index);
|
||||
if (!selectedIndexView().isValid())
|
||||
return false;
|
||||
int typeId = m_model->privateData(selectedIndexView())->data().value<ParticipantManagement::TemplateData>().typeId();
|
||||
int typeId = m_model->privateData(selectedIndexView())->data().value<ParticipantManagement::TemplateData>().typeId;
|
||||
if (typeId <= 0)
|
||||
return false;
|
||||
|
||||
if (m_asSupportService)
|
||||
return m_dtc->type(typeId).typeClass() == ParticipantManagement::TypeClass::SupportUnit;
|
||||
return m_dtc->type(typeId).typeClass == ParticipantManagement::TypeClass::SupportUnit;
|
||||
else
|
||||
return m_dtc->type(typeId).typeClass() == ParticipantManagement::TypeClass::Unit;
|
||||
return m_dtc->type(typeId).typeClass == ParticipantManagement::TypeClass::Unit;
|
||||
|
||||
}
|
||||
|
||||
@@ -216,7 +217,7 @@ void ParticipantTemplateEdit::removeCurrentRow()
|
||||
NGLTreeItem *item = m_model->privateData(selIndex);
|
||||
ParticipantManagement::TemplateData tmpl = item->data().value<ParticipantManagement::TemplateData>();
|
||||
|
||||
const bool isRootTemplate = (tmpl.templateId() == m_rootId);
|
||||
const bool isRootTemplate = (tmpl.templateId == m_rootId);
|
||||
if (!selIndex.isValid() || isRootTemplate)
|
||||
return;
|
||||
|
||||
@@ -238,8 +239,8 @@ void ParticipantTemplateEdit::onAddItem()
|
||||
if (selIndex.isValid())
|
||||
{
|
||||
ParticipantManagement::TemplateData dataAll = m_model->privateData(selIndex)->data().value<ParticipantManagement::TemplateData>();
|
||||
data.designator(dataAll.designator());
|
||||
data.tacticalIdentifier(dataAll.tacticalIdentifier());
|
||||
data.designator = dataAll.designator;
|
||||
data.tacticalIdentifier = dataAll.tacticalIdentifier;
|
||||
}
|
||||
|
||||
if (!newItemDlg->init(selIndex, m_dtc, m_ppmGuiCbxIfc, m_asbIfc, data, addItem))
|
||||
@@ -257,7 +258,7 @@ void ParticipantTemplateEdit::onAddItem()
|
||||
if (m_firingUnitValidator)
|
||||
{
|
||||
newItemDlg->setIsAdler(m_firingUnitValidator->isAdler(m_model, selIndex));
|
||||
const int unitGearClassType = m_firingUnitValidator->getGearClassType(m_model, selIndex);
|
||||
const int unitGearClassType = static_cast<int>(m_firingUnitValidator->getGearClassType(m_model, selIndex));
|
||||
|
||||
newItemDlg->setFiringUnitRestrictions(m_model, false, m_firingUnitValidator->getRestrictions(m_model, selIndex), m_firingUnitValidator, unitGearClassType);
|
||||
|
||||
@@ -298,7 +299,7 @@ void ParticipantTemplateEdit::onEditItem()
|
||||
|
||||
if (m_firingUnitValidator)
|
||||
{
|
||||
const int unitGearClassType = m_firingUnitValidator->getGearClassType(m_model, selIndex);
|
||||
const int unitGearClassType = static_cast<int>(m_firingUnitValidator->getGearClassType(m_model, selIndex));
|
||||
newItemDlg->setFiringUnitRestrictions(m_model, true, m_firingUnitValidator->getRestrictions(m_model, selIndex), m_firingUnitValidator, unitGearClassType);
|
||||
}
|
||||
newItemDlg->show();
|
||||
@@ -317,8 +318,8 @@ void ParticipantTemplateEdit::onPrint()
|
||||
bool ParticipantTemplateEdit::apply()
|
||||
{
|
||||
ModifyTemplateDataRequest req;
|
||||
req.data(m_model->templateData());
|
||||
if (req.data().size() == 0)
|
||||
req.data = m_model->templateData();
|
||||
if (req.data.size() == 0)
|
||||
return true;
|
||||
|
||||
m_bNeedCommitModifedData = true;
|
||||
@@ -359,8 +360,8 @@ void ParticipantTemplateEdit::onSaveAsNewTemplate()
|
||||
return;
|
||||
|
||||
ModifyTemplateDataRequest req;
|
||||
req.data(m_model->templateDataAsCopy(selIndex));
|
||||
if (req.data().size() == 0)
|
||||
req.data = m_model->templateDataAsCopy(selIndex);
|
||||
if (req.data.size() == 0)
|
||||
return;
|
||||
|
||||
m_bNeedCommitModifedData = false;
|
||||
@@ -373,12 +374,12 @@ void ParticipantTemplateEdit::onSaveAsNewTemplate()
|
||||
void ParticipantTemplateEdit::onAddItemToModel(const QModelIndex &parent, const TemplateData &templateData)
|
||||
{
|
||||
bool ret = m_model->onInsertRow(parent, templateData);
|
||||
int typeId = m_model->privateData(parent)->data().value<ParticipantManagement::TemplateData>().typeId();
|
||||
int typeId = m_model->privateData(parent)->data().value<ParticipantManagement::TemplateData>().typeId;
|
||||
if (!ret && typeId <= 0)
|
||||
return;
|
||||
Type type = m_dtc->type(typeId);
|
||||
if (type.typeClass() == TypeClass::Unit ||
|
||||
type.typeClass() == TypeClass::SupportUnit)
|
||||
if (type.typeClass == TypeClass::Unit ||
|
||||
type.typeClass == TypeClass::SupportUnit)
|
||||
{
|
||||
m_ui->treeViewEdit->setExpanded(m_ui->treeViewEdit->selectionModel()->selectedIndexes().at(0), true);
|
||||
}
|
||||
|
||||
+7
-6
@@ -19,6 +19,7 @@ TemplateUnitNamer::TemplateUnitNamer(bool asSupportService, const std::shared_pt
|
||||
, m_ppmGuiCbxIfc(ppmGuiCbxIfc)
|
||||
, m_ui(new Ui::TemplateUnitNamer)
|
||||
, m_validator(new QRegularExpressionValidator(QRegularExpression(QStringLiteral("[^,;\"'´`]*")), this))
|
||||
, m_logger(getLogger("TemplateTemplateChooser"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
if (!m_ppmGuiCbxIfc || !m_dtc)
|
||||
@@ -62,12 +63,12 @@ TemplateUnitNamer::~TemplateUnitNamer()
|
||||
void ParticipantManagement::TemplateUnitNamer::onSetUnitName()
|
||||
{
|
||||
ParticipantManagement::TemplateData templateData;
|
||||
templateData.modId(1);
|
||||
templateData.hierarchyNumber(1);
|
||||
templateData.designator(m_ui->leDesignator->text().toStdString());
|
||||
templateData.tacticalIdentifier(m_ui->leTactIdentifier->text().toStdString());
|
||||
templateData.typeId(m_ui->cbxType->currentData().toInt());
|
||||
templateData.symbol(m_dtc->type(templateData.typeId()).symbol());
|
||||
templateData.modId = 1;
|
||||
templateData.hierarchyNumber = 1;
|
||||
templateData.designator = m_ui->leDesignator->text().toStdString();
|
||||
templateData.tacticalIdentifier = m_ui->leTactIdentifier->text().toStdString();
|
||||
templateData.typeId = m_ui->cbxType->currentData().toInt();
|
||||
templateData.symbol = m_dtc->type(templateData.typeId).symbol;
|
||||
|
||||
emit newUnitTemplateRoot(templateData);
|
||||
close();
|
||||
|
||||
+1
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <ParticipantManagement/logger.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
|
||||
#include <LtsWidgets/lts_frameless_dialog.h>
|
||||
|
||||
|
||||
+33
-31
@@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
#include "operator_party_assignment.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include "ui_operator_party_assignment.h"
|
||||
#include <ParticipantManagement/ppm_data_plugin_interface.h>
|
||||
#include <OperatorManagement/opm_data_plugin_interface.h>
|
||||
@@ -24,6 +25,7 @@ OperatorPartyAssignment::OperatorPartyAssignment(const QString &menuGroup, QWidg
|
||||
, m_operatorId(-1)
|
||||
, m_model(nullptr)
|
||||
, m_ui(new Ui::OperatorPartyAssignment)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
@@ -103,15 +105,15 @@ QMap<int, bool> OperatorPartyAssignment::getPartyStatesForOpertator() const
|
||||
QMap<int,bool> mapPartyCheckStates;
|
||||
for (auto p : partys)
|
||||
{
|
||||
const QString partyId = QString::number(p.id());
|
||||
QJsonObject mainObj = QJsonDocument::fromJson(QByteArray::fromStdString(p.properties())).object();
|
||||
const QString partyId = QString::number(p.id);
|
||||
QJsonObject mainObj = QJsonDocument::fromJson(QByteArray::fromStdString(p.properties)).object();
|
||||
QJsonObject subObj = mainObj.value(s_partyOpAssignStr).toObject();
|
||||
QJsonArray opIdJsArry = subObj.value(QString::number(p.id())).toArray();
|
||||
QJsonArray opIdJsArry = subObj.value(QString::number(p.id)).toArray();
|
||||
|
||||
if (opIdJsArry.contains(QJsonValue::fromVariant(m_operatorId)))
|
||||
mapPartyCheckStates.insert(p.id(), true);
|
||||
mapPartyCheckStates.insert(p.id, true);
|
||||
else
|
||||
mapPartyCheckStates.insert(p.id(), false);
|
||||
mapPartyCheckStates.insert(p.id, false);
|
||||
|
||||
}
|
||||
|
||||
@@ -124,35 +126,35 @@ void OperatorPartyAssignment::onOperatorChanged(const OperatorManagement::User &
|
||||
{
|
||||
case DataModification::eRemoved:
|
||||
{
|
||||
Q_ASSERT(m_operatorMap.contains(data.id()));
|
||||
Q_ASSERT(m_operatorMap.contains(data.id));
|
||||
|
||||
|
||||
if (m_ui->operatorComboBox->currentData().toInt() == data.id())
|
||||
if (m_ui->operatorComboBox->currentData().toInt() == data.id)
|
||||
{
|
||||
__unchange__();
|
||||
}
|
||||
|
||||
m_operatorMap.remove(data.id());
|
||||
m_ui->operatorComboBox->removeItem(m_ui->operatorComboBox->findData(data.id()));
|
||||
m_operatorMap.remove(data.id);
|
||||
m_ui->operatorComboBox->removeItem(m_ui->operatorComboBox->findData(data.id));
|
||||
break;
|
||||
}
|
||||
|
||||
case DataModification::eAdded:
|
||||
{
|
||||
Q_ASSERT(!m_operatorMap.contains(data.id()));
|
||||
const QString operatorName = QString::fromStdString(data.name());
|
||||
m_operatorMap.insert(data.id(), operatorName);
|
||||
m_ui->operatorComboBox->addItem(operatorName, data.id());
|
||||
Q_ASSERT(!m_operatorMap.contains(data.id));
|
||||
const QString operatorName = QString::fromStdString(data.name);
|
||||
m_operatorMap.insert(data.id, operatorName);
|
||||
m_ui->operatorComboBox->addItem(operatorName, data.id);
|
||||
m_ui->operatorComboBox->model()->sort(0);
|
||||
break;
|
||||
}
|
||||
|
||||
case DataModification::eModified:
|
||||
{
|
||||
Q_ASSERT(m_operatorMap.contains(data.id()));
|
||||
const QString operatorName = QString::fromStdString(data.name());
|
||||
m_operatorMap.insert(data.id(), operatorName);
|
||||
int i = m_ui->operatorComboBox->findData(data.id());
|
||||
Q_ASSERT(m_operatorMap.contains(data.id));
|
||||
const QString operatorName = QString::fromStdString(data.name);
|
||||
m_operatorMap.insert(data.id, operatorName);
|
||||
int i = m_ui->operatorComboBox->findData(data.id);
|
||||
Q_ASSERT(i != -1);
|
||||
m_ui->operatorComboBox->setItemText(i, operatorName);
|
||||
m_ui->operatorComboBox->model()->sort(0);
|
||||
@@ -202,13 +204,13 @@ bool OperatorPartyAssignment::apply()
|
||||
const auto &partys = m_ppmDtc->partys();
|
||||
for (auto party : partys)
|
||||
{
|
||||
const QString partyId = QString::number(party.id());
|
||||
QJsonObject propertiesObj = QJsonDocument::fromJson(QByteArray::fromStdString(party.properties())).object();
|
||||
const QString partyId = QString::number(party.id);
|
||||
QJsonObject propertiesObj = QJsonDocument::fromJson(QByteArray::fromStdString(party.properties)).object();
|
||||
QJsonObject subObj = propertiesObj.value(s_partyOpAssignStr).toObject();
|
||||
QJsonArray jsArry = subObj.value(QString::number(party.id())).toArray();
|
||||
QJsonArray jsArry = subObj.value(QString::number(party.id)).toArray();
|
||||
|
||||
const bool containsOpId = jsArry.contains(QJsonValue::fromVariant(m_operatorId));
|
||||
const bool isPartyChecked = statesData.value(party.id(), false);
|
||||
const bool isPartyChecked = statesData.value(party.id, false);
|
||||
if (!containsOpId && !isPartyChecked)
|
||||
continue;
|
||||
if (containsOpId && isPartyChecked)
|
||||
@@ -222,7 +224,7 @@ bool OperatorPartyAssignment::apply()
|
||||
if (jsArry.at(idx).toInt() == m_operatorId)
|
||||
{
|
||||
jsArry.removeAt(idx);
|
||||
subObj.insert(QString::number(party.id()), jsArry);
|
||||
subObj.insert(QString::number(party.id), jsArry);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -230,7 +232,7 @@ bool OperatorPartyAssignment::apply()
|
||||
else if (isPartyChecked)
|
||||
{
|
||||
jsArry.append(QJsonValue::fromVariant(m_operatorId));
|
||||
subObj.insert(QString::number(party.id()), jsArry);
|
||||
subObj.insert(QString::number(party.id), jsArry);
|
||||
}
|
||||
|
||||
|
||||
@@ -239,15 +241,15 @@ bool OperatorPartyAssignment::apply()
|
||||
|
||||
|
||||
Party req = party;
|
||||
req.id(party.id());
|
||||
req.name(party.name());
|
||||
req.color(party.color());
|
||||
req.fadingColor(party.fadingColor());
|
||||
req.hlaForceIdentifier(party.hlaForceIdentifier());
|
||||
req.isUsedBy(party.isUsedBy());
|
||||
req.role(party.role());
|
||||
req.id = party.id;
|
||||
req.name = party.name;
|
||||
req.color = party.color;
|
||||
req.fadingColor = party.fadingColor;
|
||||
req.hlaForceIdentifier = party.hlaForceIdentifier;
|
||||
req.isUsedBy = party.isUsedBy;
|
||||
req.role = party.role;
|
||||
QString props = QString::fromUtf8(QJsonDocument(propertiesObj).toJson());
|
||||
req.properties(props.toStdString());
|
||||
req.properties = props.toStdString();
|
||||
|
||||
m_requestHelper->addRequest([this, req]
|
||||
{
|
||||
|
||||
+9
-7
@@ -1,4 +1,5 @@
|
||||
#include "operator_party_assignment_model.h"
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
#include <ParticipantManagement/ppm_translation.h>
|
||||
#include <QtGui/QColor>
|
||||
@@ -17,6 +18,7 @@ OPeratorPartyAssignmentModel::OPeratorPartyAssignmentModel(QObject *parent)
|
||||
tr("Role")},
|
||||
parent)
|
||||
, m_dtc(nullptr)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
||||
{
|
||||
}
|
||||
bool OPeratorPartyAssignmentModel::initModel(const std::shared_ptr<ParticipantManagement::Interface::Dtc> &dtc)
|
||||
@@ -70,9 +72,9 @@ QVariant OPeratorPartyAssignmentModel::data(const QModelIndex &index, int role)
|
||||
switch(index.column())
|
||||
{
|
||||
case Color:
|
||||
return QColor::fromRgb(QRgb(party.color()));
|
||||
return QColor::fromRgb(QRgb(party.color));
|
||||
case FadedColor:
|
||||
return QColor::fromRgb(QRgb(party.fadingColor()));
|
||||
return QColor::fromRgb(QRgb(party.fadingColor));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,20 +83,20 @@ QVariant OPeratorPartyAssignmentModel::data(const QModelIndex &index, int role)
|
||||
switch (index.column())
|
||||
{
|
||||
case Id:
|
||||
return party.id();
|
||||
return party.id;
|
||||
case Name:
|
||||
return ParticipantManagement::trPartyName(party.name());
|
||||
return ParticipantManagement::trPartyName(party.name);
|
||||
case Color:
|
||||
return QVariant();
|
||||
case FadedColor:
|
||||
return QVariant();
|
||||
case Role:
|
||||
return ParticipantManagement::toString(party.role());
|
||||
return ParticipantManagement::toString(party.role);
|
||||
}
|
||||
}
|
||||
if (role == Qt::CheckStateRole && index.column() == Name)
|
||||
{
|
||||
Qt::CheckState checkState = m_mapPartyCheckStates.value(party.id(),false) ? Qt::Checked : Qt::Unchecked;
|
||||
Qt::CheckState checkState = m_mapPartyCheckStates.value(party.id,false) ? Qt::Checked : Qt::Unchecked;
|
||||
return checkState;
|
||||
}
|
||||
return QVariant();
|
||||
@@ -119,7 +121,7 @@ bool OPeratorPartyAssignmentModel::setData(const QModelIndex &index, const QVari
|
||||
return QAbstractTableModel::setData(index, value, role);
|
||||
|
||||
const ParticipantManagement::Party &party = m_vecData.at(index.row());
|
||||
bool &state = m_mapPartyCheckStates[party.id()];
|
||||
bool &state = m_mapPartyCheckStates[party.id];
|
||||
state = state ? false : true;
|
||||
|
||||
emit dataChanged(index, index, {role});
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/logger.h>
|
||||
|
||||
#include <QtCore/QSortFilterProxyModel>
|
||||
@@ -43,7 +44,7 @@ NGL::INGLLogger &m_logger;
|
||||
bool isFiltered(const Party &data, DataModification modType) const override
|
||||
{
|
||||
|
||||
if (data.id() <= 1)
|
||||
if (data.id <= 1)
|
||||
return true;
|
||||
return LtsWidgets::LtsAbstractTableModel<ParticipantManagement::Party>::isFiltered(data, modType);
|
||||
}
|
||||
|
||||
+39
-39
@@ -54,7 +54,7 @@ PartyEdit::~PartyEdit()
|
||||
|
||||
void PartyEdit::retranslate()
|
||||
{
|
||||
translate(m_ui, m_dtc->party(m_partyId), trPartyName(m_dtc->party(m_partyId).name()), tr("Party"));
|
||||
translate(m_ui, m_dtc->party(m_partyId), trPartyName(m_dtc->party(m_partyId).name), tr("Party"));
|
||||
m_ppmGuiCbxIfc->fillRoleComboBox(m_ui->cbRole);
|
||||
m_ppmGuiCbxIfc->fillHlaForceIdentifierComboBox(m_ui->cbHlaForceIdentifier);
|
||||
}
|
||||
@@ -98,7 +98,7 @@ bool PartyEdit::init(int partyId, LtsSession::LtsSession *session)
|
||||
if (m_partyId >= 0) // pool has id 0 so is a valid party
|
||||
{
|
||||
const Party &party = m_dtc->party(m_partyId);
|
||||
if(party.id() >= 0)
|
||||
if(party.id >= 0)
|
||||
{
|
||||
setData(party);
|
||||
}
|
||||
@@ -115,8 +115,8 @@ bool PartyEdit::init(int partyId, LtsSession::LtsSession *session)
|
||||
}
|
||||
|
||||
// Could be filled programmatically later
|
||||
m_ui->cbAdlerNotification->setProperty("Notification", NotificationManagement::NotificationType::AdlerNotification);
|
||||
m_ui->cbCombatOrder->setProperty("Notification", NotificationManagement::NotificationType::CombatOrder);
|
||||
m_ui->cbAdlerNotification->setProperty("Notification", static_cast<int>(NotificationManagement::NotificationType::AdlerNotification));
|
||||
m_ui->cbCombatOrder->setProperty("Notification", static_cast<int>(NotificationManagement::NotificationType::CombatOrder));
|
||||
|
||||
bool enableNotification = (LtsSessionData::LtsSessionData::getInstance()->hasOperatorRight(OperatorRights::NotificationShow) );
|
||||
if (!enableNotification)
|
||||
@@ -127,7 +127,7 @@ bool PartyEdit::init(int partyId, LtsSession::LtsSession *session)
|
||||
|
||||
const ParticipantManagement::ConnectState status = m_dtc->saaConnectedState(m_partyId);
|
||||
const bool enableReset = (LtsSessionData::LtsSessionData::getInstance()->hasOperatorRight(OperatorRights::ChargeAdministrationShow)) &&
|
||||
(status.underlying() == ParticipantManagement::ConnectState::NoHeartbeat);
|
||||
(status == ParticipantManagement::ConnectState::NoHeartbeat);
|
||||
if (!enableReset)
|
||||
{
|
||||
m_ui->lblReset->hide();
|
||||
@@ -156,13 +156,13 @@ bool PartyEdit::apply()
|
||||
ParticipantManagement::HlaForceIdentifierEnum hlaIdentfier = static_cast<ParticipantManagement::HlaForceIdentifierEnum>(m_ui->cbHlaForceIdentifier->currentData().toInt());
|
||||
Party req;
|
||||
|
||||
req.id(m_partyId);
|
||||
req.name(m_ui->leName->text().toStdString());
|
||||
req.color(m_color.rgb());
|
||||
req.fadingColor(m_fadedColor.rgb());
|
||||
req.role(role);
|
||||
req.hlaForceIdentifier(hlaIdentfier);
|
||||
req.isUsedBy(m_isUsed);
|
||||
req.id = m_partyId;
|
||||
req.name = m_ui->leName->text().toStdString();
|
||||
req.color = m_color.rgb();
|
||||
req.fadingColor = m_fadedColor.rgb();
|
||||
req.role = role;
|
||||
req.hlaForceIdentifier = hlaIdentfier;
|
||||
req.isUsedBy = m_isUsed;
|
||||
|
||||
m_requestHelper->addRequest([req, this]()
|
||||
{
|
||||
@@ -171,23 +171,23 @@ bool PartyEdit::apply()
|
||||
}
|
||||
|
||||
OperatorManagement::User user = m_dtcOpm->user(LtsSessionData::LtsSessionData::getInstance()->getOperatorId());
|
||||
QJsonObject opmProperties(QJsonDocument::fromJson(QByteArray::fromStdString(user.properties())).object());
|
||||
QJsonObject opmProperties(QJsonDocument::fromJson(QByteArray::fromStdString(user.properties)).object());
|
||||
|
||||
fillOpmProperties(opmProperties);
|
||||
|
||||
OperatorManagement::OperatorCreateModifyRequest reqOpm;
|
||||
reqOpm.id(user.id());
|
||||
reqOpm.name(user.name());
|
||||
reqOpm.description(user.description());
|
||||
reqOpm.audioChannelPriority(user.audioChannelPriority());
|
||||
reqOpm.projectionPriority(user.projectionPriority());
|
||||
reqOpm.image(user.image());
|
||||
reqOpm.visiblePartiesByExercise(user.visiblePartiesByExercise());
|
||||
reqOpm.rolePresetId(user.rolePresetId());
|
||||
reqOpm.id = user.id;
|
||||
reqOpm.name = user.name;
|
||||
reqOpm.description = user.description;
|
||||
reqOpm.audioChannelPriority = user.audioChannelPriority;
|
||||
reqOpm.projectionPriority = user.projectionPriority;
|
||||
reqOpm.image = user.image;
|
||||
reqOpm.visiblePartiesByExercise = user.visiblePartiesByExercise;
|
||||
reqOpm.rolePresetId = user.rolePresetId;
|
||||
|
||||
QString properties = QString::fromUtf8(QJsonDocument(opmProperties).toJson());
|
||||
DEBUG_LOG(m_logger) << "properties: " << properties;
|
||||
reqOpm.properties(properties.toStdString());
|
||||
reqOpm.properties = properties.toStdString();
|
||||
|
||||
m_requestHelper->addRequest([reqOpm, this]()
|
||||
{
|
||||
@@ -238,11 +238,11 @@ void PartyEdit::onResetAdlerConnectionClicked()
|
||||
|
||||
void PartyEdit::onPartyChanged(const Party &data, DataModification modType)
|
||||
{
|
||||
if (modType == DataModification::eRemoved || data.id() != m_partyId)
|
||||
if (modType == DataModification::eRemoved || data.id != m_partyId)
|
||||
return;
|
||||
|
||||
const ConnectState connectState = m_dtc->saaConnectedState(m_partyId);
|
||||
switch (connectState.underlying())
|
||||
switch (connectState)
|
||||
{
|
||||
case ParticipantManagement::ConnectState::NoHeartbeat:
|
||||
{
|
||||
@@ -264,14 +264,14 @@ void PartyEdit::onPartyChanged(const Party &data, DataModification modType)
|
||||
|
||||
void PartyEdit::setData(const Party &party)
|
||||
{
|
||||
m_ui->leName->setText(ParticipantManagement::trPartyName(party.name()));
|
||||
m_color = QColor::fromRgb(QRgb(party.color()));
|
||||
m_fadedColor = QColor::fromRgb(QRgb(party.fadingColor()));
|
||||
m_isUsed = party.isUsedBy();
|
||||
m_ui->leName->setText(ParticipantManagement::trPartyName(party.name));
|
||||
m_color = QColor::fromRgb(QRgb(party.color));
|
||||
m_fadedColor = QColor::fromRgb(QRgb(party.fadingColor));
|
||||
m_isUsed = party.isUsedBy;
|
||||
setColorToButton(m_ui->tbColor, m_color);
|
||||
setColorToButton(m_ui->tbFadedColor, m_fadedColor);
|
||||
m_ui->cbRole->setCurrentIndex(m_ui->cbRole->findData(party.role().underlying()));
|
||||
m_ui->cbHlaForceIdentifier->setCurrentIndex(m_ui->cbHlaForceIdentifier->findData(party.hlaForceIdentifier().underlying()));
|
||||
m_ui->cbRole->setCurrentIndex(m_ui->cbRole->findData(static_cast<int>(party.role)));
|
||||
m_ui->cbHlaForceIdentifier->setCurrentIndex(m_ui->cbHlaForceIdentifier->findData(static_cast<int>(party.hlaForceIdentifier)));
|
||||
}
|
||||
|
||||
void PartyEdit::setColorToButton(QToolButton *button, const QColor &color)
|
||||
@@ -283,7 +283,7 @@ void PartyEdit::fillJsonSuppressNotifications( QJsonArray ¬if, NotificationMa
|
||||
{
|
||||
QJsonObject suppNotif;
|
||||
suppNotif[QStringLiteral("partyId")] = m_partyId;
|
||||
suppNotif[QStringLiteral("AddressType")] = NotificationManagement::AddressType::Service;
|
||||
suppNotif[QStringLiteral("AddressType")] = static_cast<int>(NotificationManagement::AddressType::Service);
|
||||
suppNotif[QStringLiteral("Address")] = AreaEffectSimulation::Offset;
|
||||
|
||||
QCheckBox *cbNotif = findCheckBoxByNotificationType(notifType);
|
||||
@@ -293,7 +293,7 @@ void PartyEdit::fillJsonSuppressNotifications( QJsonArray ¬if, NotificationMa
|
||||
int index = findSuppressNotification(m_partyId, notifType, notif);
|
||||
if (!cbNotif->isChecked())
|
||||
{
|
||||
suppNotif[QStringLiteral("NotificationType")] = notifType.underlying();
|
||||
suppNotif[QStringLiteral("NotificationType")] = static_cast<int>(notifType);
|
||||
if (index >= 0)
|
||||
notif.replace(index, suppNotif);
|
||||
else
|
||||
@@ -310,7 +310,7 @@ QCheckBox* PartyEdit::findCheckBoxByNotificationType(const NotificationManagemen
|
||||
{
|
||||
for(QCheckBox* cb : findChildren<QCheckBox*>())
|
||||
{
|
||||
if (cb->property("Notification").toInt() == notif.underlying())
|
||||
if (cb->property("Notification").toInt() == static_cast<int>(notif))
|
||||
return cb;
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ int PartyEdit::findSuppressNotification( int partyId, NotificationManagement::No
|
||||
{
|
||||
QJsonObject obj = suppNotif.at(i).toObject();
|
||||
if (obj[QStringLiteral("partyId")] == partyId &&
|
||||
obj[QStringLiteral("NotificationType")] == notifType.underlying())
|
||||
obj[QStringLiteral("NotificationType")] == static_cast<int>(notifType))
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ void PartyEdit::notificationCheck()
|
||||
|
||||
DEBUG_LOG(m_logger) << "Party allowed for ADLER notifications";
|
||||
|
||||
const std::string properties = m_dtcOpm->user(LtsSessionData::LtsSessionData::getInstance()->getOperatorId()).properties();
|
||||
const std::string properties = m_dtcOpm->user(LtsSessionData::LtsSessionData::getInstance()->getOperatorId()).properties;
|
||||
QJsonObject opmProperties(QJsonDocument::fromJson(QByteArray::fromStdString(properties)).object());
|
||||
|
||||
QJsonArray arrExercises = opmProperties[QStringLiteral("Exercises")].toArray();
|
||||
@@ -419,11 +419,11 @@ void PartyEdit::modifyPartyProperties()
|
||||
ParticipantManagement::Party requestParty;
|
||||
requestParty = m_dtc->party(m_partyId);
|
||||
// Get properties and then update them
|
||||
const QJsonObject &origObj = QJsonDocument::fromJson(requestParty.properties().c_str()).object();
|
||||
const QJsonObject &origObj = QJsonDocument::fromJson(requestParty.properties.c_str()).object();
|
||||
QJsonObject adlerPropertiesObj = origObj[QStringLiteral("Adler")].toObject();
|
||||
adlerPropertiesObj[QStringLiteral("saaConnectedState")] = ParticipantManagement::ConnectState::Disconnecting;
|
||||
adlerPropertiesObj[QStringLiteral("saaConnectedState")] = static_cast<int>(ParticipantManagement::ConnectState::Disconnecting);
|
||||
|
||||
const QByteArray &propertiesBa = requestParty.properties().c_str();
|
||||
const QByteArray &propertiesBa = requestParty.properties.c_str();
|
||||
QJsonParseError parserError;
|
||||
QJsonDocument doc(QJsonDocument::fromJson(propertiesBa, &parserError));
|
||||
|
||||
@@ -439,7 +439,7 @@ void PartyEdit::modifyPartyProperties()
|
||||
obj[QStringLiteral("Adler")] = adlerPropertiesObj;
|
||||
|
||||
const QByteArray propertiesStr = QJsonDocument(obj).toJson(QJsonDocument::Compact);
|
||||
requestParty.properties() = propertiesStr.data();
|
||||
requestParty.properties = propertiesStr.data();
|
||||
|
||||
m_ftc->modifyPartyDataRequest(requestParty);
|
||||
}
|
||||
|
||||
+1
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <ParticipantManagement/logger.h>
|
||||
#include <ParticipantManagement/ppm.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <ParticipantManagement/ppm_ftc.h>
|
||||
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
|
||||
Loaded 100 of 1718 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user