Browse Source

Simplifying Airframe config

Users are getting confused because we are missing images. Will put back
new fancy version once we get new airframe config plus auto-generate of
images sorted out.
QGC4.4
Don Gagne 10 years ago
parent
commit
b68ab86cc2
  1. 134
      src/AutoPilotPlugins/APM/APMAirframeComponent.qml
  2. 14
      src/AutoPilotPlugins/APM/APMAirframeFactMetaData.xml

134
src/AutoPilotPlugins/APM/APMAirframeComponent.qml

@ -23,7 +23,6 @@ @@ -23,7 +23,6 @@
import QtQuick 2.5
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QtQuick.Dialogs 1.2
import QGroundControl.FactSystem 1.0
@ -39,34 +38,18 @@ QGCView { @@ -39,34 +38,18 @@ QGCView {
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
property real _minW: ScreenTools.defaultFontPixelWidth * 30
property real _boxWidth: _minW
property real _boxSpace: ScreenTools.defaultFontPixelWidth
property Fact sysIdFact: controller.getParameterFact(-1, "FRAME")
function computeDimensions() {
var sw = 0
var rw = 0
var idx = Math.floor(scroll.width / (_minW + ScreenTools.defaultFontPixelWidth))
if(idx < 1) {
_boxWidth = scroll.width
_boxSpace = 0
} else {
_boxSpace = 0
if(idx > 1) {
_boxSpace = ScreenTools.defaultFontPixelWidth
sw = _boxSpace * (idx - 1)
}
rw = scroll.width - sw
_boxWidth = rw / idx
}
}
property real _margins: ScreenTools.defaultFontPixelWidth
property Fact _frame: controller.getParameterFact(-1, "FRAME")
APMAirframeComponentController {
id: controller
factPanel: panel
}
ExclusiveGroup {
id: airframeTypeExclusive
}
Component {
id: applyRestartDialogComponent
@ -88,19 +71,20 @@ QGCView { @@ -88,19 +71,20 @@ QGCView {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: _boxSpace
anchors.margins: _margins
wrapMode: Text.WordWrap
text: "Select you drone to load the default parameters for it. "
}
Flow {
anchors.margins: _margins
anchors.top: applyParamsText.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
spacing : _boxSpace
spacing : _margins
layoutDirection: Qt.Vertical;
anchors.margins : _boxSpace
Repeater {
id: airframePicker
model: controller.currentAirframeType.airframes;
@ -111,9 +95,7 @@ QGCView { @@ -111,9 +95,7 @@ QGCView {
height: (ScreenTools.defaultFontPixelHeight * 14) / 5
text: controller.currentAirframeType.airframes[index].name;
onClicked : {
controller.currentAirframe = controller.currentAirframeType.airframes[index]
}
onClicked : controller.currentAirframe = controller.currentAirframeType.airframes[index]
}
}
}
@ -124,12 +106,6 @@ QGCView { @@ -124,12 +106,6 @@ QGCView {
id: panel
anchors.fill: parent
readonly property real spacerHeight: ScreenTools.defaultFontPixelHeight
onWidthChanged: {
computeDimensions()
}
Item {
id: helpApplyRow
anchors.top: parent.top
@ -139,8 +115,10 @@ QGCView { @@ -139,8 +115,10 @@ QGCView {
QGCLabel {
id: helpText
width: parent.width - applyButton.width - 5
text: qsTr("Please select your airframe type")
anchors.rightMargin: _margins
anchors.left: parent.left
anchors.right: applyButton.right
text: "Please select your airframe type"
font.pixelSize: ScreenTools.mediumFontPixelSize
wrapMode: Text.WordWrap
}
@ -148,14 +126,13 @@ QGCView { @@ -148,14 +126,13 @@ QGCView {
QGCButton {
id: applyButton
anchors.right: parent.right
text: qsTr("Load common parameters")
text: "Load common parameters"
onClicked: showDialog(applyRestartDialogComponent, qsTr("Load common parameters"), 50, StandardButton.Close)
}
}
Item {
id: lastSpacer
id: helpSpacer
anchors.top: helpApplyRow.bottom
height: parent.spacerHeight
width: 10
@ -163,90 +140,35 @@ QGCView { @@ -163,90 +140,35 @@ QGCView {
Flickable {
id: scroll
anchors.top: lastSpacer.bottom
width: parent.width;
height: parent.height;
clip: true
boundsBehavior: Flickable.StopAtBounds
flickableDirection: Flickable.VerticalFlick
anchors.top: helpSpacer.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
contentHeight: frameColumn.height
contentWidth: frameColumn.width
onWidthChanged: {
computeDimensions()
}
Flow {
id: flowView
width: scroll.width
spacing: _boxSpace
ExclusiveGroup {
id: airframeTypeExclusive
}
Column {
id: frameColumn
spacing: _margins
Repeater {
model: controller.airframeTypesModel
// Outer summary item rectangle
delegate : Rectangle {
id: airframeBackground
width: _boxWidth
height: ScreenTools.defaultFontPixelHeight * 14
color: qgcPal.windowShade;
readonly property real titleHeight: ScreenTools.defaultFontPixelHeight * 1.75
readonly property real innerMargin: ScreenTools.defaultFontPixelWidth
MouseArea {
anchors.fill: parent
onClicked: airframeCheckBox.checked = true;
}
Rectangle {
id: nameRect;
width: parent.width
height: parent.titleHeight
color: qgcPal.windowShadeDark
QGCLabel {
anchors.fill: parent
color: qgcPal.buttonText
verticalAlignment: TextEdit.AlignVCenter
horizontalAlignment: TextEdit.AlignHCenter
QGCRadioButton {
text: object.name
}
}
Image {
id: imageRect
anchors.topMargin: innerMargin
anchors.top: nameRect.bottom
width: parent.width * 0.75
height: parent.height - nameRect.height - (innerMargin * 3)
fillMode: Image.PreserveAspectFit
smooth: true
mipmap: true
source: object.imageResource
anchors.horizontalCenter: parent.horizontalCenter
}
QGCCheckBox {
id: airframeCheckBox
checked: object.type == sysIdFact.value
checked: controller.currentAirframeType == object
exclusiveGroup: airframeTypeExclusive
anchors.bottom: imageRect.bottom
anchors.right: parent.right
anchors.rightMargin: innerMargin
onCheckedChanged: {
if (checked) {
controller.currentAirframeType = object
}
airframeBackground.color = checked ? qgcPal.buttonHighlight : qgcPal.windowShade;
}
}
}
}
}
} // Scroll View - summary boxes
} // QGCViewPanel
} // QGCView

14
src/AutoPilotPlugins/APM/APMAirframeFactMetaData.xml

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<airframes>
<version>1</version>
<airframe_group image="AirframeQuadRotorPlus.png" name="Plus Frame" id="0">
<airframe_group image="AirframeQuadRotorPlus.png" name="Plus Style: Quad, Hexa, Octo, Heli" id="0">
<airframe name="3DR Aero M" file="3DR_AERO_M.param"/>
<airframe name="3DR Aero RTF" file="3DR_Aero_RTF.param"/>
<airframe name="3DR Rover" file="3DR_Rover.param"/>
@ -9,26 +9,26 @@ @@ -9,26 +9,26 @@
<airframe name="Parrot Bebop" file="Parrot_Bebop.param"/>
<airframe name="Storm32" file="SToRM32-MAVLink.param"/>
</airframe_group>
<airframe_group image="AirframeQuadRotorX.png" name="X Frame, Y6A Frame" id="1">
<airframe_group image="AirframeQuadRotorX.png" name="X Style, Y6A Style: Quad, Hexa, Octo, X8, Tri, Y6A" id="1">
<airframe name="3DR X8-M RTF" file="3DR_X8-M_RTF.param"/>
<airframe name="3DR Y6A" file="3DR_Y6A_RTF.param"/>
<airframe name="3DR X8+ RTF" file="3DR_X8+_RTF.param"/>
<airframe name="3DR QUAD X4 RTF" file="3DR_QUAD_X4_RTF.param"/>
<airframe name="3DR X8" file="3DR_X8_RTF.param"/>
</airframe_group>
<airframe_group image="AirframeQuadRotorH.png" name="V Frame (3DR Iris)" id="2">
<airframe_group image="AirframeQuadRotorH.png" name="V (3DR Iris)" id="2">
<airframe name="Iris with GoPro" file="Iris with Front Mount Go Pro.param"/>
<airframe name="Iris with Tarot" file="Iris with Tarot Gimbal.param"/>
<airframe name="3DR Iris+" file="3DR_Iris+.param"/>
<airframe name="Iris" file="Iris.param"/>
</airframe_group>
<airframe_group image="AirframeQuadRotorH.png" name="V Tail Frame" id="4">
<airframe_group image="AirframeQuadRotorH.png" name="V Tail" id="4">
</airframe_group>
<airframe_group image="AirframeQuadRotorH.png" name="A Tail Frame" id="5">
<airframe_group image="AirframeQuadRotorH.png" name="A Tail" id="5">
</airframe_group>
<airframe_group name="H Frame" id="3">
<airframe_group name="H: X and H differ in prop rotation" id="3">
</airframe_group>
<airframe_group name="Y6B Frame (3DR TriCopter)" id="10">
<airframe_group name="Y6B Frame (3DR TriCopter): Y6B and Y6A differ in prop rotation" id="10">
<airframe name="3DR Y6B" file="3DR_Y6B_RTF.param"/>
</airframe_group>
<airframes>

Loading…
Cancel
Save