GPSRTKIndicator.qml 4.48 KB
Newer Older
1 2
/****************************************************************************
 *
3
 *   (c) 2017 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 5 6 7 8 9
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

Gus Grubba's avatar
Gus Grubba committed
10 11
import QtQuick          2.11
import QtQuick.Layouts  1.11
12 13 14 15 16 17 18 19 20

import QGroundControl                       1.0
import QGroundControl.Controls              1.0
import QGroundControl.ScreenTools           1.0
import QGroundControl.Palette               1.0

//-------------------------------------------------------------------------
//-- GPS Indicator
Item {
21
    id:             _root
Don Gagne's avatar
Don Gagne committed
22
    width:          visible ? (gpsValuesColumn.x + gpsValuesColumn.width) * 1.1 : 0
23 24
    anchors.top:    parent.top
    anchors.bottom: parent.bottom
25
    visible:        QGroundControl.gpsRtk.connected.value
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45

    Component {
        id: gpsInfo

        Rectangle {
            width:  gpsCol.width   + ScreenTools.defaultFontPixelWidth  * 3
            height: gpsCol.height  + ScreenTools.defaultFontPixelHeight * 2
            radius: ScreenTools.defaultFontPixelHeight * 0.5
            color:  qgcPal.window
            border.color:   qgcPal.text

            Column {
                id:                 gpsCol
                spacing:            ScreenTools.defaultFontPixelHeight * 0.5
                width:              Math.max(gpsGrid.width, gpsLabel.width)
                anchors.margins:    ScreenTools.defaultFontPixelHeight
                anchors.centerIn:   parent

                QGCLabel {
                    id:             gpsLabel
46
                    text: (QGroundControl.gpsRtk.active.value) ? qsTr("Survey-in Active") : qsTr("RTK Streaming")
47 48 49 50 51 52
                    font.family:    ScreenTools.demiboldFontFamily
                    anchors.horizontalCenter: parent.horizontalCenter
                }

                GridLayout {
                    id:                 gpsGrid
53
                    visible:            true
54 55 56 57 58
                    anchors.margins:    ScreenTools.defaultFontPixelHeight
                    columnSpacing:      ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter: parent.horizontalCenter
                    columns: 2

59 60 61 62 63 64 65 66 67
                    QGCLabel {
                        text: qsTr("Duration:")
                        visible: QGroundControl.gpsRtk.active.value
                        }
                    QGCLabel {
                        text: QGroundControl.gpsRtk.currentDuration.value + ' s'
                        visible: QGroundControl.gpsRtk.active.value
                        }
                    QGCLabel {
68 69
                        // during survey-in show the current accuracy, after that show the final accuracy
                        text: QGroundControl.gpsRtk.valid.value ? qsTr("Accuracy:") : qsTr("Current Accuracy:")
70
                        visible: QGroundControl.gpsRtk.currentAccuracy.value > 0
71 72
                        }
                    QGCLabel {
DonLakeFlyer's avatar
DonLakeFlyer committed
73
                        text: QGroundControl.gpsRtk.currentAccuracy.valueString + " " + QGroundControl.appSettingsDistanceUnitsString
74
                        visible: QGroundControl.gpsRtk.currentAccuracy.value > 0
75 76
                        }
                    QGCLabel { text: qsTr("Satellites:") }
77
                    QGCLabel { text: QGroundControl.gpsRtk.numSatellites.value }
78 79 80 81 82 83 84 85 86 87
                }
            }
        }
    }

    QGCColoredImage {
        id:                 gpsIcon
        width:              height
        anchors.top:        parent.top
        anchors.bottom:     parent.bottom
DonLakeFlyer's avatar
DonLakeFlyer committed
88
        source:             "/qmlimages/RTK.svg"
89 90
        fillMode:           Image.PreserveAspectFit
        sourceSize.height:  height
91 92
        opacity:            1
        color:              QGroundControl.gpsRtk.active.value ? qgcPal.colorRed : qgcPal.buttonText
93 94 95 96 97 98 99 100 101
    }

    Column {
        id:                     gpsValuesColumn
        anchors.verticalCenter: parent.verticalCenter
        anchors.leftMargin:     ScreenTools.defaultFontPixelWidth / 2
        anchors.left:           gpsIcon.right

        QGCLabel {
102
            anchors.horizontalCenter:   parent.horizontalCenter
103
            color:                      qgcPal.buttonText
104
            text:                       QGroundControl.gpsRtk.numSatellites.value
105 106
        }
    }
107

108 109 110
    MouseArea {
        anchors.fill:   parent
        onClicked: {
111
            mainWindow.showPopUp(_root, gpsInfo)
112 113 114
        }
    }
}