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 { id: verifyBox title: "识别用户" property bool verifying: (App.currentMessageId == ModuleCommunication.Verify) || (App.currentMessageId == ModuleCommunication.VerifyExtended) GridLayout { columns: 2 Label { text: qsTr("超时时间(s)") } TextField { id: verifyTimeout implicitWidth: 80 text: "10" } Label { text: qsTr("持续识别") } Switch { 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 } } } Label { text: qsTr("保存图片") } Switch { id: extendedVerifyMode } Label { text: qsTr("识别间隔(s)") } TextField { id: verifyIntetval implicitWidth: 80 text: App.persistenceVerifyInterval } Item {} Button { text: verifyBox.verifying ? "停止" : "识别" onClicked: { if (verifyBox.verifying) { App.resetModule() } else { App.persistenceVerifyInterval = parseInt(verifyIntetval.text) App.verify(extendedVerifyMode.checked, parseInt(verifyTimeout.text)) } } } } } }