Corrections

This commit is contained in:
Lord-Grey 2023-10-08 21:00:56 +02:00
parent a366f4c0cf
commit 2de4d4ebc1
3 changed files with 17 additions and 15 deletions

View File

@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- Nanoleaf: Wizard to generate user authorization token allowing users to configure the device via a single window - Nanoleaf: Wizard to generate user authorization token allowing users to configure the device via a single window
- Nanoleaf: Generation of a default layout per device's configuration, including oriantation - Nanoleaf: Generation of a default layout per device's configuration, including orientation
### Changed ### Changed

View File

@ -2555,7 +2555,7 @@ function nanoleafGeneratelayout(panelLayout, panelOrderTopDown, panelOrderLeftRi
maxY = panel.maxY; maxY = panel.maxY;
} }
if (panel.y < minY) { if (panel.y < minY) {
minY = panel.y minY = panel.y;
} }
}); });

View File

@ -792,7 +792,7 @@ bool SettingsManager::handleConfigUpgrade(QJsonObject& config)
{ {
QString type = newDeviceConfig["type"].toString(); QString type = newDeviceConfig["type"].toString();
if (type == "philipshue") if (type == "philipshue")
{ {
if (newDeviceConfig.contains("groupId")) if (newDeviceConfig.contains("groupId"))
{ {
@ -822,7 +822,7 @@ bool SettingsManager::handleConfigUpgrade(QJsonObject& config)
} }
} }
if (type == "nanoleaf") if (type == "nanoleaf")
{ {
if (newDeviceConfig.contains("panelStartPos")) if (newDeviceConfig.contains("panelStartPos"))
{ {
@ -832,24 +832,25 @@ bool SettingsManager::handleConfigUpgrade(QJsonObject& config)
if (newDeviceConfig.contains("panelOrderTopDown")) if (newDeviceConfig.contains("panelOrderTopDown"))
{ {
QString panelOrderTopDown; int panelOrderTopDown;
if (newDeviceConfig["panelOrderTopDown"].isDouble()) if (newDeviceConfig["panelOrderTopDown"].isDouble())
{ {
panelOrderTopDown = QString(newDeviceConfig["panelOrderTopDown"].toInt()); panelOrderTopDown = newDeviceConfig["panelOrderTopDown"].toInt();
} }
else else
{ {
panelOrderTopDown = newDeviceConfig["panelOrderTopDown"].toString(); panelOrderTopDown = newDeviceConfig["panelOrderTopDown"].toString().toInt();
} }
if (newDeviceConfig["panelOrderTopDown"] == "0") newDeviceConfig.remove("panelOrderTopDown");
if (panelOrderTopDown == 0)
{ {
newDeviceConfig["panelOrderTopDown"] = "top2down"; newDeviceConfig["panelOrderTopDown"] = "top2down";
migrated = true; migrated = true;
} }
else else
{ {
if (newDeviceConfig["panelOrderTopDown"] == "1") if (panelOrderTopDown == 1)
{ {
newDeviceConfig["panelOrderTopDown"] = "bottom2up"; newDeviceConfig["panelOrderTopDown"] = "bottom2up";
migrated = true; migrated = true;
@ -859,26 +860,27 @@ bool SettingsManager::handleConfigUpgrade(QJsonObject& config)
if (newDeviceConfig.contains("panelOrderLeftRight")) if (newDeviceConfig.contains("panelOrderLeftRight"))
{ {
QString panelOrderLeftRight; int panelOrderLeftRight;
if (newDeviceConfig["panelOrderLeftRight"].isDouble()) if (newDeviceConfig["panelOrderLeftRight"].isDouble())
{ {
panelOrderLeftRight = QString(newDeviceConfig["panelOrderLeftRight"].toInt()); panelOrderLeftRight = newDeviceConfig["panelOrderLeftRight"].toInt();
} }
else else
{ {
panelOrderLeftRight = newDeviceConfig["panelOrderLeftRight"].toString(); panelOrderLeftRight = newDeviceConfig["panelOrderLeftRight"].toString().toInt();
} }
if (newDeviceConfig["panelOrderLeftRight"] == "0") newDeviceConfig.remove("panelOrderLeftRight");
if (panelOrderLeftRight == 0)
{ {
newDeviceConfig["panelOrderLeftRight"] = "left2right"; newDeviceConfig["panelOrderLeftRight"] = "left2right";
migrated = true; migrated = true;
} }
else else
{ {
if (newDeviceConfig["panelOrderLeftRight"] == "1") if (panelOrderLeftRight == 1)
{ {
newDeviceConfig["panelOrderTopDown"] = "right2left"; newDeviceConfig["panelOrderLeftRight"] = "right2left";
migrated = true; migrated = true;
} }
} }