实现向设备发起防夹灵敏度设置,恢复出厂设置请求。

This commit is contained in:
luocai
2024-12-04 15:23:42 +08:00
parent 77dd027ff7
commit fb27b0fa57
7 changed files with 165 additions and 36 deletions

View File

@ -16,6 +16,7 @@ Item {
property color antiClipAreaColor: "blue"
property var antiClipAreaPoints: []
property bool antiClipAreaEnabled: false
property int antiClipSensitivity: 1
property alias flip: flipSwitch.checked
property alias videoRotation: rotateComboBox.currentIndex
@ -241,19 +242,18 @@ Item {
}
}
}
Grid {
GridLayout {
id: controlBar
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
columns: 2
spacing: 10
verticalItemAlignment: Qt.AlignVCenter
columns: 4
Label { text: qsTr("图像: ") }
Row {
enabled: root.enabled
Layout.columnSpan: 3
Label {
anchors.verticalCenter: parent.verticalCenter
text: qsTr("旋转")
@ -283,6 +283,7 @@ Item {
}
Row {
enabled: root.enabled
Layout.columnSpan: 3
RadioButton {
text: "关闭"
checked: App.currentOpenDoorAreaWay ==DeviceConnection.Diabled
@ -310,6 +311,7 @@ Item {
Label {text: qsTr("防夹区域: ")}
Row {
enabled: root.enabled
Layout.columnSpan: 1
RadioButton {
text: "关闭"
checked: !App.currentAntiClipAreaEnabled
@ -327,6 +329,19 @@ Item {
}
}
Label { text: qsTr("灵敏度: ")
Layout.alignment: Qt.AlignRight
}
ComboBox {
id: antiClipSensitivityComboBox
enabled: root.enabled
Layout.alignment: Qt.AlignLeft
model: [1,2,3,4,5]
currentIndex: root.antiClipSensitivity-1
onCurrentIndexChanged: {
App.currentAntiClipSensitivity = antiClipSensitivityComboBox.currentIndex+1
}
}
Label {text: qsTr("屏蔽区域: ")}
Row {

View File

@ -118,6 +118,7 @@ ApplicationWindow {
shieldedAreaEnabled: App.currentShieldedAreaEnabled
shieldedAreaPoints: App.currentShieldedAreaPoints
antiClipAreaEnabled: App.currentAntiClipAreaEnabled
antiClipSensitivity: App.currentAntiClipSensitivity
antiClipAreaPoints: App.currentAntiClipAreaPoints
flip: App.currentDeviceFlip
videoRotation: App.currentDeviceRotation
@ -163,6 +164,7 @@ ApplicationWindow {
}
Item {}
Button {
Layout.alignment: Qt.AlignRight
text: "升级"
onClicked: {
if (deviceList.currentIndex < 0) {
@ -175,17 +177,32 @@ ApplicationWindow {
otaPopup.open()
}
}
Item {}
Button {
Layout.alignment: Qt.AlignRight
Layout.rightMargin: 5
text: "重置"
onClicked: {
if (deviceList.currentIndex < 0) {
showMessageDialog(2, "恢复出厂设置", "请先选择设备")
return
} else {
showMessageDialog(2, "恢复出厂设置", "设备将会重启,重启后配置恢复默认",()=>{
App.resetDevice();
})
}
}
}
spacing: (parent.width - (2 * 100)) / 3
}
function showMessageDialog(type, title, message) {
function showMessageDialog(type, title, message, callback) {
let component = Qt.createComponent("MessageDialog.qml")
if (component.status === Component.Ready) {
let dialog = component.createObject(window, {
"type": type,
"titleText": title,
"text": message
"text": message,
"callback": callback
})
dialog.open()
}

View File

@ -13,6 +13,7 @@ Dialog {
property alias text: textLabel.text
property alias textFontSize: textLabel.font.pixelSize
property int type: MessageDialog.Type.Successful
property var callback
closePolicy: Popup.CloseOnEscap | Popup.NoAutoClose
background: Rectangle {
radius: 8
@ -62,30 +63,60 @@ Dialog {
wrapMode: Text.WordWrap
}
Button {
id: cancelButton
Row {
Layout.alignment: Qt.AlignRight
Layout.rightMargin: 6
Layout.preferredWidth: 72
Layout.preferredHeight: 40
font.family: control.font.family
text: "关闭"
font.pixelSize: 14
contentItem: Text {
text: parent.text
font: parent.font
color: parent.down ? "#FFFFFF" : "#53627C"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
spacing: 10
Button {
id: okButton
width: 72
height: 40
font.family: control.font.family
text: "好的"
font.pixelSize: 14
contentItem: Text {
text: parent.text
font: parent.font
color: parent.down ? "#FFFFFF" : "#53627C"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
background: Rectangle {
border.color: "#E1E4E8"
border.width: 1
color: parent.down ? "#F25959" : "#FFFFFF"
radius: 2
}
onClicked: {
if(callback !== undefined){
callback()
}
control.accept()
}
}
background: Rectangle {
border.color: "#E1E4E8"
border.width: 1
color: parent.down ? "#F25959" : "#FFFFFF"
radius: 2
Button {
id: cancelButton
visible: callback !== undefined
width: 72
height: 40
font.family: control.font.family
text: "取消"
font.pixelSize: 14
contentItem: Text {
text: parent.text
font: parent.font
color: parent.down ? "#FFFFFF" : "#53627C"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
background: Rectangle {
border.color: "#E1E4E8"
border.width: 1
color: parent.down ? "#F25959" : "#FFFFFF"
radius: 2
}
onClicked: control.reject()
}
onClicked: control.reject()
}
}
onTypeChanged: {