FlightDisplayViewWidgets.qml 22.3 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
13
import QtQuick.Controls.Styles  1.4
14
import QtQuick.Dialogs          1.2
15 16
import QtLocation               5.3
import QtPositioning            5.3
17

18 19 20 21 22 23
import QGroundControl                           1.0
import QGroundControl.ScreenTools               1.0
import QGroundControl.Controls                  1.0
import QGroundControl.Palette                   1.0
import QGroundControl.Vehicle                   1.0
import QGroundControl.FlightMap                 1.0
24 25

Item {
26
    id: _root
27

28 29
    property alias  guidedModeBar:          _guidedModeBar
    property bool   gotoEnabled:            _activeVehicle && _activeVehicle.guidedMode && _activeVehicle.flying
30
    property var    qgcView
31
    property bool   useLightColors
32
    property var    missionController
Don Gagne's avatar
Don Gagne committed
33

34 35 36
    property var    _activeVehicle:         QGroundControl.multiVehicleManager.activeVehicle
    property bool   _isSatellite:           _mainIsMap ? (_flightMap ? _flightMap.isSatelliteMap : true) : true
    property bool   _lightWidgetBorders:    _isSatellite
37

38 39 40 41 42 43 44
    // Guided bar properties
    property bool _missionAvailable:    missionController.containsItems
    property bool _missionActive:       _activeVehicle ? _activeVehicle.flightMode === _activeVehicle.missionFlightMode : false
    property bool _missionInProgress:   missionController.missionInProgress
    property bool _showEmergenyStop:    QGroundControl.corePlugin.options.guidedBarShowEmergencyStop
    property bool _showOrbit:           QGroundControl.corePlugin.options.guidedBarShowOrbit

45
    readonly property real _margins:        ScreenTools.defaultFontPixelHeight * 0.5
dogmaphobic's avatar
dogmaphobic committed
46

47
    QGCMapPalette { id: mapPal; lightColors: useLightColors }
48
    QGCPalette    { id: qgcPal }
49

50
    function getPreferredInstrumentWidth() {
51
        if(ScreenTools.isMobile) {
52
            return ScreenTools.isTinyScreen ? mainWindow.width * 0.2 : mainWindow.width * 0.15
53 54 55 56 57
        }
        var w = mainWindow.width * 0.15
        return Math.min(w, 200)
    }

58
    function _setInstrumentWidget() {
59 60 61 62 63 64 65 66 67 68 69 70 71 72
        if(QGroundControl.corePlugin.options.instrumentWidget.source.toString().length) {
            instrumentsLoader.source = QGroundControl.corePlugin.options.instrumentWidget.source
            switch(QGroundControl.corePlugin.options.instrumentWidget.widgetPosition) {
            case CustomInstrumentWidget.POS_TOP_RIGHT:
                instrumentsLoader.state  = "topMode"
                break;
            case CustomInstrumentWidget.POS_BOTTOM_RIGHT:
                instrumentsLoader.state  = "bottomMode"
                break;
            case CustomInstrumentWidget.POS_CENTER_RIGHT:
            default:
                instrumentsLoader.state  = "centerMode"
                break;
            }
73
        } else {
74
            var useAlternateInstruments = QGroundControl.settingsManager.appSettings.virtualJoystick.value || ScreenTools.isTinyScreen
75 76 77 78 79
            if(useAlternateInstruments) {
                instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidgetAlternate.qml"
                instrumentsLoader.state  = "topMode"
            } else {
                instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidget.qml"
80
                instrumentsLoader.state  = QGroundControl.settingsManager.appSettings.showLargeCompass.value == 1 ? "centerMode" : "topMode"
81
            }
82 83 84 85
        }
    }

    Connections {
86 87
        target:         QGroundControl.settingsManager.appSettings.virtualJoystick
        onValueChanged: _setInstrumentWidget()
88 89
    }

90 91 92 93 94
    Connections {
        target:         QGroundControl.settingsManager.appSettings.showLargeCompass
        onValueChanged: _setInstrumentWidget()
    }

95 96 97 98
    Component.onCompleted: {
        _setInstrumentWidget()
    }

Don Gagne's avatar
Don Gagne committed
99
    //-- Map warnings
100
    Column {
Don Gagne's avatar
Don Gagne committed
101 102 103 104 105 106
        anchors.horizontalCenter:   parent.horizontalCenter
        anchors.verticalCenter:     parent.verticalCenter
        spacing:                    ScreenTools.defaultFontPixelHeight

        QGCLabel {
            anchors.horizontalCenter:   parent.horizontalCenter
107
            visible:                    _activeVehicle && !_activeVehicle.coordinateValid && _mainIsMap
Don Gagne's avatar
Don Gagne committed
108 109
            z:                          QGroundControl.zOrderTopMost
            color:                      mapPal.text
110
            font.pointSize:             ScreenTools.largeFontPointSize
111
            text:                       qsTr("No GPS Lock for Vehicle")
Don Gagne's avatar
Don Gagne committed
112 113 114 115
        }

        QGCLabel {
            anchors.horizontalCenter:   parent.horizontalCenter
116
            visible:                    _activeVehicle && _activeVehicle.prearmError
Don Gagne's avatar
Don Gagne committed
117 118
            z:                          QGroundControl.zOrderTopMost
            color:                      mapPal.text
119
            font.pointSize:             ScreenTools.largeFontPointSize
Don Gagne's avatar
Don Gagne committed
120
            text:                       _activeVehicle ? _activeVehicle.prearmError : ""
121 122 123
        }
    }

dogmaphobic's avatar
dogmaphobic committed
124
    //-- Instrument Panel
125 126
    Loader {
        id:                     instrumentsLoader
127
        anchors.margins:        ScreenTools.defaultFontPixelHeight / 2
Don Gagne's avatar
Don Gagne committed
128
        anchors.right:          altitudeSlider.visible ? altitudeSlider.left : parent.right
129
        z:                      QGroundControl.zOrderWidgets
130 131 132 133 134 135 136 137
        property var  qgcView:  _root.qgcView
        property real maxHeight:parent.height - (anchors.margins * 2)
        states: [
            State {
                name:   "topMode"
                AnchorChanges {
                    target:                 instrumentsLoader
                    anchors.verticalCenter: undefined
138
                    anchors.bottom:         undefined
139 140 141 142 143 144 145 146
                    anchors.top:            _root ? _root.top : undefined
                }
            },
            State {
                name:   "centerMode"
                AnchorChanges {
                    target:                 instrumentsLoader
                    anchors.top:            undefined
147
                    anchors.bottom:         undefined
148 149
                    anchors.verticalCenter: _root ? _root.verticalCenter : undefined
                }
150 151 152 153 154 155 156 157 158
            },
            State {
                name:   "bottomMode"
                AnchorChanges {
                    target:                 instrumentsLoader
                    anchors.top:            undefined
                    anchors.verticalCenter: undefined
                    anchors.bottom:         _root ? _root.bottom : undefined
                }
159 160
            }
        ]
161 162
    }

Don Gagne's avatar
Don Gagne committed
163 164 165
    //-- Guided mode buttons
    Rectangle {
        id:                         _guidedModeBar
Don Gagne's avatar
Don Gagne committed
166
        anchors.margins:            _barMargin
Don Gagne's avatar
Don Gagne committed
167 168
        anchors.bottom:             parent.bottom
        anchors.horizontalCenter:   parent.horizontalCenter
169
        width:                      guidedModeColumn.width  + (_margins * 2)
Don Gagne's avatar
Don Gagne committed
170
        height:                     guidedModeColumn.height + (_margins * 2)
171
        radius:                     ScreenTools.defaultFontPixelHeight * 0.25
172
        color:                      _isSatellite ? Qt.rgba(qgcPal.mapWidgetBorderLight.r, qgcPal.mapWidgetBorderLight.g, qgcPal.mapWidgetBorderLight.b, 0.8) : Qt.rgba(qgcPal.mapWidgetBorderDark.r, qgcPal.mapWidgetBorderDark.g, qgcPal.mapWidgetBorderDark.b, 0.75)
Don Gagne's avatar
Don Gagne committed
173 174
        visible:                    _activeVehicle
        z:                          QGroundControl.zOrderWidgets
Don Gagne's avatar
Don Gagne committed
175 176
        state:                      "Shown"

177 178
        property real _fontPointSize: ScreenTools.isMobile ? ScreenTools.largeFontPointSize : ScreenTools.defaultFontPointSize

Don Gagne's avatar
Don Gagne committed
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
        states: [
            State {
                name: "Shown"
                PropertyChanges { target: showAnimation; running: true  }
                PropertyChanges { target: guidedModeHideTimer; running: true }
            },
            State {
                name: "Hidden"
                PropertyChanges { target: hideAnimation; running: true  }
            }
        ]

        PropertyAnimation {
            id:             hideAnimation
            target:         _guidedModeBar
            property:       "_barMargin"
            duration:       1000
            easing.type:    Easing.InOutQuad
            from:           _guidedModeBar._showMargin
            to:             _guidedModeBar._hideMargin
        }

        PropertyAnimation {
            id:             showAnimation
            target:         _guidedModeBar
            property:       "_barMargin"
            duration:       250
            easing.type:    Easing.InOutQuad
            from:           _guidedModeBar._hideMargin
            to:             _guidedModeBar._showMargin
        }

        Timer {
            id:             guidedModeHideTimer
            interval:       7000
            running:        true
215
            onTriggered: {
Don Gagne's avatar
Don Gagne committed
216
                if (ScreenTools.isTinyScreen) {
217 218 219
                    _guidedModeBar.state = "Hidden"
                }
            }
Don Gagne's avatar
Don Gagne committed
220
        }
Don Gagne's avatar
Don Gagne committed
221 222 223 224 225 226 227 228 229

        readonly property int confirmHome:          1
        readonly property int confirmLand:          2
        readonly property int confirmTakeoff:       3
        readonly property int confirmArm:           4
        readonly property int confirmDisarm:        5
        readonly property int confirmEmergencyStop: 6
        readonly property int confirmChangeAlt:     7
        readonly property int confirmGoTo:          8
230
        readonly property int confirmRetask:        9
231
        readonly property int confirmOrbit:         10
232
        readonly property int confirmAbort:         11
233 234
        readonly property int confirmStartMission:  12
        readonly property int confirmResumeMission: 13
Don Gagne's avatar
Don Gagne committed
235 236

        property int    confirmActionCode
Don Gagne's avatar
Don Gagne committed
237 238 239
        property real   _showMargin:    _margins
        property real   _hideMargin:    _margins - _guidedModeBar.height
        property real   _barMargin:     _showMargin
Don Gagne's avatar
Don Gagne committed
240 241 242 243 244 245 246 247 248 249

        function actionConfirmed() {
            switch (confirmActionCode) {
            case confirmHome:
                _activeVehicle.guidedModeRTL()
                break;
            case confirmLand:
                _activeVehicle.guidedModeLand()
                break;
            case confirmTakeoff:
250 251 252 253 254
                _activeVehicle.guidedModeTakeoff()
                break;
            case confirmResumeMission:
            case confirmStartMission:
                _activeVehicle.startMission()
Don Gagne's avatar
Don Gagne committed
255 256 257 258 259 260 261 262 263 264 265
                break;
            case confirmArm:
                _activeVehicle.armed = true
                break;
            case confirmDisarm:
                _activeVehicle.armed = false
                break;
            case confirmEmergencyStop:
                _activeVehicle.emergencyStop()
                break;
            case confirmChangeAlt:
266 267 268
                var altitude2 = altitudeSlider.getValue()
                if (!isNaN(altitude2)) {
                    _activeVehicle.guidedModeChangeAltitude(altitude2)
Don Gagne's avatar
Don Gagne committed
269 270 271 272 273
                }
                break;
            case confirmGoTo:
                _activeVehicle.guidedModeGotoLocation(_flightMap._gotoHereCoordinate)
                break;
274 275 276
            case confirmRetask:
                _activeVehicle.setCurrentMissionSequence(_flightMap._retaskSequence)
                break;
277 278 279 280 281 282
            case confirmOrbit:
                //-- All parameters controlled by RC
                _activeVehicle.guidedModeOrbit()
                //-- Center on current flight map position and orbit with a 50m radius (velocity/direction controlled by the RC)
                //_activeVehicle.guidedModeOrbit(QGroundControl.flightMapPosition, 50.0)
                break;
283
            case confirmAbort:
284
                _activeVehicle.abortLanding(50)     // hardcoded value for climbOutAltitude that is currently ignored
285
                break;
Don Gagne's avatar
Don Gagne committed
286
            default:
287
                console.warn(qsTr("Internal error: unknown confirmActionCode"), confirmActionCode)
Don Gagne's avatar
Don Gagne committed
288 289 290
            }
        }

291 292
        function rejectGuidedModeConfirm() {
            guidedModeConfirm.visible = false
Don Gagne's avatar
Don Gagne committed
293
            _guidedModeBar.visible = true
294 295
            altitudeSlider.visible = false
            _flightMap._gotoHereCoordinate = QtPositioning.coordinate()
Don Gagne's avatar
Don Gagne committed
296
            guidedModeHideTimer.restart()
297 298
        }

Don Gagne's avatar
Don Gagne committed
299
        function confirmAction(actionCode) {
Don Gagne's avatar
Don Gagne committed
300
            guidedModeHideTimer.stop()
Don Gagne's avatar
Don Gagne committed
301 302 303
            confirmActionCode = actionCode
            switch (confirmActionCode) {
            case confirmArm:
304
                guidedModeConfirm.confirmText = qsTr("arm")
Don Gagne's avatar
Don Gagne committed
305 306
                break;
            case confirmDisarm:
307
                guidedModeConfirm.confirmText = qsTr("disarm")
Don Gagne's avatar
Don Gagne committed
308 309
                break;
            case confirmEmergencyStop:
310
                guidedModeConfirm.confirmText = qsTr("STOP ALL MOTORS!")
Don Gagne's avatar
Don Gagne committed
311 312
                break;
            case confirmTakeoff:
313
                guidedModeConfirm.confirmText = qsTr("takeoff")
Don Gagne's avatar
Don Gagne committed
314
                break;
315 316 317 318 319 320
            case confirmStartMission:
                guidedModeConfirm.confirmText = qsTr("start mission")
                break;
            case confirmResumeMission:
                guidedModeConfirm.confirmText = qsTr("resume mission")
                break;
Don Gagne's avatar
Don Gagne committed
321
            case confirmLand:
322
                guidedModeConfirm.confirmText = qsTr("land")
Don Gagne's avatar
Don Gagne committed
323
                break;
Don Gagne's avatar
Don Gagne committed
324
            case confirmHome:
325
                guidedModeConfirm.confirmText = qsTr("return to land")
Don Gagne's avatar
Don Gagne committed
326
                break;
Don Gagne's avatar
Don Gagne committed
327 328
            case confirmChangeAlt:
                altitudeSlider.visible = true
329
                altitudeSlider.setInitialValueAppSettingsDistanceUnits(_activeVehicle.altitudeRelative.value)
330
                guidedModeConfirm.confirmText = qsTr("change altitude")
Don Gagne's avatar
Don Gagne committed
331 332
                break;
            case confirmGoTo:
333
                guidedModeConfirm.confirmText = qsTr("move vehicle")
Don Gagne's avatar
Don Gagne committed
334
                break;
335
            case confirmRetask:
336
                guidedModeConfirm.confirmText = qsTr("activate waypoint change")
337
                break;
338 339 340
            case confirmOrbit:
                guidedModeConfirm.confirmText = qsTr("enter orbit mode")
                break;
341 342 343
            case confirmAbort:
                guidedModeConfirm.confirmText = qsTr("abort landing")
                break;
Don Gagne's avatar
Don Gagne committed
344
            }
Don Gagne's avatar
Don Gagne committed
345
            _guidedModeBar.visible = false
Don Gagne's avatar
Don Gagne committed
346 347 348
            guidedModeConfirm.visible = true
        }

Don Gagne's avatar
Don Gagne committed
349 350
        Column {
            id:                 guidedModeColumn
Don Gagne's avatar
Don Gagne committed
351 352 353 354 355
            anchors.margins:    _margins
            anchors.top:        parent.top
            anchors.left:       parent.left
            spacing:            _margins

356 357
            QGCLabel {
                anchors.horizontalCenter: parent.horizontalCenter
358
                color:      _isSatellite ? qgcPal.mapWidgetBorderDark : qgcPal.mapWidgetBorderLight
359
                text:       "Click in map to move vehicle"
360
                visible:    gotoEnabled
361 362
            }

Don Gagne's avatar
Don Gagne committed
363
            Row {
Don Gagne's avatar
Don Gagne committed
364
                spacing: _margins * 2
Don Gagne's avatar
Don Gagne committed
365 366

                QGCButton {
367
                    pointSize:  _guidedModeBar._fontPointSize
368 369 370 371 372 373 374 375 376 377
                    text:       qsTr("Emergency Stop")
                    visible:    _showEmergenyStop && _activeVehicle && _activeVehicle.armed && _activeVehicle.flying
                    onClicked:  _guidedModeBar.confirmAction(_guidedModeBar.confirmEmergencyStop)
                }

                QGCButton {
                    pointSize:  _guidedModeBar._fontPointSize
                    text:       qsTr("Disarm")
                    visible:    _activeVehicle && _activeVehicle.armed && !_activeVehicle.flying
                    onClicked:  _guidedModeBar.confirmAction(_guidedModeBar.confirmDisarm)
378
                }
Don Gagne's avatar
Don Gagne committed
379

Don Gagne's avatar
Don Gagne committed
380
                QGCButton {
381
                    pointSize:  _guidedModeBar._fontPointSize
382
                    text:       qsTr("RTL")
383
                    visible:    _activeVehicle && _activeVehicle.armed && _activeVehicle.guidedModeSupported && _activeVehicle.flying
Don Gagne's avatar
Don Gagne committed
384
                    onClicked:  _guidedModeBar.confirmAction(_guidedModeBar.confirmHome)
385
                }
Don Gagne's avatar
Don Gagne committed
386

Don Gagne's avatar
Don Gagne committed
387
                QGCButton {
388
                    pointSize:  _guidedModeBar._fontPointSize
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412
                    text:       qsTr("Takeoff")
                    visible:    _activeVehicle && _activeVehicle.guidedModeSupported && !_activeVehicle.flying  && !_activeVehicle.fixedWing
                    onClicked:  _guidedModeBar.confirmAction(_guidedModeBar.confirmTakeoff)
                }

                QGCButton {
                    pointSize:  _guidedModeBar._fontPointSize
                    text:       qsTr("Land")
                    visible:    _activeVehicle && _activeVehicle.guidedModeSupported && _activeVehicle.armed && !_activeVehicle.fixedWing
                    onClicked:  _guidedModeBar.confirmAction(_guidedModeBar.confirmLand)
                }

                QGCButton {
                    pointSize:  _guidedModeBar._fontPointSize
                    text:       qsTr("Start Mission")
                    visible:    _activeVehicle && !_activeVehicle.flying && _missionAvailable
                    onClicked:  _guidedModeBar.confirmAction(_guidedModeBar.confirmStartMission)
                }

                QGCButton {
                    pointSize:  _guidedModeBar._fontPointSize
                    text:       qsTr("Resume Mission")
                    visible:    _activeVehicle && _activeVehicle.guidedModeSupported && !_activeVehicle.flying && _missionAvailable && _missionInProgress
                    onClicked:  _guidedModeBar.confirmAction(_guidedModeBar.confirmResumeMission)
413
                }
Don Gagne's avatar
Don Gagne committed
414

Don Gagne's avatar
Don Gagne committed
415
                QGCButton {
416
                    pointSize:  _guidedModeBar._fontPointSize
417 418 419
                    text:       _missionActive ? qsTr("Pause Mission") : qsTr("Pause")
                    visible:    _activeVehicle && _activeVehicle.armed && _activeVehicle.pauseVehicleSupported && _activeVehicle.flying
                    onClicked:  _activeVehicle.pauseVehicle()
420
                }
Don Gagne's avatar
Don Gagne committed
421

Don Gagne's avatar
Don Gagne committed
422
                QGCButton {
423
                    pointSize:  _guidedModeBar._fontPointSize
424
                    text:       qsTr("Change Altitude")
425
                    visible:    (_activeVehicle && _activeVehicle.flying) && _activeVehicle.guidedModeSupported && _activeVehicle.armed
Don Gagne's avatar
Don Gagne committed
426
                    onClicked:  _guidedModeBar.confirmAction(_guidedModeBar.confirmChangeAlt)
427
                }
428 429 430 431

                QGCButton {
                    pointSize:  _guidedModeBar._fontPointSize
                    text:       qsTr("Orbit")
432
                    visible:    _showOrbit && _activeVehicle && _activeVehicle.flying && _activeVehicle.orbitModeSupported && _activeVehicle.armed
433 434 435
                    onClicked:  _guidedModeBar.confirmAction(_guidedModeBar.confirmOrbit)
                }

436 437 438
                QGCButton {
                    pointSize:  _guidedModeBar._fontPointSize
                    text:       qsTr("Abort")
439
                    visible:    _activeVehicle && _activeVehicle.flying && _activeVehicle.fixedWing
440 441 442
                    onClicked:  _guidedModeBar.confirmAction(_guidedModeBar.confirmAbort)
                }

Don Gagne's avatar
Don Gagne committed
443 444
            } // Row
        } // Column
445 446
    } // Rectangle - Guided mode buttons

447
    MouseArea {
Don Gagne's avatar
Don Gagne committed
448 449 450
        anchors.fill:   parent
        enabled:        guidedModeConfirm.visible
        onClicked:      _guidedModeBar.rejectGuidedModeConfirm()
451 452
    }

453 454 455
    // Action confirmation control
    SliderSwitch {
        id:                         guidedModeConfirm
Don Gagne's avatar
Don Gagne committed
456 457
        anchors.bottomMargin:       _margins
        anchors.bottom:             parent.bottom
458 459 460
        anchors.horizontalCenter:   parent.horizontalCenter
        visible:                    false
        z:                          QGroundControl.zOrderWidgets
461
        fontPointSize:              _guidedModeBar._fontPointSize
462 463 464

        onAccept: {
            guidedModeConfirm.visible = false
Don Gagne's avatar
Don Gagne committed
465
            _guidedModeBar.visible = true
466 467
            _guidedModeBar.actionConfirmed()
            altitudeSlider.visible = false
Don Gagne's avatar
Don Gagne committed
468
            guidedModeHideTimer.restart()
Don Gagne's avatar
Don Gagne committed
469
        }
470

Don Gagne's avatar
Don Gagne committed
471
        onReject: _guidedModeBar.rejectGuidedModeConfirm()
472
    }
Don Gagne's avatar
Don Gagne committed
473 474 475 476 477 478 479 480 481 482 483 484 485

    //-- Altitude slider
    Rectangle {
        id:                 altitudeSlider
        anchors.margins:    _margins
        anchors.right:      parent.right
        anchors.top:        parent.top
        anchors.bottom:     parent.bottom
        color:              qgcPal.window
        width:              ScreenTools.defaultFontPixelWidth * 10
        opacity:            0.8
        visible:            false

486 487 488 489 490 491 492
        function setInitialValueMeters(meters) {
            altSlider.value = QGroundControl.metersToAppSettingsDistanceUnits(meters)
        }

        function setInitialValueAppSettingsDistanceUnits(height) {
            altSlider.value = height
        }
Don Gagne's avatar
Don Gagne committed
493 494 495

        /// Returns NaN for bad value
        function getValue() {
496 497 498 499 500 501
            var value =  parseFloat(altField.text)
            if (!isNaN(value)) {
                return QGroundControl.appSettingsDistanceUnitsToMeters(value);
            } else {
                return value;
            }
Don Gagne's avatar
Don Gagne committed
502 503 504 505 506 507 508 509 510 511 512
        }

        Column {
            id:                 headerColumn
            anchors.margins:    _margins
            anchors.top:        parent.top
            anchors.left:       parent.left
            anchors.right:      parent.right

            QGCLabel {
                anchors.horizontalCenter: parent.horizontalCenter
513
                text: qsTr("Alt (rel)")
Don Gagne's avatar
Don Gagne committed
514 515 516 517
            }

            QGCLabel {
                anchors.horizontalCenter: parent.horizontalCenter
518
                text: QGroundControl.appSettingsDistanceUnitsString
Don Gagne's avatar
Don Gagne committed
519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536
            }

            QGCTextField {
                id:             altField
                anchors.left:   parent.left
                anchors.right:  parent.right
                text:           altSlider.value.toFixed(1)
            }
        }

        Slider {
            id:                 altSlider
            anchors.margins:    _margins
            anchors.top:        headerColumn.bottom
            anchors.bottom:     parent.bottom
            anchors.left:       parent.left
            anchors.right:      parent.right
            orientation:        Qt.Vertical
537 538
            minimumValue:       QGroundControl.metersToAppSettingsDistanceUnits(0)
            maximumValue:       QGroundControl.metersToAppSettingsDistanceUnits((_activeVehicle && _activeVehicle.flying) ? Math.round((_activeVehicle.altitudeRelative.value + 100) / 100) * 100 : 10)
Don Gagne's avatar
Don Gagne committed
539 540
        }
    }
541
}