Commit 5efd09f9 authored by Don Gagne's avatar Don Gagne

Boot performance

Mostly accomplished by delay loading Qml elements
parent 9417909f
......@@ -64,9 +64,11 @@ DEFINES += NOMINMAX
#
# [REQUIRED] QWT plotting library dependency. Provides plotting capabilities.
#
!MobileBuild {
include(libs/qwt.pri)
DEPENDPATH += libs/qwt
INCLUDEPATH += libs/qwt
}
#
# [OPTIONAL] XBee wireless support. This is not necessary for basic serial/UART communications.
......
......@@ -123,8 +123,9 @@
<!-- Main Window -->
<file alias="MainWindow.qml">src/ui/MainWindow.qml</file>
<file alias="MainWindowDelayLoad.qml">src/ui/MainWindowDelayLoad.qml</file>
<file alias="QGroundControl/Controls/MainToolBar.qml">src/ui/toolbar/MainToolBar.qml</file>
<file alias="QGroundControl/Controls/FlightDisplayView.qml">src/FlightDisplay/FlightDisplayView.qml</file>
<file alias="MainToolBarActiveVehicleComponent.qml">src/ui/toolbar/MainToolBarActiveVehicleComponent.qml</file>
<!-- Vehicle Setup -->
<file alias="SetupView.qml">src/VehicleSetup/SetupView.qml</file>
......@@ -152,6 +153,13 @@
<file alias="FlightDisplayWidget.qml">src/FlightDisplay/FlightDisplayWidget.qml</file>
<file alias="MissionEditor.qml">src/MissionEditor/MissionEditor.qml</file>
<!-- FlightDisplay module -->
<file alias="QGroundControl/FlightDisplay/qmldir">src/FlightDisplay/qmldir</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayView.qml">src/FlightDisplay/FlightDisplayView.qml</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayViewDelayLoadInner.qml">src/FlightDisplay/FlightDisplayViewDelayLoadInner.qml</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayViewDelayLoadOuter.qml">src/FlightDisplay/FlightDisplayViewDelayLoadOuter.qml</file>
<!-- FlightMap module -->
<file alias="QGroundControl/FlightMap/qmldir">src/FlightMap/qmldir</file>
<file alias="QGroundControl/FlightMap/FlightMap.qml">src/FlightMap/FlightMap.qml</file>
......
......@@ -29,6 +29,7 @@ import QtLocation 5.3
import QtPositioning 5.2
import QGroundControl 1.0
import QGroundControl.FlightDisplay 1.0
import QGroundControl.FlightMap 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controls 1.0
......@@ -67,6 +68,8 @@ Item {
readonly property string _mapName: "FlightDisplayView"
readonly property string _showMapBackgroundKey: "/showMapBackground"
readonly property var _flightMap: flightMap
property real _roll: _activeVehicle ? (isNaN(_activeVehicle.roll) ? _defaultRoll : _activeVehicle.roll) : _defaultRoll
property real _pitch: _activeVehicle ? (isNaN(_activeVehicle.pitch) ? _defaultPitch : _activeVehicle.pitch) : _defaultPitch
property real _heading: _activeVehicle ? (isNaN(_activeVehicle.heading) ? _defaultHeading : _activeVehicle.heading) : _defaultHeading
......@@ -88,6 +91,8 @@ Item {
// Validate _showMap setting
Component.onCompleted: {
delayLoader.source = "FlightDisplayViewDelayLoadOuter.qml"
// We have to be careful to not reference root properties in a function which is in a subcomponent
// until the root component has completed loading. Otherwise you get undefined references.
flightMap.rootLoadCompleted = true
......@@ -122,6 +127,8 @@ Item {
onRootVehicleCoordinateChanged: updateMapPosition(false /* force */)
Component.onCompleted: flightMapDelayLoader.source = "FlightDisplayViewDelayLoadInner.qml"
function updateMapPosition(force) {
if ((_followVehicle || force) && rootLoadCompleted) {
flightMap.latitude = root._vehicleCoordinate.latitude
......@@ -183,255 +190,14 @@ Item {
}
}
// Vehicle GPS lock display
Column {
id: gpsLockColumn
y: (parent.height - height) / 2
width: parent.width
Repeater {
model: multiVehicleManager.vehicles
delegate:
QGCLabel {
width: gpsLockColumn.width
horizontalAlignment: Text.AlignHCenter
visible: object.satelliteLock < 2
text: "No GPS Lock for Vehicle #" + object.id
z: flightMap.zOrderMapItems - 2
}
}
}
QGCCompassWidget {
anchors.leftMargin: ScreenTools.defaultFontPixelHeight
anchors.topMargin: topMargin
anchors.left: parent.left
anchors.top: parent.top
size: ScreenTools.defaultFontPixelSize * (13.3)
heading: _heading
active: multiVehicleManager.activeVehicleAvailable
z: flightMap.zOrderWidgets
}
QGCAttitudeWidget {
anchors.margins: ScreenTools.defaultFontPixelHeight
anchors.left: parent.left
anchors.bottom: parent.bottom
size: ScreenTools.defaultFontPixelSize * (13.3)
rollAngle: _roll
pitchAngle: _pitch
active: multiVehicleManager.activeVehicleAvailable
z: flightMap.zOrderWidgets
}
DropButton {
id: centerMapDropButton
anchors.rightMargin: ScreenTools.defaultFontPixelHeight
anchors.right: mapTypeButton.left
anchors.top: mapTypeButton.top
dropDirection: dropDown
buttonImage: "/qmlimages/MapCenter.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2
exclusiveGroup: _dropButtonsExclusiveGroup
z: flightMap.zOrderWidgets
dropDownComponent: Component {
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCCheckBox {
id: followVehicleCheckBox
text: "Follow Vehicle"
checked: flightMap._followVehicle
anchors.baseline: centerMapButton.baseline
onClicked: {
centerMapDropButton.hideDropDown()
flightMap._followVehicle = !flightMap._followVehicle
}
}
QGCButton {
id: centerMapButton
text: "Center map on Vehicle"
enabled: _activeVehicle && !followVehicleCheckBox.checked
property var activeVehicle: multiVehicleManager.activeVehicle
onClicked: {
centerMapDropButton.hideDropDown()
flightMap.latitude = activeVehicle.latitude
flightMap.longitude = activeVehicle.longitude
}
}
}
}
}
DropButton {
id: mapTypeButton
anchors.topMargin: topMargin
anchors.rightMargin: ScreenTools.defaultFontPixelHeight
anchors.top: parent.top
anchors.right: parent.right
dropDirection: dropDown
buttonImage: "/qmlimages/MapType.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2
exclusiveGroup: _dropButtonsExclusiveGroup
z: flightMap.zOrderWidgets
dropDownComponent: Component {
Row {
spacing: ScreenTools.defaultFontPixelWidth
Repeater {
model: QGroundControl.flightMapSettings.mapTypes
QGCButton {
checkable: true
checked: flightMap.mapType == text
text: modelData
onClicked: {
flightMap.mapType = text
mapTypeButton.hideDropDown()
}
}
}
}
}
Loader {
id: flightMapDelayLoader
anchors.fill: parent
}
} // Flight Map
QGCVideoBackground {
Loader {
id: delayLoader
anchors.fill: parent
display: _controller.videoSurface
receiver: _controller.videoReceiver
visible: !_showMap
QGCCompassHUD {
id: compassHUD
y: root.height * 0.7
x: root.width * 0.5 - ScreenTools.defaultFontPixelSize * (5)
width: ScreenTools.defaultFontPixelSize * (10)
height: ScreenTools.defaultFontPixelSize * (10)
heading: _heading
active: multiVehicleManager.activeVehicleAvailable
z: flightMap.zOrderWidgets
}
QGCAttitudeHUD {
id: attitudeHUD
rollAngle: _roll
pitchAngle: _pitch
width: ScreenTools.defaultFontPixelSize * (30)
height: ScreenTools.defaultFontPixelSize * (30)
active: multiVehicleManager.activeVehicleAvailable
z: flightMap.zOrderWidgets
}
}
QGCAltitudeWidget {
anchors.right: parent.right
height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65
width: ScreenTools.defaultFontPixelSize * (5)
altitude: _altitudeWGS84
z: flightMap.zOrderWidgets
visible: !hideWidgets
}
QGCSpeedWidget {
anchors.left: parent.left
width: ScreenTools.defaultFontPixelSize * (5)
height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65
speed: _groundSpeed
z: flightMap.zOrderWidgets
visible: !hideWidgets
}
QGCCurrentSpeed {
anchors.left: parent.left
width: ScreenTools.defaultFontPixelSize * (6.25)
airspeed: _airSpeed
groundspeed: _groundSpeed
active: multiVehicleManager.activeVehicleAvailable
z: flightMap.zOrderWidgets
visible: !hideWidgets
}
QGCCurrentAltitude {
anchors.right: parent.right
width: ScreenTools.defaultFontPixelSize * (6.25)
altitude: _altitudeWGS84
vertZ: _climbRate
active: multiVehicleManager.activeVehicleAvailable
z: flightMap.zOrderWidgets
visible: !hideWidgets
}
// Mission item list
ListView {
id: missionItemSummaryList
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.left: parent.left
anchors.right: optionsButton.left
anchors.bottom: parent.bottom
height: ScreenTools.defaultFontPixelHeight * 7
spacing: ScreenTools.defaultFontPixelWidth / 2
opacity: 0.75
orientation: ListView.Horizontal
model: multiVehicleManager.activeVehicle ? multiVehicleManager.activeVehicle.missionItems : 0
z: flightMap.zOrderWidgets
visible: !hideWidgets
property real _maxItemHeight: 0
delegate:
MissionItemSummary {
opacity: 0.75
missionItem: object
}
} // ListView - Mission item list
QGCButton {
id: optionsButton
x: flightMap.mapWidgets.x
y: flightMap.mapWidgets.y - height - (ScreenTools.defaultFontPixelHeight / 2)
z: flightMap.zOrderWidgets
width: flightMap.mapWidgets.width
text: "Options"
menu: optionsMenu
visible: _controller.hasVideo && !hideWidgets
ExclusiveGroup {
id: backgroundTypeGroup
}
Menu {
id: optionsMenu
MenuItem {
id: mapBackgroundMenuItem
exclusiveGroup: backgroundTypeGroup
checkable: true
checked: _showMap
text: "Show map as background"
onTriggered: _setShowMap(true)
}
MenuItem {
id: videoBackgroundMenuItem
exclusiveGroup: backgroundTypeGroup
checkable: true
checked: !_showMap
text: "Show video as background"
onTriggered: _setShowMap(false)
}
}
}
}
/*=====================================================================
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/>.
======================================================================*/
import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Controls.Styles 1.2
import QtQuick.Dialogs 1.2
import QtLocation 5.3
import QtPositioning 5.2
import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Vehicle 1.0
import QGroundControl.FlightMap 1.0
/// This component is used to delay load the controls which are children of the inner FlightMap
/// control of FlightDisplayView.
// Vehicle GPS lock display
Item {
Column {
id: gpsLockColumn
y: (parent.height - height) / 2
width: parent.width
Repeater {
model: multiVehicleManager.vehicles
delegate:
QGCLabel {
width: gpsLockColumn.width
horizontalAlignment: Text.AlignHCenter
visible: object.satelliteLock < 2
text: "No GPS Lock for Vehicle #" + object.id
z: flightMap.zOrderMapItems - 2
}
}
}
QGCCompassWidget {
anchors.leftMargin: ScreenTools.defaultFontPixelHeight
anchors.topMargin: topMargin
anchors.left: parent.left
anchors.top: parent.top
size: ScreenTools.defaultFontPixelSize * (13.3)
heading: _heading
active: multiVehicleManager.activeVehicleAvailable
z: flightMap.zOrderWidgets
}
QGCAttitudeWidget {
anchors.margins: ScreenTools.defaultFontPixelHeight
anchors.left: parent.left
anchors.bottom: parent.bottom
size: ScreenTools.defaultFontPixelSize * (13.3)
rollAngle: _roll
pitchAngle: _pitch
active: multiVehicleManager.activeVehicleAvailable
z: flightMap.zOrderWidgets
}
DropButton {
id: centerMapDropButton
anchors.rightMargin: ScreenTools.defaultFontPixelHeight
anchors.right: mapTypeButton.left
anchors.top: mapTypeButton.top
dropDirection: dropDown
buttonImage: "/qmlimages/MapCenter.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2
exclusiveGroup: _dropButtonsExclusiveGroup
z: flightMap.zOrderWidgets
dropDownComponent: Component {
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCCheckBox {
id: followVehicleCheckBox
text: "Follow Vehicle"
checked: flightMap._followVehicle
anchors.baseline: centerMapButton.baseline
onClicked: {
centerMapDropButton.hideDropDown()
flightMap._followVehicle = !flightMap._followVehicle
}
}
QGCButton {
id: centerMapButton
text: "Center map on Vehicle"
enabled: _activeVehicle && !followVehicleCheckBox.checked
property var activeVehicle: multiVehicleManager.activeVehicle
onClicked: {
centerMapDropButton.hideDropDown()
flightMap.latitude = activeVehicle.latitude
flightMap.longitude = activeVehicle.longitude
}
}
}
}
}
DropButton {
id: mapTypeButton
anchors.topMargin: topMargin
anchors.rightMargin: ScreenTools.defaultFontPixelHeight
anchors.top: parent.top
anchors.right: parent.right
dropDirection: dropDown
buttonImage: "/qmlimages/MapType.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2
exclusiveGroup: _dropButtonsExclusiveGroup
z: flightMap.zOrderWidgets
dropDownComponent: Component {
Row {
spacing: ScreenTools.defaultFontPixelWidth
Repeater {
model: QGroundControl.flightMapSettings.mapTypes
QGCButton {
checkable: true
checked: flightMap.mapType == text
text: modelData
onClicked: {
flightMap.mapType = text
mapTypeButton.hideDropDown()
}
}
}
}
}
}
}
/*=====================================================================
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/>.
======================================================================*/
import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Controls.Styles 1.2
import QtQuick.Dialogs 1.2
import QtLocation 5.3
import QtPositioning 5.2
import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Vehicle 1.0
import QGroundControl.FlightMap 1.0
/// This component is used to delay load the items which are direct children of the
/// FlightDisplayViewControl.
Item {
QGCVideoBackground {
anchors.fill: parent
display: _controller.videoSurface
receiver: _controller.videoReceiver
visible: !_showMap
QGCCompassHUD {
id: compassHUD
y: root.height * 0.7
x: root.width * 0.5 - ScreenTools.defaultFontPixelSize * (5)
width: ScreenTools.defaultFontPixelSize * (10)
height: ScreenTools.defaultFontPixelSize * (10)
heading: _heading
active: multiVehicleManager.activeVehicleAvailable
z: _flightMap.zOrderWidgets
}
QGCAttitudeHUD {
id: attitudeHUD
rollAngle: _roll
pitchAngle: _pitch
width: ScreenTools.defaultFontPixelSize * (30)
height: ScreenTools.defaultFontPixelSize * (30)
active: multiVehicleManager.activeVehicleAvailable
z: _flightMap.zOrderWidgets
}
}
QGCAltitudeWidget {
anchors.right: parent.right
height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65
width: ScreenTools.defaultFontPixelSize * (5)
altitude: _altitudeWGS84
z: _flightMap.zOrderWidgets
visible: !hideWidgets
}
QGCSpeedWidget {
anchors.left: parent.left
width: ScreenTools.defaultFontPixelSize * (5)
height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65
speed: _groundSpeed
z: _flightMap.zOrderWidgets
visible: !hideWidgets
}
QGCCurrentSpeed {
anchors.left: parent.left
width: ScreenTools.defaultFontPixelSize * (6.25)
airspeed: _airSpeed
groundspeed: _groundSpeed
active: multiVehicleManager.activeVehicleAvailable
z: _flightMap.zOrderWidgets
visible: !hideWidgets
}
QGCCurrentAltitude {
anchors.right: parent.right
width: ScreenTools.defaultFontPixelSize * (6.25)
altitude: _altitudeWGS84
vertZ: _climbRate
active: multiVehicleManager.activeVehicleAvailable
z: _flightMap.zOrderWidgets
visible: !hideWidgets
}
QGCButton {
id: optionsButton
x: _flightMap.mapWidgets.x
y: _flightMap.mapWidgets.y - height - (ScreenTools.defaultFontPixelHeight / 2)
z: _flightMap.zOrderWidgets
width: _flightMap.mapWidgets.width
text: "Options"
menu: optionsMenu
visible: _controller.hasVideo && !hideWidgets
ExclusiveGroup {
id: backgroundTypeGroup
}
Menu {
id: optionsMenu
MenuItem {
id: mapBackgroundMenuItem
exclusiveGroup: backgroundTypeGroup
checkable: true
checked: _showMap
text: "Show map as background"
onTriggered: _setShowMap(true)
}
MenuItem {
id: videoBackgroundMenuItem
exclusiveGroup: backgroundTypeGroup
checkable: true
checked: !_showMap
text: "Show video as background"
onTriggered: _setShowMap(false)
}
}
}
}
Module QGroundControl.FlightDisplay
FlightDisplayView 1.0 FlightDisplayView.qml
FlightDisplayViewDelayLoadInner 1.0 FlightDisplayViewDelayLoadInner.qml
FlightDisplayViewDelayLoadOuter 1.0 FlightDisplayViewDelayLoadOuter.qml
......@@ -34,6 +34,4 @@ MissionItemIndexLabel 1.0 MissionItemIndexLabel.qml
MissionItemSummary 1.0 MissionItemSummary.qml
MissionItemEditor 1.0 MissionItemEditor.qml
MainToolBar 1.0 MainToolBar.qml
FlightDisplayView 1.0 FlightDisplayView.qml
MainToolBar 1.0 MainToolBar.qml
......@@ -26,14 +26,16 @@ import QtQuick.Controls 1.2
import QtPositioning 5.2
import QGroundControl.Controls 1.0
import QGroundControl.FlightMap 1.0
import QGroundControl.FlightDisplay 1.0
import QGroundControl.ScreenTools 1.0
/// Qml for MainWindow
FlightDisplayView {
id: _root
// sets the top margin soo map widgets are not under toolbar
topMargin: toolbar.height + ScreenTools.defaultFontPixelWidth
topMargin: toolbarLoader.height
property var _toolbar: toolbarLoader.item
readonly property string _planViewSource: "MissionEditor.qml"
readonly property string _setupViewSource: "SetupView.qml"
......@@ -65,7 +67,7 @@ FlightDisplayView {
_root.hideWidgets = true
}
onShowToolbarMessage: toolbar.showToolbarMessage(message)
onShowToolbarMessage: _toolbar.showToolbarMessage(message)
// The following are use for unit testing only
......@@ -75,9 +77,15 @@ FlightDisplayView {
onShowSetupVehicleComponent: setupViewLoader.item.showVehicleComponentPanel(vehicleComponent)
}
MainToolBar {
id: toolbar
// We delay load the following control to improve boot time
Component.onCompleted: {
toolbarLoader.source = "MainToolBar.qml"
}
Loader {
id: toolbarLoader
width: parent.width
height: item ? item.height : 0
z: _root.zOrderTopMost
}
......@@ -85,7 +93,7 @@ FlightDisplayView {
id: planViewLoader
anchors.left: parent.left
anchors.right: parent.right
anchors.top: toolbar.bottom
anchors.top: toolbarLoader.bottom
anchors.bottom: parent.bottom
visible: false
......@@ -97,7 +105,7 @@ FlightDisplayView {
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.left: parent.left
anchors.right: parent.right
anchors.top: toolbar.bottom
anchors.top: toolbarLoader.bottom
anchors.bottom: parent.bottom
visible: false
......
/*=====================================================================
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/>.
======================================================================*/
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtPositioning 5.2
import QGroundControl.Controls 1.0
import QGroundControl.FlightDisplay 1.0
import QGroundControl.ScreenTools 1.0
/// Qml for MainWindow
FlightDisplayView {
id: _root
topMargin: toolbarLoader.height
property var _toolbar: toolbarLoader.item
readonly property string _planViewSource: "MissionEditor.qml"
readonly property string _setupViewSource: "SetupView.qml"
Connections {
target: controller
onShowFlyView: {
setupViewLoader.visible = false
planViewLoader.visible = false
_root.hideWidgets = false
}
onShowPlanView: {
if (planViewLoader.source != _planViewSource) {
planViewLoader.source = _planViewSource
}
setupViewLoader.visible = false
planViewLoader.visible = true
_root.hideWidgets = true
}
onShowSetupView: {
if (setupViewLoader.source != _setupViewSource) {
setupViewLoader.source = _setupViewSource
}
setupViewLoader.visible = true
planViewLoader.visible = false
_root.hideWidgets = true
}
onShowToolbarMessage: _toolbar.showToolbarMessage(message)
// The following are use for unit testing only
onShowSetupFirmware: setupViewLoader.item.showFirmwarePanel()
onShowSetupParameters: setupViewLoader.item.showParametersPanel()
onShowSetupSummary: setupViewLoader.item.showSummaryPanel()
onShowSetupVehicleComponent: setupViewLoader.item.showVehicleComponentPanel(vehicleComponent)
}
// We delay load the following control to improve boot time
Component.onCompleted: {
toolbarLoader.source = "MainToolBar.qml"
}
Loader {
id: toolbarLoader
width: parent.width
height: item ? item.height : 0
z: _root.zOrderTopMost
}
Loader {
id: planViewLoader
anchors.left: parent.left
anchors.right: parent.right
anchors.top: toolbarLoader.bottom
anchors.bottom: parent.bottom
visible: false
property real zOrder: _root.zOrderTopMost
}
Loader {
id: setupViewLoader
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.left: parent.left
anchors.right: parent.right
anchors.top: toolbarLoader.bottom
anchors.bottom: parent.bottom
visible: false
property real zOrder: _root.zOrderTopMost
}
}
......@@ -42,7 +42,7 @@ Item {
id: toolBarHolder
height: toolBarHeight
property var qgcPal: QGCPalette { id: palette; colorGroupEnabled: true }
QGCPalette { id: qgcPal; colorGroupEnabled: true }
property var activeVehicle: multiVehicleManager.activeVehicle
......@@ -153,7 +153,7 @@ Item {
//-------------------------------------------------------------------------
//-- Main menu for Mobile Devices
Menu {
id: maintMenu
id: mobileMenu
ExclusiveGroup { id: mainMenuGroup }
......@@ -204,561 +204,106 @@ Item {
}
} // Menu
Component {
id: activeVehicleComponent
Row {
height: cellHeight
spacing: cellSpacerSize
Rectangle {
id: messages
width: (activeVehicle.messageCount > 99) ? getProportionalDimmension(65) : getProportionalDimmension(60)
height: cellHeight
anchors.verticalCenter: parent.verticalCenter
color: getMessageColor()
border.color: "#00000000"
border.width: 0
property bool showTriangle: false
Image {
id: messageIcon
source: getMessageIcon();
height: getProportionalDimmension(16)
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: getProportionalDimmension(8)
}
Item {
id: messageTextRect
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
width: messages.width - messageIcon.width
QGCLabel {
id: messageText
text: (activeVehicle.messageCount > 0) ? activeVehicle.messageCount : ''
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
color: colorWhite
}
}
Image {
id: dropDown
source: "/qmlimages/arrow-down.png"
visible: (messages.showTriangle) && (activeVehicle.messageCount > 0)
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.bottomMargin: getProportionalDimmension(3)
anchors.rightMargin: getProportionalDimmension(3)
}
Timer {
id: mouseOffTimer
interval: 2000;
running: false;
repeat: false
onTriggered: {
messages.showTriangle = false;
}
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: {
messages.showTriangle = true;
mouseOffTimer.start();
}
onClicked: {
var p = mapToItem(toolBarHolder, mouseX, mouseY);
_controller.onEnterMessageArea(p.x, p.y);
}
}
}
QGCButton {
width: ScreenTools.defaultFontPixelWidth * 12
height: cellHeight
anchors.verticalCenter: parent.verticalCenter
text: "Vehicle " + activeVehicle.id
menu: vehicleMenu
Menu {
id: vehicleMenu
}
Component {
id: vehicleMenuItemComponent
MenuItem {
checkable: true
checked: vehicle.active
onTriggered: multiVehicleManager.activeVehicle = vehicle
property int vehicleId: Number(text.split(" ")[1])
property var vehicle: multiVehicleManager.getVehicleById(vehicleId)
}
}
property var vehicleMenuItems: []
function updateVehicleMenu() {
// Remove old menu items
for (var i=0; i<vehicleMenuItems.length; i++) {
vehicleMenu.removeItem(vehicleMenuItems[i])
}
vehicleMenuItems.length = 0
// Add new items
for (var i=0; i<multiVehicleManager.vehicles.count; i++) {
var vehicle = multiVehicleManager.vehicles.get(i)
var menuItem = vehicleMenuItemComponent.createObject(null, { "text": "Vehicle " + vehicle.id })
vehicleMenuItems.push(menuItem)
vehicleMenu.insertItem(i, menuItem)
}
}
Component.onCompleted: updateVehicleMenu()
Connections {
target: multiVehicleManager.vehicles
onCountChanged: parent.updateVehicleMenu
}
}
Rectangle {
id: satelitte
width: getProportionalDimmension(55)
height: cellHeight
anchors.verticalCenter: parent.verticalCenter
color: getSatelliteColor();
border.color: "#00000000"
border.width: 0
Image {
source: "qrc:/res/Gps";
height: getProportionalDimmension(24)
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: getProportionalDimmension(6)
mipmap: true
smooth: true
}
QGCLabel {
id: satelitteText
text: activeVehicle.satelliteCount >= 0 ? activeVehicle.satelliteCount : 'NA'
font.pixelSize: activeVehicle.satelliteCount >= 0 ? ScreenTools.defaultFontPixelSize : ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: getProportionalDimmension(6)
horizontalAlignment: Text.AlignRight
color: colorWhite
}
}
Rectangle {
id: rssiRC
width: getProportionalDimmension(55)
height: cellHeight
visible: _controller.remoteRSSI <= 100
anchors.verticalCenter: parent.verticalCenter
color: getRSSIColor(_controller.remoteRSSI);
border.color: "#00000000"
border.width: 0
Image {
source: "qrc:/res/AntennaRC";
width: cellHeight * 0.7
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: getProportionalDimmension(6)
mipmap: true
smooth: true
}
QGCLabel {
text: _controller.remoteRSSI
anchors.right: parent.right
anchors.rightMargin: getProportionalDimmension(6)
anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Text.AlignRight
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
color: colorWhite
}
}
Rectangle {
id: rssiTelemetry
width: getProportionalDimmension(80)
height: cellHeight
visible: (_controller.telemetryRRSSI > 0) && (_controller.telemetryLRSSI > 0)
anchors.verticalCenter: parent.verticalCenter
color: getRSSIColor(Math.min(_controller.telemetryRRSSI,_controller.telemetryLRSSI));
border.color: "#00000000"
border.width: 0
Image {
source: "qrc:/res/AntennaT";
width: cellHeight * 0.7
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: getProportionalDimmension(6)
mipmap: true
smooth: true
}
Column {
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: getProportionalDimmension(6)
Row {
anchors.right: parent.right
QGCLabel {
text: 'R '
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
color: colorWhite
}
QGCLabel {
text: _controller.telemetryRRSSI + 'dB'
width: getProportionalDimmension(30)
horizontalAlignment: Text.AlignRight
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
color: colorWhite
}
}
Row {
anchors.right: parent.right
QGCLabel {
text: 'L '
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
color: colorWhite
}
QGCLabel {
text: _controller.telemetryLRSSI + 'dB'
width: getProportionalDimmension(30)
horizontalAlignment: Text.AlignRight
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
color: colorWhite
}
}
}
}
Rectangle {
id: batteryStatus
width: activeVehicle.batteryConsumed < 0.0 ? getProportionalDimmension(60) : getProportionalDimmension(80)
height: cellHeight
anchors.verticalCenter: parent.verticalCenter
color: getBatteryColor();
border.color: "#00000000"
border.width: 0
Image {
source: getBatteryIcon();
height: getProportionalDimmension(20)
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: getProportionalDimmension(6)
mipmap: true
smooth: true
}
QGCLabel {
visible: batteryStatus.visible && activeVehicle.batteryConsumed < 0.0
text: (activeVehicle.batteryVoltage > 0) ? activeVehicle.batteryVoltage.toFixed(1) + 'V' : '---';
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
anchors.right: parent.right
anchors.rightMargin: getProportionalDimmension(6)
anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Text.AlignRight
color: colorWhite
}
Column {
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: getProportionalDimmension(6)
visible: batteryStatus.visible && activeVehicle.batteryConsumed >= 0.0
QGCLabel {
text: (activeVehicle.batteryVoltage > 0) ? activeVehicle.batteryVoltage.toFixed(1) + 'V' : '---';
width: getProportionalDimmension(30)
horizontalAlignment: Text.AlignRight
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
color: colorWhite
}
QGCLabel {
text: (activeVehicle.batteryConsumed > 0) ? activeVehicle.batteryConsumed.toFixed(0) + 'mAh' : '---';
width: getProportionalDimmension(30)
horizontalAlignment: Text.AlignRight
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
color: colorWhite
}
}
}
QGCButton {
width: ScreenTools.defaultFontPixelWidth * 11
height: cellHeight
anchors.verticalCenter: parent.verticalCenter
text: activeVehicle.armed ? "Armed" : "Disarmed"
menu: Menu {
MenuItem {
enabled: !activeVehicle.armed
text: "Arm"
onTriggered: activeVehicle.armed = true
}
MenuItem {
enabled: activeVehicle.armed
text: "Disarm"
onTriggered: activeVehicle.armed = false
}
}
}
QGCButton {
width: ScreenTools.defaultFontPixelWidth * 15
height: cellHeight
anchors.verticalCenter: parent.verticalCenter
text: activeVehicle.flightMode
menu: activeVehicle.flightModeSetAvailable ? flightModesMenu : null
Menu {
id: flightModesMenu
}
Component {
id: flightModeMenuItemComponent
MenuItem {
checkable: true
checked: activeVehicle.flightMode == text
onTriggered: activeVehicle.flightMode = text
}
}
property var flightModesMenuItems: []
function updateFlightModesMenu() {
if (activeVehicle.flightModeSetAvailable) {
// Remove old menu items
for (var i=0; i<flightModesMenuItems.length; i++) {
flightModesMenu.removeItem(flightModesMenuItems[i])
}
flightModesMenuItems.length = 0
// Add new items
for (var i=0; i<activeVehicle.flightModes.length; i++) {
var menuItem = flightModeMenuItemComponent.createObject(null, { "text": activeVehicle.flightModes[i] })
flightModesMenuItems.push(menuItem)
flightModesMenu.insertItem(i, menuItem)
}
}
}
Component.onCompleted: updateFlightModesMenu()
Connections {
target: multiVehicleManager
onActiveVehicleChanged: parent.updateFlightModesMenu
}
}
Rectangle {
width: ScreenTools.defaultFontPixelWidth * 4
height: cellHeight
anchors.verticalCenter: parent.verticalCenter
color: colorBlue
border.width: 0
visible: activeVehicle.hilMode
QGCLabel {
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: "HIL"
}
}
} // Row
} // Component - activeVehicleComponent
/*
Row {
id: toolRow
x: horizontalMargins
y: (toolBarHeight - cellHeight) / 2
height: cellHeight
spacing: getProportionalDimmension(4)
}
*/
Loader {
id: desktopToolsLoader
height: cellHeight
x: horizontalMargins
y: (toolBarHeight - cellHeight) / 2
sourceComponent: ScreenTools.isMobile ? undefined : desktopTools
}
//---------------------------------------------------------------------
//-- Main menu for Non Mobile Devices (Chevron Buttons)
Row {
id: row11
height: cellHeight
spacing: -getProportionalDimmension(12)
anchors.top: parent.top
visible: !ScreenTools.isMobile
Connections {
target: ScreenTools
onRepaintRequested: {
setupButton.repaintChevron = true;
planButton.repaintChevron = true;
flyButton.repaintChevron = true;
}
}
ExclusiveGroup { id: mainActionGroup }
QGCToolBarButton {
id: setupButton
width: getProportionalDimmension(90)
height: cellHeight
exclusiveGroup: mainActionGroup
text: "Setup"
onClicked: {
checked = true
_controller.onSetupView();
}
z: 1000
}
QGCToolBarButton {
id: planButton
width: getProportionalDimmension(90)
height: cellHeight
exclusiveGroup: mainActionGroup
text: "Plan"
//---------------------------------------------------------------------
//-- Indicators
Row {
id: row12
x: desktopToolsLoader.item.width + horizontalMargins
height: cellHeight
spacing: cellSpacerSize
anchors.top: desktopToolsLoader.top
anchors.verticalCenter: desktopToolsLoader.verticalCenter
onClicked: {
checked = true
_controller.onPlanView();
}
z: 900
//-- "Hamburger" menu for Mobile Devices
Item {
id: actionButton
visible: ScreenTools.isMobile
height: cellHeight
width: cellHeight
Image {
id: buttomImg
anchors.fill: parent
source: "/qmlimages/buttonMore.svg"
mipmap: true
smooth: true
antialiasing: true
fillMode: Image.PreserveAspectFit
}
QGCToolBarButton {
id: flyButton
width: getProportionalDimmension(90)
height: cellHeight
exclusiveGroup: mainActionGroup
text: "Fly"
checked: true
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton
onClicked: {
checked = true
_controller.onFlyView();
}
z: 800
}
} // Row
//---------------------------------------------------------------------
//-- Indicators
Row {
id: row12
height: cellHeight
spacing: cellSpacerSize
anchors.verticalCenter: parent.verticalCenter
//-- "Hamburger" menu for Mobile Devices
Item {
id: actionButton
visible: ScreenTools.isMobile
height: cellHeight
width: cellHeight
Image {
id: buttomImg
anchors.fill: parent
source: "/qmlimages/buttonMore.svg"
mipmap: true
smooth: true
antialiasing: true
fillMode: Image.PreserveAspectFit
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton
onClicked: {
if (mouse.button == Qt.LeftButton)
{
maintMenu.popup();
}
if (mouse.button == Qt.LeftButton)
{
mobileMenu.popup();
}
}
}
}
//-- Separator if Hamburger menu is visible
Rectangle {
visible: actionButton.visible
height: cellHeight
width: cellHeight
color: "#00000000"
anchors.verticalCenter: parent.verticalCenter
}
//-- Separator if Hamburger menu is visible
Rectangle {
visible: actionButton.visible
height: cellHeight
width: cellHeight
color: "#00000000"
anchors.verticalCenter: parent.verticalCenter
}
Loader {
id: activeVehicleLoader
visible: showMavStatus()
sourceComponent: multiVehicleManager.activeVehicleAvailable ? activeVehicleComponent : undefined
Loader {
id: activeVehicleLoader
visible: showMavStatus()
source: multiVehicleManager.activeVehicleAvailable ? "MainToolBarActiveVehicleComponent.qml" : ""
property real cellHeight: toolBarHolder.cellHeight
property real cellSpacerSize: toolBarHolder.cellSpacerSize
}
property real cellHeight: toolBarHolder.cellHeight
property real cellSpacerSize: toolBarHolder.cellSpacerSize
}
Rectangle {
id: connectionStatus
width: getProportionalDimmension(160)
height: cellHeight
visible: (_controller.connectionCount > 0 && multiVehicleManager.activeVehicleAvailable && activeVehicle.heartbeatTimeout != 0)
Rectangle {
id: connectionStatus
width: getProportionalDimmension(160)
height: cellHeight
visible: (_controller.connectionCount > 0 && multiVehicleManager.activeVehicleAvailable && activeVehicle.heartbeatTimeout != 0)
anchors.verticalCenter: parent.verticalCenter
color: "#00000000"
border.color: "#00000000"
border.width: 0
QGCLabel {
id: connectionStatusText
text: qsTr("CONNECTION LOST")
font.pixelSize: ScreenTools.defaultFontPixelSize
font.weight: Font.DemiBold
anchors.verticalCenter: parent.verticalCenter
color: "#00000000"
border.color: "#00000000"
border.width: 0
QGCLabel {
id: connectionStatusText
text: qsTr("CONNECTION LOST")
font.pixelSize: ScreenTools.defaultFontPixelSize
font.weight: Font.DemiBold
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
color: colorRedText
}
anchors.horizontalCenter: parent.horizontalCenter
color: colorRedText
}
} // Row
}
} // Row
Row {
id: connectRow
anchors.rightMargin: verticalMargins
anchors.right: parent.right
anchors.top: toolRow.top
anchors.verticalCenter: toolRow.verticalCenter
height: toolRow.height
anchors.top: desktopToolsLoader.top
anchors.verticalCenter: desktopToolsLoader.verticalCenter
height: desktopToolsLoader.height
spacing: cellSpacerSize
Menu {
......@@ -836,7 +381,7 @@ Item {
// Progress bar
Rectangle {
id: progressBar
anchors.top: toolRow.bottom
anchors.top: desktopToolsLoader.bottom
height: getProportionalDimmension(3)
width: parent.width * _controller.progressBarValue
color: qgcPal.text
......@@ -878,4 +423,70 @@ Item {
}
}
}
Component {
id: desktopTools
//---------------------------------------------------------------------
//-- Main menu for Non Mobile Devices (Chevron Buttons)
Row {
id: row11
height: cellHeight
spacing: -getProportionalDimmension(12)
Connections {
target: ScreenTools
onRepaintRequested: {
setupButton.repaintChevron = true;
planButton.repaintChevron = true;
flyButton.repaintChevron = true;
}
}
ExclusiveGroup { id: mainActionGroup }
QGCToolBarButton {
id: setupButton
width: getProportionalDimmension(90)
height: cellHeight
exclusiveGroup: mainActionGroup
text: "Setup"
onClicked: {
checked = true
_controller.onSetupView();
}
z: 1000
}
QGCToolBarButton {
id: planButton
width: getProportionalDimmension(90)
height: cellHeight
exclusiveGroup: mainActionGroup
text: "Plan"
onClicked: {
checked = true
_controller.onPlanView();
}
z: 900
}
QGCToolBarButton {
id: flyButton
width: getProportionalDimmension(90)
height: cellHeight
exclusiveGroup: mainActionGroup
text: "Fly"
checked: true
onClicked: {
checked = true
_controller.onFlyView();
}
z: 800
}
} // Row
} // Component - desktopTools
} // Rectangle
/*=====================================================================
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/>.
======================================================================*/
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
Row {
height: cellHeight
spacing: cellSpacerSize
Rectangle {
id: messages
width: (activeVehicle.messageCount > 99) ? getProportionalDimmension(65) : getProportionalDimmension(60)
height: cellHeight
anchors.verticalCenter: parent.verticalCenter
color: getMessageColor()
border.color: "#00000000"
border.width: 0
property bool showTriangle: false
Image {
id: messageIcon
source: getMessageIcon();
height: getProportionalDimmension(16)
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: getProportionalDimmension(8)
}
Item {
id: messageTextRect
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
width: messages.width - messageIcon.width
QGCLabel {
id: messageText
text: (activeVehicle.messageCount > 0) ? activeVehicle.messageCount : ''
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
color: colorWhite
}
}
Image {
id: dropDown
source: "/qmlimages/arrow-down.png"
visible: (messages.showTriangle) && (activeVehicle.messageCount > 0)
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.bottomMargin: getProportionalDimmension(3)
anchors.rightMargin: getProportionalDimmension(3)
}
Timer {
id: mouseOffTimer
interval: 2000;
running: false;
repeat: false
onTriggered: {
messages.showTriangle = false;
}
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: {
messages.showTriangle = true;
mouseOffTimer.start();
}
onClicked: {
var p = mapToItem(toolBarHolder, mouseX, mouseY);
_controller.onEnterMessageArea(p.x, p.y);
}
}
}
QGCButton {
width: ScreenTools.defaultFontPixelWidth * 12
height: cellHeight
anchors.verticalCenter: parent.verticalCenter
text: "Vehicle " + activeVehicle.id
menu: vehicleMenu
Menu {
id: vehicleMenu
}
Component {
id: vehicleMenuItemComponent
MenuItem {
checkable: true
checked: vehicle.active
onTriggered: multiVehicleManager.activeVehicle = vehicle
property int vehicleId: Number(text.split(" ")[1])
property var vehicle: multiVehicleManager.getVehicleById(vehicleId)
}
}
property var vehicleMenuItems: []
function updateVehicleMenu() {
// Remove old menu items
for (var i=0; i<vehicleMenuItems.length; i++) {
vehicleMenu.removeItem(vehicleMenuItems[i])
}
vehicleMenuItems.length = 0
// Add new items
for (var i=0; i<multiVehicleManager.vehicles.count; i++) {
var vehicle = multiVehicleManager.vehicles.get(i)
var menuItem = vehicleMenuItemComponent.createObject(null, { "text": "Vehicle " + vehicle.id })
vehicleMenuItems.push(menuItem)
vehicleMenu.insertItem(i, menuItem)
}
}
Component.onCompleted: updateVehicleMenu()
Connections {
target: multiVehicleManager.vehicles
onCountChanged: parent.updateVehicleMenu
}
}
Rectangle {
id: satelitte
width: getProportionalDimmension(55)
height: cellHeight
anchors.verticalCenter: parent.verticalCenter
color: getSatelliteColor();
border.color: "#00000000"
border.width: 0
Image {
source: "qrc:/res/Gps";
height: getProportionalDimmension(24)
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: getProportionalDimmension(6)
mipmap: true
smooth: true
}
QGCLabel {
id: satelitteText
text: activeVehicle.satelliteCount >= 0 ? activeVehicle.satelliteCount : 'NA'
font.pixelSize: activeVehicle.satelliteCount >= 0 ? ScreenTools.defaultFontPixelSize : ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: getProportionalDimmension(6)
horizontalAlignment: Text.AlignRight
color: colorWhite
}
}
Rectangle {
id: rssiRC
width: getProportionalDimmension(55)
height: cellHeight
visible: _controller.remoteRSSI <= 100
anchors.verticalCenter: parent.verticalCenter
color: getRSSIColor(_controller.remoteRSSI);
border.color: "#00000000"
border.width: 0
Image {
source: "qrc:/res/AntennaRC";
width: cellHeight * 0.7
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: getProportionalDimmension(6)
mipmap: true
smooth: true
}
QGCLabel {
text: _controller.remoteRSSI
anchors.right: parent.right
anchors.rightMargin: getProportionalDimmension(6)
anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Text.AlignRight
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
color: colorWhite
}
}
Rectangle {
id: rssiTelemetry
width: getProportionalDimmension(80)
height: cellHeight
visible: (_controller.telemetryRRSSI > 0) && (_controller.telemetryLRSSI > 0)
anchors.verticalCenter: parent.verticalCenter
color: getRSSIColor(Math.min(_controller.telemetryRRSSI,_controller.telemetryLRSSI));
border.color: "#00000000"
border.width: 0
Image {
source: "qrc:/res/AntennaT";
width: cellHeight * 0.7
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: getProportionalDimmension(6)
mipmap: true
smooth: true
}
Column {
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: getProportionalDimmension(6)
Row {
anchors.right: parent.right
QGCLabel {
text: 'R '
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
color: colorWhite
}
QGCLabel {
text: _controller.telemetryRRSSI + 'dB'
width: getProportionalDimmension(30)
horizontalAlignment: Text.AlignRight
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
color: colorWhite
}
}
Row {
anchors.right: parent.right
QGCLabel {
text: 'L '
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
color: colorWhite
}
QGCLabel {
text: _controller.telemetryLRSSI + 'dB'
width: getProportionalDimmension(30)
horizontalAlignment: Text.AlignRight
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
color: colorWhite
}
}
}
}
Rectangle {
id: batteryStatus
width: activeVehicle.batteryConsumed < 0.0 ? getProportionalDimmension(60) : getProportionalDimmension(80)
height: cellHeight
anchors.verticalCenter: parent.verticalCenter
color: getBatteryColor();
border.color: "#00000000"
border.width: 0
Image {
source: getBatteryIcon();
height: getProportionalDimmension(20)
fillMode: Image.PreserveAspectFit
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: getProportionalDimmension(6)
mipmap: true
smooth: true
}
QGCLabel {
visible: batteryStatus.visible && activeVehicle.batteryConsumed < 0.0
text: (activeVehicle.batteryVoltage > 0) ? activeVehicle.batteryVoltage.toFixed(1) + 'V' : '---';
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
anchors.right: parent.right
anchors.rightMargin: getProportionalDimmension(6)
anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Text.AlignRight
color: colorWhite
}
Column {
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: getProportionalDimmension(6)
visible: batteryStatus.visible && activeVehicle.batteryConsumed >= 0.0
QGCLabel {
text: (activeVehicle.batteryVoltage > 0) ? activeVehicle.batteryVoltage.toFixed(1) + 'V' : '---';
width: getProportionalDimmension(30)
horizontalAlignment: Text.AlignRight
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
color: colorWhite
}
QGCLabel {
text: (activeVehicle.batteryConsumed > 0) ? activeVehicle.batteryConsumed.toFixed(0) + 'mAh' : '---';
width: getProportionalDimmension(30)
horizontalAlignment: Text.AlignRight
font.pixelSize: ScreenTools.smallFontPixelSize
font.weight: Font.DemiBold
color: colorWhite
}
}
}
QGCButton {
width: ScreenTools.defaultFontPixelWidth * 11
height: cellHeight
anchors.verticalCenter: parent.verticalCenter
text: activeVehicle.armed ? "Armed" : "Disarmed"
menu: Menu {
MenuItem {
enabled: !activeVehicle.armed
text: "Arm"
onTriggered: activeVehicle.armed = true
}
MenuItem {
enabled: activeVehicle.armed
text: "Disarm"
onTriggered: activeVehicle.armed = false
}
}
}
QGCButton {
width: ScreenTools.defaultFontPixelWidth * 15
height: cellHeight
anchors.verticalCenter: parent.verticalCenter
text: activeVehicle.flightMode
menu: activeVehicle.flightModeSetAvailable ? flightModesMenu : null
Menu {
id: flightModesMenu
}
Component {
id: flightModeMenuItemComponent
MenuItem {
checkable: true
checked: activeVehicle.flightMode == text
onTriggered: activeVehicle.flightMode = text
}
}
property var flightModesMenuItems: []
function updateFlightModesMenu() {
if (activeVehicle.flightModeSetAvailable) {
// Remove old menu items
for (var i=0; i<flightModesMenuItems.length; i++) {
flightModesMenu.removeItem(flightModesMenuItems[i])
}
flightModesMenuItems.length = 0
// Add new items
for (var i=0; i<activeVehicle.flightModes.length; i++) {
var menuItem = flightModeMenuItemComponent.createObject(null, { "text": activeVehicle.flightModes[i] })
flightModesMenuItems.push(menuItem)
flightModesMenu.insertItem(i, menuItem)
}
}
}
Component.onCompleted: updateFlightModesMenu()
Connections {
target: multiVehicleManager
onActiveVehicleChanged: parent.updateFlightModesMenu
}
}
Rectangle {
width: ScreenTools.defaultFontPixelWidth * 4
height: cellHeight
anchors.verticalCenter: parent.verticalCenter
color: colorBlue
border.width: 0
visible: activeVehicle.hilMode
QGCLabel {
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: "HIL"
}
}
} // Row
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment