move from tabs to spaces

This commit is contained in:
uvos 2022-04-15 13:28:47 +02:00
parent a6aad07f05
commit fa45072998
86 changed files with 2611 additions and 2486 deletions

View file

@ -14,74 +14,76 @@ SensorActor::SensorActor(QObject* parent): Actor(parent)
void SensorActor::setSensor(const Sensor sensor)
{
sensor_ = sensor;
sensor_ = sensor;
}
void SensorActor::sensorEvent(Sensor sensor)
{
if(sensor == sensor_)
{
if((sloap_ == SLOPE_UP || sloap_ == SLOPE_BOTH) && sensor_.field < threshold_ && sensor.field >= threshold_ ) performAction();
else if((sloap_ == SLOPE_DOWN || sloap_ == SLOPE_BOTH) && sensor_.field > threshold_ && sensor.field <= threshold_) performAction();
sensor_ = sensor;
}
if(sensor == sensor_)
{
if((sloap_ == SLOPE_UP || sloap_ == SLOPE_BOTH) && sensor_.field < threshold_
&& sensor.field >= threshold_ ) performAction();
else if((sloap_ == SLOPE_DOWN || sloap_ == SLOPE_BOTH) && sensor_.field > threshold_
&& sensor.field <= threshold_) performAction();
sensor_ = sensor;
}
}
void SensorActor::setSloap(uint8_t sloap)
{
sloap_=sloap;
sloap_=sloap;
}
void SensorActor::setThreshold(float threshold)
{
threshold_ = threshold;
threshold_ = threshold;
}
float SensorActor::getThreshold()
{
return threshold_;
return threshold_;
}
uint8_t SensorActor::getSloap()
{
return sloap_;
return sloap_;
}
void SensorActor::store(QJsonObject& json)
{
json["Type"] = "Sensor";
Actor::store(json);
json["Sloap"] = sloap_;
json["Threshold"] = threshold_;
json["SensorType"] = static_cast<int>(sensor_.type);
json["SensorId"] = static_cast<int>(sensor_.id);
json["SensorField"] = sensor_.field;
json["SensorName"] = sensor_.name;
json["Type"] = "Sensor";
Actor::store(json);
json["Sloap"] = sloap_;
json["Threshold"] = threshold_;
json["SensorType"] = static_cast<int>(sensor_.type);
json["SensorId"] = static_cast<int>(sensor_.id);
json["SensorField"] = sensor_.field;
json["SensorName"] = sensor_.name;
}
void SensorActor::load(const QJsonObject& json, bool preserve)
{
Actor::load(json, preserve);
sloap_ = json["Sloap"].toInt(0);
threshold_ = json["Threshold"].toDouble(0);
sensor_.type = json["SensorType"].toInt(0);
sensor_.id = json["SensorId"].toInt(0);
sensor_.field = json["SensorField"].toInt(0);
sensor_.name = json["SensorName"].toString("Sensor");
Actor::load(json, preserve);
sloap_ = json["Sloap"].toInt(0);
threshold_ = json["Threshold"].toDouble(0);
sensor_.type = json["SensorType"].toInt(0);
sensor_.id = json["SensorId"].toInt(0);
sensor_.field = json["SensorField"].toInt(0);
sensor_.name = json["SensorName"].toString("Sensor");
}
QString SensorActor::getName() const
{
if(name_.size() > 0) return name_;
else
{
QString string;
string = "Sensor \"" + sensor_.name + "\"";
if(name_.size() > 0) return name_;
else
{
QString string;
string = "Sensor \"" + sensor_.name + "\"";
if(sloap_ == SLOPE_UP) string.append(" rises to ");
else if (sloap_ == SLOPE_DOWN) string.append(" drops to ");
else if (sloap_ == SLOPE_BOTH) string.append(" passes ");
if(sloap_ == SLOPE_UP) string.append(" rises to ");
else if (sloap_ == SLOPE_DOWN) string.append(" drops to ");
else if (sloap_ == SLOPE_BOTH) string.append(" passes ");
string.append(QString::number(threshold_) + " ");
return string;
}
string.append(QString::number(threshold_) + " ");
return string;
}
}