MainToolBarIndicators.qml 4.19 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.
 *
 ****************************************************************************/
dogmaphobic's avatar
dogmaphobic committed
9 10


11 12 13
import QtQuick          2.3
import QtQuick.Controls 1.2
import QtQuick.Layouts  1.2
dogmaphobic's avatar
dogmaphobic committed
14

Don Gagne's avatar
Don Gagne committed
15 16 17 18 19
import QGroundControl                       1.0
import QGroundControl.Controls              1.0
import QGroundControl.MultiVehicleManager   1.0
import QGroundControl.ScreenTools           1.0
import QGroundControl.Palette               1.0
dogmaphobic's avatar
dogmaphobic committed
20

Don Gagne's avatar
Don Gagne committed
21
Item {
22 23
    property var  _activeVehicle:        QGroundControl.multiVehicleManager.activeVehicle
    property bool _communicationLost:    _activeVehicle ? _activeVehicle.connectionLost : false
dogmaphobic's avatar
dogmaphobic committed
24

Don Gagne's avatar
Don Gagne committed
25 26
    QGCPalette { id: qgcPal }

27

DonLakeFlyer's avatar
DonLakeFlyer committed
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
    // Easter egg mechanism
    MouseArea {
        anchors.fill: parent
        onClicked: {
            console.log("easter egg click", ++_clickCount)
            eggTimer.restart()
            if (_clickCount == 5) {
                QGroundControl.corePlugin.showAdvancedUI = true
            } else if (_clickCount == 7) {
                QGroundControl.corePlugin.showTouchAreas = true
            }
        }

        property int _clickCount: 0

        Timer {
            id:             eggTimer
            interval:       1000
            onTriggered:    parent._clickCount = 0
        }
    }

50 51 52 53 54 55
    QGCLabel {
        id:                     waitForVehicle
        anchors.verticalCenter: parent.verticalCenter
        text:                   qsTr("Waiting For Vehicle Connection")
        font.pointSize:         ScreenTools.mediumFontPointSize
        font.family:            ScreenTools.demiboldFontFamily
56
        color:                  qgcPal.colorRed
57 58 59
        visible:                !_activeVehicle
    }

Don Gagne's avatar
Don Gagne committed
60 61 62 63 64
    Row {
        id:             indicatorRow
        anchors.top:    parent.top
        anchors.bottom: parent.bottom
        spacing:        ScreenTools.defaultFontPixelWidth * 1.5
65 66
        visible:        _activeVehicle && !_communicationLost

67
        Repeater {
68
            model:      _activeVehicle ? _activeVehicle.toolBarIndicators : []
69
            Loader {
Don Gagne's avatar
Don Gagne committed
70 71
                anchors.top:    parent.top
                anchors.bottom: parent.bottom
72
                source:         modelData;
dogmaphobic's avatar
dogmaphobic committed
73 74
            }
        }
75
    }
Don Gagne's avatar
Don Gagne committed
76 77 78 79 80

    Image {
        anchors.right:          parent.right
        anchors.top:            parent.top
        anchors.bottom:         parent.bottom
81
        visible:                x > indicatorRow.width && !_communicationLost
Don Gagne's avatar
Don Gagne committed
82
        fillMode:               Image.PreserveAspectFit
83 84 85 86 87 88
        source:                 _outdoorPalette ? _brandImageOutdoor : _brandImageIndoor

        property bool   _outdoorPalette:        qgcPal.globalTheme === QGCPalette.Light
        property bool   _corePluginBranding:    QGroundControl.corePlugin.brandImageIndoor.length != 0
        property string _brandImageIndoor:      _corePluginBranding ? QGroundControl.corePlugin.brandImageIndoor : (_activeVehicle ? _activeVehicle.brandImageIndoor : "")
        property string _brandImageOutdoor:     _corePluginBranding ? QGroundControl.corePlugin.brandImageOutdoor : (_activeVehicle ? _activeVehicle.brandImageOutdoor : "")
dogmaphobic's avatar
dogmaphobic committed
89
    }
dogmaphobic's avatar
dogmaphobic committed
90

Don Gagne's avatar
Don Gagne committed
91 92 93 94
    Row {
        anchors.fill:       parent
        layoutDirection:    Qt.RightToLeft
        spacing:            ScreenTools.defaultFontPixelWidth
95
        visible:            _communicationLost
Don Gagne's avatar
Don Gagne committed
96 97 98 99 100 101

        QGCButton {
            id:                     disconnectButton
            anchors.verticalCenter: parent.verticalCenter
            text:                   qsTr("Disconnect")
            primary:                true
102
            onClicked:              _activeVehicle.disconnectInactiveVehicle()
Don Gagne's avatar
Don Gagne committed
103
        }
dogmaphobic's avatar
dogmaphobic committed
104

Don Gagne's avatar
Don Gagne committed
105 106 107 108 109 110
        QGCLabel {
            id:                     connectionLost
            anchors.verticalCenter: parent.verticalCenter
            text:                   qsTr("COMMUNICATION LOST")
            font.pointSize:         ScreenTools.largeFontPointSize
            font.family:            ScreenTools.demiboldFontFamily
111
            color:                  qgcPal.colorRed
Don Gagne's avatar
Don Gagne committed
112
        }
113 114
    }
}