Initial commit
This commit is contained in:
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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include "../aes_base_exports.h"
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
#include <Services/AreaEffectSimulation/aes.hpp>
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class BaseInfo;
|
||||
}
|
||||
|
||||
namespace LtsSession
|
||||
{
|
||||
class LtsSessionDataDds;
|
||||
}
|
||||
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
class AESBASEGUI_EXPORT BaseInfo : public LtsWidgets::LtsDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BaseInfo(QWidget *parent = nullptr);
|
||||
~BaseInfo();
|
||||
|
||||
bool setData(const AesItem *item);
|
||||
void init(LtsSession::LtsSessionDataDds *session);
|
||||
|
||||
void setEffectStart(qint64 effectStart);
|
||||
void setEffectDuration(int32_t effectDuration);
|
||||
|
||||
private:
|
||||
void retranslate() override;
|
||||
|
||||
LtsSession::LtsSessionDataDds *m_session;
|
||||
Ui::BaseInfo *m_ui;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>BaseInfo</class>
|
||||
<widget class="QWidget" name="BaseInfo">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>139</width>
|
||||
<height>162</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Aes Info</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lbxEffectState">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Effect State:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="lblEffectStart">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">today</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="lblEffectState">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Active</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbxEffectDuration">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Effect Duration:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="lblEffectDuration">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">1m</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbxIdentifier">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Identifier:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="lblIdentifier">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="lbxParty">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Party:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="lblParty">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">RED</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbxEffectStart">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Effect Start:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lbxChargeTye">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Charge Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="lblChargeType">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Mun</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="lbxParticipant">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Participant:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLabel" name="lblParticipant">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">Bla</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in new issue
Block a user