APMAirframeComponent.qml 3.31 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

    APMAirframeComponentController {
        id:         controller
36
        factPanel:  airframePage.viewPanel
37 38
    }

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

43
    Component {
44
        id: oldFramePageComponent
45

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

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

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

64 65
            Repeater {
                model: controller.airframeTypesModel
66

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

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

    Component {
        id: newFramePageComponent

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

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

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

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

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