QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
FlyViewTopRightPanel.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Layouts
3
4import QGroundControl
5import QGroundControl.FactControls
6import QGroundControl.Controls
7import QGroundControl.FlyView
8import QGroundControl.FlightMap
9
10Rectangle {
11 id: topRightPanel
12 width: contentWidth
13 height: Math.max(contentHeight, minimumHeight)
14 color: qgcPal.toolbarBackground
15 radius: ScreenTools.defaultFontPixelHeight / 2
16 visible: !QGroundControl.videoManager.fullScreen && _multipleVehicles && _settingEnableMVPanel
17 clip: true
18
19 property bool _settingEnableMVPanel: QGroundControl.settingsManager.appSettings.enableMultiVehiclePanel.value
20 property bool _multipleVehicles: QGroundControl.multiVehicleManager.vehicles.count > 1
21 property var vehicles: QGroundControl.multiVehicleManager.vehicles
22 property var selectedVehicles: QGroundControl.multiVehicleManager.selectedVehicles
23 property real contentWidth: Math.max(
24 multiVehicleList.implicitWidth,
25 swipeViewContainer.implicitWidth
26 ) + ScreenTools.defaultFontPixelHeight
27 property real contentHeight: Math.min(
28 maximumHeight,
29 topRightPanelColumnLayout.implicitHeight + topRightPanelColumnLayout.anchors.margins * 2
30 )
31 property real minimumHeight: swipeViewContainer.height
32 property real maximumHeight
33
34 QGCPalette { id: qgcPal }
35
36 DeadMouseArea {
37 anchors.fill: parent
38 }
39
40 ColumnLayout {
41 id: topRightPanelColumnLayout
42 anchors.fill: parent
43 anchors.margins: topRightPanel.color.a ? ScreenTools.defaultFontPixelHeight / 2 : 0
44 spacing: ScreenTools.defaultFontPixelWidth * 0.75 // _layoutMargin
45
46 MultiVehicleList {
47 id: multiVehicleList
48 Layout.fillWidth: true
49 Layout.fillHeight: true
50
51 Rectangle {
52 anchors.fill: parent
53 visible: topRightPanel.height === maximumHeight
54
55 Rectangle {
56 anchors.left: parent.left
57 anchors.right: parent.right
58 anchors.top: parent.top
59 anchors.margins: 0
60 height: 1
61 color: QGroundControl.globalPalette.groupBorder
62 }
63
64 gradient: Gradient {
65 orientation: Gradient.Vertical
66 GradientStop { position: 0.00; color: topRightPanel.color }
67 GradientStop { position: 0.05; color: "transparent" }
68
69 GradientStop { position: 0.95; color: "transparent" }
70 GradientStop { position: 1.00; color: topRightPanel.color }
71 }
72
73 Rectangle {
74 anchors.left: parent.left
75 anchors.right: parent.right
76 anchors.bottom: parent.bottom
77 anchors.margins: 0
78 height: 1
79 color: QGroundControl.globalPalette.groupBorder
80 }
81 }
82
83 }
84
85 Rectangle {
86 id: swipeViewContainer
87 Layout.fillWidth: true
88 implicitHeight: swipePages.implicitHeight
89 implicitWidth: swipePages.implicitWidth
90 color: "transparent"
91
92 QGCSwipeView {
93 id: swipePages
94 anchors.fill: parent
95 spacing: ScreenTools.defaultFontPixelHeight
96 implicitHeight: Math.max(buttonsPage.implicitHeight, photoVideoPage.implicitHeight)
97 implicitWidth: Math.max(buttonsPage.implicitWidth, photoVideoPage.implicitWidth)
98
99 MvPanelPage {
100 id: buttonsPage
101 implicitHeight: buttonsColumnLayout.implicitHeight + ScreenTools.defaultFontPixelHeight * 2
102 implicitWidth: buttonsColumnLayout.implicitWidth + ScreenTools.defaultFontPixelHeight * 2
103
104 ColumnLayout {
105 id: buttonsColumnLayout
106 anchors.right: parent.right
107 anchors.left: parent.left
108 anchors.verticalCenter: parent.verticalCenter
109 spacing: ScreenTools.defaultFontPixelHeight / 2
110 implicitHeight: Math.max(selectionRowLayout.height, actionRowLayout.height) + ScreenTools.defaultFontPixelHeight * 2
111 implicitWidth: Math.max(selectionRowLayout.width, actionRowLayout.width) + ScreenTools.defaultFontPixelHeight * 4
112
113 QGCLabel {
114 text: {
115 let ids = Array.from({length: selectedVehicles.count}, (_, i) =>
116 selectedVehicles.get(i).id
117 ).sort((a, b) => a - b)
118 .join(", ")
119 return qsTr("Vehicles Selected: ") + (ids ? ids : "-")
120 }
121 Layout.alignment: Qt.AlignHCenter
122 }
123
124 RowLayout {
125 id: selectionRowLayout
126 Layout.alignment: Qt.AlignHCenter
127
128 QGCButton {
129 text: qsTr("Select All")
130 enabled: multiVehicleList.selectedVehicles && multiVehicleList.selectedVehicles.count !== QGroundControl.multiVehicleManager.vehicles.count
131 onClicked: multiVehicleList.selectAll()
132 }
133
134 QGCButton {
135 text: qsTr("Deselect All")
136 enabled: multiVehicleList.selectedVehicles && multiVehicleList.selectedVehicles.count > 0
137 onClicked: multiVehicleList.deselectAll()
138 }
139
140 }
141
142
143 QGCLabel {
144 text: qsTr("Multi Vehicle Actions")
145 Layout.alignment: Qt.AlignHCenter
146 }
147
148 RowLayout {
149 id: actionRowLayout
150 Layout.alignment: Qt.AlignHCenter
151
152 QGCButton {
153 text: qsTr("Arm")
154 enabled: multiVehicleList.armAvailable()
155 onClicked: _guidedController.confirmAction(_guidedController.actionMVArm)
156 Layout.preferredWidth: ScreenTools.defaultFontPixelHeight * 2.75
157 leftPadding: 0
158 rightPadding: 0
159 }
160
161 QGCButton {
162 text: qsTr("Disarm")
163 enabled: multiVehicleList.disarmAvailable()
164 onClicked: _guidedController.confirmAction(_guidedController.actionMVDisarm)
165 Layout.preferredWidth: ScreenTools.defaultFontPixelHeight * 2.75
166 leftPadding: 0
167 rightPadding: 0
168 }
169
170 QGCButton {
171 text: qsTr("Start")
172 enabled: multiVehicleList.startAvailable()
173 onClicked: _guidedController.confirmAction(_guidedController.actionMVStartMission)
174 Layout.preferredWidth: ScreenTools.defaultFontPixelHeight * 2.75
175 leftPadding: 0
176 rightPadding: 0
177 }
178
179 QGCButton {
180 text: qsTr("Pause")
181 enabled: multiVehicleList.pauseAvailable()
182 onClicked: _guidedController.confirmAction(_guidedController.actionMVPause)
183 Layout.preferredWidth: ScreenTools.defaultFontPixelHeight * 2.75
184 leftPadding: 0
185 rightPadding: 0
186 }
187 }
188 }
189 } // Page 1
190
191 MvPanelPage {
192
193 id: photoVideoPage
194 implicitHeight: photoVideoControlLoader.implicitHeight + ScreenTools.defaultFontPixelHeight * 2
195 implicitWidth: photoVideoControlLoader.implicitWidth + ScreenTools.defaultFontPixelHeight * 2
196
197 // We use a Loader to load the photoVideoControlComponent only when the active vehicle is not null
198 // This make it easier to implement PhotoVideoControl without having to check for the mavlink camera
199 // to be null all over the place
200
201 Loader {
202 id: photoVideoControlLoader
203 anchors.horizontalCenter: parent.horizontalCenter
204 sourceComponent: globals.activeVehicle ? photoVideoControlComponent : undefined
205
206 property real rightEdgeCenterInset: visible ? parent.width - x : 0
207
208 Component {
209 id: photoVideoControlComponent
210
211 PhotoVideoControl {
212 }
213 }
214 }
215 } // Page 2
216 } // QGCSwipeView
217
218 QGCPageIndicator {
219 id: pageIndicator
220 count: swipePages.count
221 currentIndex: swipePages.currentIndex
222 anchors.bottom: parent.bottom
223 anchors.horizontalCenter: parent.horizontalCenter
224 anchors.margins: ScreenTools.defaultFontPixelHeight / 4
225
226 delegate: Rectangle {
227 height: ScreenTools.defaultFontPixelHeight / 2
228 width: height
229 radius: width / 2
230 color: model.index === pageIndicator.currentIndex ? qgcPal.text : qgcPal.button
231 opacity: model.index === pageIndicator.currentIndex ? 0.9 : 0.3
232 }
233 }
234 }
235 }
236}