适配模组的strict模式。

This commit is contained in:
luocai
2024-09-05 16:36:54 +08:00
parent 36a5877a0c
commit 2c06e4d1e0
13 changed files with 149 additions and 535 deletions

View File

@ -15,7 +15,7 @@ RowLayout {
ComboBox {
id: serialPort
enabled: !App.connected
implicitWidth: 100
implicitWidth: 116
}
Text {
@ -25,7 +25,7 @@ RowLayout {
ComboBox {
id: baudrate
enabled: !App.connected
implicitWidth: 110
implicitWidth: 116
model: ["2000000", "115200"]
}

View File

@ -1,17 +1,19 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Fluent as Fluent
import Analyser
Window {
width: 1120
height: 770
id: window
width: 1220
height: 890
visible: true
title: qsTr(Qt.application.name + " " + Qt.application.version)
OperationItem {
id: operationItem
width: 450
width: 510
anchors.top: parent.top
}
@ -98,22 +100,29 @@ Window {
}
}
Fluent.InfoBar{
id:info_bar
root: window
layoutY: 10
}
Connections {
target: App
function onNewLog(text) {
logBrowser.append(text)
}
function onNewStatusTip(level, tip) {
if (level === 0) {
statusTip.icon = "../resources/successfull.svg"
statusTip.color = "#EBF8ED"
statusTip.show(tip, 2000)
function onNewStatusTip(level, tip, detailMessage) {
if (level === App.Tip) {
info_bar.showSuccess(tip,2000,detailMessage)
} else if (level === App.Warnging) {
info_bar.showWarning(tip,2000,detailMessage)
} else if (level === 1) {
statusTip.icon = "../resources/warning.svg"
statusTip.color = "#FAFAD2"
statusTip.show(tip, 2000)
} else if (level === 2) {
resultBrowser.append(tip)
info_bar.showInfo(tip,2000,detailMessage)
resultBrowser.append(tip+":"+detailMessage)
}
}
function onNewVideoFrame() {
@ -121,11 +130,4 @@ Window {
image.source = "image://videoframe/"
}
}
StatusTip {
id: statusTip
width: 200
height: 50
icon: "../resources/successfull.svg"
}
}

View File

@ -32,23 +32,29 @@ Item {
title: "注册用户"
GridLayout {
columns: 2
Text {
Label {
text: qsTr("用户姓名")
}
TextField {
id: enrollName
implicitWidth: 100
}
Text {
Label {
text: qsTr("严格模式")
}
Switch {
id: strictMode
}
Label {
text: qsTr("超时时间")
}
TextField {
id: enrollTimeout
implicitWidth: 100
text: "10"
text: "30"
}
Text {
Label {
text: qsTr("持久化")
}
Switch {
@ -56,7 +62,7 @@ Item {
checked: true
}
Text {
Label {
text: qsTr("保存图片")
}
Switch {
@ -70,14 +76,9 @@ Item {
if (enrolling) {
App.module.reset()
} else if (extendedMode.checked) {
App.enrollExtended(
enrollName.text,
persistence.checked,
parseInt(enrollTimeout.text))
App.enrollExtended(enrollName.text, strictMode.checked, persistence.checked, parseInt(enrollTimeout.text))
} else {
App.enroll(enrollName.text,
persistence.checked,
parseInt(enrollTimeout.text))
App.enroll(enrollName.text, strictMode.checked, persistence.checked, parseInt(enrollTimeout.text))
}
}
}
@ -87,7 +88,7 @@ Item {
title: "识别用户"
GridLayout {
columns: 2
Text {
Label {
text: qsTr("超时时间(s)")
}
TextField {
@ -95,20 +96,20 @@ Item {
implicitWidth: 80
text: "10"
}
Text {
Label {
text: qsTr("持续识别")
}
Switch {
checked: App.persistenceMode
onToggled: App.persistenceMode = !App.persistenceMode
}
Text {
Label {
text: qsTr("保存图片")
}
Switch {
id: extendedVerifyMode
}
Text {
Label {
text: qsTr("识别间隔(s)")
}
TextField {
@ -132,25 +133,59 @@ Item {
}
}
}
GroupBox {
title: "删除用户"
GridLayout {
columns: 2
Text {
text: qsTr("用户ID")
Column {
GroupBox {
title: "删除用户"
GridLayout {
columns: 2
Label {
text: qsTr("用户ID")
}
TextField {
id: deleteUserId
implicitWidth: 100
}
Button {
text: "删除"
onClicked: App.deleteUser(parseInt(
deleteUserId.text))
}
Button {
text: "删除所有"
onClicked: App.deleteAll()
}
}
TextField {
id: deleteUserId
implicitWidth: 100
}
Button {
text: "删除"
onClicked: App.deleteUser(parseInt(
deleteUserId.text))
}
Button {
text: "删除所有"
onClicked: App.deleteAll()
}
GroupBox {
GridLayout {
columns: 2
Button {
text: "复位"
onClicked: App.module.reset()
}
Button {
text: "状态查询"
onClicked: App.module.requestCurrentStatus()
}
Button {
text: "ID查询"
onClicked: App.module.requestUniqueId()
}
Button {
id: otaButton
text: "OTA升级"
onClicked: loader.active = true
}
Row {
Label {
text: qsTr("日志")
}
Switch {
id: debugMode
onToggled: App.module.setDebugEnabled(debugMode.checked)
}
}
}
}
}
@ -168,7 +203,7 @@ Item {
fileDialog.open()
}
}
Text {
Label {
text: qsTr("用户姓名")
}
TextField {
@ -176,7 +211,7 @@ Item {
implicitWidth: 100
text: "测试下发"
}
Text {
Label {
text: qsTr("循环")
}
Switch {
@ -195,32 +230,6 @@ Item {
}
}
}
Button {
text: "复位"
onClicked: App.module.reset()
}
Button {
text: "状态查询"
onClicked: App.module.requestCurrentStatus()
}
Button {
text: "ID查询"
onClicked: App.module.requestUniqueId()
}
Button {
id: otaButton
text: "OTA升级"
onClicked: loader.active = true
}
Row {
Text {
text: qsTr("日志")
}
Switch {
id: debugMode
onToggled: App.module.setDebugEnabled(debugMode.checked)
}
}
}
}
}

View File

@ -1,56 +0,0 @@
import QtQuick
import QtQuick.Controls
Popup{
id: control
property alias text: textItem.text
property alias icon: image.source
property alias color: back.color
property string borderColor
x: (parent.width-200)/2
y: 40
width: 200
height: 32
font.pixelSize: 16
contentItem: Row{
leftPadding: 4
spacing: 9.6
Image {
id: image
anchors.verticalCenter: parent.verticalCenter
}
Text {
id: textItem
anchors.verticalCenter: parent.verticalCenter
text: control.text
font: control.font
color: "#666666"
}
}
background: Rectangle {
id:back
anchors.fill: parent
color: "#EBF8ED"
radius: 3.2
border.width: 1
border.color: control.borderColor
layer.enabled: true
}
Timer {
id: timer
repeat: false
onTriggered: control.visible=false
}
function show(text,timeout){
control.text = text
timer.interval = timeout
timer.restart();
control.visible=true
}
}