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 Layout.fillHeight: true
80 icon.source: "/res/QGCLogoFull.svg"
81 logo: true
82 onClicked: mainWindow.showToolSelectDialog()
83 }
84
85 MainStatusIndicator {
86 id: mainStatusIndicator
87 Layout.fillHeight: true
88 }
89 }
90
91 QGCButton {
92 id: disconnectButton
93 text: qsTr("Disconnect")
94 onClicked: _activeVehicle.closeVehicle()
95 visible: _activeVehicle && _communicationLost
96 }
97
98 FlightModeIndicator {
99 Layout.fillHeight: true
100 visible: _activeVehicle
101 }
102 }
103 }
104 Item {
105 id: centerPanel
106 // center panel takes up all remaining space in toolbar between left and right panels
107 width: Math.max(guidedActionConfirm.visible ? guidedActionConfirm.width : 0, control.width - (leftPanel.width + rightPanel.width))
108 height: parent.height
109
110 Rectangle {
111 anchors.fill: parent
112 color: qgcPal.windowTransparent
113 }
114
115 GuidedActionConfirm {
116 id: guidedActionConfirm
117 height: parent.height
118 anchors.horizontalCenter: parent.horizontalCenter
119 guidedController: control._guidedController
120 guidedValueSlider: control.guidedValueSlider
121 messageDisplay: guidedActionMessageDisplay
122 }
123 }
124
125 Item {
126 id: rightPanel
127 width: flyViewIndicators.width
128 height: parent.height
129
130 Rectangle {
131 anchors.fill: parent
132 color: qgcPal.windowTransparent
133 }
134
135 FlyViewToolBarIndicators {
136 id: flyViewIndicators
137 height: parent.height
138 }
139 }
140 }
141 }
142
143 // The guided action message display is outside of the GuidedActionConfirm control so that it doesn't end up as
144 // part of the Flickable
145 Rectangle {
146 id: guidedActionMessageDisplay
147 anchors.top: control.bottom
148 anchors.topMargin: _margins
149 x: control.mapFromItem(guidedActionConfirm.parent, guidedActionConfirm.x, 0).x + (guidedActionConfirm.width - guidedActionMessageDisplay.width) / 2
150 width: messageLabel.contentWidth + (_margins * 2)
151 height: messageLabel.contentHeight + (_margins * 2)
152 color: qgcPal.windowTransparent
153 radius: ScreenTools.defaultBorderRadius
154 visible: guidedActionConfirm.visible
155
156 QGCLabel {
157 id: messageLabel
158 x: _margins
159 y: _margins
160 width: ScreenTools.defaultFontPixelWidth * 30
161 wrapMode: Text.WordWrap
162 text: guidedActionConfirm.message
163 }
164
165 PropertyAnimation {
166 id: messageOpacityAnimation
167 target: guidedActionMessageDisplay
168 property: "opacity"
169 from: 1
170 to: 0
171 duration: 500
172 }
173
174 Timer {
175 id: messageFadeTimer
176 interval: 4000
177 onTriggered: messageOpacityAnimation.start()
178 }
179 }
180
181 ParameterDownloadProgress {
182 anchors.fill: parent
183 }
184}