Added system item support, support for RGBControlers with multiple item backends, and item settings widgets

This commit is contained in:
Carl Klemm 2020-05-05 22:29:43 +02:00
parent a761eb4317
commit 5fb9ca7cc0
56 changed files with 635 additions and 210 deletions

View file

@ -91,23 +91,23 @@ void Actor::onValueChanged(uint8_t value)
}
Actor* Actor::createActor(const QString& type)
std::shared_ptr<Actor> Actor::createActor(const QString& type)
{
Actor* actor = nullptr;
if(type == "Alarm") actor = new AlarmTime();
else if(type == "Sensor") actor = new SensorActor();
else if(type == "Timer") actor = new TimerActor();
else if(type == "Regulator") actor = new Regulator();
else if(type == "Polynomal") actor = new PolynomalActor();
else if(type == "MultiFactor") actor = new MultiFactorActor();
else if(type == "Actor") actor = new Actor();
std::shared_ptr<Actor> actor;
if(type == "Alarm") actor = std::shared_ptr<Actor>(new AlarmTime());
else if(type == "Sensor") actor = std::shared_ptr<Actor>(new SensorActor());
else if(type == "Timer") actor = std::shared_ptr<Actor>(new TimerActor());
else if(type == "Regulator") actor = std::shared_ptr<Actor>(new Regulator());
else if(type == "Polynomal") actor = std::shared_ptr<Actor>(new PolynomalActor());
else if(type == "MultiFactor") actor = std::shared_ptr<Actor>(new MultiFactorActor());
else if(type == "Actor") actor = std::shared_ptr<Actor>(new Actor());
return actor;
}
Actor* Actor::loadActor(const QJsonObject &json)
std::shared_ptr<Actor> Actor::loadActor(const QJsonObject &json)
{
QString type = json["Type"].toString("Actor");
Actor* actor = createActor(type);
std::shared_ptr<Actor> actor = createActor(type);
if(actor) actor->load(json);
return actor;
}