MainToolBar.qml 20.4 KB
Newer Older
dogmaphobic's avatar
dogmaphobic committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
/*=====================================================================

QGroundControl Open Source Ground Control Station

(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>

This file is part of the QGROUNDCONTROL project

    QGROUNDCONTROL is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    QGROUNDCONTROL is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.

======================================================================*/

/**
 * @file
 *   @brief QGC Main Tool Bar
 *   @author Gus Grubba <mavlink@grubba.com>
 */

dogmaphobic's avatar
dogmaphobic committed
30
import QtQuick 2.5
31
import QtQuick.Layouts 1.2
dogmaphobic's avatar
dogmaphobic committed
32 33 34
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2

Don Gagne's avatar
Don Gagne committed
35
import QGroundControl                       1.0
36 37 38 39
import QGroundControl.Controls              1.0
import QGroundControl.Palette               1.0
import QGroundControl.MultiVehicleManager   1.0
import QGroundControl.ScreenTools           1.0
40
import QGroundControl.Controllers           1.0
dogmaphobic's avatar
dogmaphobic committed
41

42
Rectangle {
43
    id:         toolBar
44
    color:      qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.8) : Qt.rgba(0,0,0,0.75)
dogmaphobic's avatar
dogmaphobic committed
45

Don Gagne's avatar
Don Gagne committed
46
    QGCPalette { id: qgcPal; colorGroupEnabled: true }
47

48
    property var  activeVehicle:        QGroundControl.multiVehicleManager.activeVehicle
dogmaphobic's avatar
dogmaphobic committed
49
    property var  mainWindow:           null
dogmaphobic's avatar
dogmaphobic committed
50 51
    property bool isMessageImportant:   activeVehicle ? !activeVehicle.messageTypeNormal && !activeVehicle.messageTypeNone : false
    property bool isBackgroundDark:     true
dogmaphobic's avatar
dogmaphobic committed
52
    property bool opaqueBackground:     false
53

dogmaphobic's avatar
dogmaphobic committed
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
    /*
        Dev System (Mac OS)

        qml: Main Window Width:   1008
        qml: Toolbar height:      51.2
        qml: Default font:        12.8
        qml: Font (.75):          9.600000000000001
        qml: Font (.85):          10.88
        qml: Font 1.5):           19.200000000000003
        qml: Default Font Width:  8.328125
        qml: Default Font Height: 12.8
        qml: --
        qml: Real Font Height:    16
        qml: fontHRatio:          1
        qml: --
        qml: cellHeight:          38
        qml: tbFontSmall:         10
        qml: tbFontNormal:        12
        qml: tbFontLarge:         18
        qml: tbSpacing:           9.54

        Nexus 9

        qml: Main Window Width:   2048
        qml: Toolbar height:      90.9312
        qml: Default font:        38
        qml: Font (.75):          28.5
        qml: Font (.85):          32.3
        qml: Font 1.5):           57
        qml: Default Font Width:  20.0625
        qml: Default Font Height: 38
        qml: --
        qml: Real Font Height:    38
        qml: fontHRatio:          2.375
        qml: --
        qml: cellHeight:          68
        qml: tbFontSmall:         23.75
        qml: tbFontNormal:        28.5
        qml: tbFontLarge:         42.75
        qml: tbSpacing:           16.87552

        Nexus 7

        qml: Main Window Width:   1920
        qml: Toolbar height:      85.248
        qml: Default font:        38
        qml: Font (.75):          28.5
        qml: Font (.85):          32.3
        qml: Font 1.5):           57
        qml: Default Font Width:  20.140625
        qml: Default Font Height: 38
        qml: --
        qml: Real Font Height:    38
        qml: fontHRatio:          2.375
        qml: --
        qml: cellHeight:          63
        qml: tbFontSmall:         23.75
        qml: tbFontNormal:        28.5
        qml: tbFontLarge:         42.75
        qml: tbSpacing:           15.820800000000002

        Nexus 4

        qml: Main Window Width:   1196
        qml: Toolbar height:      79.65360000000001
        qml: Default font:        38
        qml: Font (.75):          28.5
        qml: Font (.85):          32.3
        qml: Font 1.5):           57
        qml: Default Font Width:  20.140625
        qml: Default Font Height: 38
        qml: --
        qml: Real Font Height:    38
        qml: fontHRatio:          2.375
        qml: --
        qml: cellHeight:          59
        qml: tbFontSmall:         23.75
        qml: tbFontNormal:        28.5
        qml: tbFontLarge:         42.75
        qml: tbSpacing:           9.85504

    */

137
    readonly property real  tbFontSmall:     8 * ScreenTools.fontHRatio
dogmaphobic's avatar
dogmaphobic committed
138 139
    readonly property real  tbFontNormal:   12 * ScreenTools.fontHRatio
    readonly property real  tbFontLarge:    18 * ScreenTools.fontHRatio
dogmaphobic's avatar
dogmaphobic committed
140

dogmaphobic's avatar
dogmaphobic committed
141 142 143 144 145 146
    readonly property var   colorGreen:     "#05f068"
    readonly property var   colorOrange:    "#f0ab06"
    readonly property var   colorRed:       "#fc4638"
    readonly property var   colorGrey:      "#7f7f7f"
    readonly property var   colorBlue:      "#636efe"
    readonly property var   colorWhite:     "#ffffff"
147

Don Gagne's avatar
Don Gagne committed
148 149 150 151
    signal showSetupView()
    signal showPlanView()
    signal showFlyView()

152
    MainToolBarController { id: _controller }
dogmaphobic's avatar
dogmaphobic committed
153

Don Gagne's avatar
Don Gagne committed
154 155 156 157 158 159 160 161 162 163 164 165
    function checkSetupButton() {
        setupButton.checked = true
    }

    function checkPlanButton() {
        planButton.checked = true
    }

    function checkFlyButton() {
        flyButton.checked = true
    }

166 167
    function getBatteryColor() {
        if(activeVehicle) {
Don Gagne's avatar
Don Gagne committed
168
            if(activeVehicle.battery.percentRemaining.value > 75) {
169 170
                return colorGreen
            }
Don Gagne's avatar
Don Gagne committed
171
            if(activeVehicle.battery.percentRemaining.value > 50) {
172 173
                return colorOrange
            }
Don Gagne's avatar
Don Gagne committed
174
            if(activeVehicle.battery.percentRemaining.value > 0.1) {
175 176 177 178 179 180
                return colorRed
            }
        }
        return colorGrey
    }

dogmaphobic's avatar
dogmaphobic committed
181 182 183 184 185 186 187 188 189 190
    function getRSSIColor(value) {
        if(value >= 0)
            return colorGrey;
        if(value > -60)
            return colorGreen;
        if(value > -90)
            return colorOrange;
        return colorRed;
    }

dogmaphobic's avatar
dogmaphobic committed
191 192 193 194
    Component.onCompleted: {
        //-- TODO: Get this from the actual state
        flyButton.checked = true
    }
195

dogmaphobic's avatar
dogmaphobic committed
196 197 198 199
    //---------------------------------------------
    // GPS Info
    Component {
        id: gpsInfo
200

dogmaphobic's avatar
dogmaphobic committed
201
        Rectangle {
202 203 204 205 206
            width:  gpsCol.width   + ScreenTools.defaultFontPixelWidth  * 3
            height: gpsCol.height  + ScreenTools.defaultFontPixelHeight * 2
            radius: ScreenTools.defaultFontPixelHeight * 0.5
            color:  qgcPal.window

dogmaphobic's avatar
dogmaphobic committed
207 208 209 210 211 212
            Column {
                id:                 gpsCol
                spacing:            ScreenTools.defaultFontPixelHeight * 0.5
                width:              Math.max(gpsGrid.width, gpsLabel.width)
                anchors.margins:    ScreenTools.defaultFontPixelHeight
                anchors.centerIn:   parent
213

dogmaphobic's avatar
dogmaphobic committed
214
                QGCLabel {
215 216 217
                    id:             gpsLabel
                    text:           (activeVehicle && activeVehicle.gps.count.value >= 0) ? qsTr("GPS Status") : qsTr("GPS Data Unavailable")
                    font.family:    ScreenTools.demiboldFontFamily
dogmaphobic's avatar
dogmaphobic committed
218 219
                    anchors.horizontalCenter: parent.horizontalCenter
                }
220

dogmaphobic's avatar
dogmaphobic committed
221 222
                GridLayout {
                    id:                 gpsGrid
Don Gagne's avatar
Don Gagne committed
223
                    visible:            (activeVehicle && activeVehicle.gps.count.value >= 0)
dogmaphobic's avatar
dogmaphobic committed
224 225 226 227
                    anchors.margins:    ScreenTools.defaultFontPixelHeight
                    columnSpacing:      ScreenTools.defaultFontPixelWidth
                    anchors.horizontalCenter: parent.horizontalCenter
                    columns: 2
228

Tomaz Canabrava's avatar
Tomaz Canabrava committed
229 230 231 232 233 234 235 236 237 238
                    QGCLabel { text: qsTr("GPS Count:") }
                    QGCLabel { text: activeVehicle ? activeVehicle.gps.count.valueString : qsTr("N/A", "No data to display") }
                    QGCLabel { text: qsTr("GPS Lock:") }
                    QGCLabel { text: activeVehicle ? activeVehicle.gps.lock.enumStringValue : qsTr("N/A", "No data to display") }
                    QGCLabel { text: qsTr("HDOP:") }
                    QGCLabel { text: activeVehicle ? activeVehicle.gps.hdop.valueString : qsTr("--.--", "No data to display") }
                    QGCLabel { text: qsTr("VDOP:") }
                    QGCLabel { text: activeVehicle ? activeVehicle.gps.vdop.valueString : qsTr("--.--", "No data to display") }
                    QGCLabel { text: qsTr("Course Over Ground:") }
                    QGCLabel { text: activeVehicle ? activeVehicle.gps.courseOverGround.valueString : qsTr("--.--", "No data to display") }
dogmaphobic's avatar
dogmaphobic committed
239 240
                }
            }
241

dogmaphobic's avatar
dogmaphobic committed
242 243 244 245 246 247 248 249
            Component.onCompleted: {
                var pos = mapFromItem(toolBar, centerX - (width / 2), toolBar.height)
                x = pos.x
                y = pos.y + ScreenTools.defaultFontPixelHeight
            }
        }
    }

250 251 252 253
    //---------------------------------------------
    // Battery Info
    Component {
        id: batteryInfo
Don Gagne's avatar
Don Gagne committed
254

255
        Rectangle {
256 257 258 259
            width:  battCol.width   + ScreenTools.defaultFontPixelWidth  * 3
            height: battCol.height  + ScreenTools.defaultFontPixelHeight * 2
            radius: ScreenTools.defaultFontPixelHeight * 0.5
            color:  qgcPal.window
Don Gagne's avatar
Don Gagne committed
260

261 262 263 264 265 266
            Column {
                id:                 battCol
                spacing:            ScreenTools.defaultFontPixelHeight * 0.5
                width:              Math.max(battGrid.width, battLabel.width)
                anchors.margins:    ScreenTools.defaultFontPixelHeight
                anchors.centerIn:   parent
Don Gagne's avatar
Don Gagne committed
267

268
                QGCLabel {
269 270 271
                    id:             battLabel
                    text:           qsTr("Battery Status")
                    font.family:    ScreenTools.demiboldFontFamily
272 273
                    anchors.horizontalCenter: parent.horizontalCenter
                }
274

275 276 277 278
                GridLayout {
                    id:                 battGrid
                    anchors.margins:    ScreenTools.defaultFontPixelHeight
                    columnSpacing:      ScreenTools.defaultFontPixelWidth
279
                    columns:            2
280
                    anchors.horizontalCenter: parent.horizontalCenter
281

Tomaz Canabrava's avatar
Tomaz Canabrava committed
282
                    QGCLabel { text: qsTr("Voltage:") }
283
                    QGCLabel { text: (activeVehicle && activeVehicle.battery.voltage.value != -1) ? (activeVehicle.battery.voltage.valueString + " " + activeVehicle.battery.voltage.units) : "N/A" }
Tomaz Canabrava's avatar
Tomaz Canabrava committed
284
                    QGCLabel { text: qsTr("Accumulated Consumption:") }
285
                    QGCLabel { text: (activeVehicle && activeVehicle.battery.mahConsumed.value != -1) ? (activeVehicle.battery.mahConsumed.valueString + " " + activeVehicle.battery.mahConsumed.units) : "N/A" }
286 287
                }
            }
Don Gagne's avatar
Don Gagne committed
288

289 290 291 292 293 294 295 296 297 298 299 300
            Component.onCompleted: {
                var pos = mapFromItem(toolBar, centerX - (width / 2), toolBar.height)
                x = pos.x
                y = pos.y + ScreenTools.defaultFontPixelHeight
            }
        }
    }

    //---------------------------------------------
    // RC RSSI Info
    Component {
        id: rcRSSIInfo
301

302
        Rectangle {
303 304 305 306 307
            width:  rcrssiCol.width   + ScreenTools.defaultFontPixelWidth  * 3
            height: rcrssiCol.height  + ScreenTools.defaultFontPixelHeight * 2
            radius: ScreenTools.defaultFontPixelHeight * 0.5
            color:  qgcPal.window

308
            Column {
dogmaphobic's avatar
dogmaphobic committed
309
                id:                 rcrssiCol
310
                spacing:            ScreenTools.defaultFontPixelHeight * 0.5
dogmaphobic's avatar
dogmaphobic committed
311
                width:              Math.max(rcrssiGrid.width, rssiLabel.width)
312 313
                anchors.margins:    ScreenTools.defaultFontPixelHeight
                anchors.centerIn:   parent
314

315
                QGCLabel {
316 317 318
                    id:             rssiLabel
                    text:           activeVehicle ? (activeVehicle.rcRSSI != 255 ? qsTr("RC RSSI Status") : qsTr("RC RSSI Data Unavailable")) : qsTr("N/A", "No data avaliable")
                    font.family:    ScreenTools.demiboldFontFamily
319 320
                    anchors.horizontalCenter: parent.horizontalCenter
                }
321

322
                GridLayout {
dogmaphobic's avatar
dogmaphobic committed
323
                    id:                 rcrssiGrid
324
                    visible:            activeVehicle && activeVehicle.rcRSSI != 255
325 326
                    anchors.margins:    ScreenTools.defaultFontPixelHeight
                    columnSpacing:      ScreenTools.defaultFontPixelWidth
327
                    columns:            2
328
                    anchors.horizontalCenter: parent.horizontalCenter
329

Tomaz Canabrava's avatar
Tomaz Canabrava committed
330
                    QGCLabel { text: qsTr("RSSI:") }
331
                    QGCLabel { text: activeVehicle ? (activeVehicle.rcRSSI + "%") : 0 }
332 333
                }
            }
334

335 336 337 338 339 340 341 342
            Component.onCompleted: {
                var pos = mapFromItem(toolBar, centerX - (width / 2), toolBar.height)
                x = pos.x
                y = pos.y + ScreenTools.defaultFontPixelHeight
            }
        }
    }

dogmaphobic's avatar
dogmaphobic committed
343 344 345 346
    //---------------------------------------------
    // Telemetry RSSI Info
    Component {
        id: telemRSSIInfo
347

dogmaphobic's avatar
dogmaphobic committed
348
        Rectangle {
349 350 351 352 353
            width:  telemCol.width   + ScreenTools.defaultFontPixelWidth  * 3
            height: telemCol.height  + ScreenTools.defaultFontPixelHeight * 2
            radius: ScreenTools.defaultFontPixelHeight * 0.5
            color:  qgcPal.window

dogmaphobic's avatar
dogmaphobic committed
354 355 356 357 358 359
            Column {
                id:                 telemCol
                spacing:            ScreenTools.defaultFontPixelHeight * 0.5
                width:              Math.max(telemGrid.width, telemLabel.width)
                anchors.margins:    ScreenTools.defaultFontPixelHeight
                anchors.centerIn:   parent
360

dogmaphobic's avatar
dogmaphobic committed
361
                QGCLabel {
362
                    id:             telemLabel
Tomaz Canabrava's avatar
Tomaz Canabrava committed
363
                    text:           qsTr("Telemetry RSSI Status")
364
                    font.family:    ScreenTools.demiboldFontFamily
dogmaphobic's avatar
dogmaphobic committed
365 366
                    anchors.horizontalCenter: parent.horizontalCenter
                }
367

dogmaphobic's avatar
dogmaphobic committed
368 369 370 371
                GridLayout {
                    id:                 telemGrid
                    anchors.margins:    ScreenTools.defaultFontPixelHeight
                    columnSpacing:      ScreenTools.defaultFontPixelWidth
372
                    columns:            2
dogmaphobic's avatar
dogmaphobic committed
373
                    anchors.horizontalCenter: parent.horizontalCenter
374

Tomaz Canabrava's avatar
Tomaz Canabrava committed
375
                    QGCLabel { text: qsTr("Local RSSI:") }
376
                    QGCLabel { text: _controller.telemetryLRSSI + " dBm" }
Tomaz Canabrava's avatar
Tomaz Canabrava committed
377
                    QGCLabel { text: qsTr("Remote RSSI:") }
378
                    QGCLabel { text: _controller.telemetryRRSSI + " dBm" }
Tomaz Canabrava's avatar
Tomaz Canabrava committed
379
                    QGCLabel { text: qsTr("RX Errors:") }
380
                    QGCLabel { text: _controller.telemetryRXErrors }
Tomaz Canabrava's avatar
Tomaz Canabrava committed
381
                    QGCLabel { text: qsTr("Errors Fixed:") }
382
                    QGCLabel { text: _controller.telemetryFixed }
Tomaz Canabrava's avatar
Tomaz Canabrava committed
383
                    QGCLabel { text: qsTr("TX Buffer:") }
384
                    QGCLabel { text: _controller.telemetryTXBuffer }
Tomaz Canabrava's avatar
Tomaz Canabrava committed
385
                    QGCLabel { text: qsTr("Local Noise:") }
386
                    QGCLabel { text: _controller.telemetryLNoise }
Tomaz Canabrava's avatar
Tomaz Canabrava committed
387
                    QGCLabel { text: qsTr("Remote Noise:") }
388
                    QGCLabel { text: _controller.telemetryRNoise }
dogmaphobic's avatar
dogmaphobic committed
389 390
                }
            }
391

dogmaphobic's avatar
dogmaphobic committed
392 393 394 395 396 397 398 399
            Component.onCompleted: {
                var pos = mapFromItem(toolBar, centerX - (width / 2), toolBar.height)
                x = pos.x
                y = pos.y + ScreenTools.defaultFontPixelHeight
            }
        }
    }

400 401 402 403 404 405
    Rectangle {
        anchors.left:   parent.left
        anchors.right:  parent.right
        anchors.bottom: parent.bottom
        height:         1
        color:          "black"
dogmaphobic's avatar
dogmaphobic committed
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426
        visible:        qgcPal.globalTheme == QGCPalette.Light
    }

    //---------------------------------------------
    // Logo (Preferences Button)
    Rectangle {
        id:                     preferencesButton
        width:                  mainWindow.tbButtonWidth * 1.25
        height:                 parent.height
        anchors.top:            parent.top
        anchors.left:           parent.left
        color:                  "#4A2C6D"
        Image {
            height:                 mainWindow.tbCellHeight
            anchors.centerIn:       parent
            source:                 "/res/QGCLogoWhite"
            fillMode:               Image.PreserveAspectFit
            smooth:                 true
            mipmap:                 true
            antialiasing:           true
        }
427 428 429 430 431 432 433 434 435
        /* Experimenting with a white/black divider
        Rectangle {
            color:      qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(0,0,0,0.15) : Qt.rgba(1,1,1,0.15)
            height: parent.height
            width:  1
            anchors.right:  parent.right
            anchors.top:    parent.top
        }
        */
dogmaphobic's avatar
dogmaphobic committed
436 437 438 439
        MouseArea {
            anchors.fill: parent
            onClicked: mainWindow.showLeftMenu()
        }
440 441
    }

442 443
    //---------------------------------------------
    // Toolbar Row
dogmaphobic's avatar
dogmaphobic committed
444
    Row {
445 446 447
        id:                     viewRow
        height:                 mainWindow.tbCellHeight
        spacing:                mainWindow.tbSpacing
dogmaphobic's avatar
dogmaphobic committed
448
        anchors.left:           preferencesButton.right
dogmaphobic's avatar
dogmaphobic committed
449
        anchors.leftMargin:     mainWindow.tbSpacing
450 451 452
        anchors.bottomMargin:   1
        anchors.top:            parent.top
        anchors.bottom:         parent.bottom
dogmaphobic's avatar
dogmaphobic committed
453 454 455 456 457

        ExclusiveGroup { id: mainActionGroup }

        QGCToolBarButton {
            id:                 setupButton
dogmaphobic's avatar
dogmaphobic committed
458
            width:              mainWindow.tbButtonWidth
459 460
            anchors.top:        parent.top
            anchors.bottom:     parent.bottom
dogmaphobic's avatar
dogmaphobic committed
461
            exclusiveGroup:     mainActionGroup
dogmaphobic's avatar
dogmaphobic committed
462
            source:             "/qmlimages/Gears.svg"
Don Gagne's avatar
Don Gagne committed
463
            onClicked:          toolBar.showSetupView()
dogmaphobic's avatar
dogmaphobic committed
464
        }
465

dogmaphobic's avatar
dogmaphobic committed
466 467
        QGCToolBarButton {
            id:                 planButton
dogmaphobic's avatar
dogmaphobic committed
468
            width:              mainWindow.tbButtonWidth
469 470
            anchors.top:        parent.top
            anchors.bottom:     parent.bottom
dogmaphobic's avatar
dogmaphobic committed
471
            exclusiveGroup:     mainActionGroup
dogmaphobic's avatar
dogmaphobic committed
472
            source:             "/qmlimages/Plan.svg"
Don Gagne's avatar
Don Gagne committed
473
            onClicked:          toolBar.showPlanView()
dogmaphobic's avatar
dogmaphobic committed
474
        }
Don Gagne's avatar
Don Gagne committed
475

dogmaphobic's avatar
dogmaphobic committed
476 477
        QGCToolBarButton {
            id:                 flyButton
dogmaphobic's avatar
dogmaphobic committed
478
            width:              mainWindow.tbButtonWidth
479 480
            anchors.top:        parent.top
            anchors.bottom:     parent.bottom
dogmaphobic's avatar
dogmaphobic committed
481
            exclusiveGroup:     mainActionGroup
dogmaphobic's avatar
dogmaphobic committed
482
            source:             "/qmlimages/PaperPlane.svg"
Don Gagne's avatar
Don Gagne committed
483
            onClicked:          toolBar.showFlyView()
Don Gagne's avatar
Don Gagne committed
484
        }
dogmaphobic's avatar
dogmaphobic committed
485
    }
486

dogmaphobic's avatar
dogmaphobic committed
487
    Item {
dogmaphobic's avatar
dogmaphobic committed
488
        id:                     vehicleIndicators
dogmaphobic's avatar
dogmaphobic committed
489 490
        height:                 mainWindow.tbCellHeight
        anchors.leftMargin:     mainWindow.tbSpacing * 2
Don Gagne's avatar
Don Gagne committed
491 492
        anchors.left:           viewRow.right
        anchors.right:          parent.right
dogmaphobic's avatar
dogmaphobic committed
493
        anchors.verticalCenter: parent.verticalCenter
Don Gagne's avatar
Don Gagne committed
494

495
        property bool vehicleConnectionLost: activeVehicle ? activeVehicle.connectionLost : false
Don Gagne's avatar
Don Gagne committed
496

dogmaphobic's avatar
dogmaphobic committed
497
        Loader {
498
            source:                 activeVehicle && !parent.vehicleConnectionLost ? "MainToolBarIndicators.qml" : ""
Don Gagne's avatar
Don Gagne committed
499 500
            anchors.left:           parent.left
            anchors.verticalCenter: parent.verticalCenter
Don Gagne's avatar
Don Gagne committed
501
        }
dogmaphobic's avatar
dogmaphobic committed
502

Don Gagne's avatar
Don Gagne committed
503 504
        QGCLabel {
            id:                     connectionLost
Tomaz Canabrava's avatar
Tomaz Canabrava committed
505
            text:                   qsTr("COMMUNICATION LOST")
Don Gagne's avatar
Don Gagne committed
506
            font.pixelSize:         tbFontLarge
507
            font.family:            ScreenTools.demiboldFontFamily
Don Gagne's avatar
Don Gagne committed
508
            color:                  colorRed
509 510
            anchors.rightMargin:    ScreenTools.defaultFontPixelWidth
            anchors.right:          disconnectButton.left
Don Gagne's avatar
Don Gagne committed
511
            anchors.verticalCenter: parent.verticalCenter
512
            visible:                parent.vehicleConnectionLost
Don Gagne's avatar
Don Gagne committed
513 514 515 516

        }

        QGCButton {
517
            id:                     disconnectButton
Don Gagne's avatar
Don Gagne committed
518 519 520
            anchors.rightMargin:     mainWindow.tbSpacing * 2
            anchors.right:          parent.right
            anchors.verticalCenter: parent.verticalCenter
Tomaz Canabrava's avatar
Tomaz Canabrava committed
521
            text:                   qsTr("Disconnect")
522
            visible:                parent.vehicleConnectionLost
523
            primary:                true
Don Gagne's avatar
Don Gagne committed
524 525
            onClicked:              activeVehicle.disconnectInactiveVehicle()
        }
dogmaphobic's avatar
dogmaphobic committed
526
    }
dogmaphobic's avatar
dogmaphobic committed
527

528 529
    // Progress bar
    Rectangle {
Don Gagne's avatar
Don Gagne committed
530
        id:             progressBar
dogmaphobic's avatar
dogmaphobic committed
531 532
        anchors.bottom: parent.bottom
        height:         toolBar.height * 0.05
533
        width:          parent.width * _controller.progressBarValue
dogmaphobic's avatar
dogmaphobic committed
534
        color:          colorGreen
535
    }
dogmaphobic's avatar
dogmaphobic committed
536

537
}