109 lines
3.7 KiB
C++
Executable File
109 lines
3.7 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Gui Plugin for Demand Situation
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Patric Karwat, SLSE, 2018-03-27
|
|
*/
|
|
|
|
#pragma once
|
|
#include <PluginInterfaces/gui_plugin_interface.h>
|
|
|
|
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
|
#include <Plugins/ParticipantManagement/ppm_data_plugin_interface.h>
|
|
#include <Plugins/TrainingAreaBaseOC/taboc_data_plugin_interface.h>
|
|
|
|
#include <Plugins/OcSituationClient/osc_terminal_gui_plugin_interface.h>
|
|
#include <Plugins/OcSituationClient/osc_data_plugin_interface.h>
|
|
#include <LtsUtilsGuiDds/request_helper.h>
|
|
#include <LtsNotification/lts_notification.h>
|
|
|
|
#include "osc_demand_situation.h"
|
|
|
|
class QTimer;
|
|
namespace OcSituationClient
|
|
{
|
|
|
|
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
|
|
{
|
|
Q_PLUGIN_METADATA(IID "gui:3:osc.terminal")
|
|
Q_INTERFACES(GuiPluginBase::Plugin)
|
|
|
|
Q_OBJECT
|
|
public:
|
|
GuiPlugin() = default;
|
|
~GuiPlugin() = default;
|
|
|
|
QString pluginName() override { return QStringLiteral("ObserverController.Terminal"); }
|
|
std::shared_ptr<GuiPluginBase::Interface> createGuiInterface(LtsSession::LtsSession *session) override;
|
|
bool availableInPartition(IDL::PartitionType partition) const override
|
|
{
|
|
return (partition == IDL::PartitionType::Exercise ||
|
|
partition == IDL::PartitionType::Replay);
|
|
}
|
|
|
|
};
|
|
|
|
class InterfaceImpl final : public QObject, public ForeignTerminalGuiInterface, public GuiPluginBase::Interface,
|
|
private OcSituationClient::Interface::Ftc::SendDemandSituationReplyHandler
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit InterfaceImpl(LtsSession::LtsSession *session);
|
|
~InterfaceImpl();
|
|
|
|
void onSendDemandSituationReply(const Core::FunctionReplyObject &replyObject) override;
|
|
void stopSituationDemand();
|
|
|
|
bool fetchInterfaces() override;
|
|
void clearInterfaces() override;
|
|
QString menuGroup() const override;
|
|
QVector<LtsWidgets::PluginData> getActions() override;
|
|
bool availableInPartition(IDL::PartitionType partition) const override
|
|
{
|
|
return partition == IDL::PartitionType::Global || partition == IDL::PartitionType::Exercise;
|
|
}
|
|
|
|
private slots:
|
|
void onTimerTick();
|
|
void onNoDataTimerTick();
|
|
void onParticipantData();
|
|
void onParticipantDynamic(const ParticipantManagement::DynamicParticipantData &data);
|
|
void onParticipantPosition(const ParticipantManagement::ParticipantPosition &data);
|
|
void onCentralAesOverloadChanged(const TrainingAreaBaseOC::CentralAesOverload &data, DataModification modType);
|
|
void onParticipantsOverloadChanged(const TrainingAreaBaseOC::ParticipantsOverload &data, DataModification modType);
|
|
void onShortcutDemandSituationIconChanged();
|
|
|
|
|
|
|
|
private:
|
|
void setShortcutDemandSituationIconData(bool hasToBeDisabled = false);
|
|
QString getOverLoadTooltip() const;
|
|
QIcon getOverloadIcon() const;
|
|
|
|
private:
|
|
QTimer *m_timer;
|
|
LtsUtils::RequestHelper *m_requestHelper;
|
|
|
|
LtsWidgets::LtsDialog *onShowDemandSituation(QWidget *parent);
|
|
LtsWidgets::LtsDialog *onShowDemandSituationFilter(QWidget *parent);
|
|
LtsWidgets::LtsDialog *onShowFaultMessage(QWidget *parent);
|
|
LtsWidgets::LtsDialog *onShowEquipPlayer(QWidget *parent);
|
|
LtsWidgets::LtsDialog *onShowEditFolderContentDialog(QWidget *parent);
|
|
|
|
std::shared_ptr<SituationMap::ForeignGuiInterface> m_sitMapGuiIfc;
|
|
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_dtcPpm;
|
|
std::shared_ptr<TrainingAreaBaseOC::Interface::Dtc> m_dtcTab;
|
|
std::shared_ptr<OcSituationClient::Interface::Ftc> m_ftc;
|
|
|
|
LtsNotification::LtsNotification *m_shortcutDemandSituation;
|
|
QTimer *m_mapTimeLabelHideTimer;
|
|
bool m_demandSituationActive{false};
|
|
bool m_hasParticipantOverload{false};
|
|
bool m_hasCentralAesOverload{false};
|
|
DemandSituation *m_demandSituation;
|
|
};
|
|
|
|
} // namespace OcSituationClient
|