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

14
src/AutoPilotPlugins/APM/APMAirframeFactMetaData.xml

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<airframes> <airframes>
<version>1</version> <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 M" file="3DR_AERO_M.param"/>
<airframe name="3DR Aero RTF" file="3DR_Aero_RTF.param"/> <airframe name="3DR Aero RTF" file="3DR_Aero_RTF.param"/>
<airframe name="3DR Rover" file="3DR_Rover.param"/> <airframe name="3DR Rover" file="3DR_Rover.param"/>
@ -9,26 +9,26 @@
<airframe name="Parrot Bebop" file="Parrot_Bebop.param"/> <airframe name="Parrot Bebop" file="Parrot_Bebop.param"/>
<airframe name="Storm32" file="SToRM32-MAVLink.param"/> <airframe name="Storm32" file="SToRM32-MAVLink.param"/>
</airframe_group> </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 X8-M RTF" file="3DR_X8-M_RTF.param"/>
<airframe name="3DR Y6A" file="3DR_Y6A_RTF.param"/> <airframe name="3DR Y6A" file="3DR_Y6A_RTF.param"/>
<airframe name="3DR X8+ RTF" file="3DR_X8+_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 QUAD X4 RTF" file="3DR_QUAD_X4_RTF.param"/>
<airframe name="3DR X8" file="3DR_X8_RTF.param"/> <airframe name="3DR X8" file="3DR_X8_RTF.param"/>
</airframe_group> </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 GoPro" file="Iris with Front Mount Go Pro.param"/>
<airframe name="Iris with Tarot" file="Iris with Tarot Gimbal.param"/> <airframe name="Iris with Tarot" file="Iris with Tarot Gimbal.param"/>
<airframe name="3DR Iris+" file="3DR_Iris+.param"/> <airframe name="3DR Iris+" file="3DR_Iris+.param"/>
<airframe name="Iris" file="Iris.param"/> <airframe name="Iris" file="Iris.param"/>
</airframe_group> </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>
<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>
<airframe_group name="H Frame" id="3"> <airframe_group name="H: X and H differ in prop rotation" id="3">
</airframe_group> </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 name="3DR Y6B" file="3DR_Y6B_RTF.param"/>
</airframe_group> </airframe_group>
<airframes> <airframes>

Loading…
Cancel
Save