This repository has been archived on 2026-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
powersync-app/nymea-app/ui/magic/SelectStateDescriptorParamsPage.qml
2018-10-01 17:37:29 +02:00

46 lines
1.6 KiB
QML

import QtQuick 2.8
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.2
import "../components"
import "../delegates"
import Nymea 1.0
Page {
id: root
// Needs to be set and filled in with deviceId and eventTypeId
property var stateDescriptor: null
readonly property var device: stateDescriptor && stateDescriptor.deviceId ? engine.deviceManager.devices.getDevice(stateDescriptor.deviceId) : null
readonly property var iface: stateDescriptor && stateDescriptor.interfaceName ? Interfaces.findByName(stateDescriptor.interfaceName) : null
readonly property var stateType: device ? engine.deviceManager.deviceClasses.getDeviceClass(device.deviceClassId).stateTypes.getStateType(stateDescriptor.stateTypeId)
: iface ? iface.stateTypes.findByName(stateDescriptor.interfaceState) : null
signal backPressed();
signal completed();
header: GuhHeader {
text: qsTr("Options")
onBackPressed: root.backPressed();
}
ColumnLayout {
anchors.fill: parent
ParamDescriptorDelegate {
id: paramDelegate
Layout.fillWidth: true
paramType: root.stateType
value: paramType.defaultValue
}
Button {
text: qsTr("OK")
Layout.fillWidth: true
Layout.margins: app.margins
onClicked: {
root.stateDescriptor.valueOperator = paramDelegate.operatorType
root.stateDescriptor.value = paramDelegate.value
root.completed()
}
}
}
}