move from tabs to spaces
This commit is contained in:
parent
a6aad07f05
commit
fa45072998
86 changed files with 2611 additions and 2486 deletions
|
|
@ -19,71 +19,71 @@ Actor::~Actor()
|
|||
|
||||
void Actor::performAction()
|
||||
{
|
||||
if(active)
|
||||
{
|
||||
sigValue(triggerValue);
|
||||
}
|
||||
if(active)
|
||||
{
|
||||
sigValue(triggerValue);
|
||||
}
|
||||
}
|
||||
|
||||
void Actor::makeActive()
|
||||
{
|
||||
active = true;
|
||||
active = true;
|
||||
}
|
||||
|
||||
|
||||
void Actor::makeInactive()
|
||||
{
|
||||
active = false;
|
||||
active = false;
|
||||
}
|
||||
|
||||
QString Actor::actionName()
|
||||
{
|
||||
QString string;
|
||||
if(triggerValue == 0 ) string = "off";
|
||||
else if(triggerValue == 1 ) string = "on";
|
||||
else string = "value to " + QString::number(triggerValue);
|
||||
return string;
|
||||
QString string;
|
||||
if(triggerValue == 0 ) string = "off";
|
||||
else if(triggerValue == 1 ) string = "on";
|
||||
else string = "value to " + QString::number(triggerValue);
|
||||
return string;
|
||||
}
|
||||
|
||||
void Actor::setActive(uint8_t state)
|
||||
{
|
||||
state ? makeActive() : makeInactive();
|
||||
state ? makeActive() : makeInactive();
|
||||
}
|
||||
|
||||
bool Actor::isActive()
|
||||
{
|
||||
return active;
|
||||
return active;
|
||||
}
|
||||
|
||||
bool Actor::isExausted()
|
||||
{
|
||||
return exausted;
|
||||
return exausted;
|
||||
}
|
||||
|
||||
void Actor::store(QJsonObject& json)
|
||||
{
|
||||
Item::store(json);
|
||||
json["Active"] = active;
|
||||
json["Exausted"] = exausted;
|
||||
json["TriggerValue"] = triggerValue;
|
||||
Item::store(json);
|
||||
json["Active"] = active;
|
||||
json["Exausted"] = exausted;
|
||||
json["TriggerValue"] = triggerValue;
|
||||
}
|
||||
|
||||
void Actor::load(const QJsonObject& json, const bool preserve)
|
||||
{
|
||||
Item::load(json, preserve);
|
||||
active = json["Active"].toBool();
|
||||
exausted = json["Exausted"].toBool();
|
||||
triggerValue = json["TriggerValue"].toInt();
|
||||
Item::load(json, preserve);
|
||||
active = json["Active"].toBool();
|
||||
exausted = json["Exausted"].toBool();
|
||||
triggerValue = json["TriggerValue"].toInt();
|
||||
}
|
||||
|
||||
void Actor::setTriggerValue(uint8_t value)
|
||||
{
|
||||
triggerValue=value;
|
||||
triggerValue=value;
|
||||
}
|
||||
|
||||
uint8_t Actor::getTriggerValue()
|
||||
{
|
||||
return triggerValue;
|
||||
return triggerValue;
|
||||
}
|
||||
|
||||
void Actor::onValueChanged(uint8_t value)
|
||||
|
|
@ -93,28 +93,28 @@ void Actor::onValueChanged(uint8_t value)
|
|||
|
||||
std::shared_ptr<Actor> Actor::createActor(const QString& type)
|
||||
{
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
std::shared_ptr<Actor> Actor::loadActor(const QJsonObject &json)
|
||||
{
|
||||
QString type = json["Type"].toString("Actor");
|
||||
std::shared_ptr<Actor> actor = createActor(type);
|
||||
if(actor) actor->load(json);
|
||||
return actor;
|
||||
QString type = json["Type"].toString("Actor");
|
||||
std::shared_ptr<Actor> actor = createActor(type);
|
||||
if(actor) actor->load(json);
|
||||
return actor;
|
||||
}
|
||||
|
||||
void Actor::setValue(uint8_t value)
|
||||
{
|
||||
Item::setValue(value);
|
||||
setActive(value);
|
||||
Item::setValue(value);
|
||||
setActive(value);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue