MissionSettingsEditor.qml 8.85 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
import QtQuick          2.5
import QtQuick.Controls 1.2
import QtQuick.Layouts  1.2

import QGroundControl               1.0
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 Mission Settings
Rectangle {
    id:                 valuesRect
    width:              availableWidth
    height:             deferedload.status == Loader.Ready ? (visible ? deferedload.item.height : 0) : 0
    color:              qgcPal.windowShadeDark
    visible:            missionItem.isCurrentItem
    radius:             _radius

    Loader {
        id:              deferedload
        active:          valuesRect.visible
        asynchronous:    true
        anchors.margins: _margin
        anchors.left:    valuesRect.left
        anchors.right:   valuesRect.right
        anchors.top:     valuesRect.top

        sourceComponent: Component {
            Item {
                id:                 valuesItem
                height:             valuesColumn.height + (_margin * 2)

                property var    _missionVehicle:            missionController.vehicle
                property bool   _offlineEditing:            _missionVehicle.isOfflineEditingVehicle
                property bool   _showOfflineEditingCombos:  _offlineEditing && _noMissionItemsAdded
                property bool   _showCruiseSpeed:           !_missionVehicle.multiRotor
                property bool   _showHoverSpeed:            _missionVehicle.multiRotor || missionController.vehicle.vtol
Gus Grubba's avatar
Gus Grubba committed
40
                property bool   _multipleFirmware:          QGroundControl.supportedFirmwareCount > 2
41 42 43 44 45 46 47 48 49 50 51 52 53

                readonly property string _firmwareLabel:    qsTr("Firmware:")
                readonly property string _vehicleLabel:     qsTr("Vehicle:")

                QGCPalette { id: qgcPal }

                Column {
                    id:             valuesColumn
                    anchors.left:   parent.left
                    anchors.right:  parent.right
                    anchors.top:    parent.top
                    spacing:        _margin

Gus Grubba's avatar
Gus Grubba committed
54 55 56
                    QGCLabel {
                        text: qsTr("Planned Home Position")
                    }
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99

                    Rectangle {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        height:         1
                        color:          qgcPal.text
                    }

                    Repeater {
                        model: missionItem.textFieldFacts

                        Item {
                            width:  valuesColumn.width
                            height: textField.height

                            QGCLabel {
                                id:                 textFieldLabel
                                anchors.baseline:   textField.baseline
                                text:               object.name
                            }

                            FactTextField {
                                id:             textField
                                anchors.right:  parent.right
                                width:          _editFieldWidth
                                showUnits:      true
                                fact:           object
                                visible:        !_root.readOnly
                            }

                            FactLabel {
                                anchors.baseline:   textFieldLabel.baseline
                                anchors.right:      parent.right
                                fact:               object
                                visible:            _root.readOnly
                            }
                        }
                    }

                    QGCLabel {
                        width:          parent.width
                        wrapMode:       Text.WordWrap
                        font.pointSize: ScreenTools.smallFontPointSize
Gus Grubba's avatar
Gus Grubba committed
100 101
                        text:           qsTr("Actual position set by vehicle at flight time.")
                        horizontalAlignment: Text.AlignHCenter
102 103
                    }

Gus Grubba's avatar
Gus Grubba committed
104 105 106 107
                    QGCLabel {
                        text:           qsTr("Vehicle Info:")
                        visible:        _multipleFirmware
                    }
108 109 110 111 112 113

                    Rectangle {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        height:         1
                        color:          qgcPal.text
Gus Grubba's avatar
Gus Grubba committed
114
                        visible:        _multipleFirmware
115 116 117 118 119 120 121 122
                    }

                    GridLayout {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        columnSpacing:  ScreenTools.defaultFontPixelWidth
                        rowSpacing:     columnSpacing
                        columns:        2
Gus Grubba's avatar
Gus Grubba committed
123
                        visible:        _multipleFirmware
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 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 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191

                        QGCLabel {
                            text:       _firmwareLabel
                            visible:    _showOfflineEditingCombos
                        }
                        FactComboBox {
                            Layout.fillWidth:   true
                            fact:               QGroundControl.offlineEditingFirmwareType
                            indexModel:         false
                            visible:            _showOfflineEditingCombos
                        }

                        QGCLabel {
                            text:       _firmwareLabel
                            visible:    !_showOfflineEditingCombos
                        }
                        QGCLabel {
                            text:       _missionVehicle.firmwareTypeString
                            visible:    !_showOfflineEditingCombos
                        }

                        QGCLabel {
                            text:       _vehicleLabel
                            visible:    _showOfflineEditingCombos
                        }
                        FactComboBox {
                            id:                 offlineVehicleCombo
                            Layout.fillWidth:   true
                            fact:               QGroundControl.offlineEditingVehicleType
                            indexModel:         false
                            visible:            _showOfflineEditingCombos
                        }

                        QGCLabel {
                            text:       _vehicleLabel
                            visible:    !_showOfflineEditingCombos
                        }
                        QGCLabel {
                            text:       _missionVehicle.vehicleTypeString
                            visible:    !_showOfflineEditingCombos
                        }
                        QGCLabel {
                            Layout.row: 2
                            text:       qsTr("Cruise speed:")
                            visible:    _showCruiseSpeed
                        }
                        FactTextField {
                            Layout.fillWidth:   true
                            fact:               QGroundControl.offlineEditingCruiseSpeed
                            visible:            _showCruiseSpeed
                        }

                        QGCLabel {
                            Layout.row: 3
                            text:       qsTr("Hover speed:")
                            visible:    _showHoverSpeed
                        }
                        FactTextField {
                            Layout.fillWidth:   true
                            fact:               QGroundControl.offlineEditingHoverSpeed
                            visible:            _showHoverSpeed
                        }
                    } // GridLayout

                    QGCLabel {
                        width:          parent.width
                        wrapMode:       Text.WordWrap
                        font.pointSize: ScreenTools.smallFontPointSize
Gus Grubba's avatar
Gus Grubba committed
192 193 194 195 196 197 198 199 200
                        visible:        _multipleFirmware
                        text:           qsTr("Speeds are only for time calculations. Actual vehicle will not be affected.")
                    }

                    Rectangle {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        height:         1
                        color:          qgcPal.text
201
                    }
Gus Grubba's avatar
Gus Grubba committed
202 203 204 205 206 207 208

                    QGCButton {
                        text:       qsTr("Set Home To Map Center")
                        onClicked:  editorRoot.moveHomeToMapCenter()
                        anchors.horizontalCenter: parent.horizontalCenter
                    }

209 210 211 212 213
                } // Column
            } // Item
        } // Component
    } // Loader
} // Rectangle