- training_area_telegrams.cpp: Fixed QJsonObject initializer syntax (Qt6 requires {{}} not ({}))
- training_area_telegrams.cpp: Fixed fromJson() methods to access m_* members directly
- training_area_telegrams.cpp: Fixed brace mismatches in multiple toJson() methods
- training_area_telegrams.h: Changed Header struct to public members for consistency
- tx_mixin.cpp: Fixed getEquipmentNumber() template for direct member access
- lts_coordinate.cpp: Added missing #include <iomanip>
- MIGRATION_STATUS.md: Added migration progress tracking document
C++17 constraint enforced due to RTI Connext DDS 7.7.0 incompatibility with C++20+
Build status: BUILD_RTI=OFF successful (0 errors, warnings only)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
179 lines
4.9 KiB
C++
Executable File
179 lines
4.9 KiB
C++
Executable File
|
|
|
|
|
|
|
|
#include "replay_dialog.h"
|
|
#include "ui_replay_dialog.h"
|
|
#include "replay_dialog_model.h"
|
|
#include "CustomView/srm_replay.h"
|
|
|
|
#include <LtsWidgets/lts_message_dialog.h>
|
|
#include <LtsSession/lts_session.h>
|
|
#include <LtsSession/lts_session_data.h>
|
|
#include <LtsSession/lts_session_manager.h>
|
|
|
|
#include <QModelIndexList>
|
|
|
|
#include <LtsPrinting/printing.h>
|
|
#include <QtWidgets/QTreeView>
|
|
|
|
namespace SituationReplayManagement
|
|
{
|
|
|
|
|
|
|
|
SituationReplayManagementDialog::SituationReplayManagementDialog(LtsSession::LtsSession *session, QWidget *parent)
|
|
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
|
, m_session(session)
|
|
, m_model(nullptr)
|
|
, m_ui(new Ui::SituationReplayManagementDialog)
|
|
, m_srmForeign(nullptr)
|
|
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
|
{
|
|
m_ui->setupUi(this);
|
|
|
|
|
|
m_buttonBox->connectButton(LtsWidgets::DialogButton::Add,
|
|
this, &SituationReplayManagementDialog::onAddReplayPartition);
|
|
|
|
m_buttonBox->connectButton(LtsWidgets::DialogButton::Remove,
|
|
this, &SituationReplayManagementDialog::onRemoveReplayPartition);
|
|
|
|
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print,
|
|
this, &SituationReplayManagementDialog::onPrint);
|
|
|
|
m_buttonBox->setText(LtsWidgets::DialogButton::Yes, tr("Start Replay"));
|
|
m_buttonBox->connectButton(LtsWidgets::DialogButton::Yes,
|
|
this, &SituationReplayManagementDialog::slotStartReplay);
|
|
|
|
|
|
m_ui->widget->setSelectionMode(QAbstractItemView::MultiSelection);
|
|
|
|
setOnlineHelpFilename(QStringLiteral("Situation-Replay_Management"));
|
|
}
|
|
|
|
|
|
SituationReplayManagementDialog::~SituationReplayManagementDialog()
|
|
{
|
|
delete m_ui;
|
|
}
|
|
|
|
|
|
void SituationReplayManagementDialog::retranslate()
|
|
{
|
|
translate(m_ui, tr("Replay Management"));
|
|
}
|
|
|
|
void SituationReplayManagementDialog::tableColumnOrganiserSetting()
|
|
{
|
|
|
|
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
|
|
}
|
|
|
|
|
|
void SituationReplayManagementDialog::slotStartReplay()
|
|
{
|
|
const QModelIndex idx = m_ui->widget->currentIndex();
|
|
const Core::ReplayPartition rp = m_model->getRowData(idx.row());
|
|
|
|
int replayPartition = rp.id();
|
|
|
|
if (replayPartition < 1)
|
|
{
|
|
LtsWidgets::LtsMessageDialog::showMessage(this, tr("This Replay Partition is not valid!"), tr("Cannot start Replay"));
|
|
return;
|
|
}
|
|
|
|
const LtsSession::DdsConnectionParams connParams(rp);
|
|
m_session->getSessionManager()->createSession(connParams, true, false );
|
|
}
|
|
|
|
|
|
bool SituationReplayManagementDialog::init(const std::shared_ptr<Core::Interface::Dtc> &dtc,
|
|
const std::shared_ptr<SituationReplayManagement::ForeignDataInterface> &srmForeign)
|
|
{
|
|
m_srmForeign = srmForeign;
|
|
m_model = new ReplayPartitionDialogModel(this);
|
|
m_model->initModel(m_session->exerciseId(), dtc);
|
|
m_ui->widget->setModel(m_model, [this]() { return new CustomViewReplay(this); });
|
|
|
|
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged,
|
|
this, &SituationReplayManagementDialog::enaDisa);
|
|
|
|
enaDisa();
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
void SituationReplayManagementDialog::enaDisa()
|
|
{
|
|
QModelIndexList selectedRows = m_ui->widget->selectedRows();
|
|
const int cntSelectedRows = selectedRows.size();
|
|
|
|
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, (cntSelectedRows > 0));
|
|
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Yes, (cntSelectedRows == 1));
|
|
}
|
|
|
|
|
|
void SituationReplayManagementDialog::onAddReplayPartition()
|
|
{
|
|
if (!m_session)
|
|
return;
|
|
|
|
const int partitionId = m_session->partitionId();
|
|
try
|
|
{
|
|
m_srmForeign->replayPartitionCreateRequest(partitionId,
|
|
LtsSessionData::LtsSessionData::getInstance()->getWorkstationId(),
|
|
LtsSessionData::LtsSessionData::getInstance()->getOperatorId(),
|
|
Core::ReplayType::SituationData);
|
|
}
|
|
catch(...)
|
|
{
|
|
new LtsWidgets::LtsMessageDialogNew(this, tr("Failed to create replay partition!"));
|
|
}
|
|
}
|
|
|
|
|
|
void SituationReplayManagementDialog::onRemoveReplayPartition()
|
|
{
|
|
QVector<QPair<int, int> > toDelete;
|
|
QModelIndexList selectedRows = m_ui->widget->selectedRows();
|
|
|
|
for (auto i = selectedRows.constBegin(); i != selectedRows.constEnd(); ++i)
|
|
{
|
|
const Core::ReplayPartition &rp = m_model->getRowData((*i).row());
|
|
int id = rp.id();
|
|
int wsId = rp.workstationId();
|
|
|
|
if (id < 1 || wsId < 1)
|
|
continue;
|
|
|
|
QPair<int, int> p(id, wsId);
|
|
|
|
toDelete.append(p);
|
|
}
|
|
|
|
for (auto i = toDelete.constBegin(); i != toDelete.constEnd(); ++i)
|
|
{
|
|
QPair<int, int> p = *i;
|
|
|
|
try
|
|
{
|
|
m_srmForeign->replayPartitionRemoveRequest(p.first, p.second, 0);
|
|
}
|
|
catch(...)
|
|
{
|
|
new LtsWidgets::LtsMessageDialogNew(this, tr("Failed to remove replay partition!"));
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
void SituationReplayManagementDialog::onPrint()
|
|
{
|
|
LtsPrinting::printView(m_session, this, m_ui->widget->treeView() );
|
|
}
|
|
}
|