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


Don Gagne's avatar
Don Gagne committed
11 12 13
import QtQuick          2.5
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 27 28 29 30 31
    QGCPalette { id: qgcPal }

    Row {
        id:             indicatorRow
        anchors.top:    parent.top
        anchors.bottom: parent.bottom
        spacing:        ScreenTools.defaultFontPixelWidth * 1.5
32 33 34 35
        visible:        !communicationLost
        Repeater {
            model:  QGroundControl.corePlugin.toolBarIndicators
            Loader {
Don Gagne's avatar
Don Gagne committed
36 37
                anchors.top:    parent.top
                anchors.bottom: parent.bottom
38
                source:         modelData;
dogmaphobic's avatar
dogmaphobic committed
39 40
            }
        }
41
    }
Don Gagne's avatar
Don Gagne committed
42 43 44 45 46

    Image {
        anchors.right:          parent.right
        anchors.top:            parent.top
        anchors.bottom:         parent.bottom
47
        visible:                x > indicatorRow.width && !communicationLost
Don Gagne's avatar
Don Gagne committed
48
        fillMode:               Image.PreserveAspectFit
49
        source:                 activeVehicle ? activeVehicle.brandImage : ""
dogmaphobic's avatar
dogmaphobic committed
50
    }
dogmaphobic's avatar
dogmaphobic committed
51

Don Gagne's avatar
Don Gagne committed
52 53 54 55
    Row {
        anchors.fill:       parent
        layoutDirection:    Qt.RightToLeft
        spacing:            ScreenTools.defaultFontPixelWidth
56
        visible:            communicationLost
Don Gagne's avatar
Don Gagne committed
57 58 59 60 61 62

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

Don Gagne's avatar
Don Gagne committed
66 67 68 69 70 71 72 73
        QGCLabel {
            id:                     connectionLost
            anchors.verticalCenter: parent.verticalCenter
            text:                   qsTr("COMMUNICATION LOST")
            font.pointSize:         ScreenTools.largeFontPointSize
            font.family:            ScreenTools.demiboldFontFamily
            color:                  colorRed
        }
74 75
    }
}