SmartLockerTools/Analyser/qml/EnrollVerifyOperations.qml

128 lines
3.9 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 {
title: "识别用户"
GridLayout {
columns: 2
Label {
text: qsTr("超时时间(s)")
}
TextField {
id: verifyTimeout
implicitWidth: 80
text: "10"
}
Label {
text: qsTr("持续识别")
}
Switch {
checked: App.persistenceMode
onToggled: App.persistenceMode = !App.persistenceMode
}
Label {
text: qsTr("保存图片")
}
Switch {
id: extendedVerifyMode
}
Label {
text: qsTr("识别间隔(s)")
}
TextField {
id: verifyIntetval
implicitWidth: 80
text: App.persistenceVerifyInterval
}
Item {}
Button {
text: App.isVerifying ? "停止" : "识别"
onClicked: {
if (App.isVerifying) {
App.module.reset()
} else {
App.persistenceVerifyInterval = parseInt(verifyIntetval.text)
App.verify(extendedVerifyMode.checked, parseInt(verifyTimeout.text))
}
}
}
}
}
}