diff --git a/nymea-app/ui/components/MeaListItemDelegate.qml b/nymea-app/ui/components/MeaListItemDelegate.qml index bc116490..2a1dc9b0 100644 --- a/nymea-app/ui/components/MeaListItemDelegate.qml +++ b/nymea-app/ui/components/MeaListItemDelegate.qml @@ -12,11 +12,10 @@ SwipeDelegate { property string iconName property int iconSize: app.iconSize property color iconColor: app.guhAccent - property string secondaryIconName + property alias secondaryIconName: secondaryIcon.name property alias secondaryIconColor: secondaryIcon.color - - property bool batteryCritical: false - property bool disconnected: false + property alias tertiaryIconName: tertiaryIcon.name + property alias tertiaryIconColor: tertiaryIcon.color signal deleteClicked() @@ -56,28 +55,26 @@ SwipeDelegate { } } - ColorIcon { - Layout.preferredHeight: app.iconSize * .5 - Layout.preferredWidth: height - name: "../images/battery/battery-010.svg" - visible: root.batteryCritical - } - - ColorIcon { - Layout.preferredHeight: app.iconSize * .5 - Layout.preferredWidth: height - name: "../images/dialog-warning-symbolic.svg" - visible: root.disconnected - color: "red" - } - ColorIcon { id: secondaryIcon + Layout.preferredHeight: app.iconSize * .5 + Layout.preferredWidth: height + visible: name.length > 0 + } + + ColorIcon { + id: tertiaryIcon + Layout.preferredHeight: app.iconSize * .5 + Layout.preferredWidth: height + visible: name.length > 0 + } + + ColorIcon { + id: progressionIcon Layout.preferredHeight: app.iconSize * .6 Layout.preferredWidth: height - name: root.secondaryIconName.length > 0 ? root.secondaryIconName : "../images/next.svg" + name: "../images/next.svg" visible: root.progressive - color: root.secondaryIconColor } } diff --git a/nymea-app/ui/delegates/ThingDelegate.qml b/nymea-app/ui/delegates/ThingDelegate.qml index 2d132f34..8091b565 100644 --- a/nymea-app/ui/delegates/ThingDelegate.qml +++ b/nymea-app/ui/delegates/ThingDelegate.qml @@ -10,11 +10,14 @@ MeaListItemDelegate { iconName: deviceClass ? app.interfacesToIcon(deviceClass.interfaces) : "" text: device.name progressive: true - property bool batteryCritical: deviceClass && deviceClass.interfaces.indexOf("battery") >= 0 ? device.stateValue(deviceClass.stateTypes.findByName("batteryCritical").id) === true : false - property bool disconnected: deviceClass && deviceClass.interfaces.indexOf("connectable") >= 0 ? device.stateValue(deviceClass.stateTypes.findByName("connected").id) === false : false + secondaryIconName: batteryCritical ? "../images/battery/battery-010.svg" : "" + tertiaryIconName: disconnected ? "../images/dialog-warning-symbolic.svg" : "" + tertiaryIconColor: "red" property var device: null readonly property var deviceClass: device ? Engine.deviceManager.deviceClasses.getDeviceClass(device.deviceClassId) : null + readonly property bool batteryCritical: deviceClass && deviceClass.interfaces.indexOf("battery") >= 0 ? device.stateValue(deviceClass.stateTypes.findByName("batteryCritical").id) === true : false + readonly property bool disconnected: deviceClass && deviceClass.interfaces.indexOf("connectable") >= 0 ? device.stateValue(deviceClass.stateTypes.findByName("connected").id) === false : false }