QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
PlanViewToolBar.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.PlanView
9
10Rectangle {
11 id: _root
12
13 property var planMasterController
14 property string statusHint: ""
15
16 property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
17 property real _controllerProgressPct: planMasterController.missionController.progressPct
18
19 signal toolbarButtonClicked()
20
21 width: parent.width
22 height: ScreenTools.toolbarHeight
23 color: qgcPal.toolbarBackground
24
25 QGCPalette { id: qgcPal }
26
27 /// Bottom single pixel divider
28 Rectangle {
29 anchors.left: parent.left
30 anchors.right: parent.right
31 anchors.bottom: parent.bottom
32 height: 1
33 color: "black"
34 visible: qgcPal.globalTheme === QGCPalette.Light
35 }
36
37 QGCToolBarButton {
38 id: qgcButton
39 objectName: "toolbar_qgcLogo"
40 height: parent.height
41 icon.source: "/res/QGCLogoFull.svg"
42 logo: true
43 onClicked: mainWindow.showToolSelectDialog()
44 }
45
46 QGCFlickable {
47 id: toolsFlickable
48 anchors.bottomMargin: 1
49 anchors.left: qgcButton.right
50 anchors.top: parent.top
51 anchors.bottom: parent.bottom
52 anchors.right: parent.right
53 contentWidth: toolIndicators.width
54 flickableDirection: Flickable.HorizontalFlick
55
56 PlanToolBarIndicators {
57 id: toolIndicators
58 anchors.top: parent.top
59 anchors.bottom: parent.bottom
60 planMasterController: _root.planMasterController
61 statusHint: _root.statusHint
62 onToolbarButtonClicked: _root.toolbarButtonClicked()
63 }
64 }
65
66 // Small mission download progress bar
67 Rectangle {
68 id: progressBar
69 anchors.left: parent.left
70 anchors.bottom: parent.bottom
71 height: 4
72 width: _controllerProgressPct * parent.width
73 color: qgcPal.colorGreen
74 visible: false
75
76 onVisibleChanged: {
77 if (visible) {
78 largeProgressBar._userHide = false
79 }
80 }
81 }
82
83 // Large mission download progress bar
84 Rectangle {
85 id: largeProgressBar
86
87 property bool _userHide: false
88 property bool _showLargeProgress: progressBar.visible && !_userHide && qgcPal.globalTheme === QGCPalette.Light
89
90 anchors.bottom: parent.bottom
91 anchors.left: parent.left
92 anchors.right: parent.right
93 height: parent.height
94 color: qgcPal.window
95 visible: _showLargeProgress
96
97 Rectangle {
98 anchors.top: parent.top
99 anchors.bottom: parent.bottom
100 width: _controllerProgressPct * parent.width
101 color: qgcPal.colorGreen
102 }
103
104 QGCLabel {
105 anchors.centerIn: parent
106 text: qsTr("Syncing Mission")
107 font.pointSize: ScreenTools.largeFontPointSize
108 visible: _controllerProgressPct !== 1
109 }
110
111 QGCLabel {
112 anchors.centerIn: parent
113 text: qsTr("Done")
114 font.pointSize: ScreenTools.largeFontPointSize
115 visible: _controllerProgressPct === 1
116 }
117
118 QGCLabel {
119 property real _margin: ScreenTools.defaultFontPixelWidth / 2
120
121 anchors.margins: _margin
122 anchors.right: parent.right
123 anchors.bottom: parent.bottom
124 text: qsTr("Click anywhere to hide")
125 }
126
127 MouseArea {
128 anchors.fill: parent
129 onClicked: largeProgressBar._userHide = true
130 }
131
132 Connections {
133 target: QGroundControl.multiVehicleManager
134 function onActiveVehicleChanged(activeVehicle) { largeProgressBar._userHide = false }
135 }
136 }
137
138 Timer {
139 id: resetProgressTimer
140 interval: 3000
141 onTriggered: progressBar.visible = false
142 }
143
144 // Progress bar
145 Connections {
146 target: planMasterController.missionController
147
148 function onProgressPctChanged(progressPct) {
149 if (progressPct === 1) {
150 if (_root.visible) {
151 resetProgressTimer.start()
152 } else {
153 progressBar.visible = false
154 }
155 } else if (progressPct > 0) {
156 progressBar.visible = true
157 }
158 }
159 }
160}