MissionSettingsEditor.qml 8.41 KB
Newer Older
1 2 3
import QtQuick          2.3
import QtQuick.Controls 1.2
import QtQuick.Layouts  1.2
4

5 6 7 8 9 10 11
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
import QGroundControl.SettingsManager   1.0
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 40

// 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
41
                property bool   _multipleFirmware:          QGroundControl.supportedFirmwareCount > 2
42
                property real   _fieldWidth:                ScreenTools.defaultFontPixelWidth * 16
43
                property bool   _mobile:                    ScreenTools.isMobile
44

45 46
                readonly property string _firmwareLabel:    qsTr("Firmware")
                readonly property string _vehicleLabel:     qsTr("Vehicle")
47 48 49 50 51 52 53 54 55 56

                QGCPalette { id: qgcPal }

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

57
                    SectionHeader { text: qsTr("Planned Home Position") }
58 59 60

                    Repeater {
                        model: missionItem.textFieldFacts
61 62 63 64
                        RowLayout {
                            anchors.left:   parent.left
                            anchors.right:  parent.right
                            spacing:        _margin
65 66
                            visible:        _mobile ? index == 2 : true // Cheating here since we known we only have Lat/Lon/Alt

67
                            QGCLabel { text: object.name; Layout.fillWidth: true }
68
                            FactTextField {
69 70 71 72
                                Layout.preferredWidth:  _fieldWidth
                                showUnits:  true
                                fact:       object
                                visible:    !_root.readOnly
73 74
                            }
                            FactLabel {
75 76 77
                                Layout.preferredWidth:  _fieldWidth
                                fact:       object
                                visible:    _root.readOnly
78 79 80 81 82
                            }
                        }
                    }

                    QGCLabel {
83 84 85 86 87 88 89 90 91 92 93
                        width:                  parent.width
                        wrapMode:               Text.WordWrap
                        font.pointSize:         ScreenTools.smallFontPointSize
                        text:                   qsTr("Actual position set by vehicle at flight time.")
                        horizontalAlignment:    Text.AlignHCenter
                    }

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

96 97 98 99
                    Item {
                        height:     _sectionSpacer
                        width:      1
                        visible:    !ScreenTools.isTinyScreen
Gus Grubba's avatar
Gus Grubba committed
100
                    }
101

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

                    GridLayout {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        columnSpacing:  ScreenTools.defaultFontPixelWidth
                        rowSpacing:     columnSpacing
                        columns:        2
Gus Grubba's avatar
Gus Grubba committed
113
                        visible:        _multipleFirmware
114 115 116 117

                        QGCLabel {
                            text:       _firmwareLabel
                            visible:    _showOfflineEditingCombos
118
                            Layout.fillWidth: true
119 120
                        }
                        FactComboBox {
121
                            fact:               QGroundControl.settingsManager.appSettings.offlineEditingFirmwareType
122 123
                            indexModel:         false
                            visible:            _showOfflineEditingCombos
124
                            Layout.preferredWidth:  _fieldWidth
125 126 127 128 129
                        }

                        QGCLabel {
                            text:       _vehicleLabel
                            visible:    _showOfflineEditingCombos
130
                            Layout.fillWidth: true
131 132 133
                        }
                        FactComboBox {
                            id:                 offlineVehicleCombo
134
                            fact:               QGroundControl.settingsManager.appSettings.offlineEditingVehicleType
135 136
                            indexModel:         false
                            visible:            _showOfflineEditingCombos
137
                            Layout.preferredWidth:  _fieldWidth
138 139 140
                        }

                        QGCLabel {
141
                            text:       qsTr("Cruise speed")
142
                            visible:    _showCruiseSpeed
143
                            Layout.fillWidth: true
144 145
                        }
                        FactTextField {
146
                            fact:               QGroundControl.settingsManager.appSettings.offlineEditingCruiseSpeed
147
                            visible:            _showCruiseSpeed
148
                            Layout.preferredWidth:  _fieldWidth
149 150 151
                        }

                        QGCLabel {
152
                            text:       qsTr("Hover speed")
153
                            visible:    _showHoverSpeed
154
                            Layout.fillWidth: true
155 156
                        }
                        FactTextField {
157
                            fact:               QGroundControl.settingsManager.appSettings.offlineEditingHoverSpeed
158
                            visible:            _showHoverSpeed
159
                            Layout.preferredWidth:  _fieldWidth
160 161 162
                        }
                    } // GridLayout

163 164 165 166 167
                    RowLayout {
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        spacing:        _margin
                        visible:        !_multipleFirmware
168
                        QGCLabel { text: qsTr("Hover speed"); Layout.fillWidth: true }
169 170
                        FactTextField {
                            Layout.preferredWidth:  _fieldWidth
171
                            fact:       QGroundControl.settingsManager.appSettings.offlineEditingHoverSpeed
172 173 174
                        }
                    }

175 176 177 178
                    QGCLabel {
                        width:          parent.width
                        wrapMode:       Text.WordWrap
                        font.pointSize: ScreenTools.smallFontPointSize
179 180
                        text:           qsTr("Speeds are only used for time calculations. Actual vehicle speed will not be affected.")
                        horizontalAlignment: Text.AlignHCenter
Gus Grubba's avatar
Gus Grubba committed
181
                    }
182 183 184 185 186
                } // Column
            } // Item
        } // Component
    } // Loader
} // Rectangle