更改OTA升级步骤。
This commit is contained in:
@ -246,8 +246,7 @@ Item {
|
||||
columns: 2
|
||||
spacing: 10
|
||||
verticalItemAlignment: Qt.AlignVCenter
|
||||
Text {
|
||||
|
||||
Label {
|
||||
text: qsTr("开门区域: ")
|
||||
}
|
||||
Row {
|
||||
@ -276,7 +275,7 @@ Item {
|
||||
}
|
||||
|
||||
|
||||
Text {text: qsTr("防夹区域: ")}
|
||||
Label {text: qsTr("防夹区域: ")}
|
||||
Row {
|
||||
enabled: root.enabled
|
||||
RadioButton {
|
||||
@ -297,7 +296,7 @@ Item {
|
||||
|
||||
}
|
||||
|
||||
Text {text: qsTr("屏蔽区域: ")}
|
||||
Label {text: qsTr("屏蔽区域: ")}
|
||||
Row {
|
||||
id: shieldedRow
|
||||
RadioButton {
|
||||
|
@ -9,7 +9,7 @@ Column {
|
||||
property bool canEmpty: false
|
||||
property var regularExpression : /^(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])$/
|
||||
TextField {
|
||||
height: 40
|
||||
height: 44
|
||||
width: 350
|
||||
id: input
|
||||
selectByMouse: true
|
||||
|
28
qml/Main.qml
28
qml/Main.qml
@ -15,6 +15,7 @@ ApplicationWindow {
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
Button {
|
||||
Layout.leftMargin: 5
|
||||
Material.background: Material.Blue
|
||||
text: "搜索设备"
|
||||
onClicked: {
|
||||
@ -127,8 +128,8 @@ ApplicationWindow {
|
||||
|
||||
footer: RowLayout {
|
||||
width: parent.width
|
||||
Item {}
|
||||
Button {
|
||||
Layout.leftMargin: 5
|
||||
text: App.collector.enabled ? "停止采集" : "数据采集"
|
||||
onClicked: {
|
||||
if (App.collector.enabled) {
|
||||
@ -184,6 +185,31 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
function showFileDialog(nameFilters,onSelected){
|
||||
let dialog = null
|
||||
if (isQt5) {
|
||||
dialog = Qt.createQmlObject("import QtQuick.Dialogs 1.3; FileDialog {}", window, "myDynamicSnippet")
|
||||
} else {
|
||||
dialog = Qt.createQmlObject("import QtQuick.Dialogs; FileDialog {}", window, "myDynamicSnippet")
|
||||
}
|
||||
if (dialog) {
|
||||
dialog.nameFilters = nameFilters;
|
||||
dialog.visible = true
|
||||
dialog.accepted.connect(function () {
|
||||
let fileUrl = isQt5 ? dialog.fileUrl.toString() : dialog.selectedFile.toString()
|
||||
let localFilePath = fileUrl.startsWith(
|
||||
"file:///") ? fileUrl.substring(8) : fileUrl
|
||||
onSelected(localFilePath)
|
||||
dialog.destroy()
|
||||
})
|
||||
dialog.rejected.connect(function () {
|
||||
dialog.destroy()
|
||||
})
|
||||
} else {
|
||||
console.error("Failed to create FolderDialog object")
|
||||
}
|
||||
}
|
||||
|
||||
function showFolderDialog(onSelected) {
|
||||
let dialog = null
|
||||
if (isQt5) {
|
||||
|
@ -9,7 +9,7 @@ Popup {
|
||||
anchors.centerIn: Overlay.overlay
|
||||
modal: true
|
||||
closePolicy: Popup.CloseOnEscap | Popup.NoAutoClose
|
||||
property int inputHeight: 50
|
||||
property int inputHeight: 56
|
||||
background: Rectangle {
|
||||
radius: 8
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Dialogs 1.3
|
||||
import AntiClipSettings 1.0
|
||||
|
||||
Popup {
|
||||
@ -46,7 +45,9 @@ Popup {
|
||||
Button {
|
||||
enabled: otaFinished
|
||||
text: "选择"
|
||||
onClicked: fileDialog.open()
|
||||
onClicked: showFileDialog(["OTA文件 (*.bin)"],(path)=>{
|
||||
otaFile.text = path
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +60,7 @@ Popup {
|
||||
to: 100
|
||||
value: 0.0
|
||||
}
|
||||
Text {
|
||||
Label {
|
||||
id: progressText
|
||||
text: "0%"
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
@ -67,7 +68,7 @@ Popup {
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Text {
|
||||
Label {
|
||||
id: otaMessage
|
||||
text: "请选择升级文件,点击开始按钮升级模组"
|
||||
wrapMode: Text.Wrap
|
||||
@ -92,24 +93,6 @@ Popup {
|
||||
onClose()
|
||||
}
|
||||
|
||||
FileDialog {
|
||||
id: fileDialog
|
||||
nameFilters: ["OTA文件 (*.bin)"]
|
||||
|
||||
onAccepted: {
|
||||
let fileUrl = isQt5 ? fileDialog.fileUrl.toString() : fileDialog.selectedFile.toString()
|
||||
var localFilePath = fileUrl.startsWith(
|
||||
"file:///") ? fileUrl.substring(8) : fileUrl
|
||||
otaFile.text = localFilePath
|
||||
}
|
||||
onVisibleChanged: {
|
||||
if (!isQt5) {
|
||||
currentFolder = StandardPaths.standardLocations(
|
||||
StandardPaths.DesktopLocation)[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: App
|
||||
function onCurrentDeviceOtaProgressChanged(status, progress, message) {
|
||||
|
Reference in New Issue
Block a user