some small fixes
This commit is contained in:
parent
dcb648addb
commit
75ae223f54
@ -8,11 +8,13 @@ import "../components"
|
|||||||
ItemDelegate {
|
ItemDelegate {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property var actionType: null
|
property ActionType actionType: null
|
||||||
property var actionState: null
|
property var actionState: null
|
||||||
|
|
||||||
signal executeAction(var params)
|
signal executeAction(var params)
|
||||||
|
|
||||||
|
readonly property bool multiParam: actionType.paramTypes.count > 1
|
||||||
|
|
||||||
contentItem: ColumnLayout {
|
contentItem: ColumnLayout {
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Label {
|
Label {
|
||||||
@ -25,7 +27,7 @@ ItemDelegate {
|
|||||||
id: loader
|
id: loader
|
||||||
Layout.fillWidth: sourceComponent == textFieldComponent || sourceComponent == buttonComponent
|
Layout.fillWidth: sourceComponent == textFieldComponent || sourceComponent == buttonComponent
|
||||||
sourceComponent: {
|
sourceComponent: {
|
||||||
if (root.actionType.paramTypes.count !== 1) {
|
if (root.multiParam || root.actionType.paramTypes.count === 0) {
|
||||||
return buttonComponent
|
return buttonComponent
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,16 +70,21 @@ ItemDelegate {
|
|||||||
}
|
}
|
||||||
Repeater {
|
Repeater {
|
||||||
id: paramRepeater
|
id: paramRepeater
|
||||||
|
|
||||||
model: root.actionType.paramTypes
|
model: root.actionType.paramTypes
|
||||||
delegate: Loader {
|
delegate: Loader {
|
||||||
id: bottomLoader
|
id: bottomLoader
|
||||||
property var paramType: root.actionType.paramTypes.get(index)
|
property var paramType: root.actionType.paramTypes.get(index)
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
sourceComponent: {
|
sourceComponent: {
|
||||||
switch (paramType.type.toLowerCase()) {
|
switch (paramType.type.toLowerCase()) {
|
||||||
case "int":
|
case "int":
|
||||||
case "double":
|
case "double":
|
||||||
if (paramType.minValue !== undefined && paramType.maxValue !== undefined) {
|
if (paramType.minValue !== undefined && paramType.maxValue !== undefined) {
|
||||||
|
if (root.multiParam) {
|
||||||
|
return labelledSpinnerComponent;
|
||||||
|
}
|
||||||
return sliderComponent
|
return sliderComponent
|
||||||
}
|
}
|
||||||
return textFieldComponent;
|
return textFieldComponent;
|
||||||
@ -87,7 +94,7 @@ ItemDelegate {
|
|||||||
return paramType.allowedValues.length === 0 ? textFieldComponent :
|
return paramType.allowedValues.length === 0 ? textFieldComponent :
|
||||||
root.actionType.paramTypes.count === 1 ? null : comboBoxComponent
|
root.actionType.paramTypes.count === 1 ? null : comboBoxComponent
|
||||||
case "bool":
|
case "bool":
|
||||||
if (root.actionType.paramTypes.count > 1) {
|
if (root.multiParam) {
|
||||||
return labeledBoolComponent;
|
return labeledBoolComponent;
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
@ -104,9 +111,9 @@ ItemDelegate {
|
|||||||
}
|
}
|
||||||
Binding {
|
Binding {
|
||||||
target: bottomLoader.item
|
target: bottomLoader.item
|
||||||
when: bottomLoader.item && root.actionState
|
when: bottomLoader.item
|
||||||
property: "value"
|
property: "value"
|
||||||
value: root.actionState
|
value: (root.actionState && index == 0) ? root.actionState : root.actionType.paramTypes.get(index).defaultValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -147,8 +154,10 @@ ItemDelegate {
|
|||||||
id: switchRow
|
id: switchRow
|
||||||
property var paramType: null
|
property var paramType: null
|
||||||
property var value
|
property var value
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: paramType.displayName
|
text: paramType.displayName
|
||||||
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
Switch {
|
Switch {
|
||||||
checked: paramType.defaultValue
|
checked: paramType.defaultValue
|
||||||
@ -196,7 +205,28 @@ ItemDelegate {
|
|||||||
text: sliderRow.paramType.maxValue
|
text: sliderRow.paramType.maxValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: labelledSpinnerComponent
|
||||||
|
RowLayout {
|
||||||
|
id: sliderRow
|
||||||
|
property var paramType: null
|
||||||
|
property var value: null
|
||||||
|
Label {
|
||||||
|
text: sliderRow.paramType.displayName
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
SpinBox {
|
||||||
|
from: sliderRow.paramType.minValue
|
||||||
|
to: sliderRow.paramType.maxValue
|
||||||
|
value: sliderRow.value
|
||||||
|
editable: true
|
||||||
|
onValueModified: {
|
||||||
|
sliderRow.value = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import "../components"
|
|||||||
ItemDelegate {
|
ItemDelegate {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property var paramType: null
|
property ParamType paramType: null
|
||||||
property alias value: d.value
|
property alias value: d.value
|
||||||
property var param: Param {
|
property var param: Param {
|
||||||
id: d
|
id: d
|
||||||
@ -39,10 +39,7 @@ ItemDelegate {
|
|||||||
case "bool":
|
case "bool":
|
||||||
return boolComponent;
|
return boolComponent;
|
||||||
case "int":
|
case "int":
|
||||||
if (root.paramType.minimumValue !== undefined && root.paramType.maximumValue !== undefined) {
|
return spinnerComponent;
|
||||||
return sliderComponent;
|
|
||||||
}
|
|
||||||
return textFieldComponent;
|
|
||||||
case "string":
|
case "string":
|
||||||
case "qstring":
|
case "qstring":
|
||||||
if (root.paramType.allowedValues.length > 0) {
|
if (root.paramType.allowedValues.length > 0) {
|
||||||
@ -61,12 +58,12 @@ ItemDelegate {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
sourceComponent: {
|
sourceComponent: {
|
||||||
switch (root.paramType.type.toLowerCase()) {
|
switch (root.paramType.type.toLowerCase()) {
|
||||||
case "int":
|
// case "int":
|
||||||
case "double":
|
// case "double":
|
||||||
if (root.paramType.minValue !== undefined && root.paramType.maxValue !== undefined) {
|
// if (root.paramType.minValue !== undefined && root.paramType.maxValue !== undefined) {
|
||||||
return sliderComponent
|
// return sliderComponent
|
||||||
}
|
// }
|
||||||
break;
|
// break;
|
||||||
case "color":
|
case "color":
|
||||||
return colorPickerComponent
|
return colorPickerComponent
|
||||||
}
|
}
|
||||||
@ -143,6 +140,20 @@ ItemDelegate {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: spinnerComponent
|
||||||
|
SpinBox {
|
||||||
|
value: root.param.value
|
||||||
|
from: root.paramType.minValue
|
||||||
|
to: root.paramType.maxValue
|
||||||
|
editable: true
|
||||||
|
onValueModified: root.param.value = value
|
||||||
|
textFromValue: function(value) {
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: textFieldComponent
|
id: textFieldComponent
|
||||||
TextField {
|
TextField {
|
||||||
|
|||||||
@ -22,7 +22,8 @@ Page {
|
|||||||
function enterPage(index, replace) {
|
function enterPage(index, replace) {
|
||||||
var device = devicesProxy.get(index);
|
var device = devicesProxy.get(index);
|
||||||
var deviceClass = engine.deviceManager.deviceClasses.getDeviceClass(device.deviceClassId);
|
var deviceClass = engine.deviceManager.deviceClasses.getDeviceClass(device.deviceClassId);
|
||||||
var page = app.interfaceListToDevicePage(deviceClass.interfaces);
|
var page = app.interfaceListToDevicePage(root.shownInterfaces);
|
||||||
|
// var page = "GenericDevicePage.qml";
|
||||||
if (replace) {
|
if (replace) {
|
||||||
pageStack.replace(Qt.resolvedUrl("../devicepages/" + page), {device: devicesProxy.get(index)})
|
pageStack.replace(Qt.resolvedUrl("../devicepages/" + page), {device: devicesProxy.get(index)})
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -9,6 +9,7 @@ DevicePageBase {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
GenericTypeLogView {
|
GenericTypeLogView {
|
||||||
|
id: logView
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
logsModel: engine.jsonRpcClient.ensureServerVersion("1.10") ? logsModelNg : logsModel
|
logsModel: engine.jsonRpcClient.ensureServerVersion("1.10") ? logsModelNg : logsModel
|
||||||
@ -28,6 +29,22 @@ DevicePageBase {
|
|||||||
typeIds: [root.deviceClass.eventTypes.findByName("triggered").id];
|
typeIds: [root.deviceClass.eventTypes.findByName("triggered").id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// delegate: MeaListItemDelegate {
|
||||||
|
// width: parent.width
|
||||||
|
// iconName: app.interfaceToIcon("inputtrigger")
|
||||||
|
// text: model.value.trim()
|
||||||
|
// subText: Qt.formatDateTime(model.timestamp)
|
||||||
|
// progressive: false
|
||||||
|
|
||||||
|
// onClicked: {
|
||||||
|
// print("a", model.value.trim())
|
||||||
|
// var parts = model.value.trim().split(', ')
|
||||||
|
// print("b", parts)
|
||||||
|
// var popup = detailsPopup.createObject(root, {timestamp: model.timestamp, notificationTitle: parts[1], notificationBody: parts[0]});
|
||||||
|
// popup.open();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
onAddRuleClicked: {
|
onAddRuleClicked: {
|
||||||
var value = logView.logsModel.get(index).value
|
var value = logView.logsModel.get(index).value
|
||||||
var typeId = logView.logsModel.get(index).typeId
|
var typeId = logView.logsModel.get(index).typeId
|
||||||
|
|||||||
@ -88,6 +88,7 @@ DevicePageBase {
|
|||||||
id: logsModelNg
|
id: logsModelNg
|
||||||
deviceId: root.device.id
|
deviceId: root.device.id
|
||||||
engine: _engine
|
engine: _engine
|
||||||
|
live: true
|
||||||
typeIds: [root.deviceClass.actionTypes.findByName("notify").id];
|
typeIds: [root.deviceClass.actionTypes.findByName("notify").id];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +103,7 @@ DevicePageBase {
|
|||||||
|
|
||||||
delegate: MeaListItemDelegate {
|
delegate: MeaListItemDelegate {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
iconName: "../images/notification.svg"
|
iconName: app.interfaceToIcon("notifications")
|
||||||
text: model.value.trim()
|
text: model.value.trim()
|
||||||
subText: Qt.formatDateTime(model.timestamp)
|
subText: Qt.formatDateTime(model.timestamp)
|
||||||
progressive: false
|
progressive: false
|
||||||
|
|||||||
Reference in New Issue
Block a user