Merge PR #533: Fix volume slider limits if a thing doesn't have volume from 0 to 100

This commit is contained in:
Jenkins nymea 2021-02-19 00:40:14 +01:00
commit ba45e429c3

View File

@ -55,6 +55,7 @@ Item {
readonly property bool hasVolumeControl: thing.thingClass.interfaces.indexOf("volumecontroller") >= 0
readonly property State volumeState: thing.stateByName("volume")
readonly property StateType volumeStateType: thing.thingClass.stateTypes.findByName("volume")
readonly property State muteState: thing.stateByName("mute")
readonly property State equalizerPresetState: thing.stateByName("equalizerPreset")
@ -364,8 +365,8 @@ Item {
Slider {
Layout.fillHeight: true
visible: root.volumeState !== null
from: 0
to: 100
from: root.volumeStateType.minValue
to: root.volumeStateType.maxValue
value: volumeActionQueue.pendingValue || root.volumeState.value
orientation: Qt.Vertical
onMoved: volumeActionQueue.sendValue(value)