79 lines
1.9 KiB
C++
Executable File
79 lines
1.9 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Notifcation plugin for TAB connection states
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Philipp Dassow, SLST, 2017-09-19
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <PluginInterfaces/gui_plugin_interface.h>
|
|
#include <Plugins/TrainingAreaBase/tab_data_plugin_interface.h>
|
|
#include <Plugins/TrainingAreaBase/tab_notification_gui_plugin_interface.h>
|
|
#include <Proxies/TrainingAreaBase/tab_dtc.h>
|
|
|
|
namespace LtsNotification
|
|
{
|
|
class LtsNotification;
|
|
}
|
|
|
|
namespace TrainingAreaBase
|
|
{
|
|
|
|
class GuiPlugin final : public QObject, public GuiPluginBase::Plugin
|
|
{
|
|
Q_PLUGIN_METADATA(IID "gui:3:tab.notification")
|
|
Q_INTERFACES(GuiPluginBase::Plugin)
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit GuiPlugin() = default;
|
|
~GuiPlugin() = default;
|
|
|
|
QString pluginName() override { return ForeignGuiInterface::pluginName(); }
|
|
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::Global;
|
|
}
|
|
};
|
|
|
|
class InterfaceImpl final : public QObject, public TrainingAreaBase::ForeignGuiInterface, public GuiPluginBase::Interface
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit InterfaceImpl(LtsSession::LtsSession *session);
|
|
~InterfaceImpl();
|
|
|
|
QString pluginName() { return ForeignGuiInterface::pluginName(); }
|
|
QVector<LtsWidgets::PluginData> getActions() override;
|
|
QString menuGroup() const override { return tr("Training Area Base"); }
|
|
|
|
bool fetchInterfaces() override;
|
|
void clearInterfaces() override;
|
|
|
|
public slots:
|
|
void onConnections(const TrainingAreaBase::Connections &data, DataModification modType);
|
|
|
|
private:
|
|
enum class State {
|
|
Green = 0,
|
|
Yellow = 1,
|
|
Red = 2
|
|
};
|
|
|
|
void setDefaultToolTip();
|
|
void setIcon(State state);
|
|
|
|
std::shared_ptr<TrainingAreaBase::Interface::Dtc> m_dtc;
|
|
LtsNotification::LtsNotification *m_noti;
|
|
};
|
|
|
|
} // namespace TrainingAreaBase
|