6import QGroundControl.Controls
11 z: QGroundControl.zOrderTopMost
13 // This need to block click event leakage to underlying map.
18 QGCPalette { id: qgcPal; colorGroupEnabled: true }
20 readonly property real _defaultTextHeight: ScreenTools.defaultFontPixelHeight
21 readonly property real _defaultTextWidth: ScreenTools.defaultFontPixelWidth
22 readonly property real _horizontalMargin: _defaultTextWidth / 2
23 readonly property real _verticalMargin: _defaultTextHeight / 2
24 readonly property real _buttonWidth: _defaultTextWidth * 18
25 readonly property string _armedVehicleText: qsTr("This operation cannot be performed while the vehicle is armed.")
27 property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
28 property bool _vehicleArmed: _activeVehicle ? _activeVehicle.armed : false
29 property string _messagePanelText: qsTr("missing message panel text")
30 property bool _fullParameterVehicleAvailable: QGroundControl.multiVehicleManager.parameterReadyVehicleAvailable && !_activeVehicle.parameterManager.missingParameters
31 property var _corePlugin: QGroundControl.corePlugin
33 function showSummaryPanel() {
34 if (mainWindow.allowViewSwitch()) {
39 function _showSummaryPanel() {
40 if (_fullParameterVehicleAvailable) {
41 if (_activeVehicle.autopilotPlugin.vehicleComponents.length === 0) {
42 panelLoader.setSourceComponent(noComponentsVehicleSummaryComponent)
44 panelLoader.setSource("qrc:/qml/QGroundControl/VehicleSetup/VehicleSummary.qml")
46 } else if (QGroundControl.multiVehicleManager.parameterReadyVehicleAvailable) {
47 panelLoader.setSourceComponent(missingParametersVehicleSummaryComponent)
49 panelLoader.setSourceComponent(disconnectedVehicleAndParamsSummaryComponent)
51 summaryButton.checked = true
54 function showPanel(button, qmlSource) {
55 if (mainWindow.allowViewSwitch()) {
57 panelLoader.setSource(qmlSource)
61 function showVehicleComponentPanel(vehicleComponent)
63 if (mainWindow.allowViewSwitch()) {
64 var autopilotPlugin = _activeVehicle.autopilotPlugin
65 var prereq = autopilotPlugin.prerequisiteSetup(vehicleComponent)
67 _messagePanelText = qsTr("%1 setup must be completed prior to %2 setup.").arg(prereq).arg(vehicleComponent.name)
68 panelLoader.setSourceComponent(messagePanelComponent)
70 panelLoader.setSource(vehicleComponent.setupSource, vehicleComponent)
71 for(var i = 0; i < componentRepeater.count; i++) {
72 var obj = componentRepeater.itemAt(i);
73 if (obj.text === vehicleComponent.name) {
82 function showParametersPanel() {
83 if (mainWindow.allowViewSwitch()) {
84 parametersButton.checked = true
85 panelLoader.setSource("qrc:/qml/QGroundControl/VehicleSetup/SetupParameterEditor.qml")
89 Component.onCompleted: _showSummaryPanel()
92 target: QGroundControl.corePlugin
93 function onShowAdvancedUIChanged(showAdvancedUI) {
94 if (!showAdvancedUI) {
101 target: QGroundControl.multiVehicleManager
102 function onParameterReadyVehicleAvailableChanged(parametersReady) {
103 if (parametersReady || summaryButton.checked || !firmwareButton.checked) {
104 // Show/Reload the Summary panel when:
105 // A new vehicle shows up
106 // The summary panel is already showing and the active vehicle goes away
107 // The active vehicle goes away and we are not on the Firmware panel.
108 summaryButton.checked = true
115 id: noComponentsVehicleSummaryComponent
117 color: qgcPal.windowShade
119 anchors.margins: _defaultTextWidth * 2
121 verticalAlignment: Text.AlignVCenter
122 horizontalAlignment: Text.AlignHCenter
123 wrapMode: Text.WordWrap
124 font.pointSize: ScreenTools.mediumFontPointSize
125 text: qsTr("%1 does not currently support configuration of your vehicle. ").arg(QGroundControl.appName) +
126 "If your vehicle is already configured you can still Fly."
132 id: disconnectedVehicleAndParamsSummaryComponent
134 color: qgcPal.windowShade
136 anchors.margins: _defaultTextWidth * 2
138 verticalAlignment: Text.AlignVCenter
139 horizontalAlignment: Text.AlignHCenter
140 wrapMode: Text.WordWrap
141 font.pointSize: ScreenTools.largeFontPointSize
142 text: qsTr("Vehicle configuration pages will display after you connect your vehicle and parameters have been downloaded.")
148 id: missingParametersVehicleSummaryComponent
151 color: qgcPal.windowShade
154 anchors.margins: _defaultTextWidth * 2
156 verticalAlignment: Text.AlignVCenter
157 horizontalAlignment: Text.AlignHCenter
158 wrapMode: Text.WordWrap
159 font.pointSize: ScreenTools.mediumFontPointSize
160 text: qsTr("Vehicle did not return the full parameter list. ") +
161 qsTr("As a result, the configuration pages are not available.")
167 id: messagePanelComponent
171 anchors.margins: _defaultTextWidth * 2
173 verticalAlignment: Text.AlignVCenter
174 horizontalAlignment: Text.AlignHCenter
175 wrapMode: Text.WordWrap
176 font.pointSize: ScreenTools.mediumFontPointSize
177 text: _messagePanelText
184 width: buttonColumn.width
185 anchors.topMargin: _defaultTextHeight / 2
186 anchors.top: parent.top
187 anchors.bottom: parent.bottom
188 anchors.leftMargin: _horizontalMargin
189 anchors.left: parent.left
190 contentHeight: buttonColumn.height
191 flickableDirection: Flickable.VerticalFlick
196 spacing: ScreenTools.defaultFontPixelHeight / 4
200 icon.source: "/qmlimages/VehicleSummaryIcon.png"
202 text: qsTr("Summary")
203 Layout.fillWidth: true
205 onClicked: showSummaryPanel()
209 visible: _activeVehicle ? _activeVehicle.flowImageIndex > 0 : false
210 text: qsTr("Optical Flow")
211 Layout.fillWidth: true
212 onClicked: showPanel(this, "qrc:/qml/QGroundControl/VehicleSetup/OpticalFlowSensor.qml");
216 id: componentRepeater
217 model: _fullParameterVehicleAvailable ? _activeVehicle.autopilotPlugin.vehicleComponents : 0
220 icon.source: modelData.iconResource
221 setupComplete: modelData.setupComplete
223 visible: modelData.setupSource.toString() !== ""
224 Layout.fillWidth: true
225 onClicked: showVehicleComponentPanel(componentUrl)
227 property var componentUrl: modelData
233 visible: QGroundControl.multiVehicleManager.parameterReadyVehicleAvailable &&
234 !_activeVehicle.usingHighLatencyLink &&
235 _corePlugin.showAdvancedUI
236 text: qsTr("Parameters")
237 Layout.fillWidth: true
238 icon.source: "/qmlimages/subMenuButtonImage.png"
239 onClicked: showPanel(this, "qrc:/qml/QGroundControl/VehicleSetup/SetupParameterEditor.qml")
244 icon.source: "/qmlimages/FirmwareUpgradeIcon.png"
245 visible: !ScreenTools.isMobile && _corePlugin.options.showFirmwareUpgrade
246 text: qsTr("Firmware")
247 Layout.fillWidth: true
249 onClicked: showPanel(this, "qrc:/qml/QGroundControl/VehicleSetup/FirmwareUpgrade.qml")
256 anchors.topMargin: _verticalMargin
257 anchors.bottomMargin: _verticalMargin
258 anchors.leftMargin: _horizontalMargin
259 anchors.left: buttonScroll.right
260 anchors.top: parent.top
261 anchors.bottom: parent.bottom
263 color: qgcPal.windowShade
268 anchors.topMargin: _verticalMargin
269 anchors.bottomMargin: _verticalMargin
270 anchors.leftMargin: _horizontalMargin
271 anchors.rightMargin: _horizontalMargin
272 anchors.left: divider.right
273 anchors.right: parent.right
274 anchors.top: parent.top
275 anchors.bottom: parent.bottom
277 function setSource(source, vehicleComponent) {
278 panelLoader.source = ""
279 panelLoader.vehicleComponent = vehicleComponent
280 panelLoader.source = source
283 function setSourceComponent(sourceComponent, vehicleComponent) {
284 panelLoader.sourceComponent = undefined
285 panelLoader.vehicleComponent = vehicleComponent
286 panelLoader.sourceComponent = sourceComponent
289 property var vehicleComponent