SimpleItemEditor.qml 5.48 KB
Newer Older
1 2
import QtQuick                  2.3
import QtQuick.Controls         1.2
3
import QtQuick.Controls.Styles  1.4
4
import QtQuick.Dialogs          1.2
5
import QtQuick.Layouts          1.2
6 7 8 9 10 11 12 13 14

import QGroundControl.ScreenTools   1.0
import QGroundControl.Vehicle       1.0
import QGroundControl.Controls      1.0
import QGroundControl.FactControls  1.0
import QGroundControl.Palette       1.0

// Editor for Simple mission items
Rectangle {
15
    width:  availableWidth
Don Gagne's avatar
Don Gagne committed
16
    height: valuesColumn.height + (_margin * 2)
17 18 19
    color:  qgcPal.windowShadeDark
    radius: _radius

20 21 22
    property bool _specifiesAltitude:   missionItem.specifiesAltitude
    property bool _altModeIsTerrain:    missionItem.altitudeMode === 2

23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
    Column {
        id:                 valuesColumn
        anchors.margins:    _margin
        anchors.left:       parent.left
        anchors.right:      parent.right
        anchors.top:        parent.top
        spacing:            _margin

        QGCLabel {
            width:          parent.width
            wrapMode:       Text.WordWrap
            font.pointSize: ScreenTools.smallFontPointSize
            text:           missionItem.rawEdit ?
                                qsTr("Provides advanced access to all commands/parameters. Be very careful!") :
                                missionItem.commandDescription
        }

        GridLayout {
            anchors.left:   parent.left
            anchors.right:  parent.right
            columns:        2

            Repeater {
                model: missionItem.comboboxFacts

                QGCLabel {
                    text:           object.name
50
                    visible:        object.name !== ""
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
                    Layout.column:  0
                    Layout.row:     index
                }
            }

            Repeater {
                model: missionItem.comboboxFacts

                FactComboBox {
                    indexModel:         false
                    model:              object.enumStrings
                    fact:               object
                    Layout.column:      1
                    Layout.row:         index
                    Layout.fillWidth:   true
                }
            }
        }

        GridLayout {
            anchors.left:   parent.left
            anchors.right:  parent.right
            flow:           GridLayout.TopToBottom
74 75 76 77 78
            rows:           missionItem.textFieldFacts.count +
                            missionItem.nanFacts.count +
                            (missionItem.speedSection.available ? 1 : 0) +
                            (_specifiesAltitude ? 1 : 0) +
                            (_altModeIsTerrain ? 1 : 0)
79 80
            columns:        2

81 82 83 84 85 86 87 88 89 90 91 92 93 94
            QGCComboBox {
                id:                 altCombo
                model:              [ qsTr("Alt (Rel)"), qsTr("AMSL"), qsTr("Above Terrain") ]
                currentIndex:       missionItem.altitudeMode
                Layout.fillWidth:   true
                onActivated:        missionItem.altitudeMode = index
                visible:            _specifiesAltitude
            }

            QGCLabel {
                text:       qsTr("Actual AMSL Alt")
                visible:    _altModeIsTerrain
            }

95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
            Repeater {
                model: missionItem.textFieldFacts

                QGCLabel { text: object.name }
            }

            Repeater {
                model: missionItem.nanFacts

                QGCCheckBox {
                    text:           object.name
                    checked:        !isNaN(object.rawValue)
                    onClicked:      object.rawValue = checked ? 0 : NaN
                }
            }

            QGCCheckBox {
                id:         flightSpeedCheckbox
                text:       qsTr("Flight Speed")
                checked:    missionItem.speedSection.specifyFlightSpeed
                onClicked:  missionItem.speedSection.specifyFlightSpeed = checked
                visible:    missionItem.speedSection.available
            }

119 120 121 122 123 124 125 126 127 128 129 130 131

            FactTextField {
                showUnits:          true
                fact:               missionItem.altitude
                Layout.fillWidth:   true
                visible:            _specifiesAltitude
            }

            FactLabel {
                fact:       missionItem.amslAltAboveTerrain
                visible:    _altModeIsTerrain
            }

132 133 134 135 136 137 138
            Repeater {
                model: missionItem.textFieldFacts

                FactTextField {
                    showUnits:          true
                    fact:               object
                    Layout.fillWidth:   true
139
                    enabled:            !object.readOnly
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
                }
            }

            Repeater {
                model: missionItem.nanFacts

                FactTextField {
                    showUnits:          true
                    fact:               object
                    Layout.fillWidth:   true
                    enabled:            !isNaN(object.rawValue)
                }
            }

            FactTextField {
                fact:               missionItem.speedSection.flightSpeed
                Layout.fillWidth:   true
                enabled:            flightSpeedCheckbox.checked
                visible:            missionItem.speedSection.available
            }
        }

        CameraSection {
            checked:    missionItem.cameraSection.settingsSpecified
            visible:    missionItem.cameraSection.available
        }
    } // Column
167
} // Rectangle