2024-07-06 00:01:03 +02:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
import EVChargerApp
|
|
|
|
|
|
2024-07-17 19:47:36 +02:00
|
|
|
WhiteCheckDelegate {
|
2024-07-06 00:01:03 +02:00
|
|
|
id: checkDelegate
|
|
|
|
|
|
|
|
|
|
required property string apiKey
|
|
|
|
|
property alias exists: valueHelper.exists
|
|
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
2024-07-07 21:07:24 +02:00
|
|
|
contentItem.children[0].wrapMode = Text.Wrap
|
2024-07-06 00:01:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ApiKeyValueHelper {
|
|
|
|
|
id: valueHelper
|
2024-07-17 19:47:36 +02:00
|
|
|
deviceConnection: theDeviceConnection
|
2024-07-06 00:01:03 +02:00
|
|
|
apiKey: checkDelegate.apiKey
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-17 23:07:24 +02:00
|
|
|
SetValueHelper {
|
2024-07-06 00:01:03 +02:00
|
|
|
id: valueChanger
|
2024-07-17 19:47:36 +02:00
|
|
|
deviceConnection: theDeviceConnection
|
2024-07-17 23:07:24 +02:00
|
|
|
apiKey: checkDelegate.apiKey
|
2024-07-06 00:01:03 +02:00
|
|
|
onResponseChanged: checkDelegate.checked = Qt.binding(function(){ return valueHelper.value; })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checked: valueHelper.value
|
2024-07-17 23:38:22 +02:00
|
|
|
text: valueHelper.value === true ? qsTr("On") : valueHelper.value === false ? qsTr("Off") : qsTr("Unknown")
|
2024-07-06 00:01:03 +02:00
|
|
|
|
|
|
|
|
onClicked: {
|
2024-07-17 23:07:24 +02:00
|
|
|
valueChanger.setValue(checked)
|
2024-07-06 00:01:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BusyIndicator {
|
|
|
|
|
visible: valueChanger.pending
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RequestStatusText {
|
|
|
|
|
request: valueChanger
|
|
|
|
|
}
|
|
|
|
|
}
|