1.添加uvc视频流,
This commit is contained in:
80
Analyser/qml/ConnectionItem.qml
Normal file
80
Analyser/qml/ConnectionItem.qml
Normal file
@ -0,0 +1,80 @@
|
||||
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
|
||||
implicitWidth: 100
|
||||
}
|
||||
|
||||
Text {
|
||||
text: qsTr("波特率")
|
||||
}
|
||||
|
||||
ComboBox {
|
||||
id: baudrate
|
||||
enabled: !App.connected
|
||||
implicitWidth: 110
|
||||
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
|
||||
enabled: !App.uvcOpened
|
||||
implicitWidth: 150
|
||||
}
|
||||
Button {
|
||||
enabled: !App.uvcOpened
|
||||
text: "刷新"
|
||||
onClicked: uvcs.model = App.availableUsbVideoCameras()
|
||||
}
|
||||
Button {
|
||||
text: App.uvcOpened ? "关闭" : "连接"
|
||||
onClicked: App.uvcOpened ? App.closeUVC() : App.openUVC(
|
||||
uvcs.currentText)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
serialPort.model = App.availableSerialPorts()
|
||||
uvcs.model = App.availableUsbVideoCameras()
|
||||
}
|
||||
}
|
110
Analyser/qml/OperationItem.qml
Normal file
110
Analyser/qml/OperationItem.qml
Normal file
@ -0,0 +1,110 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import Analyser
|
||||
|
||||
ColumnLayout {
|
||||
ConnectionItem {}
|
||||
|
||||
GroupBox {
|
||||
title: "命令"
|
||||
Layout.columnSpan: 2
|
||||
enabled: App.connected
|
||||
GridLayout {
|
||||
columns: 2
|
||||
GroupBox {
|
||||
title: "注册用户"
|
||||
GridLayout {
|
||||
columns: 2
|
||||
Text {
|
||||
text: qsTr("用户姓名")
|
||||
}
|
||||
TextField {
|
||||
id: enrollName
|
||||
implicitWidth: 100
|
||||
}
|
||||
Text {
|
||||
text: qsTr("超时时间")
|
||||
}
|
||||
TextField {
|
||||
id: enrollTimeout
|
||||
implicitWidth: 100
|
||||
text: "10"
|
||||
}
|
||||
Button {
|
||||
text: "注册"
|
||||
onClicked: App.enroll(enrollName.text,
|
||||
parseInt(enrollTimeout.text))
|
||||
}
|
||||
}
|
||||
}
|
||||
GroupBox {
|
||||
title: "识别用户"
|
||||
GridLayout {
|
||||
columns: 2
|
||||
Text {
|
||||
text: qsTr("超时时间(s)")
|
||||
}
|
||||
TextField {
|
||||
id: verifyTimeout
|
||||
implicitWidth: 80
|
||||
text: "10"
|
||||
}
|
||||
Text {
|
||||
text: qsTr("持续识别")
|
||||
}
|
||||
Switch {
|
||||
checked: App.persistenceMode
|
||||
onToggled: App.persistenceMode = !App.persistenceMode
|
||||
}
|
||||
Text {
|
||||
text: qsTr("识别间隔(s)")
|
||||
}
|
||||
TextField {
|
||||
id: verifyIntetval
|
||||
implicitWidth: 80
|
||||
text: App.persistenceVerifyInterval
|
||||
}
|
||||
Item {}
|
||||
Button {
|
||||
text: App.isVerifying?"停止": "识别"
|
||||
onClicked: {
|
||||
if(App.isVerifying){
|
||||
App.module.reset()
|
||||
}else {
|
||||
App.persistenceVerifyInterval = parseInt(
|
||||
verifyIntetval.text)
|
||||
App.verify(parseInt(verifyTimeout.text))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
GroupBox {
|
||||
title: "删除用户"
|
||||
GridLayout {
|
||||
columns: 2
|
||||
Text {
|
||||
text: qsTr("用户ID")
|
||||
}
|
||||
TextField {
|
||||
id: deleteUserId
|
||||
implicitWidth: 100
|
||||
}
|
||||
Button {
|
||||
text: "删除"
|
||||
onClicked: App.deleteUser(parseInt(deleteUserId.text))
|
||||
}
|
||||
Button {
|
||||
text: "删除所有"
|
||||
onClicked: App.deleteAll()
|
||||
}
|
||||
}
|
||||
}
|
||||
Button {
|
||||
text: "复位"
|
||||
onClicked: App.module.reset()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
56
Analyser/qml/StatusTip.qml
Normal file
56
Analyser/qml/StatusTip.qml
Normal file
@ -0,0 +1,56 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
|
||||
Popup{
|
||||
id: control
|
||||
property alias text: textItem.text
|
||||
property alias icon: image.source
|
||||
property alias color: back.color
|
||||
property string borderColor
|
||||
x: (parent.width-200)/2
|
||||
y: 40
|
||||
width: 200
|
||||
height: 32
|
||||
font.pixelSize: 16
|
||||
contentItem: Row{
|
||||
leftPadding: 4
|
||||
spacing: 9.6
|
||||
Image {
|
||||
id: image
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
Text {
|
||||
id: textItem
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: control.text
|
||||
font: control.font
|
||||
color: "#666666"
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
id:back
|
||||
anchors.fill: parent
|
||||
color: "#EBF8ED"
|
||||
radius: 3.2
|
||||
border.width: 1
|
||||
border.color: control.borderColor
|
||||
layer.enabled: true
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: timer
|
||||
repeat: false
|
||||
onTriggered: control.visible=false
|
||||
}
|
||||
|
||||
|
||||
function show(text,timeout){
|
||||
control.text = text
|
||||
timer.interval = timeout
|
||||
timer.restart();
|
||||
control.visible=true
|
||||
}
|
||||
|
||||
}
|
132
Analyser/qml/main.qml
Normal file
132
Analyser/qml/main.qml
Normal file
@ -0,0 +1,132 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import Analyser
|
||||
|
||||
Window {
|
||||
width: 1120
|
||||
height: 640
|
||||
visible: true
|
||||
title: qsTr("L015上位机工具")
|
||||
|
||||
OperationItem {
|
||||
id: operationItem
|
||||
width: 450
|
||||
anchors.top: parent.top
|
||||
}
|
||||
|
||||
Item {
|
||||
id: resultGroupBox
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
width: 220
|
||||
Text {
|
||||
id: resultGroupBoxTitle
|
||||
text: "识别结果"
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
height: 30
|
||||
}
|
||||
ScrollView {
|
||||
id: resultView
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: resultGroupBoxTitle.bottom
|
||||
anchors.bottom: parent.bottom
|
||||
TextArea {
|
||||
id: resultBrowser
|
||||
font.pixelSize: 14
|
||||
readOnly: true
|
||||
wrapMode: TextArea.WordWrap
|
||||
}
|
||||
}
|
||||
Button {
|
||||
text: "清空"
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
onClicked: resultBrowser.clear()
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.left: operationItem.right
|
||||
anchors.right: resultGroupBox.left
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
TabBar {
|
||||
id: bar
|
||||
width: parent.width
|
||||
TabButton {
|
||||
implicitWidth: 100
|
||||
text: qsTr("视频流")
|
||||
}
|
||||
TabButton {
|
||||
text: qsTr("日志")
|
||||
}
|
||||
}
|
||||
|
||||
StackLayout {
|
||||
width: parent.width
|
||||
currentIndex: bar.currentIndex
|
||||
clip: true
|
||||
Image {
|
||||
id: image
|
||||
cache: false
|
||||
fillMode: Image.PreserveAspectFit
|
||||
rotation: 90
|
||||
source: "image://videoframe/"
|
||||
}
|
||||
Item {
|
||||
ScrollView {
|
||||
id: view
|
||||
anchors.fill: parent
|
||||
TextArea {
|
||||
id: logBrowser
|
||||
readOnly: true
|
||||
wrapMode: TextArea.WordWrap
|
||||
}
|
||||
}
|
||||
Button {
|
||||
text: "清空"
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
onClicked: logBrowser.clear()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: App
|
||||
function onNewLog(text) {
|
||||
logBrowser.append(text)
|
||||
}
|
||||
function onNewStatusTip(level, tip) {
|
||||
if (level === 0) {
|
||||
statusTip.icon = "../resources/successfull.svg"
|
||||
statusTip.color="#EBF8ED"
|
||||
statusTip.show(tip, 2000)
|
||||
} else if (level === 1) {
|
||||
statusTip.icon = "../resources/warning.svg"
|
||||
statusTip.color="#FAFAD2"
|
||||
statusTip.show(tip, 2000)
|
||||
} else if (level === 2) {
|
||||
resultBrowser.append(tip)
|
||||
}
|
||||
console.log(level, Application.Info)
|
||||
}
|
||||
function onNewVideoFrame() {
|
||||
image.source = ""
|
||||
image.source = "image://videoframe/"
|
||||
}
|
||||
}
|
||||
|
||||
StatusTip {
|
||||
id: statusTip
|
||||
width: 200
|
||||
height: 50
|
||||
icon: "../resources/successfull.svg"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user