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 anchors.right: parent.right
106 text: qsTr("Apply and Restart")
107 onClicked: QGroundControl.showMessageDialog(airframePage, qsTr("Apply and Restart"),
108 qsTr("Clicking 'Apply' will save the changes you have made to your airframe configuration.<br><br>\
109 All vehicle parameters other than Radio Calibration will be reset.<br><br>\
110 Your vehicle will also be restarted in order to complete the process."),
111 Dialog.Apply | Dialog.Cancel,
112 function() { controller.changeAutostart() })
119 height: parent.spacerHeight
129 id: airframeTypeExclusive
133 model: controller.airframeTypes
135 // Outer summary item rectangle
138 height: ScreenTools.defaultFontPixelHeight * 14
141 readonly property real titleHeight: ScreenTools.defaultFontPixelHeight * 1.75
142 readonly property real innerMargin: ScreenTools.defaultFontPixelWidth
148 applyButton.primary = true
149 airframeCheckBox.checked = true
159 anchors.topMargin: ScreenTools.defaultFontPixelHeight / 2
160 anchors.top: title.bottom
161 anchors.bottom: parent.bottom
162 anchors.left: parent.left
163 anchors.right: parent.right
164 color: airframeCheckBox.checked ? qgcPal.buttonHighlight : qgcPal.windowShade
168 anchors.margins: innerMargin
169 anchors.top: parent.top
170 anchors.bottom: combo.top
171 anchors.left: parent.left
172 anchors.right: parent.right
173 fillMode: Image.PreserveAspectFit
176 source: modelData.imageResource
180 // Although this item is invisible we still use it to manage state
182 checked: modelData.name === controller.currentAirframeType
183 buttonGroup: airframeTypeExclusive
187 if (checked && combo.currentIndex !== -1) {
188 console.log("check box change", combo.currentIndex)
189 controller.autostartId = modelData.airframes[combo.currentIndex].autostartId
196 objectName: modelData.airframeType + "ComboBox"
197 anchors.margins: innerMargin
198 anchors.bottom: parent.bottom
199 anchors.left: parent.left
200 anchors.right: parent.right
201 model: modelData.airframes
204 Component.onCompleted: {
205 if (airframeCheckBox.checked) {
206 currentIndex = controller.currentVehicleIndex
210 onActivated: (index) => {
211 applyButton.primary = true
212 airframeCheckBox.checked = true;
213 console.log("combo change", index)
214 controller.autostartId = modelData.airframes[index].autostartId
219 } // Repeater - summary boxes
220 } // Flow - summary boxes