MainToolBarIndicators.qml 6.71 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
101
        visible:                !communicationLost
Don Gagne's avatar
Don Gagne committed
102
        fillMode:               Image.PreserveAspectFit
103
        source:                 _outdoorPalette ? _brandImageOutdoor : _brandImageIndoor
104
        mipmap:                 true
105 106 107

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

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

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

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