Removed saving of model ids. Save the corresponding color triangles instead for speedup.

Former-commit-id: 72e6031234e12a488a5425e80e73dc8b03ec364f
This commit is contained in:
Tim Niggemann 2014-07-15 08:54:40 +02:00
parent f5a8174783
commit 9269b0a1e3
2 changed files with 4 additions and 5 deletions

View File

@ -122,6 +122,7 @@ CGTriangle LedDevicePhilipsHue::getTriangle(QString modelId) {
void LedDevicePhilipsHue::saveStates(unsigned int nLights) {
// Clear saved light states.
states.clear();
triangles.clear();
// Use json parser to parse reponse.
Json::Reader reader;
Json::FastWriter writer;
@ -142,12 +143,11 @@ void LedDevicePhilipsHue::saveStates(unsigned int nLights) {
state["xy"] = json["state"]["xy"];
state["bri"] = json["state"]["bri"];
}
// Save id.
ids.push_back(QString(writer.write(json["modelid"]).c_str()).trimmed().replace("\"", ""));
// Save state object.
states.push_back(QString(writer.write(state).c_str()).trimmed());
// Determine triangle.
triangles.push_back(getTriangle(ids.back()));
QString modelId = QString(writer.write(json["modelid"]).c_str()).trimmed().replace("\"", "");
triangles.push_back(getTriangle(modelId));
}
}
@ -165,6 +165,7 @@ void LedDevicePhilipsHue::restoreStates() {
}
// Clear saved light states.
states.clear();
triangles.clear();
}
bool LedDevicePhilipsHue::areStatesSaved() {

View File

@ -65,8 +65,6 @@ private slots:
private:
/// Array to save the light states.
std::vector<QString> states;
/// Array to save model ids.
std::vector<QString> ids;
/// Color triangles.
std::vector<CGTriangle> triangles;
/// Ip address of the bridge