SmartLockerTools/Analyser/qml/EnrollVerifyOperations.qml

136 lines
4.4 KiB
QML
Raw Normal View History

2024-09-25 18:44:04 +08:00
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Analyser
RowLayout {
id: control
GroupBox {
title: "注册用户"
GridLayout {
columns: 2
Label {
text: qsTr("用户姓名")
}
TextField {
id: enrollName
implicitWidth: 100
}
Label {
text: qsTr("严格模式")
}
Switch {
id: strictMode
}
Label {
text: qsTr("互斥模式")
}
ComboBox {
id: excludeMode
model: ["无", "仅比对", "互斥"]
}
Label {
text: qsTr("超时时间")
}
TextField {
id: enrollTimeout
implicitWidth: 100
text: "30"
}
Label {
text: qsTr("持久化")
}
Switch {
id: persistence
checked: true
}
Label {
text: qsTr("保存图片")
}
Switch {
id: extendedMode
}
Button {
property bool enrolling: App.module ? (App.module.currentMessageId
=== ModuleCommunication.EnrollSingle)
|| (App.module.currentMessageId === ModuleCommunication.EnrollExtended) : false
text: enrolling ? "取消" : "注册"
onClicked: {
if (enrolling) {
App.module.reset()
} else if (extendedMode.checked) {
App.enrollExtended(enrollName.text, strictMode.checked,
excludeMode.currentIndex,
persistence.checked,
parseInt(enrollTimeout.text))
} else {
App.enroll(enrollName.text, strictMode.checked,
excludeMode.currentIndex,
persistence.checked,
parseInt(enrollTimeout.text))
}
}
}
}
}
GroupBox {
2024-10-25 17:18:09 +08:00
id: verifyBox
2024-09-25 18:44:04 +08:00
title: "识别用户"
2024-10-25 17:18:09 +08:00
property bool verifying: (App.currentMessageId == ModuleCommunication.Verify) || (App.currentMessageId == ModuleCommunication.VerifyExtended)
2024-09-25 18:44:04 +08:00
GridLayout {
columns: 2
Label {
text: qsTr("超时时间(s)")
}
TextField {
id: verifyTimeout
implicitWidth: 80
text: "10"
}
Label {
text: qsTr("持续识别")
}
Switch {
2024-10-25 17:18:09 +08:00
checked: (App.persistenceCommand == ModuleCommunication.Verify) || (App.persistenceCommand == ModuleCommunication.VerifyExtended)
onToggled: {
if (checked) {
App.persistenceCommand = extendedVerifyMode.checked ? ModuleCommunication.VerifyExtended : ModuleCommunication.Verify
} else {
App.persistenceCommand = ModuleCommunication.Idle
}
}
2024-09-25 18:44:04 +08:00
}
Label {
text: qsTr("保存图片")
}
Switch {
id: extendedVerifyMode
}
Label {
text: qsTr("识别间隔(s)")
}
TextField {
id: verifyIntetval
implicitWidth: 80
text: App.persistenceVerifyInterval
}
Item {}
Button {
2024-10-25 17:18:09 +08:00
text: verifyBox.verifying ? "停止" : "识别"
2024-09-25 18:44:04 +08:00
onClicked: {
2024-10-25 17:18:09 +08:00
if (verifyBox.verifying) {
App.resetModule()
2024-09-25 18:44:04 +08:00
} else {
App.persistenceVerifyInterval = parseInt(verifyIntetval.text)
App.verify(extendedVerifyMode.checked, parseInt(verifyTimeout.text))
}
}
}
}
}
}