Sensor save and load from storage, and deletion. Closes #96

This commit is contained in:
Stefan Persson 2012-01-17 15:10:46 +01:00
parent 5ce0b81e39
commit 645ef2098e
6 changed files with 237 additions and 129 deletions

View file

@ -17,6 +17,7 @@ Sensor::Sensor(QObject *parent) :
{
d = new PrivateData;
d->id = 0;
d->showInList = false;
}
Sensor::~Sensor() {
@ -50,6 +51,9 @@ QString Sensor::name() const {
}
void Sensor::setName(const QString &name) {
if (name == d->name) {
return;
}
d->name = name;
emit nameChanged();
}
@ -67,7 +71,7 @@ bool Sensor::hasTemperature() const {
return d->values.contains(TELLSTICK_TEMPERATURE);
}
SensorValue * Sensor::sensorValue(int type) {
QObject * Sensor::sensorValue(int type) {
return (d->values.contains(type) ? d->values[type] : 0);
}
@ -90,7 +94,6 @@ void Sensor::setValue(int type, const QString &value, const QDateTime &timestamp
}
bool Sensor::showInList() const{
//TODO showInList and name must be persistent...
return d->showInList;
}