handle closable interfaces properly in the devices page

This commit is contained in:
Michael Zanetti 2018-07-11 21:10:17 +02:00
parent 226c21d4ac
commit c122113195
2 changed files with 28 additions and 4 deletions

View File

@ -137,7 +137,7 @@ ApplicationWindow {
}
}
property var supportedInterfaces: ["light", "weather", "sensor", "media", "garagegate", "awning", "extendedawning", "shutter", "extendedshutter", "blind", "extendedblind", "button", "notifications", "inputtrigger", "outputtrigger", "gateway"]
property var supportedInterfaces: ["light", "weather", "sensor", "media", "garagegate", "extendedawning", "extendedshutter", "extendedblind", "button", "notifications", "inputtrigger", "outputtrigger", "gateway"]
function interfaceToString(name) {
switch(name) {
case "light":

View File

@ -88,9 +88,15 @@ Item {
case "light":
case "media":
case "garagegate":
case "shutter":
case "blind":
case "extendedblind":
case "shutter":
case "extendedshutter":
case "awning":
case "extendedawning":
return buttonComponent
default:
console.warn("DevicesPageDelegate, inlineControl: Unhandled interface", model.name)
}
}
}
@ -150,7 +156,12 @@ Item {
Engine.deviceManager.executeAction(device.id, actionTypeId)
case "garagegate":
case "shutter":
case "extendedshutter":
case "blind":
case "extendedblind":
case "awning":
case "extendedawning":
case "simpleclosable":
for (var i = 0; i < devicesProxy.count; i++) {
var device = devicesProxy.get(i);
var deviceClass = Engine.deviceManager.deviceClasses.getDeviceClass(device.deviceClassId);
@ -158,6 +169,8 @@ Item {
Engine.deviceManager.executeAction(device.id, actionType.id)
}
default:
console.warn("DevicesPageDelegate, inlineButtonControl clicked: Unhandled interface", model.name)
}
}
@ -193,10 +206,15 @@ Item {
}
}
return count === 0 ? qsTr("All closed") : qsTr("%1 open").arg(count)
case "blind":
case "extendedblind":
case "awning":
case "extendedawning":
case "shutter":
case "extendedshutter":
return qsTr("%1 installed").arg(devicesProxy.count)
}
console.warn("Unhandled interface", model.name)
console.warn("DevicesPageDelegate, inlineButtonControl: Unhandled interface", model.name)
}
font.pixelSize: app.smallFont
elide: Text.ElideRight
@ -220,9 +238,15 @@ Item {
case "light":
return "../images/system-shutdown.svg"
case "garagegate":
case "shutter":
case "blind":
case "extendedblind":
case "awning":
case "extendedawning":
case "shutter":
case "extendedshutter":
return "../images/down.svg"
default:
console.warn("DevicesPageDelegate, inlineButtonControl image: Unhandled interface", model.name)
}
}
}