Possibility to add/remove sensors from list, and change their names. Not yet persistent.

This commit is contained in:
Stefan Persson 2011-11-01 14:14:14 +01:00
parent e7ec37aa60
commit ef9a201f90
5 changed files with 191 additions and 30 deletions

View file

@ -1,10 +1,11 @@
#include "sensor.h"
#include "sensorvalue.h"
#include <telldus-core.h>
#include <QDebug>
class Sensor::PrivateData {
public:
bool hasTemperature, hasHumidity;
bool hasTemperature, hasHumidity, showInList;
int id;
QString model, name, protocol;
QDateTime lastUpdated;
@ -45,7 +46,10 @@ void Sensor::setModel(const QString &model) {
}
QString Sensor::name() const {
return QString("%1 %2").arg(this->protocol()).arg(this->id()); //TODO: Remove when name is fully implemented
//return QString("%1 %2").arg(this->protocol()).arg(this->id()); //TODO: Remove when name is fully implemented
if(d->name == ""){
return "<unnamed>";
}
return d->name;
}
@ -88,3 +92,13 @@ void Sensor::setValue(int type, const QString &value, const QDateTime &timestamp
emit hasHumidityChanged();
}
}
bool Sensor::showInList() const{
//TODO showInList and name must be persistent...
return d->showInList;
}
void Sensor::setShowInList(bool show){
d->showInList = show;
emit showInListChanged();
}