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