FlightDisplay.qml 26.4 KB
Newer Older
dogmaphobic's avatar
dogmaphobic committed
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
/*=====================================================================

QGroundControl Open Source Ground Control Station

(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>

This file is part of the QGROUNDCONTROL project

    QGROUNDCONTROL is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    QGROUNDCONTROL is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.

======================================================================*/

/**
 * @file
26
 *   @brief QGC Main Flight Display
dogmaphobic's avatar
dogmaphobic committed
27 28 29 30
 *   @author Gus Grubba <mavlink@grubba.com>
 */

import QtQuick 2.3
31
import QtQuick.Controls 1.3
dogmaphobic's avatar
dogmaphobic committed
32
import QtQuick.Controls.Styles 1.2
33
import QtQuick.Dialogs 1.2
dogmaphobic's avatar
dogmaphobic committed
34

35
import QGroundControl.FlightControls 1.0
36 37 38
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
dogmaphobic's avatar
dogmaphobic committed
39

40
Item {
dogmaphobic's avatar
dogmaphobic committed
41
    id: root
42 43 44

    property ScreenTools __screenTools: ScreenTools { }
    property var __qgcPal: QGCPalette { colorGroupEnabled: enabled }
dogmaphobic's avatar
dogmaphobic committed
45 46 47 48

    property real roll:    isNaN(flightDisplay.roll)    ? 0 : flightDisplay.roll
    property real pitch:   isNaN(flightDisplay.pitch)   ? 0 : flightDisplay.pitch

49 50 51
    property bool showPitchIndicator:       true
    property bool showAttitudeIndicator:    true
    property bool showCompass:              true
52

53 54 55 56 57 58 59 60
    function getBool(value) {
        return value === '0' ? false : true;
    }

    function setBool(value) {
        return value ? "1" : "0";
    }

dogmaphobic's avatar
dogmaphobic committed
61 62
    Component.onCompleted:
    {
63 64
        mapBackground.visible               = getBool(flightDisplay.loadSetting("showMapBackground",        "0"));
        mapBackground.alwaysNorth           = getBool(flightDisplay.loadSetting("mapAlwaysPointsNorth",     "0"));
65 66
        showAttitudeIndicator               = getBool(flightDisplay.loadSetting("showAttitudeIndicator",    "1"));
        showPitchIndicator                  = getBool(flightDisplay.loadSetting("showPitchIndicator",       "1"));
67
        showCompass                         = getBool(flightDisplay.loadSetting("showCompass",              "1"));
68 69 70 71 72 73 74
        altitudeWidget.visible              = getBool(flightDisplay.loadSetting("showAltitudeWidget",       "1"));
        speedWidget.visible                 = getBool(flightDisplay.loadSetting("showSpeedWidget",          "1"));
        currentSpeed.showAirSpeed           = getBool(flightDisplay.loadSetting("showCurrentAirSpeed",      "1"));
        currentSpeed.showGroundSpeed        = getBool(flightDisplay.loadSetting("showCurrentGroundSpeed",   "1"));
        currentAltitude.showClimbRate       = getBool(flightDisplay.loadSetting("showCurrentClimbRate",     "1"));
        currentAltitude.showAltitude        = getBool(flightDisplay.loadSetting("showCurrentAltitude",      "1"));
        mapTypeMenu.update();
dogmaphobic's avatar
dogmaphobic committed
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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 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 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273
    // TODO: This is to replace the context menu but it is not working. Not only the buttons don't show,
    // the default placement is random and mostly off screen on mobile devices.
    Dialog {
        id: optionsDialog
        modality: Qt.WindowModal
        title: "Flight Display Options"
        standardButtons: StandardButton.Close | StandardButton.RestoreDefaults
        onReset: {
            showPitchIndicator = true;
            flightDisplay.saveSetting("showPitchIndicator", setBool(showPitchIndicator));
            showAttitudeIndicator = true;
            flightDisplay.saveSetting("showAttitudeIndicator", setBool(showAttitudeIndicator));
            showCompass = true;
            flightDisplay.saveSetting("showCompass", setBool(showCompass));
            altitudeWidget.visible = true;
            flightDisplay.saveSetting("showAltitudeWidget", setBool(altitudeWidget.visible));
            currentAltitude.showAltitude = true;
            flightDisplay.saveSetting("showCurrentAltitude", setBool(currentAltitude.showAltitude));
            currentAltitude.showClimbRate = true;
            flightDisplay.saveSetting("showCurrentClimbRate", setBool(currentAltitude.showClimbRate));
            speedWidget.visible = true;
            flightDisplay.saveSetting("showSpeedWidget", setBool(speedWidget.visible));
            currentSpeed.showAirSpeed = true;
            flightDisplay.saveSetting("showCurrentAirSpeed", setBool(currentSpeed.showAirSpeed));
            currentSpeed.showGroundSpeed = true;
            flightDisplay.saveSetting("showCurrentGroundSpeed", setBool(currentSpeed.showGroundSpeed));
            mapBackground.visible = false;
            flightDisplay.saveSetting("showMapBackground", setBool(mapBackground.visible));
            mapBackground.alwaysNorth = false;
            flightDisplay.saveSetting("mapAlwaysPointsNorth", setBool(mapBackground.alwaysNorth));
        }
        contentItem: Rectangle {
            color: __qgcPal.window
            implicitWidth:  __screenTools.pixelSizeFactor * (360)
            implicitHeight: __screenTools.pixelSizeFactor * (300)
            Column {
                id: dialogColumn
                anchors.centerIn: parent
                spacing:  __screenTools.adjustPixelSize(10)
                width: parent.width
                Grid {
                    columns: 2
                    spacing:    __screenTools.pixelSizeFactor * (8)
                    rowSpacing: __screenTools.pixelSizeFactor * (10)
                    anchors.horizontalCenter: parent.horizontalCenter
                    QGCCheckBox {
                        text: "Map Background"
                        checked: mapBackground.visible
                        onClicked:
                        {
                            mapBackground.visible = !mapBackground.visible;
                            flightDisplay.saveSetting("showMapBackground", setBool(mapBackground.visible));
                        }
                    }
                    QGCCheckBox {
                        text: "Pitch Indicator"
                        checked: showPitchIndicator
                        onClicked:
                        {
                            showPitchIndicator = !showPitchIndicator;
                            flightDisplay.saveSetting("showPitchIndicator", setBool(showPitchIndicator));
                        }
                    }
                    QGCCheckBox {
                        text: "Attitude Indicator"
                        checked: showAttitudeIndicator
                        onClicked:
                        {
                            showAttitudeIndicator = !showAttitudeIndicator;
                            flightDisplay.saveSetting("showAttitudeIndicator", setBool(showAttitudeIndicator));
                        }
                    }
                    QGCCheckBox {
                        text: "Compass"
                        checked: showCompass
                        onClicked:
                        {
                            showCompass = !showCompass;
                            flightDisplay.saveSetting("showCompass", setBool(showCompass));
                        }
                    }
                    QGCCheckBox {
                        text: "Altitude Indicator"
                        checked: altitudeWidget.visible
                        onClicked:
                        {
                            altitudeWidget.visible = !altitudeWidget.visible;
                            flightDisplay.saveSetting("showAltitudeWidget", setBool(altitudeWidget.visible));
                        }
                    }
                    QGCCheckBox {
                        text: "Current Altitude"
                        checked: currentAltitude.showAltitude
                        onClicked:
                        {
                            currentAltitude.showAltitude = !currentAltitude.showAltitude;
                            flightDisplay.saveSetting("showCurrentAltitude", setBool(currentAltitude.showAltitude));
                        }
                    }
                    QGCCheckBox {
                        text: "Current Climb Rate"
                        checked: currentAltitude.showClimbRate
                        onClicked:
                        {
                            currentAltitude.showClimbRate = !currentAltitude.showClimbRate;
                            flightDisplay.saveSetting("showCurrentClimbRate", setBool(currentAltitude.showClimbRate));
                        }
                    }
                    QGCCheckBox {
                        text: "Speed Indicator"
                        checked: speedWidget.visible
                        onClicked:
                        {
                            speedWidget.visible = !speedWidget.visible;
                            flightDisplay.saveSetting("showSpeedWidget", setBool(speedWidget.visible));
                        }
                    }
                    QGCCheckBox {
                        text: "Current Air Speed"
                        checked: currentSpeed.showAirSpeed
                        onClicked:
                        {
                            currentSpeed.showAirSpeed = !currentSpeed.showAirSpeed;
                            flightDisplay.saveSetting("showCurrentAirSpeed", setBool(currentSpeed.showAirSpeed));
                        }
                    }
                    QGCCheckBox {
                        text: "Current Ground Speed"
                        checked: currentSpeed.showGroundSpeed
                        onClicked:
                        {
                            currentSpeed.showGroundSpeed = !currentSpeed.showGroundSpeed;
                            flightDisplay.saveSetting("showCurrentGroundSpeed", setBool(currentSpeed.showGroundSpeed));
                        }
                    }
                }
                //-- Hack tool to find optimal scale factor
                Column {
                    id: fudgeColumn
                    anchors.horizontalCenter: parent.horizontalCenter
                    spacing:    __screenTools.adjustPixelSize(4)
                    width:      parent.width
                    QGCLabel {
                        text: "Adjust Pixel Size Factor"
                        anchors.horizontalCenter: parent.horizontalCenter
                    }
                    Row {
                        spacing:    __screenTools.adjustPixelSize(4)
                        anchors.horizontalCenter: parent.horizontalCenter
                        Button {
                            text: 'Inc'
                            onClicked: {
                                __screenTools.increasePixelSize()
                            }
                        }
                        Label {
                            text: __screenTools.pixelSizeFactor.toFixed(2)
                            color: __qgcPal.text
                            anchors.verticalCenter: parent.verticalCenter
                        }
                        Button {
                            text: 'Dec'
                            onClicked: {
                                __screenTools.decreasePixelSize()
                            }
                        }
                    }
                    QGCLabel {
                        text: "Adjust Font Size Factor"
                        anchors.horizontalCenter: parent.horizontalCenter
                    }
                    Row {
                        spacing:    __screenTools.adjustPixelSize(4)
                        anchors.horizontalCenter: parent.horizontalCenter
                        Button {
                            text: 'Inc'
                            onClicked: {
                                __screenTools.increaseFontSize()
                            }
                        }
                        Label {
                            text: __screenTools.fontPointFactor.toFixed(2)
                            color: __qgcPal.text
                            anchors.verticalCenter: parent.verticalCenter
                        }
                        Button {
                            text: 'Dec'
                            onClicked: {
                                __screenTools.decreaseFontSize()
                            }
                        }
                    }
                }
            }
        }
    }

dogmaphobic's avatar
dogmaphobic committed
274 275 276 277
    Menu {
        id: contextMenu

        MenuItem {
278
            text: "Map Background"
dogmaphobic's avatar
dogmaphobic committed
279
            checkable: true
280
            checked: mapBackground.visible
dogmaphobic's avatar
dogmaphobic committed
281 282
            onTriggered:
            {
283 284
                mapBackground.visible = !mapBackground.visible;
                flightDisplay.saveSetting("showMapBackground", setBool(mapBackground.visible));
dogmaphobic's avatar
dogmaphobic committed
285 286 287
            }
        }

288 289 290 291 292 293 294 295 296 297
        /*
        MenuItem {
            text: "Options Dialog"
            onTriggered:
            {
                optionsDialog.open()
            }
        }
        */

298
        /*
dogmaphobic's avatar
dogmaphobic committed
299
        MenuItem {
300
            text: "Map Always Points North"
dogmaphobic's avatar
dogmaphobic committed
301
            checkable: true
302
            checked: mapBackground.alwaysNorth
dogmaphobic's avatar
dogmaphobic committed
303 304
            onTriggered:
            {
305 306
                mapBackground.alwaysNorth = !mapBackground.alwaysNorth;
                flightDisplay.saveSetting("mapAlwaysPointsNorth", setBool(mapBackground.alwaysNorth));
dogmaphobic's avatar
dogmaphobic committed
307 308
            }
        }
309 310 311 312 313
        */

        Menu {
            id: mapTypeMenu
            title: "Map Type..."
314
            ExclusiveGroup { id: currMapType }
315 316 317 318 319 320 321 322 323 324 325 326 327
            function setCurrentMap(map) {
                for (var i = 0; i < mapBackground.mapItem.supportedMapTypes.length; i++) {
                    if (map === mapBackground.mapItem.supportedMapTypes[i].name) {
                        mapBackground.mapItem.activeMapType = mapBackground.mapItem.supportedMapTypes[i]
                        flightDisplay.saveSetting("currentMapType", map);
                        return;
                    }
                }
            }
            function addMap(map, checked) {
                var mItem = mapTypeMenu.addItem(map);
                mItem.checkable = true
                mItem.checked   = checked
328
                mItem.exclusiveGroup = currMapType
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347
                var menuSlot = function() {setCurrentMap(map);};
                mItem.triggered.connect(menuSlot);
            }
            function update() {
                clear()
                var map = ''
                if (mapBackground.mapItem.supportedMapTypes.length > 0)
                    map = mapBackground.mapItem.activeMapType.name;
                map = flightDisplay.loadSetting("currentMapType", map);
                for (var i = 0; i < mapBackground.mapItem.supportedMapTypes.length; i++) {
                    var name = mapBackground.mapItem.supportedMapTypes[i].name;
                    addMap(name, map === name);
                }
                if(map != '')
                    setCurrentMap(map);
            }
        }

        MenuSeparator {}
dogmaphobic's avatar
dogmaphobic committed
348 349 350

        MenuItem {
            text: "Pitch Indicator"
351 352
            checkable:  true
            checked:    showPitchIndicator
dogmaphobic's avatar
dogmaphobic committed
353 354
            onTriggered:
            {
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378
                showPitchIndicator = !showPitchIndicator;
                flightDisplay.saveSetting("showPitchIndicator", setBool(showPitchIndicator));
            }
        }

        MenuItem {
            text: "Attitude Indicator"
            checkable:  true
            checked:    showAttitudeIndicator
            onTriggered:
            {
                showAttitudeIndicator = !showAttitudeIndicator;
                flightDisplay.saveSetting("showAttitudeIndicator", setBool(showAttitudeIndicator));
            }
        }

        MenuItem {
            text: "Compass"
            checkable: true
            checked: showCompass
            onTriggered:
            {
                showCompass = !showCompass;
                flightDisplay.saveSetting("showCompass", setBool(showCompass));
dogmaphobic's avatar
dogmaphobic committed
379 380 381 382 383 384 385 386 387 388
            }
        }

        MenuItem {
            text: "Altitude Indicator"
            checkable: true
            checked: altitudeWidget.visible
            onTriggered:
            {
                altitudeWidget.visible = !altitudeWidget.visible;
389
                flightDisplay.saveSetting("showAltitudeWidget", setBool(altitudeWidget.visible));
dogmaphobic's avatar
dogmaphobic committed
390 391 392 393 394 395 396 397 398 399
            }
        }

        MenuItem {
            text: "Current Altitude"
            checkable: true
            checked: currentAltitude.showAltitude
            onTriggered:
            {
                currentAltitude.showAltitude = !currentAltitude.showAltitude;
400
                flightDisplay.saveSetting("showCurrentAltitude", setBool(currentAltitude.showAltitude));
dogmaphobic's avatar
dogmaphobic committed
401 402 403 404 405 406 407 408 409 410
            }
        }

        MenuItem {
            text: "Current Climb Rate"
            checkable: true
            checked: currentAltitude.showClimbRate
            onTriggered:
            {
                currentAltitude.showClimbRate = !currentAltitude.showClimbRate;
411
                flightDisplay.saveSetting("showCurrentClimbRate", setBool(currentAltitude.showClimbRate));
dogmaphobic's avatar
dogmaphobic committed
412 413 414 415 416 417 418 419 420 421
            }
        }

        MenuItem {
            text: "Speed Indicator"
            checkable: true
            checked: speedWidget.visible
            onTriggered:
            {
                speedWidget.visible = !speedWidget.visible;
422
                flightDisplay.saveSetting("showSpeedWidget", setBool(speedWidget.visible));
dogmaphobic's avatar
dogmaphobic committed
423 424 425 426 427 428 429 430 431 432
            }
        }

        MenuItem {
            text: "Current Air Speed"
            checkable: true
            checked: currentSpeed.showAirSpeed
            onTriggered:
            {
                currentSpeed.showAirSpeed = !currentSpeed.showAirSpeed;
433
                flightDisplay.saveSetting("showCurrentAirSpeed", setBool(currentSpeed.showAirSpeed));
dogmaphobic's avatar
dogmaphobic committed
434 435 436 437 438 439 440 441 442 443
            }
        }

        MenuItem {
            text: "Current Ground Speed"
            checkable: true
            checked: currentSpeed.showGroundSpeed
            onTriggered:
            {
                currentSpeed.showGroundSpeed = !currentSpeed.showGroundSpeed;
444
                flightDisplay.saveSetting("showCurrentGroundSpeed", setBool(currentSpeed.showGroundSpeed));
dogmaphobic's avatar
dogmaphobic committed
445 446 447 448 449 450 451 452 453
            }
        }

        MenuSeparator {}

        MenuItem {
            text: "Restore Defaults"
            onTriggered:
            {
454
                showPitchIndicator = true;
455
                flightDisplay.saveSetting("showPitchIndicator", setBool(showPitchIndicator));
456 457 458 459
                showAttitudeIndicator = true;
                flightDisplay.saveSetting("showAttitudeIndicator", setBool(showAttitudeIndicator));
                showCompass = true;
                flightDisplay.saveSetting("showCompass", setBool(showCompass));
dogmaphobic's avatar
dogmaphobic committed
460
                altitudeWidget.visible = true;
461
                flightDisplay.saveSetting("showAltitudeWidget", setBool(altitudeWidget.visible));
dogmaphobic's avatar
dogmaphobic committed
462
                currentAltitude.showAltitude = true;
463
                flightDisplay.saveSetting("showCurrentAltitude", setBool(currentAltitude.showAltitude));
dogmaphobic's avatar
dogmaphobic committed
464
                currentAltitude.showClimbRate = true;
465
                flightDisplay.saveSetting("showCurrentClimbRate", setBool(currentAltitude.showClimbRate));
dogmaphobic's avatar
dogmaphobic committed
466
                speedWidget.visible = true;
467
                flightDisplay.saveSetting("showSpeedWidget", setBool(speedWidget.visible));
dogmaphobic's avatar
dogmaphobic committed
468
                currentSpeed.showAirSpeed = true;
469
                flightDisplay.saveSetting("showCurrentAirSpeed", setBool(currentSpeed.showAirSpeed));
dogmaphobic's avatar
dogmaphobic committed
470
                currentSpeed.showGroundSpeed = true;
471 472 473 474 475
                flightDisplay.saveSetting("showCurrentGroundSpeed", setBool(currentSpeed.showGroundSpeed));
                mapBackground.visible = false;
                flightDisplay.saveSetting("showMapBackground", setBool(mapBackground.visible));
                mapBackground.alwaysNorth = false;
                flightDisplay.saveSetting("mapAlwaysPointsNorth", setBool(mapBackground.alwaysNorth));
dogmaphobic's avatar
dogmaphobic committed
476 477 478 479 480 481
            }
        }

    }

    QGCMapBackground {
482 483 484 485 486 487 488
        id:                 mapBackground
        anchors.fill:       parent
        heading:            0 // isNaN(flightDisplay.heading) ? 0 : flightDisplay.heading
        latitude:           mapBackground.visible ? ((flightDisplay.latitude  === 0) ?   37.803784 : flightDisplay.latitude)  :   37.803784
        longitude:          mapBackground.visible ? ((flightDisplay.longitude === 0) ? -122.462276 : flightDisplay.longitude) : -122.462276
        interactive:        !flightDisplay.mavPresent
        z:                  10
dogmaphobic's avatar
dogmaphobic committed
489 490
    }

491 492
    QGCCompassInstrument {
        id:                 compassInstrument
493 494 495
        y:                  __screenTools.pixelSizeFactor * (5)
        x:                  __screenTools.pixelSizeFactor * (85)
        size:               __screenTools.pixelSizeFactor * (160)
496 497 498 499
        heading:            isNaN(flightDisplay.heading) ? 0 : flightDisplay.heading
        visible:            mapBackground.visible && showCompass
        z:                  mapBackground.z + 1
        onResetRequested: {
500 501 502
            y               = __screenTools.pixelSizeFactor * (5)
            x               = __screenTools.pixelSizeFactor * (85)
            size            = __screenTools.pixelSizeFactor * (160)
503 504 505 506 507 508 509
            tForm.xScale    = 1
            tForm.yScale    = 1
        }
    }

    QGCAttitudeInstrument {
        id:                 attitudeInstrument
510 511
        y:                  __screenTools.pixelSizeFactor * (5)
        size:               __screenTools.pixelSizeFactor * (160)
512 513 514 515 516
        rollAngle:          roll
        pitchAngle:         pitch
        showPitch:          showPitchIndicator
        visible:            mapBackground.visible && showAttitudeIndicator
        anchors.right:      root.right
517
        anchors.rightMargin: __screenTools.pixelSizeFactor * (85)
518 519
        z:                  mapBackground.z + 1
        onResetRequested: {
520
            y                   = __screenTools.pixelSizeFactor * (5)
521
            anchors.right       = root.right
522 523
            anchors.rightMargin = __screenTools.pixelSizeFactor * (85)
            size                = __screenTools.pixelSizeFactor * (160)
524 525 526 527 528
            tForm.xScale        = 1
            tForm.yScale        = 1
        }
    }

529 530 531
    QGCArtificialHorizon {
        id:                 artificialHoriz
        anchors.fill:       parent
dogmaphobic's avatar
dogmaphobic committed
532 533
        rollAngle:          roll
        pitchAngle:         pitch
534
        visible:            !mapBackground.visible
dogmaphobic's avatar
dogmaphobic committed
535
        z:                  10
dogmaphobic's avatar
dogmaphobic committed
536 537
    }

538 539 540 541 542 543 544 545 546 547
    QGCAttitudeWidget {
        id:                 attitudeWidget
        rollAngle:          roll
        pitchAngle:         pitch
        visible:            !mapBackground.visible && showAttitudeIndicator
        width:              __screenTools.pixelSizeFactor * (260)
        height:             __screenTools.pixelSizeFactor * (260)
        z:                  20
    }

dogmaphobic's avatar
dogmaphobic committed
548
    QGCPitchWidget {
549 550
        id:                 pitchWidget
        visible:            showPitchIndicator && !mapBackground.visible
dogmaphobic's avatar
dogmaphobic committed
551
        anchors.verticalCenter: parent.verticalCenter
552 553 554
        pitchAngle:         pitch
        rollAngle:          roll
        color:              Qt.rgba(0,0,0,0)
555
        size:               __screenTools.pixelSizeFactor * (120)
556
        z:                  30
dogmaphobic's avatar
dogmaphobic committed
557 558 559
    }

    QGCAltitudeWidget {
560 561
        id:                 altitudeWidget
        anchors.right:      parent.right
562 563
        width:              __screenTools.pixelSizeFactor * (60)
        height:             parent.height * 0.65 > __screenTools.pixelSizeFactor * (280) ? __screenTools.pixelSizeFactor * (280) : parent.height * 0.65
564 565
        altitude:           flightDisplay.altitudeWGS84
        z:                  30
dogmaphobic's avatar
dogmaphobic committed
566 567 568
    }

    QGCSpeedWidget {
569 570
        id:                 speedWidget
        anchors.left:       parent.left
571 572
        width:              __screenTools.pixelSizeFactor * (60)
        height:             parent.height * 0.65 > __screenTools.pixelSizeFactor * (280) ? __screenTools.pixelSizeFactor * (280) : parent.height * 0.65
573 574
        speed:              flightDisplay.groundSpeed
        z:                  40
dogmaphobic's avatar
dogmaphobic committed
575 576 577 578 579
    }

    QGCCurrentSpeed {
        id: currentSpeed
        anchors.left:       parent.left
580
        width:              __screenTools.pixelSizeFactor * (75)
dogmaphobic's avatar
dogmaphobic committed
581 582 583 584
        airspeed:           flightDisplay.airSpeed
        groundspeed:        flightDisplay.groundSpeed
        showAirSpeed:       true
        showGroundSpeed:    true
dogmaphobic's avatar
dogmaphobic committed
585
        visible:            (currentSpeed.showGroundSpeed || currentSpeed.showAirSpeed)
dogmaphobic's avatar
dogmaphobic committed
586 587 588 589 590
        z:                  50
    }

    QGCCurrentAltitude {
        id: currentAltitude
dogmaphobic's avatar
dogmaphobic committed
591
        anchors.right:      parent.right
592
        width:              __screenTools.pixelSizeFactor * (75)
dogmaphobic's avatar
dogmaphobic committed
593 594 595 596 597 598
        altitude:           flightDisplay.altitudeWGS84
        vertZ:              flightDisplay.climbRate
        showAltitude:       true
        showClimbRate:      true
        visible:            (currentAltitude.showAltitude || currentAltitude.showClimbRate)
        z:                  60
dogmaphobic's avatar
dogmaphobic committed
599 600 601
    }

    QGCCompass {
602 603
        id:                 compassIndicator
        y:                  root.height * 0.7
604 605 606
        x:                  root.width  * 0.5 - __screenTools.pixelSizeFactor * (60)
        width:              __screenTools.pixelSizeFactor * (120)
        height:             __screenTools.pixelSizeFactor * (120)
607 608 609
        heading:            isNaN(flightDisplay.heading) ? 0 : flightDisplay.heading
        visible:            !mapBackground.visible && showCompass
        z:                  70
dogmaphobic's avatar
dogmaphobic committed
610 611
    }

612 613 614
    // Button at upper left corner
    Item {
        id:             optionsButton
615 616 617 618
        x:              __screenTools.pixelSizeFactor * (5)
        y:              __screenTools.pixelSizeFactor * (5)
        width:          __screenTools.pixelSizeFactor * (30)
        height:         __screenTools.pixelSizeFactor * (30)
619 620 621 622 623 624 625 626 627 628 629 630 631
        opacity:        0.85
        z:              1000
        Image {
            id:             buttomImg
            anchors.fill:   parent
            source:         "/qml/buttonMore.svg"
            mipmap:         true
            smooth:         true
            antialiasing:   true
            fillMode:       Image.PreserveAspectFit
        }
        MouseArea {
            anchors.fill: parent
632
            acceptedButtons: Qt.LeftButton | Qt.RightButton
633 634 635
            onClicked: {
                if (mouse.button == Qt.LeftButton)
                {
636 637 638 639 640 641
                    contextMenu.popup();
                }
                // Experimental
                if (mouse.button == Qt.RightButton)
                {
                    optionsDialog.open();
642
                }
dogmaphobic's avatar
dogmaphobic committed
643 644
            }
        }
645
    }
646

dogmaphobic's avatar
dogmaphobic committed
647
}