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 var 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
89 height: ScreenTools.defaultFontPixelHeight * 14
92 readonly property real titleHeight: ScreenTools.defaultFontPixelHeight * 1.75
93 readonly property real innerMargin: ScreenTools.defaultFontPixelWidth
98 if (!airframeCheckBox.checked || !combo.valid) {
99 if (_frameTypeAvailable && object.defaultFrameType != -1) {
100 _frameType.rawValue = object.defaultFrameType
102 airframeCheckBox.checked = true
114 anchors.topMargin: ScreenTools.defaultFontPixelHeight / 2
115 anchors.top: title.bottom
116 anchors.bottom: parent.bottom
117 anchors.left: parent.left
118 anchors.right: parent.right
119 color: airframeCheckBox.checked ? qgcPal.buttonHighlight : qgcPal.windowShade
120 opacity: combo.valid ? 1.0 : 0.5
123 anchors.margins: innerMargin
129 Layout.fillWidth: true
130 Layout.fillHeight: true
131 fillMode: Image.PreserveAspectFit
134 sourceSize.width: width
135 source: airframeCheckBox.checked ? object.imageResource : object.imageResourceDefault
139 // Although this item is invisible we still use it to manage state
141 checked: object.frameClass === _frameClass.rawValue
142 buttonGroup: airframeTypeExclusive
147 _frameClass.rawValue = object.frameClass
153 text: qsTr("Frame Type")
154 font.pointSize: ScreenTools.smallFontPointSize
155 color: qgcPal.buttonHighlightText
156 visible: airframeCheckBox.checked && object.frameTypeSupported
161 Layout.fillWidth: true
162 model: object.frameTypeEnumStrings
163 visible: airframeCheckBox.checked && object.frameTypeSupported
164 onActivated: (index) => { _frameType.rawValue = object.frameTypeEnumValues[index] }
166 property bool valid: true
168 function checkFrameType(value) {
169 return value == _frameType.rawValue
172 function selectFrameType() {
173 var index = object.frameTypeEnumValues.findIndex(checkFrameType)
174 if (index == -1 && combo.visible) {
175 // Frame Class/Type is set to an invalid combination
178 combo.currentIndex = index
183 Component.onCompleted: selectFrameType()
186 target: _frameTypeAvailable ? _frameType : null
187 ignoreUnknownSignals: true
188 function onRawValueChanged(value) { combo.selectFrameType() }
195 anchors.fill: imageComboRect
196 text: qsTr("Invalid setting for FRAME_TYPE. Click to Reset.")
197 wrapMode: Text.WordWrap
198 visible: !combo.valid
201 } // Repeater - summary boxes
202 } // Flow - summary boxes