QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
FlyViewToolBar.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Layouts
4import QtQuick.Dialogs
5
6import QGroundControl
7import QGroundControl.Controls
8import QGroundControl.FlyView
9
10Item {
11 required property var guidedValueSlider
12
13 id: control
14 width: parent.width
15 height: ScreenTools.toolbarHeight
16
17 property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
18 property bool _communicationLost: _activeVehicle ? _activeVehicle.vehicleLinkManager.communicationLost : false
19 property color _mainStatusBGColor: qgcPal.brandingPurple
20 property real _leftRightMargin: ScreenTools.defaultFontPixelWidth * 0.75
21 property var _guidedController: globals.guidedControllerFlyView
22
23 function dropMainStatusIndicatorTool() {
24 mainStatusIndicator.dropMainStatusIndicator();
25 }
26
27 QGCPalette { id: qgcPal }
28
29 QGCFlickable {
30 anchors.fill: parent
31 contentWidth: toolBarLayout.width
32 flickableDirection: Flickable.HorizontalFlick
33
34 Row {
35 id: toolBarLayout
36 height: parent.height
37 spacing: 0
38
39 Item {
40 id: leftPanel
41 width: leftPanelLayout.implicitWidth
42 height: parent.height
43
44 // Gradient background behind Q button and main status indicator
45 Rectangle {
46 id: gradientBackground
47 height: parent.height
48 width: mainStatusLayout.width
49 opacity: qgcPal.windowTransparent.a
50
51 gradient: Gradient {
52 orientation: Gradient.Horizontal
53 GradientStop { position: 0; color: _mainStatusBGColor }
54 //GradientStop { position: qgcButton.x + qgcButton.width; color: _mainStatusBGColor }
55 GradientStop { position: 1; color: qgcPal.window }
56 }
57 }
58
59 // Standard toolbar background to the right of the gradient
60 Rectangle {
61 anchors.left: gradientBackground.right
62 anchors.right: parent.right
63 height: parent.height
64 color: qgcPal.windowTransparent
65 }
66
67 RowLayout {
68 id: leftPanelLayout
69 height: parent.height
70 spacing: ScreenTools.defaultFontPixelWidth * 2
71
72 RowLayout {
73 id: mainStatusLayout
74 height: parent.height
75 spacing: 0
76
77 QGCToolBarButton {
78 id: qgcButton
79 objectName: "toolbar_qgcLogo"
80 Layout.fillHeight: true
81 icon.source: "/res/QGCLogoFull.svg"
82 logo: true
83 onClicked: mainWindow.showToolSelectDialog()
84 }
85
86 MainStatusIndicator {
87 id: mainStatusIndicator
88 objectName: "toolbar_mainStatusIndicator"
89 Layout.fillHeight: true
90 }
91 }
92
93 QGCButton {
94 id: disconnectButton
95 text: qsTr("Disconnect")
96 onClicked: _activeVehicle.closeVehicle()
97 visible: _activeVehicle && _communicationLost
98 }
99
100 FlightModeIndicator {
101 objectName: "toolbar_flightModeIndicator"
102 Layout.fillHeight: true
103 visible: _activeVehicle
104 }
105 }
106 }
107 Item {
108 id: centerPanel
109 // center panel takes up all remaining space in toolbar between left and right panels
110 width: Math.max(guidedActionConfirm.visible ? guidedActionConfirm.width : 0, control.width - (leftPanel.width + rightPanel.width))
111 height: parent.height
112
113 Rectangle {
114 anchors.fill: parent
115 color: qgcPal.windowTransparent
116 }
117
118 GuidedActionConfirm {
119 id: guidedActionConfirm
120 height: parent.height
121 anchors.horizontalCenter: parent.horizontalCenter
122 guidedController: control._guidedController
123 guidedValueSlider: control.guidedValueSlider
124 messageDisplay: guidedActionMessageDisplay
125 }
126 }
127
128 Item {
129 id: rightPanel
130 width: flyViewIndicators.width
131 height: parent.height
132
133 Rectangle {
134 anchors.fill: parent
135 color: qgcPal.windowTransparent
136 }
137
138 FlyViewToolBarIndicators {
139 id: flyViewIndicators
140 height: parent.height
141 }
142 }
143 }
144 }
145
146 // The guided action message display is outside of the GuidedActionConfirm control so that it doesn't end up as
147 // part of the Flickable
148 Rectangle {
149 id: guidedActionMessageDisplay
150 anchors.top: control.bottom
151 anchors.topMargin: _margins
152 x: control.mapFromItem(guidedActionConfirm.parent, guidedActionConfirm.x, 0).x + (guidedActionConfirm.width - guidedActionMessageDisplay.width) / 2
153 width: messageLabel.contentWidth + (_margins * 2)
154 height: messageLabel.contentHeight + (_margins * 2)
155 color: qgcPal.windowTransparent
156 radius: ScreenTools.defaultBorderRadius
157 visible: guidedActionConfirm.visible
158
159 QGCLabel {
160 id: messageLabel
161 x: _margins
162 y: _margins
163 width: ScreenTools.defaultFontPixelWidth * 30
164 wrapMode: Text.WordWrap
165 text: guidedActionConfirm.message
166 }
167
168 PropertyAnimation {
169 id: messageOpacityAnimation
170 target: guidedActionMessageDisplay
171 property: "opacity"
172 from: 1
173 to: 0
174 duration: 500
175 }
176
177 Timer {
178 id: messageFadeTimer
179 interval: 4000
180 onTriggered: messageOpacityAnimation.start()
181 }
182 }
183
184 ParameterDownloadProgress {
185 anchors.fill: parent
186 }
187}