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

+42
View File
@@ -0,0 +1,42 @@
#
# $Id$
# $HeadURL$
# $Author$
# Created by Patric Karwat, SLSE, 2016-10-05
#
SET(gna_nasat_part_gui_SRCS
gna_nasat_part_gui_plugin.cpp
gna_nasat_part_gui_plugin.h
assign_gna_dialog.cpp
assign_gna_dialog.h
gna_part_dialog.cpp
gna_part_dialog.h
)
NGL_WRAP_UI(gna_nasat_part_gui_SRCS
gna_part_dialog.ui
assign_gna_dialog.ui
)
NGL_ADD_LIBRARY(WS GnaNasatPartGuiPlugin MODULE ${gna_nasat_part_gui_SRCS})
NGL_TARGET_LINK_LIBRARIES(GnaNasatPartGuiPlugin
LtsPrinting
GnaCommon
LtsSession
LtsSessionData
GnaGuiPluginInterface
GnaDataPluginInterface
svcGnaCommon
svcPpmCommon
GuiPluginInterface
Qt5::Widgets
LtsCoordTrans
LtsWidgets
LtsDataView
NGLLogger
LtsUtilsGuiDds
LtsUtilsSettings
)
NGL_INSTALL_TARGET(GnaNasatPartGuiPlugin)
+116
View File
@@ -0,0 +1,116 @@
/**
* @RDE_HEADER@
* Beschreibung des Dialogs
* $Id$
* $HeadURL$
* $Author$
* Created by Mike Wille, SLSE, 2017-11-01
*/
#include "assign_gna_dialog.h"
#include "ui_assign_gna_dialog.h"
#include <LtsWidgets/lts_dialog.h>
#include <Plugins/GuezNasat/Gui/Common/gna_nasat_aircraft_part_model.h>
namespace GuezNasat
{
AssignGuezNasatPartDialog::AssignGuezNasatPartDialog(int exerciseId, QWidget *parent)
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
, m_ftc(nullptr)
, m_nasatAircraftParticipantModel(nullptr)
, m_exerciseId(exerciseId)
, m_ui(new Ui::AssignGuezNasatPartDialog)
, m_requestHelper(new LtsUtils::RequestHelper(this))
, m_logger(getLogger("Dialog"))
{
m_ui->setupUi(this);
}
AssignGuezNasatPartDialog::~AssignGuezNasatPartDialog()
{
delete m_ui;
}
bool AssignGuezNasatPartDialog::init(const std::shared_ptr<GuezNasat::Interface::Ftc> &ftc,
NasatAircraftParticipantModel *nasatAircraftParticipantModel,
const NasatAircraftParticipant &nap)
{
m_ftc = ftc;
m_nasatAircraftParticipantModel = nasatAircraftParticipantModel;
m_nap = nap;
initCmbNasats();
initCmbParticipants();
connect(m_nasatAircraftParticipantModel, &NasatAircraftParticipantModel::signalNasatNamesChanged,
this, &AssignGuezNasatPartDialog::initCmbNasats);
connect(m_nasatAircraftParticipantModel, &NasatAircraftParticipantModel::signalParticipantNamesChanged,
this, &AssignGuezNasatPartDialog::initCmbParticipants);
m_buttonBox->setButtonVisible(LtsWidgets::DialogButton::Apply, false);
setOnlineHelpFilename(QStringLiteral("Administrator-Airplanes"));
if (nap.id() <= 0)
slotChangesMade();
return true;
}
void AssignGuezNasatPartDialog::initCmbNasats()
{
m_ui->cmbNasats->clear();
const auto names(m_nasatAircraftParticipantModel->getNasatNames());
for (auto it = names.begin(); it != names.end(); ++it)
{
if (!m_nasatAircraftParticipantModel->getAssociatedNasatIds().contains(it.key()) || m_nap.nasatAircraftId() == it.key())
m_ui->cmbNasats->addItem(it.value(), it.key());
}
int newIdx = m_ui->cmbNasats->findData(m_nap.nasatAircraftId());
if (newIdx >= 0)
m_ui->cmbNasats->setCurrentIndex(newIdx);
m_ui->cmbNasats->model()->sort(0);
}
void AssignGuezNasatPartDialog::initCmbParticipants()
{
m_ui->cmbParticipants->clear();
const auto hierarchies(m_nasatAircraftParticipantModel->getParticipantHierarchies());
const auto decorations(m_nasatAircraftParticipantModel->getParticipantDecorations());
for (auto it = hierarchies.begin(); it != hierarchies.end(); ++it)
{
if (!m_nasatAircraftParticipantModel->getAssociatedParticipantIds().contains(it.key()) || m_nap.participantId() == it.key())
m_ui->cmbParticipants->addItem(QIcon(decorations.value(it.key())), it.value(), it.key());
}
int newIdx = m_ui->cmbParticipants->findData(m_nap.participantId());
if (newIdx >= 0)
m_ui->cmbParticipants->setCurrentIndex(newIdx);
m_ui->cmbParticipants->model()->sort(0);
}
void AssignGuezNasatPartDialog::retranslate()
{
translate(m_ui, m_nap.id() <= 0 ? tr("Add Assign Aircraft") : tr("Edit Assign Aircraft"));
}
bool AssignGuezNasatPartDialog::apply()
{
INFO_LOG(m_logger) << "AssignGuezNasatPartDialog::apply()";
int32_t participantId = m_ui->cmbParticipants->currentData().toInt();
int32_t nasatAircraftId = m_ui->cmbNasats->currentData().toInt();
const NasatAircraftParticipant req(m_nap.id(), nasatAircraftId, m_exerciseId, participantId);
return m_requestHelper->startSingleRequest([req, this]()
{
return m_ftc->modifyNasatAircraftParticipantRequest(req, this);
});
} // end of apply
} // namespace GuezNasat
+60
View File
@@ -0,0 +1,60 @@
/**
* @RDE_HEADER@
* Alarm Configuration
* $Id$
* $HeadURL$
* $Author$
* Created by Mike Wille, SLSE, 2017-01-11
*/
#pragma once
#include <LtsWidgets/lts_dialog.h>
#include <GuezNasat/gna_ftc.h>
#include <LtsUtilsGuiDds/request_helper.h>
#include <GuezNasat/logger.h>
namespace Ui
{
class AssignGuezNasatPartDialog;
}
namespace GuezNasat
{
class NasatAircraftParticipantModel;
class AssignGuezNasatPartDialog final : public LtsWidgets::LtsDialog
, protected GuezNasat::Interface::Ftc::ModifyNasatAircraftParticipantReplyHandler
{
Q_OBJECT
public:
explicit AssignGuezNasatPartDialog(int exerciseId, QWidget *parent = nullptr);
~AssignGuezNasatPartDialog();
bool init(const std::shared_ptr<GuezNasat::Interface::Ftc> &ftc,
NasatAircraftParticipantModel *nasatAircraftParticipantModel,
const NasatAircraftParticipant &nap = NasatAircraftParticipant());
void retranslate() override;
bool apply() override;
protected:
void onModifyNasatAircraftParticipantReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
private:
void getCheckedValues();
void initCmbNasats();
void initCmbParticipants();
std::shared_ptr<GuezNasat::Interface::Ftc> m_ftc;
NasatAircraftParticipantModel *m_nasatAircraftParticipantModel;
int m_exerciseId;
Ui::AssignGuezNasatPartDialog *m_ui;
LtsUtils::RequestHelper *m_requestHelper;
LOGGER_T m_logger;
NasatAircraftParticipant m_nap;
};
} // namespace GuezNasat
+81
View File
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AssignGuezNasatPartDialog</class>
<widget class="QWidget" name="AssignGuezNasatPartDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>366</width>
<height>88</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true">AlarmView</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>NASAT Aircraft:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="LtsWidgets::LtsComboBox" name="cmbNasats">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Associated Participant:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="LtsWidgets::LtsComboBox" name="cmbParticipants"/>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LtsWidgets::LtsComboBox</class>
<extends>QComboBox</extends>
<header>LtsWidgets/lts_combo_box.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
@@ -0,0 +1,200 @@
/**
* @RDE_HEADER@
* Gui Plugin for AlarmManagement
* $Id$
* $HeadURL$
* $Author$
* Created by Patric Karwat, SLSE, 2016-10-05
*/
#include "gna_nasat_part_gui_plugin.h"
#include "gna_part_dialog.h"
#include <LtsSession/lts_session.h>
#include <LtsWidgets/lts_base_layout_widget.h>
#include <LtsWidgets/lts_message_dialog.h>
#include <LtsWidgets/lts_global_wait_dialog.h>
#include <LtsUtilsSettings/settings.h>
#include <Proxies/GuezNasat/gna_operator_rights.h>
#include <Proxies/GuezNasat/logger.h>
#include <QApplication>
#include <QDesktopWidget>
#include <QProcess>
#include <QScreen>
namespace GuezNasat
{
std::shared_ptr<GuiPluginBase::Interface> GuiPlugin::createGuiInterface(LtsSession::LtsSession *session)
{
return std::make_shared<InterfaceImpl>(session);
}
bool GuiPlugin::availableInPartition(IDL::PartitionType partition) const
{
return partition == IDL::PartitionType::Exercise;
}
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
: GuiPluginBase::Interface(session, getLogger("NasatAircraft"))
{
}
bool InterfaceImpl::fetchInterfaces()
{
if (!m_session->getDtc<GuezNasat::DataInterface>(m_dtc))
return false;
if (!m_session->getFtc<GuezNasat::DataInterface>(m_ftc))
return false;
if (!m_session->getDtc<ExerciseManagement::DataInterface>(m_exmDtc))
return false;
if (!m_session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc))
return false;
m_session->getForeignGuiInterface(m_ppmCbxIfc);
return true;
}
void InterfaceImpl::clearInterfaces()
{
m_ftc = nullptr;
m_dtc = nullptr;
m_exmDtc = nullptr;
m_ppmDtc = nullptr;
m_ppmCbxIfc = nullptr;
}
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
{
QVector<LtsWidgets::PluginData> ret;
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
const bool enableGuezNasat = ps->value(QStringLiteral("gna"),
QStringLiteral("enableGuezNasat")).toBool();
if (!enableGuezNasat)
return ret;
{
LtsWidgets::PluginData plData;
plData.menuGroup = menuGroup();
plData.menuText = tr("Assign NASAT Aircrafts");
plData.identifier = QStringLiteral("assignNasatAircraft");
plData.menuIcon = QIcon(QStringLiteral("icon:nasat_assign.svg"));
plData.operatorRight = OperatorRights::GuezNasatConfigurationShow;
plData.exercisePart = LtsWidgets::ExercisePart::ePlanning;
plData.createWidgetFunc = [this](QWidget *parent)
{
return LtsWidgets::initDialog(new GuezNasatPartDialog(menuGroup(), m_session, parent),
m_ftc, m_dtc, m_exmDtc, m_ppmDtc, m_ppmCbxIfc);
};
ret.append(plData);
}
#ifndef Q_OS_WIN
const QString rdesktopIP = ps->value(QStringLiteral("gna"), QStringLiteral("midasRDesktopIP")).toString();
if (!rdesktopIP.isEmpty())
{
LtsWidgets::PluginData plData;
plData.menuGroup = menuGroup();
plData.menuText = tr("MiDAS remote desktop");
plData.identifier = QStringLiteral("remoteDesktopMidas");
plData.menuIcon = QIcon(QStringLiteral("icon:midas_remote_desktop.svg"));
plData.operatorRight = OperatorRights::GuezNasatConfigurationShow;
plData.exercisePart = LtsWidgets::ExercisePart::ePlanning;
plData.directFunc = [this, rdesktopIP](const LtsWidgets::PluginData &)
{
onMidasRemoteDesktop(rdesktopIP);
};
ret.append(plData);
}
#endif
return ret;
}
QString InterfaceImpl::menuGroup() const
{
return tr("Participants / Aircrafts");
}
void InterfaceImpl::onMidasRemoteDesktop(const QString &rdesktopIP)
{
#ifdef LTS_DEBUG // TODO: activate for all
LtsWidgets::LtsGlobalWaitDialog::getInstance()->wait(tr("Waiting for Remote Desktop session"));
#endif
LtsUtils::ProjectSettings *ps = LtsUtils::ProjectSettings::getInstance();
const QString username(ps->value(QStringLiteral("gna"), QStringLiteral("midasUser")).toString());
const QString password(ps->value(QStringLiteral("gna"), QStringLiteral("midasPassword")).toString());
QSize s(1920, 1080);
if (m_rdesktop != nullptr)
m_rdesktop->deleteLater();
m_rdesktop = new QProcess(this);
m_rdesktop->setProgram(QStringLiteral("rdesktop"));
const QString cmd(QStringLiteral("%1 -g %2x%3 -u %4 -p %5 -z").arg(rdesktopIP).arg(s.width()).arg(s.height()).arg(username, password));
m_rdesktop->setArguments(cmd.split(QStringLiteral(" ")));
DEBUG_LOG(m_logger) << "rdesktop args" << m_rdesktop->arguments().join(QStringLiteral(", "));
connect(m_rdesktop, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
this, [this](int exitCode)
{
if (m_rdesktop != qobject_cast<QProcess *>(sender()))
return;
#ifdef LTS_DEBUG // TODO: activate for all
if (exitCode < 0 || exitCode == 4 || (exitCode >= 6 && exitCode <= 8) || exitCode == 10 || (exitCode >= 16 && exitCode <= 26) || exitCode >= 63)
new LtsWidgets::LtsMessageDialogNew(m_session->baseLayout(), tr("Remote desktop error id: %1").arg(exitCode));
#endif
m_rdesktop->deleteLater();
m_rdesktop = nullptr;
});
#ifdef LTS_DEBUG // TODO: activate for all
connect(m_rdesktop, &QProcess::started,
this, []()
{
LtsWidgets::LtsGlobalWaitDialog::getInstance()->done();
});
connect(m_rdesktop, &QProcess::readyReadStandardError,
this, [this]()
{
QProcess *p = qobject_cast<QProcess *>(sender());
if (p == nullptr)
return;
ERROR_LOG(m_logger) << "Remote desktop: error:" << p->readAllStandardError();
});
connect(m_rdesktop, &QProcess::readyReadStandardOutput,
this, [this]()
{
QProcess *p = qobject_cast<QProcess *>(sender());
if (p == nullptr)
return;
INFO_LOG(m_logger) << "Remote desktop: " << p->readAllStandardOutput();
});
connect(m_rdesktop, &QProcess::errorOccurred,
this, [this](QProcess::ProcessError )
{
if (m_rdesktop != qobject_cast<QProcess *>(sender())) // only print messages if process relevant (and not 0ptr)
return;
if (m_rdesktop->state() != QProcess::Running)
LtsWidgets::LtsGlobalWaitDialog::getInstance()->done();
new LtsWidgets::LtsMessageDialogNew(m_session->baseLayout(), tr("Remote desktop process error: %1.").arg(m_rdesktop->errorString()));
});
#endif
m_rdesktop->start();
}
} // namespace NasatAircraft
@@ -0,0 +1,66 @@
/**
* @RDE_HEADER@
* Gui Plugin for AlarmManagement
* $Id$
* $HeadURL$
* $Author$
* Created by Patric Karwat, SLSE, 2016-10-05
*/
#pragma once
#include <GuezNasat/logger.h>
#include <PluginInterfaces/gui_plugin_interface.h>
#include <Common/ProjectConfig/project_defines.h>
#include "gna_nasat_part_gui_plugin.h"
#include <GuezNasat/gna_data_plugin_interface.h>
#include <GuezNasat/gna_gui_plugin_interface.h>
#include <ExerciseManagement/exm_data_plugin_interface.h>
#include <ParticipantManagement/ppm_data_plugin_interface.h>
#include <ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
class QProcess;
namespace GuezNasat
{
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
{
Q_PLUGIN_METADATA(IID "gui:3:ppm.assignnasat")
Q_INTERFACES(GuiPluginBase::Plugin)
Q_OBJECT
public:
explicit GuiPlugin() = default;
~GuiPlugin() = default;
QString pluginName() override { return QLatin1String("ParticipantManagement.GuiPlugin.AssignNasat"); }
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
bool availableInPartition(IDL::PartitionType partition) const override;
};
class InterfaceImpl final
: public QObject
, public GuiPluginBase::Interface
, public ForeignGuiInterface
{
Q_OBJECT
public:
explicit InterfaceImpl(LtsSession::LtsSession *session);
bool fetchInterfaces() override;
void clearInterfaces() override;
QString menuGroup() const override;
QVector<LtsWidgets::PluginData> getActions() override;
private:
void onMidasRemoteDesktop(const QString &rdesktopIP);
std::shared_ptr<GuezNasat::Interface::Dtc> m_dtc;
std::shared_ptr<GuezNasat::Interface::Ftc> m_ftc;
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_exmDtc;
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> m_ppmCbxIfc;
QProcess *m_rdesktop = nullptr;
};
} // namespace GuezNasat
+162
View File
@@ -0,0 +1,162 @@
/**
* @RDE_HEADER@
* Beschreibung des Dialogs
* $Id$
* $HeadURL$
* $Author$
* Created by Mike Wille, SLSE, 2017-11-01
*/
#include "gna_part_dialog.h"
#include "ui_gna_part_dialog.h"
#include "assign_gna_dialog.h"
namespace GuezNasat
{
GuezNasatPartDialog::GuezNasatPartDialog(const QString &menuGroup, LtsSession::LtsSession *session, QWidget *parent)
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
, m_nasatAircraftParticipantModel(nullptr)
, m_dtc(nullptr)
, m_ftc(nullptr)
, m_exmDtc(nullptr)
, m_ppmDtc(nullptr)
, m_session(session)
, m_ui(new Ui::GuezNasatPartDialog)
, m_menuGroup(menuGroup)
, m_requestHelper(new LtsUtils::RequestHelper(this))
, m_logger(getLogger("Dialog"))
{
m_ui->setupUi(this);
setOnlineHelpFilename(QStringLiteral("Administrator-Airplanes"));
}
GuezNasatPartDialog::~GuezNasatPartDialog()
{
delete m_ui;
}
bool GuezNasatPartDialog::init(const std::shared_ptr<GuezNasat::Interface::Ftc> &ftc,
const std::shared_ptr<GuezNasat::Interface::Dtc> &dtc,
const std::shared_ptr<ExerciseManagement::Interface::Dtc> &exmDtc,
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
const std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> &ppmGuiCbxIfc)
{
if (!ftc || !dtc || !exmDtc || !ppmDtc)
return false;
m_ftc = ftc;
m_dtc = dtc;
m_exmDtc = exmDtc;
m_ppmDtc = ppmDtc;
INFO_LOG(m_logger) << "GuezNasatPartDialog::init";
m_nasatAircraftParticipantModel = new GuezNasat::NasatAircraftParticipantModel(this);
m_nasatAircraftParticipantModel->initModel(m_dtc, m_exmDtc, m_ppmDtc, ppmGuiCbxIfc, m_session);
m_ui->widget->setModel(m_nasatAircraftParticipantModel);
// connects fuer Widgetaenderungen
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged,
this, &GuezNasatPartDialog::onSelectionChanged);
connect(m_ui->widget, &LtsDataView::LtsDataView::signalDoubleClicked, this, &GuezNasatPartDialog::onEditAircraftPart);
// Create Add-Button
m_buttonBox->setButtonVisible(LtsWidgets::DialogButton::Add, true);
m_buttonBox->connectButton(LtsWidgets::DialogButton::Add, this, &GuezNasatPartDialog::onNewAircraftPart);
// Create Remove-Button
m_buttonBox->connectButton(LtsWidgets::DialogButton::Remove, this, &GuezNasatPartDialog::onRemoveAircraftPart);
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, false);
// Create Modify-Button
m_buttonBox->setButtonVisible(LtsWidgets::DialogButton::Edit, true);
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, false);
m_buttonBox->connectButton(LtsWidgets::DialogButton::Edit, this, &GuezNasatPartDialog::onEditAircraftPart);
#ifndef LTS_DEBUG
m_ui->widget->hideColumn(NasatAircraftParticipantModel::Columns::Id);
m_ui->widget->hideColumn(NasatAircraftParticipantModel::Columns::NasatAircreaftId);
m_ui->widget->hideColumn(NasatAircraftParticipantModel::Columns::ExerciseId);
m_ui->widget->hideColumn(NasatAircraftParticipantModel::Columns::ExerciseName);
m_ui->widget->hideColumn(NasatAircraftParticipantModel::Columns::ParticipantId);
#endif
return true;
}
void GuezNasatPartDialog::retranslate()
{
translate(m_ui, tr("Assign Aircrafts"));
}
void GuezNasatPartDialog::onNewAircraftPart()
{
INFO_LOG(m_logger) << "onNewAircraft";
AssignGuezNasatPartDialog *assignGuezNasatPartDialog = new AssignGuezNasatPartDialog(m_session->exerciseId(), this);
if (!assignGuezNasatPartDialog->init(m_ftc, m_nasatAircraftParticipantModel))
{
ERROR_LOG(m_logger) << QLatin1String("Can't initialize AssignGuezNasatPartDialog!");
delete assignGuezNasatPartDialog;
return;
}
addDialog(assignGuezNasatPartDialog, m_menuGroup, QStringLiteral("Add Assign Aircraft"), LtsWidgets::LayoutArea::eDialogTab, true, true);
}
void GuezNasatPartDialog::onEditAircraftPart()
{
const QModelIndex curIdx = m_ui->widget->currentIndex();
if (!curIdx.isValid())
return;
INFO_LOG(m_logger) << "onEditAircraft";
AssignGuezNasatPartDialog *assignGuezNasatPartDialog = new AssignGuezNasatPartDialog(m_session->exerciseId(), this);
if (!assignGuezNasatPartDialog->init(m_ftc, m_nasatAircraftParticipantModel, m_nasatAircraftParticipantModel->getRowData(curIdx.row())))
{
ERROR_LOG(m_logger) << QLatin1String("Can't initialize assignGuezNasatPartDialog!");
delete assignGuezNasatPartDialog;
return;
}
addDialog(assignGuezNasatPartDialog, m_menuGroup, QStringLiteral("Edit Assign Aircraft"), LtsWidgets::LayoutArea::eDialogTab, true, true);
}
void GuezNasatPartDialog::tableColumnOrganiserSetting()
{
//LtsColumnOrganiser
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
}
void GuezNasatPartDialog::onRemoveAircraftPart()
{
const QModelIndex curIdx = m_ui->widget->currentIndex();
if (!curIdx.isValid())
return;
INFO_LOG(m_logger) << "onRemoveNewAircraft";
NasatAircraftParticipant req;
req.id(m_nasatAircraftParticipantModel->getRowData(curIdx.row()).id());
m_requestHelper->startSingleRequest([req, this]()
{
return m_ftc->modifyNasatAircraftParticipantRequest(req, this);
});
}
void GuezNasatPartDialog::onSelectionChanged()
{
QModelIndexList selectedRows = m_ui->widget->selectedRows();
const int cntSelectedRows = selectedRows.size();
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Remove, cntSelectedRows == 1);
m_buttonBox->setButtonEnabled(LtsWidgets::DialogButton::Edit, cntSelectedRows == 1);
} // end of onSelectionChanged()
//-----------------------------------------------------------------------------
} // namespace GuezNasat
+72
View File
@@ -0,0 +1,72 @@
/**
* @RDE_HEADER@
* Alarm Configuration
* $Id$
* $HeadURL$
* $Author$
* Created by Mike Wille, SLSE, 2017-01-11
*/
#pragma once
#include <LtsWidgets/lts_dialog.h>
#include <GuezNasat/gna_dtc.h>
#include <GuezNasat/gna_ftc.h>
#include <ParticipantManagement/ppm_dtc.h>
#include <LtsUtilsGuiDds/request_helper.h>
#include <GuezNasat/logger.h>
#include <Plugins/GuezNasat/Gui/Common/gna_nasat_aircraft_part_model.h>
namespace Ui
{
class GuezNasatPartDialog;
}
namespace GuezNasat
{
class GuezNasatPartDialog final : public LtsWidgets::LtsDialog
, protected GuezNasat::Interface::Ftc::ModifyNasatAircraftParticipantReplyHandler
{
Q_OBJECT
public:
explicit GuezNasatPartDialog(const QString &menuGroup, LtsSession::LtsSession *session, QWidget *parent = nullptr);
~GuezNasatPartDialog();
bool init(const std::shared_ptr<GuezNasat::Interface::Ftc> &ftc,
const std::shared_ptr<GuezNasat::Interface::Dtc> &dtc,
const std::shared_ptr<ExerciseManagement::Interface::Dtc> &exmDtc,
const std::shared_ptr<ParticipantManagement::Interface::Dtc> &ppmDtc,
const std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> &ppmGuiCbxIfc);
void retranslate() override;
protected:
void onModifyNasatAircraftParticipantReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
private slots:
void onSelectionChanged();
void onNewAircraftPart();
void onRemoveAircraftPart();
void onEditAircraftPart();
private:
void tableColumnOrganiserSetting() override;
NasatAircraftParticipantModel *m_nasatAircraftParticipantModel;
std::shared_ptr<GuezNasat::Interface::Dtc> m_dtc;
std::shared_ptr<GuezNasat::Interface::Ftc> m_ftc;
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_exmDtc;
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
LtsSession::LtsSession *m_session;
Ui::GuezNasatPartDialog *m_ui;
QString m_menuGroup;
LtsUtils::RequestHelper *m_requestHelper;
LOGGER_T m_logger;
};
} // namespace GuezNasat
+45
View File
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GuezNasatPartDialog</class>
<widget class="QWidget" name="GuezNasatPartDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>455</width>
<height>341</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true">AlarmView</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="LtsDataView::LtsDataView" name="widget">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>250</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LtsDataView::LtsDataView</class>
<extends>QWidget</extends>
<header>LtsDataView/lts_data_view.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>