7import QGroundControl.FactControls
8import QGroundControl.Controls
12 pageComponent: pageComponent
21 property real _minW: ScreenTools.defaultFontPixelWidth * 20
22 property real _boxWidth: _minW
23 property real _boxSpace: ScreenTools.defaultFontPixelWidth
24 property real _margins: ScreenTools.defaultFontPixelWidth
25 property Fact _frameClass: controller.getParameterFact(-1, "FRAME_CLASS")
26 property Fact _frameType: controller.getParameterFact(-1, "FRAME_TYPE", false) // FRAME_TYPE is not available on all Rover versions
27 property bool _frameTypeAvailable: controller.vehicle.multiRotor
29 readonly property real spacerHeight: ScreenTools.defaultFontPixelHeight
31 onWidthChanged: computeDimensions()
32 Component.onCompleted: computeDimensions()
34 function computeDimensions() {
37 let idx = Math.floor(mainColumn.width / (_minW + ScreenTools.defaultFontPixelWidth))
39 _boxWidth = mainColumn.width
44 _boxSpace = ScreenTools.defaultFontPixelWidth
45 sw = _boxSpace * (idx - 1)
47 rw = mainColumn.width - sw
52 APMAirframeComponentController { id: controller; }
56 Layout.fillWidth: true
57 text: (_frameClass.rawValue === 0 ?
58 qsTr("Airframe is currently not set.") :
59 qsTr("Currently set to frame class '%1'").arg(_frameClass.enumStringValue) +
60 (_frameTypeAvailable ? qsTr(" and frame type '%2'").arg(_frameType.enumStringValue) : "") +
61 qsTr(".", "period for end of sentence")) +
62 qsTr(" To change this configuration, select the desired frame class below and then reboot the vehicle.")
64 wrapMode: Text.WordWrap
69 height: parent.spacerHeight
75 Layout.fillWidth: true
79 id: airframeTypeExclusive
83 model: controller.frameClassModel
85 // Outer summary item rectangle
88 objectName: "apmAirframeBox_" + object.name
90 height: ScreenTools.defaultFontPixelHeight * 14
93 readonly property real titleHeight: ScreenTools.defaultFontPixelHeight * 1.75
94 readonly property real innerMargin: ScreenTools.defaultFontPixelWidth
99 if (!airframeCheckBox.checked || !combo.valid) {
100 if (_frameTypeAvailable && object.defaultFrameType != -1) {
101 _frameType.rawValue = object.defaultFrameType
103 airframeCheckBox.checked = true
115 anchors.topMargin: ScreenTools.defaultFontPixelHeight / 2
116 anchors.top: title.bottom
117 anchors.bottom: parent.bottom
118 anchors.left: parent.left
119 anchors.right: parent.right
120 color: airframeCheckBox.checked ? qgcPal.buttonHighlight : qgcPal.windowShade
121 opacity: combo.valid ? 1.0 : 0.5
124 anchors.margins: innerMargin
130 Layout.fillWidth: true
131 Layout.fillHeight: true
132 fillMode: Image.PreserveAspectFit
135 sourceSize.width: width
136 source: airframeCheckBox.checked ? object.imageResource : object.imageResourceDefault
140 // Although this item is invisible we still use it to manage state
142 checked: object.frameClass === _frameClass.rawValue
143 buttonGroup: airframeTypeExclusive
148 _frameClass.rawValue = object.frameClass
154 text: qsTr("Frame Type")
155 font.pointSize: ScreenTools.smallFontPointSize
156 color: qgcPal.buttonHighlightText
157 visible: airframeCheckBox.checked && object.frameTypeSupported
162 Layout.fillWidth: true
163 model: object.frameTypeEnumStrings
164 visible: airframeCheckBox.checked && object.frameTypeSupported
165 onActivated: (index) => { _frameType.rawValue = object.frameTypeEnumValues[index] }
167 property bool valid: true
169 function checkFrameType(value) {
170 return value == _frameType.rawValue
173 function selectFrameType() {
174 let index = object.frameTypeEnumValues.findIndex(checkFrameType)
175 if (index == -1 && combo.visible) {
176 // Frame Class/Type is set to an invalid combination
179 combo.currentIndex = index
184 Component.onCompleted: selectFrameType()
187 target: _frameTypeAvailable ? _frameType : null
188 ignoreUnknownSignals: true
189 function onRawValueChanged(value) { combo.selectFrameType() }
196 anchors.fill: imageComboRect
197 text: qsTr("Invalid setting for FRAME_TYPE. Click to Reset.")
198 wrapMode: Text.WordWrap
199 visible: !combo.valid
202 } // Repeater - summary boxes
203 } // Flow - summary boxes