/** * @RDE_HEADER@ * Gui Plugin for Demand Situation * $Id$ * $HeadURL$ * $Author$ * Created by Patric Karwat, SLSE, 2018-03-27 */ #pragma once #include #include #include #include #include #include #include #include #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 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 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 m_sitMapGuiIfc; std::shared_ptr m_dtcPpm; std::shared_ptr m_dtcTab; std::shared_ptr 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