MainToolBarIndicators.qml 6.9 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

Gus Grubba's avatar
Gus Grubba committed
10
import QtQuick          2.11
11 12
import QtQuick.Controls 2.4
import QtQuick.Dialogs  1.3
Gus Grubba's avatar
Gus Grubba committed
13
import QtQuick.Layouts  1.11
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 {
Don Gagne's avatar
Don Gagne committed
22

23
    //-------------------------------------------------------------------------
DonLakeFlyer's avatar
DonLakeFlyer committed
24 25 26 27
    // Easter egg mechanism
    MouseArea {
        anchors.fill: parent
        onClicked: {
Donald Gagne's avatar
Donald Gagne committed
28
            _clickCount++
DonLakeFlyer's avatar
DonLakeFlyer committed
29
            eggTimer.restart()
30 31 32 33 34 35
            if (_clickCount == 5) {
                if(QGroundControl.corePlugin.showAdvancedUI) {
                    advancedModeConfirmation.open()
                } else {
                    QGroundControl.corePlugin.showAdvancedUI = false
                }
DonLakeFlyer's avatar
DonLakeFlyer committed
36
            } else if (_clickCount == 7) {
37
                QGroundControl.corePlugin.showTouchAreas = !QGroundControl.corePlugin.showTouchAreas
DonLakeFlyer's avatar
DonLakeFlyer committed
38 39 40 41 42 43 44 45
            }
        }

        property int _clickCount: 0

        Timer {
            id:             eggTimer
            interval:       1000
46
            repeat:         false
DonLakeFlyer's avatar
DonLakeFlyer committed
47 48
            onTriggered:    parent._clickCount = 0
        }
Donald Gagne's avatar
Donald Gagne committed
49 50 51 52 53 54 55 56

        MessageDialog {
            id:                 advancedModeConfirmation
            title:              qsTr("Advanced Mode")
            text:               QGroundControl.corePlugin.showAdvancedUIMessage
            standardButtons:    StandardButton.Yes | StandardButton.No
            onYes: {
                QGroundControl.corePlugin.showAdvancedUI = true
57
                advancedModeConfirmation.close()
Donald Gagne's avatar
Donald Gagne committed
58 59
            }
        }
DonLakeFlyer's avatar
DonLakeFlyer committed
60 61
    }

62 63
    //-------------------------------------------------------------------------
    //-- Waiting for a vehicle
64 65
    QGCLabel {
        id:                     waitForVehicle
Gus Grubba's avatar
Gus Grubba committed
66
        anchors.centerIn:       parent
67 68 69
        text:                   qsTr("Waiting For Vehicle Connection")
        font.pointSize:         ScreenTools.mediumFontPointSize
        font.family:            ScreenTools.demiboldFontFamily
70
        color:                  qgcPal.colorRed
71
        visible:                !activeVehicle
72 73
    }

74 75
    //-------------------------------------------------------------------------
    //-- Toolbar Indicators
Don Gagne's avatar
Don Gagne committed
76
    Row {
Gus Grubba's avatar
Gus Grubba committed
77 78 79 80 81 82 83
        id:                 indicatorRow
        anchors.top:        parent.top
        anchors.bottom:     parent.bottom
        anchors.left:       parent.left
        anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2
        spacing:            ScreenTools.defaultFontPixelWidth * 1.5
        visible:            activeVehicle && !communicationLost
84
        Repeater {
85
            model:      activeVehicle ? activeVehicle.toolBarIndicators : []
86
            Loader {
87 88 89 90
                anchors.top:        parent.top
                anchors.bottom:     parent.bottom
                anchors.margins:    ScreenTools.defaultFontPixelHeight * 0.66
                source:             modelData;
dogmaphobic's avatar
dogmaphobic committed
91 92
            }
        }
93
    }
Don Gagne's avatar
Don Gagne committed
94

95 96
    //-------------------------------------------------------------------------
    //-- Branding Logo
Don Gagne's avatar
Don Gagne committed
97 98 99 100
    Image {
        anchors.right:          parent.right
        anchors.top:            parent.top
        anchors.bottom:         parent.bottom
Gus Grubba's avatar
Gus Grubba committed
101 102
        anchors.margins:        ScreenTools.defaultFontPixelHeight * 0.66
        visible:                activeVehicle && !communicationLost && x > (indicatorRow.x + indicatorRow.width + ScreenTools.defaultFontPixelWidth)
Don Gagne's avatar
Don Gagne committed
103
        fillMode:               Image.PreserveAspectFit
104
        source:                 _outdoorPalette ? _brandImageOutdoor : _brandImageIndoor
105
        mipmap:                 true
106 107 108

        property bool   _outdoorPalette:        qgcPal.globalTheme === QGCPalette.Light
        property bool   _corePluginBranding:    QGroundControl.corePlugin.brandImageIndoor.length != 0
109 110
        property string _userBrandImageIndoor:  QGroundControl.settingsManager.brandImageSettings.userBrandImageIndoor.value
        property string _userBrandImageOutdoor: QGroundControl.settingsManager.brandImageSettings.userBrandImageOutdoor.value
111 112
        property bool   _userBrandingIndoor:    _userBrandImageIndoor.length != 0
        property bool   _userBrandingOutdoor:   _userBrandImageOutdoor.length != 0
113 114 115
        property string _brandImageIndoor:      _userBrandingIndoor ?
                                                    _userBrandImageIndoor : (_userBrandingOutdoor ?
                                                        _userBrandImageOutdoor : (_corePluginBranding ?
116 117
                                                            QGroundControl.corePlugin.brandImageIndoor : (activeVehicle ?
                                                                activeVehicle.brandImageIndoor : ""
118 119 120 121 122 123
                                                            )
                                                        )
                                                    )
        property string _brandImageOutdoor:     _userBrandingOutdoor ?
                                                    _userBrandImageOutdoor : (_userBrandingIndoor ?
                                                        _userBrandImageIndoor : (_corePluginBranding ?
124 125
                                                            QGroundControl.corePlugin.brandImageOutdoor : (activeVehicle ?
                                                                activeVehicle.brandImageOutdoor : ""
126 127 128
                                                            )
                                                        )
                                                    )
dogmaphobic's avatar
dogmaphobic committed
129
    }
dogmaphobic's avatar
dogmaphobic committed
130

131 132
    //-------------------------------------------------------------------------
    //-- Connection Status
Don Gagne's avatar
Don Gagne committed
133 134 135 136
    Row {
        anchors.fill:       parent
        layoutDirection:    Qt.RightToLeft
        spacing:            ScreenTools.defaultFontPixelWidth
Gus Grubba's avatar
Gus Grubba committed
137
        visible:            activeVehicle && communicationLost
Don Gagne's avatar
Don Gagne committed
138 139 140 141 142 143

        QGCButton {
            id:                     disconnectButton
            anchors.verticalCenter: parent.verticalCenter
            text:                   qsTr("Disconnect")
            primary:                true
144
            onClicked:              activeVehicle.disconnectInactiveVehicle()
Don Gagne's avatar
Don Gagne committed
145
        }
dogmaphobic's avatar
dogmaphobic committed
146

Don Gagne's avatar
Don Gagne committed
147 148 149 150 151 152
        QGCLabel {
            id:                     connectionLost
            anchors.verticalCenter: parent.verticalCenter
            text:                   qsTr("COMMUNICATION LOST")
            font.pointSize:         ScreenTools.largeFontPointSize
            font.family:            ScreenTools.demiboldFontFamily
153
            color:                  qgcPal.colorRed
Don Gagne's avatar
Don Gagne committed
154
        }
155 156
    }
}