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