Initial commit

This commit is contained in:
torsten committed 2026-08-13 18:33:10 +02:00
commit b7d90b9afe
16245 files changed
+3396666

No files matched your search

@@ -0,0 +1,122 @@
#include "aes_base_info.h"
#include "ui_aes_base_info.h"
#include <Plugins/ProjectDataManagement/pdm_data_plugin_interface.h>
#include <Plugins/ParticipantManagement/ppm_data_plugin_interface.h>
#include <LtsSession/lts_session.h>
#include <QDateTime>
#include <AreaEffectSimulation/aes_translation.h>
#include <ParticipantManagement/ppm_translation.h>
namespace AreaEffectSimulation
{
BaseInfo::BaseInfo(QWidget *parent)
: LtsDialog(parent)
, m_session(nullptr)
, m_ui(new Ui::BaseInfo)
{
m_ui->setupUi(this);
}
BaseInfo::~BaseInfo()
{
delete m_ui;
}
void BaseInfo::retranslate()
{
translate(m_ui, tr("AES Info"));
}
void BaseInfo::setEffectStart(qint64 effectStart)
{
if (effectStart > 0)
{
m_ui->lblEffectStart->show();
m_ui->lbxEffectStart->show();
m_ui->lblEffectStart->setText(QDateTime::fromMSecsSinceEpoch(effectStart).toString());
}
else
{
m_ui->lblEffectStart->hide();
m_ui->lbxEffectStart->hide();
}
}
void BaseInfo::setEffectDuration(int32_t effectDuration)
{
if (effectDuration > 0)
{
m_ui->lblEffectDuration->show();
m_ui->lbxEffectDuration->show();
m_ui->lblEffectDuration->setText(LtsWidgets::readableDuration(effectDuration, false));
}
else
{
m_ui->lblEffectDuration->hide();
m_ui->lbxEffectDuration->hide();
}
}
bool BaseInfo::setData(const AesItem *item)
{
if (!m_session)
return false;
std::shared_ptr<ProjectDataManagement::Interface::Dtc> pdmDtc = nullptr;
std::shared_ptr<ParticipantManagement::Interface::Dtc> ppmDtc = nullptr;
m_session->getDtc<ParticipantManagement::DataInterface>(ppmDtc);
if (!m_session->getDtc<ProjectDataManagement::DataInterface>(pdmDtc) || !pdmDtc )
return false;
setEffectDuration(item->effectDuration());
m_ui->lblIdentifier->setText(QString::fromStdString(item->name().c_str()));
m_ui->lblChargeType->setText(pdmDtc->trChargeTypeShortName(item->chargeStruct().chargeTypeId(), true));
m_ui->lblChargeType->setToolTip(pdmDtc->trChargeTypeName(item->chargeStruct().chargeTypeId(), true));
m_ui->lblEffectState->setText(AreaEffectSimulation::toString(item->effectStateId()));
setEffectStart(item->effectStart().is_set() ? item->effectStart().get() : 0);
if (item->participantId().is_set())
{
if (!ppmDtc)
m_ui->lblParticipant->setText(tr("ID: %1").arg(item->participantId().get()));
else
{
ParticipantManagement::Participant participant = ppmDtc->participant(item->partyId().get());
m_ui->lblParticipant->setText(QString::fromStdString(participant.name()));
}
}
else
{
m_ui->lblParticipant->hide();
m_ui->lbxParticipant->hide();
}
if (item->partyId().is_set())
{
if (!ppmDtc)
m_ui->lblParty->setText(tr("ID: %1").arg(item->partyId().get()));
else
{
ParticipantManagement::Party party = ppmDtc->party(item->partyId().get());
m_ui->lblParty->setText(ParticipantManagement::trPartyName(party.name()));
}
}
else
{
m_ui->lblParty->hide();
m_ui->lblParty->hide();
}
return true;
}
void BaseInfo::init(LtsSession::LtsSessionDataDds *session)
{
m_session = session;
}
}