SmartLockerTools/Analyser/qml/Main.qml

104 lines
3.0 KiB
QML
Raw Normal View History

2024-06-13 15:41:40 +08:00
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
2024-09-05 16:36:54 +08:00
import Fluent as Fluent
2024-06-13 15:41:40 +08:00
import Analyser
Window {
2024-09-05 16:36:54 +08:00
id: window
2024-09-25 18:44:04 +08:00
width: 1120
2024-10-01 00:50:05 +08:00
height: 650
2024-06-13 15:41:40 +08:00
visible: true
2024-06-21 18:08:23 +08:00
title: qsTr(Qt.application.name + " " + Qt.application.version)
2024-06-13 15:41:40 +08:00
OperationItem {
id: operationItem
2024-09-11 15:45:19 +08:00
width: 530
2024-06-13 15:41:40 +08:00
anchors.top: parent.top
}
ColumnLayout {
anchors.left: operationItem.right
2024-09-25 18:44:04 +08:00
anchors.right: parent.right
2024-06-13 15:41:40 +08:00
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
2024-09-25 18:44:04 +08:00
Item {
Image {
id: image
property real aspectRatio: 600 / 800
anchors.centerIn: parent
width: Math.min(parent.width, parent.height * aspectRatio)
height: width / aspectRatio
cache: false
fillMode: Image.PreserveAspectFit
source: "image://videoframe/"
}
Image {
anchors.fill: image
source: "qrc:/qt/qml/Analyser/resources/palm-middle.png"
}
2024-06-13 15:41:40 +08:00
}
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()
}
}
}
}
2024-09-05 16:36:54 +08:00
Fluent.InfoBar{
id:info_bar
root: window
layoutY: 10
}
2024-06-13 15:41:40 +08:00
Connections {
target: App
function onNewLog(text) {
logBrowser.append(text)
}
2024-09-05 16:36:54 +08:00
function onNewStatusTip(level, tip, detailMessage) {
if (level === App.Tip) {
info_bar.showSuccess(tip,2000,detailMessage)
} else if (level === App.Warnging) {
info_bar.showWarning(tip,2000,detailMessage)
2024-09-05 22:33:07 +08:00
} else if (level === App.Error) {
info_bar.showError(tip,2000,detailMessage)
2024-06-13 15:41:40 +08:00
} else if (level === 2) {
2024-09-05 16:36:54 +08:00
info_bar.showInfo(tip,2000,detailMessage)
2024-06-13 15:41:40 +08:00
}
}
function onNewVideoFrame() {
image.source = ""
image.source = "image://videoframe/"
}
}
}