2024-06-13 15:41:40 +08:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
|
|
|
import QtQuick.Layouts
|
|
|
|
import Analyser
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
GroupBox {
|
|
|
|
title: "串口设置"
|
|
|
|
Layout.fillWidth: true
|
|
|
|
GridLayout {
|
|
|
|
columns: 2
|
|
|
|
Text {
|
|
|
|
text: qsTr("端口")
|
|
|
|
}
|
|
|
|
ComboBox {
|
|
|
|
id: serialPort
|
|
|
|
enabled: !App.connected
|
2024-09-05 16:36:54 +08:00
|
|
|
implicitWidth: 116
|
2024-06-13 15:41:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Text {
|
|
|
|
text: qsTr("波特率")
|
|
|
|
}
|
|
|
|
|
|
|
|
ComboBox {
|
|
|
|
id: baudrate
|
|
|
|
enabled: !App.connected
|
2024-09-05 16:36:54 +08:00
|
|
|
implicitWidth: 116
|
2024-06-13 15:41:40 +08:00
|
|
|
model: ["2000000", "115200"]
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
|
|
|
text: "刷新"
|
|
|
|
enabled: !App.connected
|
|
|
|
onClicked: {
|
|
|
|
serialPort.model = App.availableSerialPorts()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
|
|
|
text: App.connected ? "断开" : "连接"
|
|
|
|
onClicked: App.connected ? App.close() : App.open(
|
|
|
|
serialPort.currentText,
|
|
|
|
parseInt(baudrate.currentText))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GroupBox {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
title: "UVC设置"
|
|
|
|
GridLayout {
|
|
|
|
columns: 2
|
|
|
|
Text {
|
|
|
|
text: qsTr("设备名")
|
|
|
|
}
|
|
|
|
ComboBox {
|
|
|
|
id: uvcs
|
2024-11-21 19:34:13 +08:00
|
|
|
textRole: "name"
|
2024-06-13 15:41:40 +08:00
|
|
|
enabled: !App.uvcOpened
|
|
|
|
implicitWidth: 150
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
enabled: !App.uvcOpened
|
|
|
|
text: "刷新"
|
|
|
|
onClicked: uvcs.model = App.availableUsbVideoCameras()
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
text: App.uvcOpened ? "关闭" : "连接"
|
2024-11-21 19:34:13 +08:00
|
|
|
onClicked: App.uvcOpened ? App.closeUVC() : App.openUVC(uvcs.currentValue.path)
|
2024-06-13 15:41:40 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
serialPort.model = App.availableSerialPorts()
|
|
|
|
uvcs.model = App.availableUsbVideoCameras()
|
|
|
|
}
|
|
|
|
}
|