1#ifndef __COMPONENTINTERFACE_H
2#define __COMPONENTINTERFACE_H
5#include <QtCore/QJsonObject>
38 virtual void setConfig(
const QJsonObject& json) = 0;
65 using ComponentProperty = std::tuple<QString, QVariant::Type, PropertyEditable, CustomEditFieldCbk>;
71 return std::get<0>(p);
76 return std::get<1>(p);
81 return std::get<2>(p);
86 return std::get<3>(p);
107 virtual void simBcastSnd(
const QJsonObject &msg,
const QVariant ¶m = QVariant()) = 0;
108 virtual void simBcastRcv(
const QJsonObject &msg,
const QVariant ¶m) = 0;
Interface to be implemented by every component.
Definition componentinterface.h:15
virtual void startSimulation()=0
Slot to be implemented by Component to execute simulation start action.
virtual void setConfig(const QJsonObject &json)=0
Sets configuration for component.
virtual void simBcastRcv(const QJsonObject &msg, const QVariant ¶m)=0
virtual bool mainWidgetDocked() const =0
Main widget docking status.
static constexpr const CustomEditFieldCbk & propertyField(const ComponentProperty &p)
Definition componentinterface.h:84
bool PropertyEditable
Definition componentinterface.h:63
virtual ~ComponentInterface()
Definition componentinterface.h:16
static constexpr const QVariant::Type & propertyType(const ComponentProperty &p)
Definition componentinterface.h:74
virtual void configChanged()=0
Reconfigure component if necessary.
virtual ComponentProperties getSupportedProperties() const =0
virtual void simBcastSnd(const QJsonObject &msg, const QVariant ¶m=QVariant())=0
std::vector< ComponentProperty > ComponentProperties
Definition componentinterface.h:66
static constexpr const PropertyEditable & propertyEditability(const ComponentProperty &p)
Definition componentinterface.h:79
std::function< QWidget *(void)> CustomEditFieldCbk
Definition componentinterface.h:64
virtual void mainWidgetDockToggled(QWidget *widget)=0
Signal to be implemented by Component. Indicates when dock/undock action was invoked.
virtual void setConfig(const QWidget &qobject)=0
Sets configuration for component.
virtual QWidget * mainWidget()=0
Gets components's main widget.
std::tuple< QString, QVariant::Type, PropertyEditable, CustomEditFieldCbk > ComponentProperty
Definition componentinterface.h:65
std::map< QString, QVariant > PropertyContainer
Definition componentinterface.h:67
virtual QJsonObject getConfig() const =0
Gets current component configuation.
static constexpr const QString & propertyName(const ComponentProperty &p)
Definition componentinterface.h:69
virtual void stopSimulation()=0
Slot to be implemented by Component to execute simulation stop action.
virtual std::shared_ptr< QWidget > getQConfig() const =0
Gets current component configuation.