APMAirframeComponent.qml 3.27 KB
Newer Older
1 2 3 4 5 6 7 8
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/
9 10


11 12
import QtQuick          2.3
import QtQuick.Controls 1.2
Don Gagne's avatar
Don Gagne committed
13
import QtQuick.Dialogs  1.2
14
import QtQuick.Layouts  1.2
15

Don Gagne's avatar
Don Gagne committed
16
import QGroundControl.FactSystem    1.0
17
import QGroundControl.FactControls  1.0
Don Gagne's avatar
Don Gagne committed
18 19 20 21
import QGroundControl.Palette       1.0
import QGroundControl.Controls      1.0
import QGroundControl.Controllers   1.0
import QGroundControl.ScreenTools   1.0
22

23 24
SetupPage {
    id:             airframePage
25
    pageComponent:  _useOldFrameParam ?  oldFramePageComponent: newFramePageComponent
26

27 28 29 30 31
    property real _margins:             ScreenTools.defaultFontPixelWidth
    property bool _useOldFrameParam:    controller.parameterExists(-1, "FRAME")
    property Fact _oldFrameParam:       controller.getParameterFact(-1, "FRAME", false)
    property Fact _newFrameParam:       controller.getParameterFact(-1, "FRAME_CLASS", false)
    property Fact _frameTypeParam:      controller.getParameterFact(-1, "FRAME_TYPE", false)
32

33 34 35 36 37

    APMAirframeComponentController {
        id:         controller
    }

Don Gagne's avatar
Don Gagne committed
38 39 40 41
    ExclusiveGroup {
        id: airframeTypeExclusive
    }

42
    Component {
43
        id: oldFramePageComponent
44

45 46 47 48
        Column {
            width:      availableWidth
            height:     1000
            spacing:    _margins
49

50 51
            RowLayout {
                anchors.left:   parent.left
52
                anchors.right:  parent.right
53
                spacing:        _margins
54

55 56 57 58 59 60 61
                QGCLabel {
                    font.pointSize:     ScreenTools.mediumFontPointSize
                    wrapMode:           Text.WordWrap
                    text:               qsTr("Please select your airframe type")
                    Layout.fillWidth:   true
                }
            }
62

63 64
            Repeater {
                model: controller.airframeTypesModel
65

66 67 68 69
                QGCRadioButton {
                    text: object.name
                    checked: controller.currentAirframeType == object
                    exclusiveGroup: airframeTypeExclusive
70

71 72 73
                    onCheckedChanged: {
                        if (checked) {
                            controller.currentAirframeType = object
74 75 76 77
                        }
                    }
                }
            }
78
        } // Column
79 80 81 82 83 84
    } // Component - oldFramePageComponent

    Component {
        id: newFramePageComponent

        Grid {
DonLakeFlyer's avatar
DonLakeFlyer committed
85 86 87
            width:      availableWidth
            spacing:    _margins
            columns:    2
88 89

            QGCLabel {
90
                text: qsTr("Frame Class:")
91 92 93 94 95 96 97 98 99
            }

            FactComboBox {
                fact:       _newFrameParam
                indexModel: false
                width:      ScreenTools.defaultFontPixelWidth * 15
            }

            QGCLabel {
100
                text: qsTr("Frame Type:")
101 102 103 104 105 106 107 108 109
            }

            FactComboBox {
                fact:       _frameTypeParam
                indexModel: false
                width:      ScreenTools.defaultFontPixelWidth * 15
            }
        }
    }
110
} // SetupPage