QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
VideoStreamIndicator.qml
Go to the documentation of this file.
1pragma ComponentBehavior: Bound
2
3import QtQuick
4import QtQuick.Layouts
5
6import QGroundControl
7import QGroundControl.Controls
8import QGroundControl.VideoManager
9
10// Frame rate and bitrate of the measured video source (its resolution where the receiver can't count the bitrate, as
11// for the USB camera), orange while a source degrades. The drawer shows each source's statistics, and expands to the
12// video settings that change a running stream.
13Item {
14 id: root
15
16 property bool showIndicator: _stats.valid
17 /// The manager whose sources the indicator reports.
18 property VideoManager videoManager: QGroundControl.videoManager
19
20 readonly property VideoStreamController _measuredSource: root.videoManager.measuredSource
21 readonly property videoStreamStats _stats: _measuredSource.stats
22
23 objectName: "toolbar_videoStreamIndicator"
24 width: indicatorRow.width
25 anchors.top: parent.top
26 anchors.bottom: parent.bottom
27
28 QGCPalette { id: qgcPal }
29
30 Row {
31 id: indicatorRow
32 anchors.top: parent.top
33 anchors.bottom: parent.bottom
34 spacing: ScreenTools.defaultFontPixelWidth / 2
35
36 QGCColoredImage {
37 width: height
38 anchors.top: parent.top
39 anchors.bottom: parent.bottom
40 objectName: "videoStreamIcon"
41 source: "/InstrumentValueIcons/video-camera.svg"
42 fillMode: Image.PreserveAspectFit
43 sourceSize.height: height
44 color: root.videoManager.degraded ? qgcPal.colorOrange : qgcPal.textPrimary
45 }
46
47 Column {
48 anchors.verticalCenter: parent.verticalCenter
49 spacing: 0
50
51 QGCLabel {
52 text: qsTr("%1 fps").arg(root._stats.fps.toFixed(0))
53 }
54
55 QGCLabel {
56 text: root._stats.bitrateKbps >= 0 ? VideoStreamFormat.bitrateText(root._stats.bitrateKbps)
57 : qsTr("%1p").arg(root._measuredSource.videoSize.height)
58 }
59 }
60 }
61
62 MouseArea {
63 anchors.fill: parent
64 onClicked: mainWindow.showIndicatorDrawer(videoStreamPage, root)
65 }
66
67 Component {
68 id: videoStreamPage
69
70 ToolIndicatorPage {
71 showExpand: true
72
73 contentComponent: Component {
74 VideoSourceStats {
75 videoManager: root.videoManager
76 }
77 }
78
79 expandedComponent: Component {
80 ColumnLayout {
81 spacing: ScreenTools.defaultFontPixelHeight / 4
82
83 VideoStreamSettingsGroup { }
84
85 VideoDecodingSettingsGroup { }
86
87 VideoDisplaySettingsGroup { }
88
89 RowLayout {
90 spacing: ScreenTools.defaultFontPixelWidth
91
92 QGCButton {
93 text: qsTr("Restart Video")
94 visible: !root.videoManager.isUvc
95 onClicked: root.videoManager.startVideo()
96 }
97
98 QGCButton {
99 text: qsTr("All Video Settings")
100 onClicked: {
101 if (mainWindow.allowViewSwitch()) {
102 mainWindow.closeIndicatorDrawer()
103 mainWindow.showSettingsTool("Video")
104 }
105 }
106 }
107 }
108 }
109 }
110 }
111 }
112}