Commit b68ab86c authored by Don Gagne's avatar Don Gagne
Browse files

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.
parent 3a1f28cc
......@@ -21,17 +21,16 @@
======================================================================*/
import QtQuick 2.5
import QtQuick 2.5
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.FactControls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Controllers 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Controllers 1.0
import QGroundControl.ScreenTools 1.0
QGCView {
id: 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
......@@ -84,36 +67,35 @@ QGCView {
}
QGCLabel {
id: applyParamsText
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: _boxSpace
wrapMode: Text.WordWrap
text: "Select you drone to load the default parameters for it. "
id: applyParamsText
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: _margins
wrapMode: Text.WordWrap
text: "Select you drone to load the default parameters for it. "
}
Flow {
anchors.top : applyParamsText.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
spacing : _boxSpace
layoutDirection: Qt.Vertical;
anchors.margins : _boxSpace
anchors.margins: _margins
anchors.top: applyParamsText.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
spacing : _margins
layoutDirection: Qt.Vertical;
Repeater {
id : airframePicker
model : controller.currentAirframeType.airframes;
id: airframePicker
model: controller.currentAirframeType.airframes;
delegate: QGCButton {
id: btnParams
id: btnParams
width: parent.width / 2.1
height: (ScreenTools.defaultFontPixelHeight * 14) / 5
text: controller.currentAirframeType.airframes[index].name;
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 {
id: panel
anchors.fill: parent
readonly property real spacerHeight: ScreenTools.defaultFontPixelHeight
onWidthChanged: {
computeDimensions()
}
Item {
id: helpApplyRow
anchors.top: parent.top
......@@ -138,24 +114,25 @@ QGCView {
height: Math.max(helpText.contentHeight, applyButton.height)
QGCLabel {
id: helpText
width: parent.width - applyButton.width - 5
text: qsTr("Please select your airframe type")
font.pixelSize: ScreenTools.mediumFontPixelSize
wrapMode: Text.WordWrap
id: helpText
anchors.rightMargin: _margins
anchors.left: parent.left
anchors.right: applyButton.right
text: "Please select your airframe type"
font.pixelSize: ScreenTools.mediumFontPixelSize
wrapMode: Text.WordWrap
}
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 {
Flickable {
id: scroll
anchors.top: lastSpacer.bottom
width: parent.width;
height: parent.height;
clip: true
boundsBehavior: Flickable.StopAtBounds
flickableDirection: Flickable.VerticalFlick
onWidthChanged: {
computeDimensions()
}
anchors.top: helpSpacer.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
contentHeight: frameColumn.height
contentWidth: frameColumn.width
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;
}
QGCRadioButton {
text: object.name
checked: controller.currentAirframeType == object
exclusiveGroup: airframeTypeExclusive
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
}
}
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
anchors.bottom: imageRect.bottom
anchors.right: parent.right
anchors.rightMargin: innerMargin
onCheckedChanged: {
if (checked) {
controller.currentAirframeType = object
}
airframeBackground.color = checked ? qgcPal.buttonHighlight : qgcPal.windowShade;
onCheckedChanged: {
if (checked) {
controller.currentAirframeType = object
}
}
}
}
}
} // Scroll View - summary boxes
}
} // QGCViewPanel
} // QGCView
<?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 @@
<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>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment