解决部分BUG。
This commit is contained in:
@ -7,7 +7,7 @@ Item {
|
||||
id: root
|
||||
property alias enabled: shieldedRow.enabled
|
||||
property int dargWidth: 12
|
||||
property color openDoorAreaColor: "green"
|
||||
property color openDoorAreaColor: "#0FF40D" // 绿色
|
||||
property var openDoorAreaPoints: []
|
||||
property int openDoorAreaWay: 0
|
||||
property color shieldedAreaColor: "yellow"
|
||||
|
@ -7,6 +7,7 @@ Column {
|
||||
property alias text: input.text
|
||||
property bool valid: false
|
||||
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: 36
|
||||
width: 350
|
||||
@ -30,8 +31,7 @@ Column {
|
||||
root.valid = root.canEmpty
|
||||
return root.valid
|
||||
}
|
||||
var regex = /^(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])$/
|
||||
root.valid = regex.test(input.text)
|
||||
root.valid = root.regularExpression.test(input.text)
|
||||
if (!root.valid) {
|
||||
hint.text = "参数配置无效"
|
||||
} else {
|
||||
|
66
qml/Main.qml
66
qml/Main.qml
@ -1,22 +1,20 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Dialogs
|
||||
import AntiClipSettings 1.0
|
||||
import Qt.labs.platform 1.1 as Labs
|
||||
|
||||
|
||||
ApplicationWindow {
|
||||
id: window
|
||||
width: 1000
|
||||
height: 640
|
||||
visible: true
|
||||
title: qsTr("T009上位机工具")
|
||||
title: qsTr(Qt.application.name + " " + Qt.application.version)
|
||||
|
||||
header: ToolBar {
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
ToolButton {
|
||||
Button {
|
||||
Material.background: Material.Blue
|
||||
text: "搜索设备"
|
||||
onClicked: {
|
||||
deviceList.currentIndex = -1
|
||||
@ -42,6 +40,12 @@ ApplicationWindow {
|
||||
width: 420
|
||||
clip: true
|
||||
model: App.devices
|
||||
Label {
|
||||
id: emptyHint
|
||||
visible: false
|
||||
anchors.centerIn: parent
|
||||
text: qsTr("未搜索到设备")
|
||||
}
|
||||
delegate: Rectangle {
|
||||
width: deviceList.width
|
||||
height: 40
|
||||
@ -72,7 +76,11 @@ ApplicationWindow {
|
||||
deviceList.currentIndex = index
|
||||
}
|
||||
onDoubleClicked: {
|
||||
networkPopup.open()
|
||||
if(App.devices.deviceConnected(index)){
|
||||
networkPopup.open()
|
||||
} else {
|
||||
showMessageDialog(2, "网络设置", "设备已离线!")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -97,7 +105,7 @@ ApplicationWindow {
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: deviceList.right
|
||||
anchors.right: parent.right
|
||||
enabled: App.currentDeviceConnected&&(deviceList.currentIndex >= 0)
|
||||
enabled: App.currentDeviceConnected && (deviceList.currentIndex >= 0)
|
||||
openDoorAreaWay: App.currentOpenDoorAreaWay
|
||||
openDoorAreaPoints: App.currentOpenDoorAreaPoints
|
||||
shieldedAreaEnabled: App.currentShieldedAreaEnabled
|
||||
@ -116,14 +124,6 @@ ApplicationWindow {
|
||||
id: otaPopup
|
||||
}
|
||||
|
||||
Labs.FolderDialog {
|
||||
id: folderDialog
|
||||
onAccepted: {
|
||||
App.collector.path = folderDialog.selectedFolder
|
||||
App.collector.start(App.devices.get(deviceList.currentIndex).ip)
|
||||
}
|
||||
}
|
||||
|
||||
footer: RowLayout {
|
||||
width: parent.width
|
||||
Item {}
|
||||
@ -136,12 +136,15 @@ ApplicationWindow {
|
||||
if (deviceList.currentIndex < 0) {
|
||||
showMessageDialog(2, "数据采集", "请先选择设备")
|
||||
return
|
||||
} else if(!App.currentDeviceConnected){
|
||||
} else if (!App.currentDeviceConnected) {
|
||||
showMessageDialog(2, "数据采集", "设备已离线,请重新连接设备!")
|
||||
return
|
||||
}
|
||||
if (App.collector.path.length <= 0) {
|
||||
folderDialog.open()
|
||||
showFolderDialog((folder)=>{
|
||||
App.collector.path = folder
|
||||
App.collector.start(App.devices.get(deviceList.currentIndex).ip)
|
||||
})
|
||||
} else {
|
||||
App.collector.start(App.devices.get(
|
||||
deviceList.currentIndex).ip)
|
||||
@ -156,7 +159,7 @@ ApplicationWindow {
|
||||
if (deviceList.currentIndex < 0) {
|
||||
showMessageDialog(2, "OTA升级", "请先选择设备!")
|
||||
return
|
||||
}else if(!App.currentDeviceConnected){
|
||||
} else if (!App.currentDeviceConnected) {
|
||||
showMessageDialog(2, "OTA升级", "设备已离线,请重新连接设备!")
|
||||
return
|
||||
}
|
||||
@ -179,10 +182,37 @@ ApplicationWindow {
|
||||
dialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
function showFolderDialog(onSelected){
|
||||
var dialog = Qt.createQmlObject("import QtQuick.Dialogs; FolderDialog {}",window,"myDynamicSnippet");
|
||||
if (dialog) {
|
||||
dialog.visible = true;
|
||||
dialog.accepted.connect(function() {
|
||||
onSelected(dialog.selectedFolder)
|
||||
dialog.destroy();
|
||||
});
|
||||
dialog.rejected.connect(function() {
|
||||
dialog.destroy();
|
||||
});
|
||||
} else {
|
||||
console.error("Failed to create FolderDialog object");
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: App
|
||||
function onNewMessage(type, title, message) {
|
||||
showMessageDialog(type, title, message)
|
||||
}
|
||||
}
|
||||
Connections {
|
||||
target: App.devices
|
||||
function onIsSearchingChanged() {
|
||||
if (App.devices.isSearching) {
|
||||
emptyHint.visible = false
|
||||
} else if (!App.devices.isSearching && (App.devices.rowCount() <= 0)) {
|
||||
emptyHint.visible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,10 @@ Popup {
|
||||
}
|
||||
contentItem: ColumnLayout {
|
||||
anchors.centerIn: parent
|
||||
Label {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
text: "有线网络设置"
|
||||
}
|
||||
|
||||
Row {
|
||||
spacing: 10
|
||||
@ -59,6 +63,7 @@ Popup {
|
||||
height: inputHeight
|
||||
width: 350
|
||||
text: App.currentNetworkInfomation.ip
|
||||
regularExpression: /^(22[0-3]|2[01][0-9]|1[0-9]{2}|[1-9][0-9]?|1[0-9]{2})\.(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])$/;
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,6 +106,7 @@ Popup {
|
||||
width: 350
|
||||
height: inputHeight
|
||||
text: App.currentNetworkInfomation.gateway
|
||||
regularExpression: /^(22[0-3]|2[01][0-9]|1[0-9]{2}|[1-9][0-9]?|1[0-9]{2})\.(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])$/;
|
||||
canEmpty: true
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user