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