Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+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>
|
||||
Reference in new issue
Block a user