import QtCore import QtQuick import QtQuick.Controls import QtQuick.Dialogs import QtQuick.Layouts import Analyser Item { id: control RowLayout { anchors.fill: parent enabled: App.connected 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() } } } GroupBox { title: "其它" enabled: App.connected 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 checked: App.module ? App.module.cdcDebugEnabled : false onToggled: App.module.setDebugEnabled(debugMode.checked) } } } } } GroupBox { id: imageBox title: "图片注册" visible: true property bool imaging: (App.currentMessageId == ModuleCommunication.UploadImageInfo) || (App.currentMessageId == ModuleCommunication.UploadImageData) GridLayout { columns: 2 TextField { id: imagePath Layout.columnSpan: 2 implicitWidth: 200 placeholderText: "请选择图片" onPressed: { fileDialog.open() } } Label { text: qsTr("用户姓名") } TextField { id: imageEnrollName implicitWidth: 100 text: "测试下发" } Label { text: qsTr("操作") } ComboBox { id: imageMode implicitWidth: 100 model: ["注册", "识别"] } Label { text: qsTr("循环") } Switch { checked: App.persistenceCommand == ModuleCommunication.UploadImageInfo onToggled: App.persistenceCommand = checked ? ModuleCommunication.UploadImageInfo : ModuleCommunication.Idle } Button { text: imageBox.imaging ? "取消" : "执行" onClicked: { if (imageBox.imaging) { App.resetModule() } else { App.uploadImage(imagePath.text, imageEnrollName.text, imageMode.currentIndex) } } } } } } FileDialog { id: fileDialog nameFilters: ["图片 (*.jpg *.yuv)"] currentFolder: StandardPaths.standardLocations(StandardPaths.DesktopLocation)[0] onAccepted: { var fileUrl = fileDialog.selectedFile.toString() var localFilePath = fileUrl.startsWith("file:///") ? fileUrl.substring(8) : fileUrl imagePath.text = localFilePath } } MouseArea { id: otaMouseArea width: otaButton.width height: otaButton.height enabled: !App.connected onClicked: { loader.active = true } } onVisibleChanged: { if (!visible) return Qt.callLater(() => { otaMouseArea.x = otaButton.mapToItem(control, 0, 0).x otaMouseArea.y = otaButton.mapToItem(control, 0, 0).y }) } }