- NGL_ADD_LIBRARY2: 87 CMakeLists.txt konvertiert für Export-Header Generierung - 44 Export-Header Include-Pfade korrigiert (_export.h) - 81 DDS-Stub-Header generiert (*_dtc.h, *_fts.h, *_dts.h, *_ftc.h) - INGLLogger: Duplikat gelöscht, m_logger Member entfernt, variadische Makros - Q_FUNC_INFO Redefinition behoben (Qt6 definiert bereits) - FATAL_LOG Makro hinzugefügt - InfrastructureManagement DDS-Stubs (ism.hpp, ism_enums.hpp, ism_ftc.h) - FilterManagement DDS-Stubs (flt_ftc.h, flt_dts.h) - AreaEffectSimulation DDS-Stubs (aes.hpp, aes_enums.hpp) - SymbolAppearance Klasse vollständig definiert mit content() Methode - BuildingComponentFilter Klasse definiert mit Copy-Konstruktor - Ftc Factory: nullptr Return (abstract class) - AesFilter Klasse in aes.hpp hinzugefügt - Dtc Klasse in ppm.hpp mit participantChanged Signal - AesType Enum: alle 15 At* Werte definiert - AesEffectState_def: EsReceived hinzugefügt - DataModification Enum: eAdded/eModified/eRemoved - function_reply_object.h → core_types.h Include-Pfad (72 Dateien) - Enum-Class-Streaming Template-Operator in INGLLogger.h - ism_mounting_point.h: QImage → QtGui/QImage, QGuiApplication/QScreen - ism_data_plugin_interface.h: QSet Include, Include-Reihenfolge - QRegExp → QRegularExpression in tpm_js_parser.cpp - .underlying() Aufrufe zu direktem Enum-Vergleich korrigiert - Include-Pfade: aes.hpp in symbol_appearance_settings_impl.h und aes_display_filter_impl.h 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 <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() );
|
|
}
|
|
}
|