MainToolBarIndicators.qml 7 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
            if (_clickCount == 5) {
Pierre TILAK's avatar
Pierre TILAK committed
31
                if(!QGroundControl.corePlugin.showAdvancedUI) {
32 33 34 35
                    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
                id:                 indicatorLoader
88 89 90
                anchors.top:        parent.top
                anchors.bottom:     parent.bottom
                anchors.margins:    ScreenTools.defaultFontPixelHeight * 0.66
91 92
                source:             modelData
                visible:            item.showIndicator
dogmaphobic's avatar
dogmaphobic committed
93 94
            }
        }
95
    }
Don Gagne's avatar
Don Gagne committed
96

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

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

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

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

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