Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+48
@@ -0,0 +1,48 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
|
||||
#ADD_SUBDIRECTORY(Data)
|
||||
#ADD_SUBDIRECTORY(Gui)
|
||||
|
||||
#
|
||||
# Gui Plugin Interface
|
||||
#
|
||||
ADD_INTERFACE_LIBRARY(GnaGuiPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gna_gui_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
GuiPluginInterface
|
||||
)
|
||||
|
||||
#
|
||||
# Data Plugin Interface
|
||||
#
|
||||
ADD_INTERFACE_LIBRARY(GnaDataPluginInterface
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gna_data_plugin_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
DataPluginInterface
|
||||
svcGnaCommon
|
||||
svcExmCommon
|
||||
)
|
||||
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Mike Wille, SLSE, 2017-01-11
|
||||
#
|
||||
|
||||
ADD_SUBDIRECTORY(Data)
|
||||
ADD_SUBDIRECTORY(Gui)
|
||||
|
||||
#
|
||||
# Gui Plugin Interface
|
||||
#
|
||||
#NGL_ADD_LIBRARY(WS GnaGuiPluginInterface SHARED gna_gui_plugin_interface.h)
|
||||
#NGL_TARGET_LINK_LIBRARIES(AlmGuiPluginInterface
|
||||
# Qt5::Core
|
||||
# GuiPluginInterface
|
||||
#)
|
||||
#NGL_INSTALL_TARGET(AlarmGuiPluginInterface)
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Mike Wille, SLSE; 2016-09-06
|
||||
#
|
||||
|
||||
#
|
||||
# Data Plugin
|
||||
#
|
||||
NGL_ADD_LIBRARY2(WS GnaDataPlugin MODULE gna_data_plugin.cpp gna_data_plugin.h)
|
||||
NGL_TARGET_LINK_LIBRARIES(GnaDataPlugin
|
||||
Qt5::Core
|
||||
GnaDataPluginInterface
|
||||
svcGnaClient
|
||||
NGLLogger
|
||||
LtsSessionDataDds
|
||||
)
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Data Plugin for AlarmManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#include "gna_data_plugin.h"
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <LtsSession/lts_session_data_dds.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
namespace GuezNasat
|
||||
{
|
||||
std::shared_ptr<DataPluginBase::Interface> DataPlugin::createDataInterface(LtsSession::LtsSessionDataDds *session)
|
||||
{
|
||||
std::shared_ptr<GuezNasat::Interface::Dtc> dtc;
|
||||
|
||||
// Unfortunately, it´s not really clear, which dtc we need: global or not.
|
||||
// 30.01.2020, r49714 -> CE: bGlobal == true: if (!session->createTopicClient(dtc, ftc, true))
|
||||
// 14.05.2020, r51152 -> NT: bGlobal = !session->isExercisePartition(); // of for displaying NineLiner at SitMap@Exercise
|
||||
// 28.07.2020, NT:
|
||||
// ddsview@ex42: Topics "Nasat9Liner, NasatAircraft, NasatAircraftparticipant are visible
|
||||
// NineLine are missing at snapshot and Replay ->
|
||||
// 28.07.2020: rXXXXX -> NT_ bGlobal == false
|
||||
|
||||
//bool bGlobal = !session->isExercisePartition();
|
||||
bool bGlobal = false;
|
||||
|
||||
if (!session->createTopicClient(dtc, false, bGlobal))
|
||||
{
|
||||
// qCritical() << " createTopicClient failed, bGlobal=" << bGlobal;
|
||||
return std::shared_ptr<DataPluginBase::Interface>();
|
||||
}
|
||||
|
||||
std::shared_ptr<GuezNasat::Interface::Ftc> ftc;
|
||||
if (!session->createTopicClient(ftc))
|
||||
return std::shared_ptr<DataPluginBase::Interface>();
|
||||
ftc->enableAll();
|
||||
|
||||
return std::make_shared<DataInterfaceImpl>(dtc, ftc);
|
||||
}
|
||||
|
||||
DataInterfaceImpl::DataInterfaceImpl(const std::shared_ptr<GuezNasat::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<GuezNasat::Interface::Ftc> &ftc)
|
||||
: DataInterface()
|
||||
, m_dtc(dtc)
|
||||
, m_ftc(ftc)
|
||||
{}
|
||||
|
||||
} // namespace GuezNasat
|
||||
Executable
+56
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Data Plugin for AlarmManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterfaces/data_plugin_interface.h>
|
||||
#include <Plugins/GuezNasat/gna_data_plugin_interface.h>
|
||||
|
||||
#include <GuezNasat/gna_dtc.h>
|
||||
#include <GuezNasat/gna_ftc.h>
|
||||
|
||||
namespace GuezNasat
|
||||
{
|
||||
|
||||
class DataPlugin final : public QObject, public DataPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "data:3:gna")
|
||||
Q_INTERFACES(DataPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
DataPlugin() = default;
|
||||
~DataPlugin() = default;
|
||||
|
||||
QString pluginName() const override { return QStringLiteral("NasatAircraft"); }
|
||||
std::shared_ptr<DataPluginBase::Interface> createDataInterface(LtsSession::LtsSessionDataDds *session) override;
|
||||
bool availableInPartition(IDL::PartitionType partition) const override
|
||||
{
|
||||
return partition == IDL::PartitionType::Exercise ||
|
||||
partition == IDL::PartitionType::Replay ||
|
||||
partition == IDL::PartitionType::Global;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class DataInterfaceImpl final : public DataInterface
|
||||
{
|
||||
public:
|
||||
explicit DataInterfaceImpl(const std::shared_ptr<GuezNasat::Interface::Dtc> &dtc,
|
||||
const std::shared_ptr<GuezNasat::Interface::Ftc> &ftc);
|
||||
|
||||
std::shared_ptr<GuezNasat::Interface::Dtc> getDtc() override { return m_dtc; }
|
||||
std::shared_ptr<GuezNasat::Interface::Ftc> getFtc() override { return m_ftc; }
|
||||
|
||||
private:
|
||||
std::shared_ptr<GuezNasat::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<GuezNasat::Interface::Ftc> m_ftc;
|
||||
};
|
||||
|
||||
} // namespace GuezNasat
|
||||
+42
@@ -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
@@ -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
|
||||
@@ -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
|
||||
@@ -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
@@ -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
@@ -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
|
||||
@@ -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>
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
|
||||
ADD_SUBDIRECTORY(Common)
|
||||
ADD_SUBDIRECTORY(ConfigNasat)
|
||||
ADD_SUBDIRECTORY(AssignNasat)
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Mike Wille, SLSE, 2016-09-06
|
||||
#
|
||||
|
||||
#
|
||||
# Data Plugin
|
||||
#
|
||||
SET(gna_common_gui_SRCS
|
||||
gna_nasat_aircraft_model.cpp
|
||||
gna_nasat_aircraft_model.h
|
||||
gna_nasat_aircraft_part_model.cpp
|
||||
gna_nasat_aircraft_part_model.h
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY2(WS GnaCommon SHARED ${gna_common_gui_SRCS} )
|
||||
NGL_TARGET_LINK_LIBRARIES(GnaCommon
|
||||
PRIVATE
|
||||
LtsSessionData
|
||||
NGLLogger
|
||||
PUBLIC
|
||||
LtsWidgets
|
||||
LtsSession
|
||||
PpmGuiComboboxPluginInterface
|
||||
svcGnaCommon
|
||||
svcExmCommon
|
||||
svcPpmCommon
|
||||
)
|
||||
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AlarmManagement - AlarmManagement Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10.05
|
||||
*/
|
||||
|
||||
#include "gna_nasat_aircraft_model.h"
|
||||
#include <GuezNasat/gna_translation.h>
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
|
||||
|
||||
namespace GuezNasat
|
||||
{
|
||||
//---------------------------------
|
||||
// NasatAircraftModel
|
||||
//---------------------------------
|
||||
NasatAircraftModel::NasatAircraftModel(QObject *parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<GuezNasat::NasatAircraft>(
|
||||
{
|
||||
tr("Id"),
|
||||
tr("NASAT Identifier"),
|
||||
tr("Name"),
|
||||
tr("Simulation Activated")
|
||||
},
|
||||
parent)
|
||||
, m_dtc(nullptr)
|
||||
, m_logger(getLogger("NasatAircraftModel"))
|
||||
{}
|
||||
|
||||
|
||||
bool NasatAircraftModel::initModel(const std::shared_ptr<GuezNasat::Interface::Dtc> &dtc)
|
||||
{
|
||||
m_dtc = dtc;
|
||||
|
||||
// insert Model
|
||||
connect(m_dtc.get(), &Interface::Dtc::nasatAircraftChanged,
|
||||
this, &NasatAircraftModel::onDataChanged);
|
||||
auto cb = [this](const NasatAircraft &data)
|
||||
{
|
||||
onDataChanged(data, DataModification::eAdded);
|
||||
};
|
||||
m_dtc->nasatAircrafts(cb);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariant NasatAircraftModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
INFO_LOG(m_logger) << "NasatAircraftModel::data";
|
||||
|
||||
if (role != Qt::DisplayRole || !indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
const GuezNasat::NasatAircraft &nasatAircraft = m_vecData.at(index.row());
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
case Id:
|
||||
return nasatAircraft.id();
|
||||
case NasatId:
|
||||
return nasatAircraft.nasatId();
|
||||
case SimulationActive:
|
||||
return nasatAircraft.simulationActive() ? tr("Yes") : tr("No");
|
||||
case Name:
|
||||
return QString::fromStdString(nasatAircraft.name());
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
} // namespace GuezNasat
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for Messaging - Messaging Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10.05
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Common/gnacommon_export.h>
|
||||
#include <GuezNasat/gna_dtc.h>
|
||||
#include <GuezNasat/logger.h>
|
||||
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
|
||||
namespace GuezNasat
|
||||
{
|
||||
// --------------------------------------------------------
|
||||
// NasatAircraftModel
|
||||
// --------------------------------------------------------
|
||||
class GNACOMMON_EXPORT NasatAircraftModel final : public LtsWidgets::LtsAbstractTableModel<GuezNasat::NasatAircraft>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
Id,
|
||||
NasatId,
|
||||
Name,
|
||||
SimulationActive
|
||||
};
|
||||
|
||||
explicit NasatAircraftModel(QObject *parent = nullptr);
|
||||
|
||||
bool initModel(const std::shared_ptr<GuezNasat::Interface::Dtc> &dtc);
|
||||
|
||||
QVariant data(const QModelIndex &, int) const override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<GuezNasat::Interface::Dtc> m_dtc;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
} //namespace GuezNasat
|
||||
@@ -0,0 +1,251 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AlarmManagement - AlarmManagement Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10.05
|
||||
*/
|
||||
|
||||
#include "gna_nasat_aircraft_part_model.h"
|
||||
#include <GuezNasat/gna_translation.h>
|
||||
#include <ParticipantManagement/ppm_translation.h>
|
||||
|
||||
namespace GuezNasat
|
||||
{
|
||||
//---------------------------------
|
||||
// NasatAircraftParticipantModel
|
||||
//---------------------------------
|
||||
NasatAircraftParticipantModel::NasatAircraftParticipantModel(QObject *parent)
|
||||
: LtsWidgets::LtsAbstractTableModel<GuezNasat::NasatAircraftParticipant>(
|
||||
{
|
||||
tr("Id"),
|
||||
tr("NASAT Aircraft Id"),
|
||||
tr("Aircraft Name"),
|
||||
tr("Exercise Id"),
|
||||
tr("Exercise Name"),
|
||||
tr("Participant Id"),
|
||||
tr("Participant")
|
||||
},
|
||||
parent)
|
||||
, m_logger(getLogger("NasatAircraftParticipantModel"))
|
||||
{}
|
||||
|
||||
|
||||
bool NasatAircraftParticipantModel::initModel(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,
|
||||
LtsSession::LtsSession *session)
|
||||
{
|
||||
m_dtc = dtc;
|
||||
m_exm_dtc = exmDtc;
|
||||
m_ppm_dtc = ppmDtc;
|
||||
m_ppmGuiCbxIfc = ppmGuiCbxIfc;
|
||||
m_session = session;
|
||||
|
||||
// insert Model
|
||||
const QMap<qint32, GuezNasat::NasatAircraftParticipant> nasatAircraftParticipants = m_dtc->nasatAircraftParticipants();
|
||||
INFO_LOG(m_logger) << "initModel - #NasatAircraftParticipantModel: " << nasatAircraftParticipants.size() ;
|
||||
|
||||
connect(m_dtc.get(), &Interface::Dtc::nasatAircraftParticipantChanged,
|
||||
this, &NasatAircraftParticipantModel::onNasatAircraftParticipantChanged);
|
||||
|
||||
connect(m_dtc.get(), &Interface::Dtc::nasatAircraftChanged,
|
||||
this, &NasatAircraftParticipantModel::onNasatAircraftChanged);
|
||||
|
||||
connect(m_ppm_dtc.get(), &ParticipantManagement::Interface::Dtc::typeChanged,
|
||||
this, &NasatAircraftParticipantModel::onTypeChanged);
|
||||
|
||||
connect(m_ppm_dtc.get(), &ParticipantManagement::Interface::Dtc::participantChanged,
|
||||
this, &NasatAircraftParticipantModel::onParticipantChanged);
|
||||
|
||||
{
|
||||
auto cb = [this](const NasatAircraftParticipant &d) { onNasatAircraftParticipantChanged(d, DataModification::eAdded); };
|
||||
m_dtc->nasatAircraftParticipants(cb);
|
||||
}
|
||||
|
||||
{
|
||||
auto cb = [this](const NasatAircraft &d) { onNasatAircraftChanged(d, DataModification::eAdded); };
|
||||
m_dtc->nasatAircrafts(cb);
|
||||
}
|
||||
|
||||
{
|
||||
auto cb = [this](const ExerciseManagement::Exercise &d) { onExerciseChanged(d, DataModification::eAdded); };
|
||||
m_exm_dtc->exercises(cb);
|
||||
}
|
||||
|
||||
{
|
||||
auto cb = [this](const ParticipantManagement::Type &d) { onTypeChanged(d, DataModification::eAdded); };
|
||||
m_ppm_dtc->types(cb);
|
||||
}
|
||||
|
||||
{
|
||||
auto cb = [this](const ParticipantManagement::Participant &d) { onParticipantChanged(d, DataModification::eAdded); };
|
||||
m_ppm_dtc->participants(cb);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariant NasatAircraftParticipantModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
INFO_LOG(m_logger) << "NasatAircraftParticipantModel::data";
|
||||
|
||||
if ((role != Qt::DisplayRole && role != Qt::DecorationRole) || !indexIsValid(index))
|
||||
return QVariant();
|
||||
|
||||
const GuezNasat::NasatAircraftParticipant &nasatAircraftParticipant = m_vecData.at(index.row());
|
||||
|
||||
if (role == Qt::DecorationRole)
|
||||
{
|
||||
if (index.column() == Participant)
|
||||
return m_participantDecorations.value(nasatAircraftParticipant.participantId());
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
switch (index.column())
|
||||
{
|
||||
case Id:
|
||||
INFO_LOG(m_logger) << "nasatAircraftParticipant.id()=" << nasatAircraftParticipant.id();
|
||||
return nasatAircraftParticipant.id();
|
||||
case NasatAircreaftId:
|
||||
return nasatAircraftParticipant.nasatAircraftId();
|
||||
case Nasat:
|
||||
if (m_nasatNames.contains(nasatAircraftParticipant.nasatAircraftId()))
|
||||
return m_nasatNames[nasatAircraftParticipant.nasatAircraftId()];
|
||||
return tr("No Participant");
|
||||
case ExerciseId:
|
||||
return nasatAircraftParticipant.exerciseId();
|
||||
case ExerciseName:
|
||||
if (m_exerciseNames.contains(nasatAircraftParticipant.exerciseId()))
|
||||
return m_exerciseNames[nasatAircraftParticipant.exerciseId()];
|
||||
return tr("No exercise name available");
|
||||
case ParticipantId:
|
||||
return nasatAircraftParticipant.participantId();
|
||||
case Participant:
|
||||
if (m_participantHierarchies.contains(nasatAircraftParticipant.participantId()))
|
||||
return m_participantHierarchies[nasatAircraftParticipant.participantId()];
|
||||
return tr("No participant name available");
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QSet<int> NasatAircraftParticipantModel::getAssociatedNasatIds() const
|
||||
{
|
||||
QSet<int> ret;
|
||||
ret.reserve(m_vecData.size());
|
||||
for (const NasatAircraftParticipant &data : m_vecData)
|
||||
ret += data.nasatAircraftId();
|
||||
return ret;
|
||||
}
|
||||
|
||||
QSet<int> NasatAircraftParticipantModel::getAssociatedParticipantIds() const
|
||||
{
|
||||
QSet<int> ret;
|
||||
ret.reserve(m_vecData.size());
|
||||
for (const NasatAircraftParticipant &data : m_vecData)
|
||||
ret += data.participantId();
|
||||
return ret;
|
||||
}
|
||||
|
||||
void NasatAircraftParticipantModel::onNasatAircraftParticipantChanged(const GuezNasat::NasatAircraftParticipant &data,
|
||||
const DataModification modType)
|
||||
{
|
||||
if (data.exerciseId() != m_session->exerciseId())
|
||||
return;
|
||||
|
||||
LtsWidgets::LtsAbstractTableModel<GuezNasat::NasatAircraftParticipant>::onDataChanged(data, modType);
|
||||
|
||||
emit signalNasatNamesChanged();
|
||||
emit signalParticipantNamesChanged();
|
||||
}
|
||||
|
||||
void NasatAircraftParticipantModel::onExerciseChanged(const ExerciseManagement::Exercise &data,
|
||||
const DataModification modType)
|
||||
{
|
||||
INFO_LOG(m_logger) << "onExerciseChanged: " << data << ", " << modType;
|
||||
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eRemoved:
|
||||
m_exerciseNames.remove(data.id());
|
||||
break;
|
||||
case DataModification::eModified:
|
||||
case DataModification::eAdded:
|
||||
m_exerciseNames.insert(data.id(), QString::fromStdString(data.name()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void NasatAircraftParticipantModel::onTypeChanged(const ParticipantManagement::Type &data,
|
||||
const DataModification modType)
|
||||
{
|
||||
INFO_LOG(m_logger) << "onTypeChanged:" << data << ", " << modType;
|
||||
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eRemoved:
|
||||
m_typeToTypeClass.remove(data.id());
|
||||
break;
|
||||
case DataModification::eModified:
|
||||
case DataModification::eAdded:
|
||||
m_typeToTypeClass.insert(data.id(), data.typeClass());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void NasatAircraftParticipantModel::onParticipantChanged(const ParticipantManagement::Participant &data,
|
||||
DataModification modType)
|
||||
{
|
||||
INFO_LOG(m_logger) << "onParticipantChanged: " << data << ", " << modType;
|
||||
|
||||
if (data.isDeleted())
|
||||
modType = DataModification::eRemoved;
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eRemoved:
|
||||
m_participantHierarchies.remove(data.id());
|
||||
break;
|
||||
case DataModification::eModified:
|
||||
case DataModification::eAdded:
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "DataModification::eAdded Participant"
|
||||
<< " TypeId=" << data.typeId()
|
||||
<< " " << data.name();
|
||||
|
||||
ParticipantManagement::TypeClass typeClass = m_typeToTypeClass.value(data.typeId());
|
||||
if (typeClass != ParticipantManagement::TypeClass::Aircraft)
|
||||
return;
|
||||
const QString hierarchy = m_ppm_dtc->hierarchyFromParticipant(data.id());
|
||||
m_participantHierarchies.insert(data.id(), hierarchy);
|
||||
if (m_ppmGuiCbxIfc)
|
||||
{
|
||||
const auto party = m_ppm_dtc->party(data.partyId());
|
||||
const QRgb col = QRgb(party.color());
|
||||
m_participantDecorations.insert(data.id(), m_ppmGuiCbxIfc->pixmapFromParty(col));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
emit signalParticipantNamesChanged();
|
||||
}
|
||||
|
||||
void NasatAircraftParticipantModel::onNasatAircraftChanged(const GuezNasat::NasatAircraft &data,
|
||||
const DataModification modType)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onNasatAircraftChanged: " << data << ", " << modType;
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eRemoved:
|
||||
m_nasatNames.remove(data.id());
|
||||
break;
|
||||
case DataModification::eModified:
|
||||
case DataModification::eAdded:
|
||||
m_nasatNames.insert(data.id(), QString::fromStdString(data.name()));
|
||||
break;
|
||||
}
|
||||
emit signalNasatNamesChanged();
|
||||
}
|
||||
} // namespace GuezNasat
|
||||
@@ -0,0 +1,93 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for Messaging - Messaging Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10.05
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Common/gnacommon_export.h>
|
||||
#include <GuezNasat/gna_dtc.h>
|
||||
// Get exercise names
|
||||
#include <ExerciseManagement/exm_dtc.h>
|
||||
// Get Participants
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <Plugins/ParticipantManagement/ppm_gui_combobox_plugin_interface.h>
|
||||
|
||||
#include <GuezNasat/logger.h>
|
||||
|
||||
#include <LtsWidgets/lts_abstract_table_model.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
|
||||
namespace GuezNasat
|
||||
{
|
||||
// --------------------------------------------------------
|
||||
// NasatAircraftParticipantModel
|
||||
// --------------------------------------------------------
|
||||
class GNACOMMON_EXPORT NasatAircraftParticipantModel final : public LtsWidgets::LtsAbstractTableModel<GuezNasat::NasatAircraftParticipant>
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
Id,
|
||||
NasatAircreaftId,
|
||||
Nasat,
|
||||
ExerciseId,
|
||||
ExerciseName,
|
||||
ParticipantId,
|
||||
Participant
|
||||
};
|
||||
|
||||
explicit NasatAircraftParticipantModel(QObject *parent = nullptr);
|
||||
|
||||
bool initModel(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,
|
||||
LtsSession::LtsSession *session);
|
||||
|
||||
QVariant data(const QModelIndex &, int) const override;
|
||||
|
||||
QHash <int, QString> getExerciseNames() const { return m_exerciseNames; }
|
||||
QHash <int, QString> getNasatNames() const { return m_nasatNames; }
|
||||
QHash <int, QString> getParticipantHierarchies() const { return m_participantHierarchies; }
|
||||
QHash <int, QPixmap> getParticipantDecorations() const { return m_participantDecorations; }
|
||||
QSet<int> getAssociatedNasatIds() const;
|
||||
QSet<int> getAssociatedParticipantIds() const;
|
||||
|
||||
|
||||
signals:
|
||||
void signalNasatNamesChanged();
|
||||
void signalParticipantNamesChanged();
|
||||
|
||||
private slots:
|
||||
void onNasatAircraftParticipantChanged(const GuezNasat::NasatAircraftParticipant &data,
|
||||
const DataModification modType);
|
||||
void onExerciseChanged(const ExerciseManagement::Exercise &data,
|
||||
const DataModification modType);
|
||||
void onTypeChanged(const ParticipantManagement::Type &data,
|
||||
const DataModification modType);
|
||||
void onParticipantChanged(const ParticipantManagement::Participant &data,
|
||||
DataModification modType);
|
||||
void onNasatAircraftChanged(const GuezNasat::NasatAircraft &data,
|
||||
const DataModification modType);
|
||||
|
||||
private:
|
||||
std::shared_ptr<GuezNasat::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_exm_dtc;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppm_dtc;
|
||||
std::shared_ptr<ParticipantManagement::ForeignGuiComboboxInterface> m_ppmGuiCbxIfc;
|
||||
LtsSession::LtsSession *m_session{nullptr};
|
||||
|
||||
QHash <int, QString> m_exerciseNames; // key = ExerciseId, value = ExerciseName
|
||||
QHash <int, QString> m_nasatNames; // key = nasatId, value = NasatName
|
||||
QHash <int, QString> m_participantHierarchies; // key = participantId, value = HirarchyString
|
||||
QHash <int, QPixmap> m_participantDecorations;
|
||||
QHash <int, ParticipantManagement::TypeClass> m_typeToTypeClass; // key = ParticipantType, value = TypeClass
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
} //namespace GuezNasat
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
# Created by Patric Karwat, SLSE, 2016-10-05
|
||||
#
|
||||
|
||||
SET(gna_nasat_gui_SRCS
|
||||
|
||||
gna_nasat_gui_plugin.cpp
|
||||
gna_nasat_gui_plugin.h
|
||||
gna_dialog.cpp
|
||||
gna_dialog.h
|
||||
new_gna_dialog.cpp
|
||||
new_gna_dialog.h
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(gna_nasat_gui_SRCS
|
||||
gna_dialog.ui
|
||||
new_gna_dialog.ui
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(WS GnaNasatGuiPlugin MODULE ${gna_nasat_gui_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(GnaNasatGuiPlugin
|
||||
LtsPrinting
|
||||
GnaCommon
|
||||
LtsSession
|
||||
LtsSessionData
|
||||
GnaGuiPluginInterface
|
||||
GnaDataPluginInterface
|
||||
svcGnaCommon
|
||||
GuiPluginInterface
|
||||
Qt5::Widgets
|
||||
LtsWidgets
|
||||
LtsDataView
|
||||
NGLLogger
|
||||
LtsUtilsGuiDds
|
||||
)
|
||||
|
||||
NGL_INSTALL_TARGET(GnaNasatGuiPlugin)
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Beschreibung des Dialogs
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Mike Wille, SLSE, 2017-11-01
|
||||
*/
|
||||
|
||||
#include "gna_dialog.h"
|
||||
#include "ui_gna_dialog.h"
|
||||
#include <Plugins/GuezNasat/Gui/Common/gna_nasat_aircraft_model.h>
|
||||
|
||||
#include "new_gna_dialog.h"
|
||||
|
||||
namespace GuezNasat
|
||||
{
|
||||
|
||||
GuezNasatDialog::GuezNasatDialog(const QString &menuGroup, QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::CloseOnly)
|
||||
, m_nasatAircraftModel(nullptr)
|
||||
, m_dtc(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
, m_ui(new Ui::GuezNasatDialog)
|
||||
, m_menuGroup(menuGroup)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_logger(getLogger("Dialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Administrator-Airplanes"));
|
||||
}
|
||||
|
||||
GuezNasatDialog::~GuezNasatDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
bool GuezNasatDialog::init(const std::shared_ptr<GuezNasat::Interface::Ftc> &ftc,
|
||||
const std::shared_ptr<GuezNasat::Interface::Dtc> &dtc)
|
||||
{
|
||||
m_ftc = ftc;
|
||||
m_dtc = dtc;
|
||||
|
||||
INFO_LOG(m_logger) << "GuezNasatDialog::init";
|
||||
m_nasatAircraftModel = new GuezNasat::NasatAircraftModel(this);
|
||||
m_nasatAircraftModel->initModel(m_dtc);
|
||||
m_ui->widget->setModel(m_nasatAircraftModel);
|
||||
|
||||
// connects fuer Widgetaenderungen
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalSelectionChanged,
|
||||
this, &GuezNasatDialog::onSelectionChanged);
|
||||
|
||||
// Create Add-Button
|
||||
m_buttonBox->setButtonVisible(LtsWidgets::DialogButton::Add, true);
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Add, this, &GuezNasatDialog::onNewAircraft);
|
||||
|
||||
// Create Remove-Button
|
||||
m_buttonBox->connectButton(LtsWidgets::DialogButton::Remove, this, &GuezNasatDialog::onRemoveAircraft);
|
||||
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, &GuezNasatDialog::onEditAircraft);
|
||||
|
||||
connect(m_ui->widget, &LtsDataView::LtsDataView::signalDoubleClicked,
|
||||
this, &GuezNasatDialog::onEditAircraft);
|
||||
|
||||
#ifndef LTS_DEBUG
|
||||
m_ui->widget->hideColumn(NasatAircraftModel::Columns::Id);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void GuezNasatDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, tr("Aircrafts"));
|
||||
}
|
||||
|
||||
void GuezNasatDialog::onNewAircraft()
|
||||
{
|
||||
INFO_LOG(m_logger) << "onNewAircraft";
|
||||
NewGuezNasatDialog *newGuezNasatDialog = new NewGuezNasatDialog(this);
|
||||
if (!newGuezNasatDialog->init(m_ftc))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Can't initialize NewGuezNasatDialog!";
|
||||
delete newGuezNasatDialog;
|
||||
return;
|
||||
}
|
||||
|
||||
addDialog(newGuezNasatDialog, m_menuGroup, QStringLiteral("New Aircraft"), LtsWidgets::LayoutArea::eDialogTab, true, true);
|
||||
|
||||
}
|
||||
|
||||
void GuezNasatDialog::onEditAircraft()
|
||||
{
|
||||
const QModelIndex curIdx = m_ui->widget->currentIndex();
|
||||
if (!curIdx.isValid())
|
||||
return;
|
||||
|
||||
INFO_LOG(m_logger) << "onEditAircraft";
|
||||
NewGuezNasatDialog *editGuezNasatDialog = new NewGuezNasatDialog(this);
|
||||
if (!editGuezNasatDialog->init(m_ftc, m_nasatAircraftModel->getRowData(curIdx.row())))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Can't initialize NewGuezNasatDialog!";
|
||||
delete editGuezNasatDialog;
|
||||
return;
|
||||
}
|
||||
addDialog(editGuezNasatDialog, m_menuGroup, QStringLiteral("Edit Aircraft"), LtsWidgets::LayoutArea::eDialogTab, true, true);
|
||||
|
||||
}
|
||||
|
||||
void GuezNasatDialog::tableColumnOrganiserSetting()
|
||||
{
|
||||
//LtsColumnOrganiser
|
||||
m_ui->widget->setColumnsOrganiserEnabled(identifier(), true);
|
||||
}
|
||||
|
||||
void GuezNasatDialog::onRemoveAircraft()
|
||||
{
|
||||
const QModelIndex curIdx = m_ui->widget->currentIndex();
|
||||
if (!curIdx.isValid())
|
||||
return;
|
||||
|
||||
INFO_LOG(m_logger) << "onRemoveNewAircraft";
|
||||
NasatAircraft req;
|
||||
req.id(m_nasatAircraftModel->getRowData(curIdx.row()).id());
|
||||
|
||||
m_requestHelper->startSingleRequest([req, this]()
|
||||
{
|
||||
return m_ftc->modifyNasatAircraftRequest(req, this);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void GuezNasatDialog::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);
|
||||
} // end of onSelectionChanged()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
} // namespace GuezNasat
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* @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 <LtsUtilsGuiDds/request_helper.h>
|
||||
#include <GuezNasat/logger.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class GuezNasatDialog;
|
||||
}
|
||||
|
||||
namespace GuezNasat
|
||||
{
|
||||
class NasatAircraftModel;
|
||||
|
||||
class GuezNasatDialog final : public LtsWidgets::LtsDialog
|
||||
, protected GuezNasat::Interface::Ftc::ModifyNasatAircraftReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
explicit GuezNasatDialog(const QString &menuGroup, QWidget *parent = nullptr);
|
||||
~GuezNasatDialog();
|
||||
|
||||
bool init(const std::shared_ptr<GuezNasat::Interface::Ftc> &ftc,
|
||||
const std::shared_ptr<GuezNasat::Interface::Dtc> &dtc);
|
||||
|
||||
void retranslate() override;
|
||||
|
||||
protected:
|
||||
void onModifyNasatAircraftReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
|
||||
private slots:
|
||||
void onSelectionChanged();
|
||||
void onNewAircraft();
|
||||
void onRemoveAircraft();
|
||||
void onEditAircraft();
|
||||
|
||||
private:
|
||||
void tableColumnOrganiserSetting() override;
|
||||
|
||||
NasatAircraftModel *m_nasatAircraftModel;
|
||||
|
||||
std::shared_ptr<GuezNasat::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<GuezNasat::Interface::Ftc> m_ftc;
|
||||
|
||||
Ui::GuezNasatDialog *m_ui;
|
||||
QString m_menuGroup;
|
||||
LtsUtils::RequestHelper *m_requestHelper;
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
|
||||
} // namespace GuezNasat
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>GuezNasatDialog</class>
|
||||
<widget class="QWidget" name="GuezNasatDialog">
|
||||
<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>
|
||||
@@ -0,0 +1,219 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for AlarmManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#include "gna_nasat_gui_plugin.h"
|
||||
#include "gna_dialog.h"
|
||||
#include <Proxies/GuezNasat/gna_operator_rights.h>
|
||||
#include <LtsSession/lts_session.h>
|
||||
#include <GuezNasat/logger.h>
|
||||
#include <LtsWidgets/lts_drag_icon.h>
|
||||
#include <LtsWidgets/lts_base_layout_widget.h>
|
||||
#include <LtsWidgets/lts_global_wait_dialog.h>
|
||||
#include <QProcess>
|
||||
#include <QTimer>
|
||||
|
||||
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::Global;
|
||||
}
|
||||
|
||||
InterfaceImpl::InterfaceImpl(LtsSession::LtsSession *session)
|
||||
: GuiPluginBase::Interface(session, getLogger("NasatAircraft"))
|
||||
, m_dtc(nullptr)
|
||||
, m_ftc(nullptr)
|
||||
{}
|
||||
|
||||
bool InterfaceImpl::fetchInterfaces()
|
||||
{
|
||||
if (!m_session->getDtc<GuezNasat::DataInterface>(m_dtc))
|
||||
return false;
|
||||
if (!m_session->getFtc<GuezNasat::DataInterface>(m_ftc))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QVector<LtsWidgets::PluginData> InterfaceImpl::getActions()
|
||||
{
|
||||
if (m_session->partitionType() != IDL::PartitionType::Global)
|
||||
return {};
|
||||
|
||||
QVector<LtsWidgets::PluginData> ret;
|
||||
|
||||
{
|
||||
// Action 'Nasat Aircrafts' anlegen
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("NASAT Aircrafts");
|
||||
plData.identifier = QStringLiteral("showNasatAircraft");
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:force_organization.svg"));
|
||||
plData.operatorRight = OperatorRights::GuezNasatConfigurationShow;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::ePlanning;
|
||||
plData.createWidgetFunc = [this](QWidget * parent)
|
||||
{
|
||||
return onShowConfigGuezNasatDialog(parent);
|
||||
};
|
||||
ret.append(plData);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
{
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("Start NASAT Aircrafts");
|
||||
plData.identifier = QStringLiteral("startNasatAircraft");
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:nasat-start.svg"));
|
||||
plData.operatorRight = OperatorRights::GuezNasatConfigurationShow;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::ePlanning;
|
||||
plData.directFunc = [this](const LtsWidgets::PluginData &)
|
||||
{
|
||||
controlAircrafts();
|
||||
};
|
||||
ret += plData;
|
||||
}
|
||||
|
||||
{
|
||||
LtsWidgets::PluginData plData;
|
||||
plData.menuGroup = menuGroup();
|
||||
plData.menuText = tr("Stop NASAT Aircrafts");
|
||||
plData.identifier = QStringLiteral("stopNasatAircraft");
|
||||
plData.menuIcon = QIcon(QLatin1String("icon:nasat-stop.svg"));
|
||||
plData.operatorRight = OperatorRights::GuezNasatConfigurationShow;
|
||||
plData.exercisePart = LtsWidgets::ExercisePart::ePlanning;
|
||||
plData.directFunc = [this](const LtsWidgets::PluginData &)
|
||||
{
|
||||
controlAircrafts(false);
|
||||
};
|
||||
ret += plData;
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void InterfaceImpl::controlAircrafts(bool start)
|
||||
{
|
||||
auto ssh = [this](const QString &cmd, bool ignoreExitCode)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "controlAircrafts: ssh => " << cmd;
|
||||
|
||||
const QString hostname(QStringLiteral("nasat@CEF06IFR03"));
|
||||
const QString password(QStringLiteral("nasatnasat"));
|
||||
// const QString hostname(QStringLiteral("ctc@localhost"));
|
||||
// const QString password(QStringLiteral("ctc11de"));
|
||||
|
||||
QProcess *p = new QProcess(this);
|
||||
p->setProgram(QStringLiteral("sshpass"));
|
||||
|
||||
/* disable host key checking, because some machines might have never connecting to the host,
|
||||
* resulting in a missing host key and therefore a denied connection otherwise accepting
|
||||
* the key via first, manual ssh connection */
|
||||
const QString args(QStringLiteral("-p %1 ssh -o StrictHostKeyChecking=no %2 %3").arg(password, hostname, cmd));
|
||||
|
||||
p->setArguments(args.split(QStringLiteral(" ")));
|
||||
|
||||
connect(p, &QProcess::errorOccurred,
|
||||
this, [this](QProcess::ProcessError )
|
||||
{
|
||||
QProcess *p = qobject_cast<QProcess *>(sender());
|
||||
if (p == nullptr)
|
||||
return;
|
||||
|
||||
new LtsWidgets::LtsMessageDialogNew(m_session->baseLayout(), tr("Aircraft operation failed: %1.").arg(p->errorString()));
|
||||
p->deleteLater();
|
||||
});
|
||||
|
||||
connect(p, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||
this, [this, cmd, ignoreExitCode](int exitCode)
|
||||
{
|
||||
QProcess *p = qobject_cast<QProcess *>(sender());
|
||||
if (p == nullptr)
|
||||
return;
|
||||
|
||||
WARNING_LOG(m_logger) << "exit code for '" << cmd << "': " << exitCode;
|
||||
|
||||
if (!ignoreExitCode && exitCode != 137 /* (128 + 9(SIGKILL)) */) // ignore exit code (137 => SIGKILL) from killing liste2msg1Sender
|
||||
new LtsWidgets::LtsMessageDialogNew(m_session->baseLayout(), tr("Aircraft operation failed with error id: %1").arg(exitCode));
|
||||
|
||||
p->deleteLater();
|
||||
});
|
||||
|
||||
connect(p, &QProcess::readyReadStandardError,
|
||||
this, [this, p, cmd]()
|
||||
{
|
||||
WARNING_LOG(m_logger) << "nasat ssh process error for '"<<cmd<<"': " << p->readAllStandardError();
|
||||
});
|
||||
|
||||
connect(p, &QProcess::readyReadStandardOutput,
|
||||
this, [this, p, cmd]()
|
||||
{
|
||||
WARNING_LOG(m_logger) << "nasat ssh process output for '"<<cmd<<"': " << p->readAllStandardOutput();
|
||||
});
|
||||
|
||||
p->start();
|
||||
return p;
|
||||
};
|
||||
|
||||
auto stop = [ssh]()
|
||||
{
|
||||
ssh(QStringLiteral("killall -s9 liste2msg1Sender"), true); // force it !
|
||||
};
|
||||
|
||||
LtsWidgets::LtsGlobalWaitDialog::getInstance()->wait(tr("Executing Aircraft operation"));
|
||||
|
||||
ssh(QStringLiteral("pwd"), true);
|
||||
|
||||
stop();
|
||||
|
||||
|
||||
// wait and hope script was stopped already (kinda hacky)
|
||||
QTimer::singleShot(3500, this, [this, start, ssh]()
|
||||
{
|
||||
if (start)
|
||||
{
|
||||
QProcess *p = ssh(QStringLiteral("./start_radio_sim"), false);
|
||||
|
||||
connect(p, &QProcess::started, // is "started" even if it didn't work
|
||||
this, []()
|
||||
{
|
||||
LtsWidgets::LtsGlobalWaitDialog::getInstance()->done();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
LtsWidgets::LtsGlobalWaitDialog::getInstance()->done();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
QString InterfaceImpl::menuGroup() const
|
||||
{
|
||||
return tr("Participants / Aircrafts");
|
||||
}
|
||||
|
||||
void InterfaceImpl::clearInterfaces()
|
||||
{
|
||||
m_ftc = nullptr;
|
||||
m_dtc = nullptr;
|
||||
}
|
||||
|
||||
LtsWidgets::LtsDialog *InterfaceImpl::onShowConfigGuezNasatDialog(QWidget *parent)
|
||||
{
|
||||
return LtsWidgets::initDialog(new GuezNasatDialog(menuGroup(), parent),
|
||||
m_ftc, m_dtc);
|
||||
}
|
||||
|
||||
} // namespace NasatAircraft
|
||||
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Gui Plugin for AlarmManagement
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gna_nasat_gui_plugin.h"
|
||||
#include <GuezNasat/logger.h>
|
||||
#include <PluginInterfaces/gui_plugin_interface.h>
|
||||
#include <Common/ProjectConfig/project_defines.h>
|
||||
#include <Plugins/GuezNasat/gna_data_plugin_interface.h>
|
||||
#include <Plugins/GuezNasat/gna_gui_plugin_interface.h>
|
||||
|
||||
namespace GuezNasat
|
||||
{
|
||||
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
|
||||
{
|
||||
Q_PLUGIN_METADATA(IID "gui:3:ppm.confignasat")
|
||||
Q_INTERFACES(GuiPluginBase::Plugin)
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GuiPlugin() = default;
|
||||
~GuiPlugin() = default;
|
||||
|
||||
QString pluginName() override { return QLatin1String("ParticipantManagement.GuiPlugin.ConfigNasat"); }
|
||||
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 controlAircrafts(bool start = true);
|
||||
|
||||
LtsWidgets::LtsDialog *onShowConfigGuezNasatDialog(QWidget *parent);
|
||||
std::shared_ptr<GuezNasat::Interface::Dtc> m_dtc;
|
||||
std::shared_ptr<GuezNasat::Interface::Ftc> m_ftc;
|
||||
};
|
||||
|
||||
} // namespace GuezNasat
|
||||
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Beschreibung des Dialogs
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Mike Wille, SLSE, 2017-11-01
|
||||
*/
|
||||
|
||||
#include "new_gna_dialog.h"
|
||||
#include "ui_new_gna_dialog.h"
|
||||
|
||||
#include <LtsWidgets/lts_dialog.h>
|
||||
|
||||
|
||||
namespace GuezNasat
|
||||
{
|
||||
|
||||
NewGuezNasatDialog::NewGuezNasatDialog(QWidget *parent)
|
||||
: LtsWidgets::LtsDialog(parent, LtsWidgets::ButtonCombination::OkApplyCancel)
|
||||
, m_ui(new Ui::NewGuezNasatDialog)
|
||||
, m_requestHelper(new LtsUtils::RequestHelper(this))
|
||||
, m_logger(getLogger("Dialog"))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
NewGuezNasatDialog::~NewGuezNasatDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
bool NewGuezNasatDialog::init(const std::shared_ptr<GuezNasat::Interface::Ftc> &ftc,
|
||||
const NasatAircraft &aircraft)
|
||||
{
|
||||
m_ftc = ftc;
|
||||
m_id = aircraft.id();
|
||||
|
||||
m_ui->svNasatId->setValue(aircraft.nasatId());
|
||||
m_ui->leName->setText(QString::fromStdString(aircraft.name()));
|
||||
|
||||
m_buttonBox->setButtonVisible(LtsWidgets::DialogButton::Apply, false);
|
||||
|
||||
setOnlineHelpFilename(QStringLiteral("Administrator-Airplanes"));
|
||||
return true;
|
||||
}
|
||||
|
||||
void NewGuezNasatDialog::retranslate()
|
||||
{
|
||||
translate(m_ui, m_id <= 0 ? tr("Add Aircraft") : tr("Edit Aircraft"));
|
||||
}
|
||||
|
||||
bool NewGuezNasatDialog::apply()
|
||||
{
|
||||
int32_t id = m_id;
|
||||
int32_t nasatId = m_ui->svNasatId->value();
|
||||
bool simulationActive = false;
|
||||
QString nameStr = m_ui->leName->text();
|
||||
|
||||
const NasatAircraft req(id, nasatId, simulationActive, nameStr.toStdString());
|
||||
|
||||
return m_requestHelper->startSingleRequest([req, this]()
|
||||
{
|
||||
return m_ftc->modifyNasatAircraftRequest(req, this);
|
||||
});
|
||||
|
||||
} // end of apply
|
||||
|
||||
} // namespace GuezNasat
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* @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 NewGuezNasatDialog;
|
||||
}
|
||||
|
||||
namespace GuezNasat
|
||||
{
|
||||
|
||||
class NewGuezNasatDialog final : public LtsWidgets::LtsDialog
|
||||
, protected GuezNasat::Interface::Ftc::ModifyNasatAircraftReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
explicit NewGuezNasatDialog(QWidget *parent = nullptr);
|
||||
~NewGuezNasatDialog();
|
||||
|
||||
bool init(const std::shared_ptr<GuezNasat::Interface::Ftc> &ftc,
|
||||
const NasatAircraft &aircraft = NasatAircraft());
|
||||
|
||||
void retranslate() override;
|
||||
bool apply() override;
|
||||
|
||||
protected:
|
||||
void onModifyNasatAircraftReply(const Core::FunctionReplyObject &replyObject) override final { m_requestHelper->requestReply(replyObject); }
|
||||
|
||||
private:
|
||||
std::shared_ptr<GuezNasat::Interface::Ftc> m_ftc;
|
||||
|
||||
Ui::NewGuezNasatDialog *m_ui{nullptr};
|
||||
LtsUtils::RequestHelper *m_requestHelper{nullptr};
|
||||
int m_id{-1};
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
|
||||
} // namespace GuezNasat
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>NewGuezNasatDialog</class>
|
||||
<widget class="QWidget" name="NewGuezNasatDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>281</width>
|
||||
<height>131</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">AlarmView</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>56</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>NASAT-Id:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="LtsWidgets::LtsSpinBox" name="svNasatId">
|
||||
<property name="maximum">
|
||||
<number>9999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="leName"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsWidgets::LtsSpinBox</class>
|
||||
<extends>QSpinBox</extends>
|
||||
<header>LtsWidgets/lts_spinbox.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>leName</tabstop>
|
||||
<tabstop>svNasatId</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterfaces/data_plugin_interface.h>
|
||||
|
||||
#include <GuezNasat/gna_dtc.h>
|
||||
#include <GuezNasat/gna_ftc.h>
|
||||
|
||||
namespace GuezNasat
|
||||
{
|
||||
/**
|
||||
* @brief The DataInterface class provides the Topics Clients only for the GUI Plugins
|
||||
*/
|
||||
class DataInterface : public DataPluginBase::Interface
|
||||
{
|
||||
public:
|
||||
using DataPluginBase::Interface::Interface;
|
||||
|
||||
virtual std::shared_ptr<GuezNasat::Interface::Dtc> getDtc() = 0;
|
||||
virtual std::shared_ptr<GuezNasat::Interface::Ftc> getFtc() = 0;
|
||||
};
|
||||
|
||||
} // namespace GuezNasat
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* HMI Plugin for AlarmManagement (Interface for access from other Plugins)
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Patric Karwat, SLSE, 2016-10-05
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace GuezNasat
|
||||
{
|
||||
|
||||
class ForeignGuiInterface
|
||||
{
|
||||
public:
|
||||
ForeignGuiInterface() = default;
|
||||
virtual ~ForeignGuiInterface() = default;
|
||||
static QString pluginName() { return QStringLiteral("GuezNasat.GuiPlugin.ConfigNasat"); }
|
||||
};
|
||||
|
||||
} //namespace GuezNasat
|
||||
Reference in new issue
Block a user