6import QGroundControl.FactControls
7import QGroundControl.Controls
11 pageComponent: (controller && controller.showCustomConfigPanel) ? customFrame : pageComponent
13 AirframeComponentController {
21 spacing: ScreenTools.defaultFontPixelHeight * 4
27 anchors.horizontalCenter: parent.horizontalCenter
28 width: parent.width * 0.5
29 height: ScreenTools.defaultFontPixelHeight * 4
30 wrapMode: Text.WordWrap
31 text: qsTr("Your vehicle is using a custom airframe configuration. ") +
32 qsTr("This configuration can only be modified through the Parameter Editor.\n\n") +
33 qsTr("If you want to reset your airframe configuration and select a standard configuration, click 'Reset' below.")
37 enabled: sys_autostart
38 anchors.horizontalCenter: parent.horizontalCenter
39 property Fact sys_autostart: controller.getParameterFact(-1, "SYS_AUTOSTART")
42 sys_autostart.value = 0
56 property real _minW: ScreenTools.defaultFontPixelWidth * 30
57 property real _boxWidth: _minW
58 property real _boxSpace: ScreenTools.defaultFontPixelWidth
60 readonly property real spacerHeight: ScreenTools.defaultFontPixelHeight
66 Component.onCompleted: computeDimensions()
68 function computeDimensions() {
71 var idx = Math.floor(mainColumn.width / (_minW + ScreenTools.defaultFontPixelWidth))
73 _boxWidth = mainColumn.width
78 _boxSpace = ScreenTools.defaultFontPixelWidth
79 sw = _boxSpace * (idx - 1)
81 rw = mainColumn.width - sw
88 anchors.left: parent.left
89 anchors.right: parent.right
90 height: Math.max(helpText.contentHeight, applyButton.height)
94 width: parent.width - applyButton.width - 5
95 text: (controller.currentVehicleName != "" ?
96 qsTr("You've connected a %1.").arg(controller.currentVehicleName) :
97 qsTr("Airframe is not set.")) +
98 qsTr(" To change this configuration, select the desired airframe below then click 'Apply and Restart'.")
100 wrapMode: Text.WordWrap
105 objectName: "airframeSetup_applyButton"
106 anchors.right: parent.right
107 text: qsTr("Apply and Restart")
108 onClicked: QGroundControl.showMessageDialog(airframePage, qsTr("Apply and Restart"),
109 qsTr("Clicking 'Apply' will save the changes you have made to your airframe configuration.<br><br>\
110 All vehicle parameters other than Radio Calibration will be reset.<br><br>\
111 Your vehicle will also be restarted in order to complete the process."),
112 Dialog.Apply | Dialog.Cancel,
113 function() { controller.changeAutostart() })
120 height: parent.spacerHeight
130 id: airframeTypeExclusive
134 model: controller.airframeTypes
136 // Outer summary item rectangle
138 objectName: "airframeTypeBox_" + index
140 height: ScreenTools.defaultFontPixelHeight * 14
143 property string airframeTypeName: modelData.name
144 property bool airframeTypeSelected: airframeCheckBox.checked
146 readonly property real titleHeight: ScreenTools.defaultFontPixelHeight * 1.75
147 readonly property real innerMargin: ScreenTools.defaultFontPixelWidth
153 applyButton.primary = true
154 airframeCheckBox.checked = true
164 anchors.topMargin: ScreenTools.defaultFontPixelHeight / 2
165 anchors.top: title.bottom
166 anchors.bottom: parent.bottom
167 anchors.left: parent.left
168 anchors.right: parent.right
169 color: airframeCheckBox.checked ? qgcPal.buttonHighlight : qgcPal.windowShade
173 anchors.margins: innerMargin
174 anchors.top: parent.top
175 anchors.bottom: combo.top
176 anchors.left: parent.left
177 anchors.right: parent.right
178 fillMode: Image.PreserveAspectFit
181 source: modelData.imageResource
185 // Although this item is invisible we still use it to manage state
187 checked: modelData.name === controller.currentAirframeType
188 buttonGroup: airframeTypeExclusive
192 if (checked && combo.currentIndex !== -1) {
193 controller.autostartId = modelData.airframes[combo.currentIndex].autostartId
200 objectName: modelData.name + "ComboBox"
201 anchors.margins: innerMargin
202 anchors.bottom: parent.bottom
203 anchors.left: parent.left
204 anchors.right: parent.right
205 model: modelData.airframes
208 Component.onCompleted: {
209 if (airframeCheckBox.checked) {
210 currentIndex = controller.currentVehicleIndex
214 onActivated: (index) => {
215 applyButton.primary = true
216 airframeCheckBox.checked = true;
217 console.log("combo change", index)
218 controller.autostartId = modelData.airframes[index].autostartId
223 } // Repeater - summary boxes
224 } // Flow - summary boxes