diff --git a/QGCExternalLibs.pri b/QGCExternalLibs.pri
index e548838044dbfb75c7904ec2f2d46798cd692f30..28051f7c98bd44e81f4ace9f0b7998130d6e0843 100644
--- a/QGCExternalLibs.pri
+++ b/QGCExternalLibs.pri
@@ -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.
diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc
index b2d5ce6a3ba28f0a318ac834a2bbe4868f947f88..b85d0a534a63a4f118bd0c98f6b402f34794d773 100644
--- a/qgroundcontrol.qrc
+++ b/qgroundcontrol.qrc
@@ -124,7 +124,7 @@
src/ui/MainWindow.qml
src/ui/toolbar/MainToolBar.qml
- src/FlightDisplay/FlightDisplayView.qml
+ src/ui/toolbar/MainToolBarActiveVehicleComponent.qml
src/VehicleSetup/SetupView.qml
@@ -152,6 +152,13 @@
src/FlightDisplay/FlightDisplayWidget.qml
src/MissionEditor/MissionEditor.qml
+
+ src/FlightDisplay/qmldir
+ src/FlightDisplay/FlightDisplayView.qml
+ src/FlightDisplay/FlightDisplayViewDelayLoadInner.qml
+ src/FlightDisplay/FlightDisplayViewDelayLoadOuter.qml
+
+
src/FlightMap/qmldir
src/FlightMap/FlightMap.qml
diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml
index 6565ef69804e94e42ae86cb8fc1e65d7dd9185e2..1f361be2f4a253ea4e9f8e01762368d046d7e94a 100644
--- a/src/FlightDisplay/FlightDisplayView.qml
+++ b/src/FlightDisplay/FlightDisplayView.qml
@@ -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)
- }
- }
}
}
diff --git a/src/FlightDisplay/FlightDisplayViewDelayLoadInner.qml b/src/FlightDisplay/FlightDisplayViewDelayLoadInner.qml
new file mode 100644
index 0000000000000000000000000000000000000000..7660a859c1d11fe5fa84ad76c37cfecc1872fc54
--- /dev/null
+++ b/src/FlightDisplay/FlightDisplayViewDelayLoadInner.qml
@@ -0,0 +1,160 @@
+/*=====================================================================
+
+QGroundControl Open Source Ground Control Station
+
+(c) 2009, 2015 QGROUNDCONTROL PROJECT
+
+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 .
+
+======================================================================*/
+
+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()
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/FlightDisplay/FlightDisplayViewDelayLoadOuter.qml b/src/FlightDisplay/FlightDisplayViewDelayLoadOuter.qml
new file mode 100644
index 0000000000000000000000000000000000000000..ef454e0c27805aadc6afda1362e1408563a65975
--- /dev/null
+++ b/src/FlightDisplay/FlightDisplayViewDelayLoadOuter.qml
@@ -0,0 +1,145 @@
+/*=====================================================================
+
+QGroundControl Open Source Ground Control Station
+
+(c) 2009, 2015 QGROUNDCONTROL PROJECT
+
+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 .
+
+======================================================================*/
+
+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)
+ }
+ }
+ }
+}
diff --git a/src/FlightDisplay/qmldir b/src/FlightDisplay/qmldir
new file mode 100644
index 0000000000000000000000000000000000000000..31f93cdf6389a24b3e2e6c063e49c6923420ba70
--- /dev/null
+++ b/src/FlightDisplay/qmldir
@@ -0,0 +1,6 @@
+Module QGroundControl.FlightDisplay
+
+FlightDisplayView 1.0 FlightDisplayView.qml
+FlightDisplayViewDelayLoadInner 1.0 FlightDisplayViewDelayLoadInner.qml
+FlightDisplayViewDelayLoadOuter 1.0 FlightDisplayViewDelayLoadOuter.qml
+
diff --git a/src/QmlControls/QGroundControl.Controls.qmldir b/src/QmlControls/QGroundControl.Controls.qmldir
index cd0edaadb7babbde6ad18abf7931935549da1132..a4c6027b8573a3ed05694fb73f853eed35fda1ec 100644
--- a/src/QmlControls/QGroundControl.Controls.qmldir
+++ b/src/QmlControls/QGroundControl.Controls.qmldir
@@ -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
diff --git a/src/ui/MainWindow.qml b/src/ui/MainWindow.qml
index 83bc3ff67f5d2a1b80acce2cdc499a68520001a8..ef3d138d91d15027af921f8dfd000a1370d842ac 100644
--- a/src/ui/MainWindow.qml
+++ b/src/ui/MainWindow.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
diff --git a/src/ui/toolbar/MainToolBar.qml b/src/ui/toolbar/MainToolBar.qml
index b3ae8452cec151b9fb80cb3bf0f5a568acac8c30..e1d3cb76f6126b068b90dc6199d9d628c156bcf5 100644
--- a/src/ui/toolbar/MainToolBar.qml
+++ b/src/ui/toolbar/MainToolBar.qml
@@ -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= 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 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
diff --git a/src/ui/toolbar/MainToolBarActiveVehicleComponent.qml b/src/ui/toolbar/MainToolBarActiveVehicleComponent.qml
new file mode 100644
index 0000000000000000000000000000000000000000..ad36b51d1133dbbf69b2044428f936c5792b999d
--- /dev/null
+++ b/src/ui/toolbar/MainToolBarActiveVehicleComponent.qml
@@ -0,0 +1,426 @@
+/*=====================================================================
+
+QGroundControl Open Source Ground Control Station
+
+(c) 2009, 2015 QGROUNDCONTROL PROJECT
+
+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 .
+
+======================================================================*/
+
+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= 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