- 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>
167 lines
4.8 KiB
C++
Executable File
167 lines
4.8 KiB
C++
Executable File
|
|
|
|
|
|
#include "msg_messaging.h"
|
|
#include "ui_msg_messaging.h"
|
|
#include "msg_show_message_dialog.h"
|
|
#include "msg_new_message_dialog.h"
|
|
|
|
#include <LtsSession/lts_session_manager.h>
|
|
#include <LtsSession/lts_session_data.h>
|
|
|
|
#include <LtsPrinting/printing.h>
|
|
#include <QTreeView>
|
|
|
|
namespace Messaging
|
|
{
|
|
|
|
MessagingView::MessagingView(const QString &menuGroup, LtsSession::LtsSession *session, QWidget *parent)
|
|
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
|
, m_menuGroup(menuGroup)
|
|
, m_model(nullptr)
|
|
, m_box(MessagingModel::Box::InBox)
|
|
, m_dtc(nullptr)
|
|
, m_ftc(nullptr)
|
|
, m_opmCbxDtc(nullptr)
|
|
, m_uniqueMsgId(0)
|
|
, m_session(session)
|
|
, m_ui(new Ui::MessagingView)
|
|
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
|
{
|
|
m_ui->setupUi(this);
|
|
m_ui->widget->setSelectionMode(QAbstractItemView::SingleSelection);
|
|
|
|
|
|
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged,
|
|
this, &MessagingView::onSelectionChanged);
|
|
|
|
|
|
m_buttonBox->connectButton(LtsWidgets::DialogButton::Show, this, &MessagingView::onShowMessage);
|
|
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Show, false);
|
|
|
|
connect(m_ui->widget, &LtsDataView::LtsDataView::signalDoubleClicked, this, &MessagingView::onShowMessage);
|
|
connect(m_ui->widget, &LtsDataView::LtsDataView::signalEnterPressed, this, &MessagingView::onShowMessage);
|
|
|
|
|
|
m_buttonBox->connectButton(LtsWidgets::DialogButton::Add, this, &MessagingView::onNewMessage);
|
|
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Add, true);
|
|
m_buttonBox->setText(LtsWidgets::DialogButton::Add, tr("Add"));
|
|
|
|
|
|
|
|
m_buttonBox->connectButton(LtsWidgets::DialogButton::Remove, this, &MessagingView::onRemoveMessage);
|
|
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, false);
|
|
|
|
m_buttonBox->connectButton(LtsWidgets::DialogButton::Print, this, &MessagingView::onPrint);
|
|
|
|
}
|
|
|
|
|
|
MessagingView::~MessagingView()
|
|
{
|
|
delete m_ui;
|
|
}
|
|
|
|
|
|
void MessagingView::retranslate()
|
|
{
|
|
translate(m_ui, m_box == MessagingModel::Box::InBox ? tr("Inbox") : tr("Outbox"));
|
|
}
|
|
|
|
bool MessagingView::init(const std::shared_ptr<Messaging::Interface::Dtc> &dtc,
|
|
const std::shared_ptr<Messaging::Interface::Ftc> &ftc,
|
|
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
|
|
const std::shared_ptr<TrainingAreaBaseOC::Interface::Dtc> &tabocDtc,
|
|
const std::shared_ptr<OperatorManagement::ForeignGuiComboboxInterface> &opmCbxDtc,
|
|
const MessagingModel::Box &box)
|
|
{
|
|
if (!dtc || !ftc || !opmCbxDtc)
|
|
return false;
|
|
|
|
m_dtc = dtc;
|
|
m_ftc = ftc;
|
|
m_opmCbxDtc = opmCbxDtc;
|
|
m_box = box;
|
|
|
|
m_model = new MessagingModel(this);
|
|
m_model->initModel(m_dtc, ppmDtc, tabocDtc, m_session, m_box);
|
|
m_proxyModel = new MessagingProxyModel(this);
|
|
m_proxyModel->setSourceModel(m_model);
|
|
m_ui->widget->setModel(m_proxyModel);
|
|
|
|
#ifndef LTS_DEBUG
|
|
m_ui->widget->hideColumn(0);
|
|
#endif
|
|
|
|
m_ui->widget->setSortIndicator(1, Qt::AscendingOrder);
|
|
|
|
setOnlineHelpFilename(QStringLiteral("Situation-Function_Group_Messages"));
|
|
|
|
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
void MessagingView::onSelectionChanged()
|
|
{
|
|
QModelIndexList selectedRows = m_ui->widget->selectedRows();
|
|
const int cntSelectedRows = selectedRows.size();
|
|
|
|
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, cntSelectedRows == 1);
|
|
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, cntSelectedRows == 1);
|
|
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Show, cntSelectedRows == 1);
|
|
}
|
|
|
|
|
|
void MessagingView::onShowMessage()
|
|
{
|
|
const QModelIndex idx = m_ui->widget->currentIndex();
|
|
|
|
int row = idx.row();
|
|
if (row < 0)
|
|
return;
|
|
|
|
Messaging::OperatorMessage operatorMessage = m_model->getRowData(row);
|
|
|
|
ShowMessageDialog *dialog = new ShowMessageDialog(m_session, this);
|
|
dialog->init(m_dtc, m_ftc, m_opmCbxDtc, m_box, operatorMessage, m_menuGroup);
|
|
|
|
addDialog(dialog, m_menuGroup, QStringLiteral("msgShowMessage%1").arg(operatorMessage.id()), LtsWidgets::LayoutArea::eDialogTab);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MessagingView::onNewMessage()
|
|
{
|
|
NewMessageDialog *dialog = new NewMessageDialog(m_session);
|
|
dialog->init(m_dtc, m_ftc, m_opmCbxDtc);
|
|
addDialog(dialog, m_menuGroup, QStringLiteral("msgNewMessage%1").arg(m_uniqueMsgId++), LtsWidgets::LayoutArea::eDialogTab);
|
|
}
|
|
|
|
|
|
void MessagingView::onRemoveMessage()
|
|
{
|
|
m_requestHelper->startSingleRequest([this]()
|
|
{
|
|
return m_ftc->modifyOperatorMessageRequest(ModifyOperatorMessageRequest(m_model->getRowData(m_ui->widget->currentIndex().row()).id(), false, false, true), this);
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
void MessagingView::onPrint()
|
|
{
|
|
LtsPrinting::printView(m_session, this, m_ui->widget->treeView());
|
|
}
|
|
|
|
void MessagingView::tableColumnOrganiserSetting()
|
|
{
|
|
|
|
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
|
|
}
|
|
|
|
}
|