Fixes in garage door and barcode scanner related UIs
This commit is contained in:
parent
4d2df5792c
commit
a7cfbd0ee0
@ -108,25 +108,25 @@ ApplicationWindow {
|
|||||||
|
|
||||||
property var supportedInterfaces: [
|
property var supportedInterfaces: [
|
||||||
"light",
|
"light",
|
||||||
"weather",
|
|
||||||
"media",
|
"media",
|
||||||
"garagedoor",
|
|
||||||
"awning",
|
"awning",
|
||||||
"shutter",
|
"shutter",
|
||||||
"blind",
|
"blind",
|
||||||
|
"garagedoor",
|
||||||
"powersocket",
|
"powersocket",
|
||||||
"heating",
|
"heating",
|
||||||
|
"smartlock",
|
||||||
"doorbell",
|
"doorbell",
|
||||||
"sensor",
|
|
||||||
"irrigation",
|
"irrigation",
|
||||||
"ventilation",
|
"ventilation",
|
||||||
"smartmeter",
|
"sensor",
|
||||||
|
"weather",
|
||||||
"evcharger",
|
"evcharger",
|
||||||
|
"smartmeter",
|
||||||
"fingerprintreader",
|
"fingerprintreader",
|
||||||
"smartlock",
|
|
||||||
"button",
|
|
||||||
"barcodescanner",
|
|
||||||
"notifications",
|
"notifications",
|
||||||
|
"barcodescanner",
|
||||||
|
"button",
|
||||||
"inputtrigger",
|
"inputtrigger",
|
||||||
"outputtrigger",
|
"outputtrigger",
|
||||||
"gateway",
|
"gateway",
|
||||||
|
|||||||
@ -38,6 +38,17 @@ import "../customviews"
|
|||||||
DevicePageBase {
|
DevicePageBase {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
EmptyViewPlaceholder {
|
||||||
|
anchors { left: parent.left; right: parent.right; margins: app.margins }
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
title: qsTr("No codes have been scanned yet.")
|
||||||
|
text: qsTr("Scan a code to see it appearing here.")
|
||||||
|
visible: logView.logsModel.count === 0
|
||||||
|
buttonVisible: false
|
||||||
|
imageSource: "../images/qrcode.svg"
|
||||||
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: logsModelNg
|
target: logsModelNg
|
||||||
onCountChanged: {
|
onCountChanged: {
|
||||||
@ -49,7 +60,7 @@ DevicePageBase {
|
|||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: app.margins
|
spacing: app.margins
|
||||||
|
visible: logView.logsModel.count > 0
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -58,11 +69,17 @@ DevicePageBase {
|
|||||||
text: qsTr("Last scan")
|
text: qsTr("Last scan")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FontMetrics {
|
||||||
|
id: fontMetrics
|
||||||
|
font.pixelSize: app.largeFont
|
||||||
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
id: codeLabel
|
id: codeLabel
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
font.pixelSize: app.largeFont * 2
|
font.pixelSize: fontMetrics.boundingRect(text).width < root.width ? app.largeFont * 2 : app.mediumFont
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
@ -105,6 +122,7 @@ DevicePageBase {
|
|||||||
var rulePage = pageStack.push(Qt.resolvedUrl("../magic/DeviceRulesPage.qml"), {device: root.device});
|
var rulePage = pageStack.push(Qt.resolvedUrl("../magic/DeviceRulesPage.qml"), {device: root.device});
|
||||||
rulePage.addRule(rule);
|
rulePage.addRule(rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -143,6 +143,10 @@ MainPageTile {
|
|||||||
// return labelComponent;
|
// return labelComponent;
|
||||||
|
|
||||||
case "light":
|
case "light":
|
||||||
|
case "garagedoor":
|
||||||
|
case "impulsegaragedoor":
|
||||||
|
case "statefulgaragedoor":
|
||||||
|
case "extendedstatefulgaragedoor":
|
||||||
case "garagegate":
|
case "garagegate":
|
||||||
case "blind":
|
case "blind":
|
||||||
case "extendedblind":
|
case "extendedblind":
|
||||||
@ -255,17 +259,23 @@ MainPageTile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return count === 0 ? qsTr("All off") : qsTr("%1 on").arg(count)
|
return count === 0 ? qsTr("All off") : qsTr("%1 on").arg(count)
|
||||||
case "garagegate":
|
case "garagedoor":
|
||||||
|
var statefulCount = 0;
|
||||||
var count = 0;
|
var count = 0;
|
||||||
for (var i = 0; i < devicesProxy.count; i++) {
|
for (var i = 0; i < devicesProxy.count; i++) {
|
||||||
var device = devicesProxy.get(i);
|
var thing = devicesProxy.get(i);
|
||||||
var deviceClass = engine.deviceManager.deviceClasses.getDeviceClass(device.deviceClassId);
|
if (thing.thingClass.interfaces.indexOf("statefulgaragedoor") >= 0 || thing.thingClass.interfaces.indexOf("extendedstatefulgaragedoor") >= 0 || thing.thingClass.interfaces.indexOf("garagegate") >= 0) {
|
||||||
var stateType = deviceClass.stateTypes.findByName("state");
|
statefulCount++;
|
||||||
if (device.states.getState(stateType.id).value !== "closed") {
|
var stateType = thing.thingClass.stateTypes.findByName("state");
|
||||||
count++;
|
if (stateType && device.states.getState(stateType.id).value !== "closed") {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return count === 0 ? qsTr("All closed") : qsTr("%1 open").arg(count)
|
if (statefulCount > 0) {
|
||||||
|
return count === 0 ? qsTr("All closed") : qsTr("%1 open").arg(count)
|
||||||
|
}
|
||||||
|
return "";
|
||||||
case "blind":
|
case "blind":
|
||||||
case "extendedblind":
|
case "extendedblind":
|
||||||
case "awning":
|
case "awning":
|
||||||
@ -302,7 +312,15 @@ MainPageTile {
|
|||||||
case "irrigation":
|
case "irrigation":
|
||||||
case "ventilation":
|
case "ventilation":
|
||||||
return ""
|
return ""
|
||||||
case "garagegate":
|
case "garagedoor":
|
||||||
|
var dev = devicesProxy.get(0)
|
||||||
|
if (dev.thingClass.interfaces.indexOf("simplegaragedoor") >= 0
|
||||||
|
|| dev.thingClass.interfaces.indexOf("statefulgaragedoor") >= 0
|
||||||
|
|| dev.thingClass.interfaces.indexOf("extendedstatefulgaragedoor") >= 0
|
||||||
|
|| dev.thingClass.interfaces.indexOf("garagegate") >= 0) {
|
||||||
|
return "../images/up.svg"
|
||||||
|
}
|
||||||
|
return ""
|
||||||
case "blind":
|
case "blind":
|
||||||
case "extendedblind":
|
case "extendedblind":
|
||||||
case "awning":
|
case "awning":
|
||||||
@ -324,7 +342,19 @@ MainPageTile {
|
|||||||
case "irrigation":
|
case "irrigation":
|
||||||
case "ventilation":
|
case "ventilation":
|
||||||
break;
|
break;
|
||||||
case "garagegate":
|
case "garagedoor":
|
||||||
|
for (var i = 0; i < devicesProxy.count; i++) {
|
||||||
|
var thing = devicesProxy.get(i);
|
||||||
|
if (thing.thingClass.interfaces.indexOf("simplegaragedoor") >= 0
|
||||||
|
|| thing.thingClass.interfaces.indexOf("statefulgaragedoor") >= 0
|
||||||
|
|| thing.thingClass.interfaces.indexOf("extendedstatefulgaragedoor") >= 0
|
||||||
|
|| thing.thingClass.interfaces.indexOf("garagegate") >= 0) {
|
||||||
|
|
||||||
|
var actionType = thing.thingClass.actionTypes.findByName("open");
|
||||||
|
engine.deviceManager.executeAction(thing.id, actionType.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "shutter":
|
case "shutter":
|
||||||
case "extendedshutter":
|
case "extendedshutter":
|
||||||
case "blind":
|
case "blind":
|
||||||
@ -362,7 +392,15 @@ MainPageTile {
|
|||||||
case "irrigation":
|
case "irrigation":
|
||||||
case "ventilation":
|
case "ventilation":
|
||||||
return ""
|
return ""
|
||||||
case "garagegate":
|
case "garagedoor":
|
||||||
|
var dev = devicesProxy.get(0)
|
||||||
|
if (dev.thingClass.interfaces.indexOf("simplegaragedoor") >= 0
|
||||||
|
|| dev.thingClass.interfaces.indexOf("statefulgaragedoor") >= 0
|
||||||
|
|| dev.thingClass.interfaces.indexOf("extendedstatefulgaragedoor") >= 0
|
||||||
|
|| dev.thingClass.interfaces.indexOf("garagegate") >= 0) {
|
||||||
|
return "../images/media-playback-stop.svg"
|
||||||
|
}
|
||||||
|
return ""
|
||||||
case "blind":
|
case "blind":
|
||||||
case "awning":
|
case "awning":
|
||||||
case "shutter":
|
case "shutter":
|
||||||
@ -384,7 +422,19 @@ MainPageTile {
|
|||||||
case "irrigation":
|
case "irrigation":
|
||||||
case "ventilation":
|
case "ventilation":
|
||||||
break;
|
break;
|
||||||
case "garagegate":
|
case "garagedoor":
|
||||||
|
for (var i = 0; i < devicesProxy.count; i++) {
|
||||||
|
var thing = devicesProxy.get(i);
|
||||||
|
if (thing.thingClass.interfaces.indexOf("simplegaragedoor") >= 0
|
||||||
|
|| thing.thingClass.interfaces.indexOf("statefulgaragedoor") >= 0
|
||||||
|
|| thing.thingClass.interfaces.indexOf("extendedstatefulgaragedoor") >= 0
|
||||||
|
|| thing.thingClass.interfaces.indexOf("garagegate") >= 0) {
|
||||||
|
|
||||||
|
var actionType = thing.thingClass.actionTypes.findByName("stop");
|
||||||
|
engine.thingManager.executeAction(thing.id, actionType.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "shutter":
|
case "shutter":
|
||||||
case "extendedshutter":
|
case "extendedshutter":
|
||||||
case "blind":
|
case "blind":
|
||||||
@ -398,7 +448,7 @@ MainPageTile {
|
|||||||
var actionType = deviceClass.actionTypes.findByName("stop");
|
var actionType = deviceClass.actionTypes.findByName("stop");
|
||||||
engine.deviceManager.executeAction(device.id, actionType.id)
|
engine.deviceManager.executeAction(device.id, actionType.id)
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
console.warn("DevicesPageDelegate, inlineButtonControl clicked: Unhandled interface", iface.name)
|
console.warn("DevicesPageDelegate, inlineButtonControl clicked: Unhandled interface", iface.name)
|
||||||
}
|
}
|
||||||
@ -430,7 +480,18 @@ MainPageTile {
|
|||||||
case "irrigation":
|
case "irrigation":
|
||||||
case "ventilation":
|
case "ventilation":
|
||||||
return "../images/system-shutdown.svg"
|
return "../images/system-shutdown.svg"
|
||||||
case "garagegate":
|
case "garagedoor":
|
||||||
|
var dev = devicesProxy.get(0)
|
||||||
|
if (dev.thingClass.interfaces.indexOf("simplegaragedoor") >= 0
|
||||||
|
|| dev.thingClass.interfaces.indexOf("statefulgaragedoor") >= 0
|
||||||
|
|| dev.thingClass.interfaces.indexOf("extendedstatefulgaragedoor") >= 0
|
||||||
|
|| dev.thingClass.interfaces.indexOf("garagegate") >= 0) {
|
||||||
|
return "../images/down.svg"
|
||||||
|
}
|
||||||
|
if (dev.thingClass.interfaces.indexOf("impulsegaragedoor") >= 0) {
|
||||||
|
return "../images/closable-move.svg"
|
||||||
|
}
|
||||||
|
return ""
|
||||||
case "blind":
|
case "blind":
|
||||||
case "extendedblind":
|
case "extendedblind":
|
||||||
case "awning":
|
case "awning":
|
||||||
@ -492,7 +553,23 @@ MainPageTile {
|
|||||||
print("executing", device, device.id, actionTypeId, actionName, deviceClass.actionTypes)
|
print("executing", device, device.id, actionTypeId, actionName, deviceClass.actionTypes)
|
||||||
|
|
||||||
engine.deviceManager.executeAction(device.id, actionTypeId)
|
engine.deviceManager.executeAction(device.id, actionTypeId)
|
||||||
case "garagegate":
|
case "garagedoor":
|
||||||
|
for (var i = 0; i < devicesProxy.count; i++) {
|
||||||
|
var thing = devicesProxy.get(i);
|
||||||
|
if (thing.thingClass.interfaces.indexOf("simplegaragedoor") >= 0
|
||||||
|
|| thing.thingClass.interfaces.indexOf("statefulgaragedoor") >= 0
|
||||||
|
|| thing.thingClass.interfaces.indexOf("extendedstatefulgaragedoor") >= 0
|
||||||
|
|| thing.thingClass.interfaces.indexOf("garagegate") >= 0) {
|
||||||
|
|
||||||
|
var actionType = thing.thingClass.actionTypes.findByName("close");
|
||||||
|
engine.deviceManager.executeAction(thing.id, actionType.id)
|
||||||
|
}
|
||||||
|
if (thing.thingClass.interfaces.indexOf("impulsegaragedoor") >= 0) {
|
||||||
|
var actionType = thing.thingClass.actionTypes.findByName("triggerImpulse");
|
||||||
|
engine.deviceManager.executeAction(thing.id, actionType.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "shutter":
|
case "shutter":
|
||||||
case "extendedshutter":
|
case "extendedshutter":
|
||||||
case "blind":
|
case "blind":
|
||||||
|
|||||||
@ -330,15 +330,15 @@ SettingsPageBase {
|
|||||||
text: qsTr("Connect \"%1\" to:").arg(ioConnectionDialog.ioStateType.displayName)
|
text: qsTr("Connect \"%1\" to:").arg(ioConnectionDialog.ioStateType.displayName)
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
}
|
}
|
||||||
Label { text: "\n" } // Fake in some spacing
|
// Label { text: "\n" } // Fake in some spacing
|
||||||
|
|
||||||
GridLayout {
|
GridLayout {
|
||||||
columns: (ioConnectionDialog.width / 400) * 2
|
columns: (ioConnectionDialog.width / 400) * 2
|
||||||
|
|
||||||
Label {
|
// Label {
|
||||||
Layout.fillWidth: true
|
// Layout.fillWidth: true
|
||||||
text: qsTr("Thing")
|
// text: qsTr("Thing")
|
||||||
}
|
// }
|
||||||
|
|
||||||
ComboBox {
|
ComboBox {
|
||||||
id: ioThingComboBox
|
id: ioThingComboBox
|
||||||
@ -369,10 +369,10 @@ SettingsPageBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
// Label {
|
||||||
Layout.fillWidth: true
|
// Layout.fillWidth: true
|
||||||
text: (ioConnectionDialog.ioStateType.ioType == Types.IOTypeDigitalInput || ioConnectionDialog.ioStateType.ioType == Types.IOTypeAnalogInput) ? qsTr("Output") : qsTr("Input")
|
// text: (ioConnectionDialog.ioStateType.ioType == Types.IOTypeDigitalInput || ioConnectionDialog.ioStateType.ioType == Types.IOTypeAnalogInput) ? qsTr("Output") : qsTr("Input")
|
||||||
}
|
// }
|
||||||
|
|
||||||
ComboBox {
|
ComboBox {
|
||||||
id: ioStateComboBox
|
id: ioStateComboBox
|
||||||
@ -405,29 +405,41 @@ SettingsPageBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
RowLayout {
|
||||||
text: qsTr("Inverted")
|
|
||||||
Layout.fillWidth: true
|
Label {
|
||||||
|
text: qsTr("Inverted")
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
CheckBox {
|
||||||
|
id: invertCheckBox
|
||||||
|
checked: ioConnectionDialog.isInput ? ioConnectionDialog.inputWatcher.ioConnection.inverted : ioConnectionDialog.outputWatcher.ioConnection.inverted
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckBox {
|
|
||||||
id: invertCheckBox
|
|
||||||
checked: ioConnectionDialog.isInput ? ioConnectionDialog.inputWatcher.ioConnection.inverted : ioConnectionDialog.outputWatcher.ioConnection.inverted
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
GridLayout {
|
||||||
|
id: buttonGrid
|
||||||
|
columns: width > (cancelButton.implicitWidth + disconnectButton.implicitWidth + connectButton.implicitWidth)
|
||||||
|
? 4 : 1
|
||||||
|
layoutDirection: columns == 1 ? Qt.RightToLeft : Qt.LeftToRight
|
||||||
Item {
|
Item {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
|
id: cancelButton
|
||||||
text: qsTr("Cancel")
|
text: qsTr("Cancel")
|
||||||
|
Layout.fillWidth: buttonGrid.columns === 1
|
||||||
onClicked: ioConnectionDialog.reject();
|
onClicked: ioConnectionDialog.reject();
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
|
id: disconnectButton
|
||||||
text: qsTr("Disconnect")
|
text: qsTr("Disconnect")
|
||||||
enabled: ioConnectionDialog.isInput ? ioConnectionDialog.inputWatcher.ioConnection != null : ioConnectionDialog.outputWatcher.ioConnection != null
|
enabled: ioConnectionDialog.isInput ? ioConnectionDialog.inputWatcher.ioConnection != null : ioConnectionDialog.outputWatcher.ioConnection != null
|
||||||
|
Layout.fillWidth: buttonGrid.columns === 1
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (ioConnectionDialog.ioStateType.ioType == Types.IOTypeDigitalInput
|
if (ioConnectionDialog.ioStateType.ioType == Types.IOTypeDigitalInput
|
||||||
@ -441,8 +453,10 @@ SettingsPageBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
|
id: connectButton
|
||||||
text: qsTr("Connect")
|
text: qsTr("Connect")
|
||||||
enabled: ioThingComboBox.currentIndex >= 0 && ioStateComboBox.currentIndex >= 0
|
enabled: ioThingComboBox.currentIndex >= 0 && ioStateComboBox.currentIndex >= 0
|
||||||
|
Layout.fillWidth: buttonGrid.columns === 1
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var inputThingId;
|
var inputThingId;
|
||||||
|
|||||||
Reference in New Issue
Block a user