Small improvments in the edit rules page
This commit is contained in:
parent
b790905d60
commit
c30edaafdc
@ -499,7 +499,7 @@ Page {
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
Layout.margins: app.margins
|
||||
Layout.leftMargin: app.margins; Layout.rightMargin: app.margins; Layout.bottomMargin: app.margins
|
||||
text: eventsRepeater.count == 0 && timeEventRepeater.count === 0 ? qsTr("Configure...") : qsTr("Add another...")
|
||||
visible: !root.isStateBased
|
||||
onClicked: {
|
||||
@ -592,8 +592,8 @@ Page {
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
Layout.margins: app.margins
|
||||
text: root.rule.stateEvaluator === null && root.rule.timeDescriptor.calendarItems.count === 0 ?
|
||||
Layout.leftMargin: app.margins; Layout.rightMargin: app.margins; Layout.bottomMargin: app.margins
|
||||
text: root.rule.stateEvaluator === null || root.rule.timeDescriptor.calendarItems.count === 0 ?
|
||||
qsTr("Configure...") :
|
||||
qsTr("Add another...")
|
||||
visible: root.rule.timeDescriptor.timeEventItems.count === 0 || root.rule.stateEvaluator === null
|
||||
@ -661,7 +661,7 @@ Page {
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
Layout.margins: app.margins
|
||||
Layout.leftMargin: app.margins; Layout.rightMargin: app.margins; Layout.bottomMargin: app.margins
|
||||
text: root.isEmpty ? qsTr("Configure...") :
|
||||
actionsRepeater.count == 0 ? qsTr("Add an action...") : qsTr("Add another action...")
|
||||
onClicked: {
|
||||
@ -697,7 +697,7 @@ Page {
|
||||
|
||||
Button {
|
||||
Layout.fillWidth: true
|
||||
Layout.margins: app.margins
|
||||
Layout.leftMargin: app.margins; Layout.rightMargin: app.margins; Layout.bottomMargin: app.margins
|
||||
text: actionsRepeater.count == 0 ? qsTr("Add an action...") : qsTr("Add another action...")
|
||||
onClicked: {
|
||||
var page = pageStack.push(ruleActionQuestionPageComponent, {exitAction: true});
|
||||
|
||||
@ -64,9 +64,18 @@ NymeaListItemDelegate {
|
||||
var ruleActionParam = root.ruleAction.ruleActionParams.get(i)
|
||||
print("populating subtext:", ruleActionParam.eventTypeId, ruleActionParam.eventParamTypeId, ruleActionParam.stateDeviceId, ruleActionParam.stateTypeId, ruleActionParam.isValueBased, ruleActionParam.isEventParamBased, ruleActionParam.isStateValueBased)
|
||||
|
||||
var paramString = qsTr("%1: %2").arg(root.actionType.paramTypes.getParamType(ruleActionParam.paramTypeId).displayName)
|
||||
var paramType = root.actionType.paramTypes.getParamType(ruleActionParam.paramTypeId);
|
||||
var paramString = qsTr("%1: %2").arg(paramType.displayName)
|
||||
if (ruleActionParam.isValueBased) {
|
||||
paramString = paramString.arg(ruleActionParam.value)
|
||||
var text = ""
|
||||
switch (paramType.type.toLowerCase()) {
|
||||
case "bool":
|
||||
text = ruleActionParam.value === true ? qsTr("True") : qsTr("False")
|
||||
break;
|
||||
default:
|
||||
text = ruleActionParam.value
|
||||
}
|
||||
paramString = paramString.arg(text)
|
||||
} else if (ruleActionParam.isEventParamBased) {
|
||||
paramString = paramString.arg(qsTr("value from event"))
|
||||
} else if (ruleActionParam.isStateValueBased) {
|
||||
|
||||
@ -97,10 +97,17 @@ SwipeDelegate {
|
||||
if (!root.stateType) {
|
||||
return qsTr("Press to edit condition")
|
||||
}
|
||||
var valueText = root.stateEvaluator.stateDescriptor.value;
|
||||
switch (root.stateType.type.toLowerCase()) {
|
||||
case "bool":
|
||||
valueText = root.stateEvaluator.stateDescriptor.value === true ? qsTr("True") : qsTr("False")
|
||||
break;
|
||||
}
|
||||
|
||||
if (root.device) {
|
||||
return qsTr("%1: %2 %3 %4").arg(root.device.name).arg(root.stateType.displayName).arg(operatorString).arg(root.stateEvaluator.stateDescriptor.value)
|
||||
return qsTr("%1: %2 %3 %4").arg(root.device.name).arg(root.stateType.displayName).arg(operatorString).arg(valueText)
|
||||
} else if (root.iface) {
|
||||
return qsTr("%1: %2 %3 %4").arg(root.iface.displayName).arg(root.stateType.displayName).arg(operatorString).arg(root.stateEvaluator.stateDescriptor.value)
|
||||
return qsTr("%1: %2 %3 %4").arg(root.iface.displayName).arg(root.stateType.displayName).arg(operatorString).arg(valueText)
|
||||
}
|
||||
return "--";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user