Commit 42bdd1fc authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

Allow providing an initial value for AggregateSensor and SysFsSensor

To be able to use initialValue from SensorProperty.
parent f2a09fc6
......@@ -75,7 +75,12 @@ public:
};
AggregateSensor::AggregateSensor(SensorObject *provider, const QString &id, const QString &name)
: SensorProperty(id, name, provider)
: AggregateSensor(provider, id, name, QVariant{})
{
}
AggregateSensor::AggregateSensor(SensorObject *provider, const QString &id, const QString &name, const QVariant &initialValue)
: SensorProperty(id, name, initialValue, provider)
, d(std::make_unique<Private>())
{
d->subsystem = qobject_cast<SensorContainer *>(provider->parent());
......
......@@ -31,6 +31,7 @@ class SYSTEMSTATS_EXPORT AggregateSensor : public SensorProperty
public:
AggregateSensor(SensorObject *provider, const QString &id, const QString &name);
AggregateSensor(SensorObject *provider, const QString &id, const QString &name, const QVariant &initialValue);
~AggregateSensor() override;
QVariant value() const override;
......
......@@ -18,7 +18,12 @@ public:
};
SysFsSensor::SysFsSensor(const QString &id, const QString &path, SensorObject *parent)
: SensorProperty(id, parent)
: SysFsSensor(id, path, QVariant{}, parent)
{
}
SysFsSensor::SysFsSensor(const QString &id, const QString &path, const QVariant &initialValue, SensorObject *parent)
: SensorProperty(id, id, initialValue, parent)
, d(std::make_unique<Private>())
{
d->path = path;
......
......@@ -24,6 +24,7 @@ class SYSTEMSTATS_EXPORT SysFsSensor : public SensorProperty
public:
SysFsSensor(const QString &id, const QString &path, SensorObject *parent);
SysFsSensor(const QString &id, const QString &path, const QVariant &initialValue, SensorObject *parent);
~SysFsSensor() override;
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment