Commit 07087525 authored by Don Gagne's avatar Don Gagne

Add video background support

parent 8ce30794
...@@ -63,6 +63,8 @@ Item { ...@@ -63,6 +63,8 @@ Item {
property real _airSpeed: _activeVehicle ? _activeVehicle.airSpeed : _defaultAirSpeed property real _airSpeed: _activeVehicle ? _activeVehicle.airSpeed : _defaultAirSpeed
property real _climbRate: _activeVehicle ? _activeVehicle.climbRate : _defaultClimbRate property real _climbRate: _activeVehicle ? _activeVehicle.climbRate : _defaultClimbRate
property bool _showMap: true
function getBool(value) { function getBool(value) {
return value === '0' ? false : true; return value === '0' ? false : true;
} }
...@@ -77,6 +79,7 @@ Item { ...@@ -77,6 +79,7 @@ Item {
mapName: "FlightDisplayView" mapName: "FlightDisplayView"
latitude: parent._latitude latitude: parent._latitude
longitude: parent._longitude longitude: parent._longitude
visible: _showMap
// Add the vehicles to the map // Add the vehicles to the map
MapItemView { MapItemView {
...@@ -121,35 +124,11 @@ Item { ...@@ -121,35 +124,11 @@ Item {
} }
} }
// Mission item list
ListView {
id: missionItemSummaryList
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.left: parent.left
anchors.right: flightMap.mapWidgets.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
property real _maxItemHeight: 0
delegate:
MissionItemSummary {
opacity: 0.75
missionItem: object
}
} // ListView - Mission item list
}
QGCCompassWidget { QGCCompassWidget {
x: ScreenTools.defaultFontPixelSize * (7.1) x: ScreenTools.defaultFontPixelSize * (7.1)
y: ScreenTools.defaultFontPixelSize * (0.42) y: ScreenTools.defaultFontPixelSize * (0.42)
size: ScreenTools.defaultFontPixelSize * (13.3) size: ScreenTools.defaultFontPixelSize * (13.3)
heading: parent._heading heading: _heading
active: multiVehicleManager.activeVehicleAvailable active: multiVehicleManager.activeVehicleAvailable
z: flightMap.z + 2 z: flightMap.z + 2
} }
...@@ -159,17 +138,45 @@ Item { ...@@ -159,17 +138,45 @@ Item {
anchors.right: parent.right anchors.right: parent.right
y: ScreenTools.defaultFontPixelSize * (0.42) y: ScreenTools.defaultFontPixelSize * (0.42)
size: ScreenTools.defaultFontPixelSize * (13.3) size: ScreenTools.defaultFontPixelSize * (13.3)
rollAngle: parent._roll rollAngle: _roll
pitchAngle: parent._pitch pitchAngle: _pitch
active: multiVehicleManager.activeVehicleAvailable active: multiVehicleManager.activeVehicleAvailable
z: flightMap.z + 2 z: flightMap.z + 2
} }
} // Flight Map
QGCVideoBackground {
anchors.fill: parent
display: videoDisplay
receiver: 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: root.heading
active: multiVehicleManager.activeVehicleAvailable
z: 70
}
QGCAttitudeHUD {
id: attitudeHUD
rollAngle: _roll
pitchAngle: _pitch
width: ScreenTools.defaultFontPixelSize * (30)
height: ScreenTools.defaultFontPixelSize * (30)
active: multiVehicleManager.activeVehicleAvailable
}
}
QGCAltitudeWidget { QGCAltitudeWidget {
anchors.right: parent.right anchors.right: parent.right
height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65 height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65
width: ScreenTools.defaultFontPixelSize * (5) width: ScreenTools.defaultFontPixelSize * (5)
altitude: parent._altitudeWGS84 altitude: _altitudeWGS84
z: 30 z: 30
} }
...@@ -177,15 +184,15 @@ Item { ...@@ -177,15 +184,15 @@ Item {
anchors.left: parent.left anchors.left: parent.left
width: ScreenTools.defaultFontPixelSize * (5) width: ScreenTools.defaultFontPixelSize * (5)
height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65 height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65
speed: parent._groundSpeed speed: _groundSpeed
z: 40 z: 40
} }
QGCCurrentSpeed { QGCCurrentSpeed {
anchors.left: parent.left anchors.left: parent.left
width: ScreenTools.defaultFontPixelSize * (6.25) width: ScreenTools.defaultFontPixelSize * (6.25)
airspeed: parent._airSpeed airspeed: _airSpeed
groundspeed: parent._groundSpeed groundspeed: _groundSpeed
active: multiVehicleManager.activeVehicleAvailable active: multiVehicleManager.activeVehicleAvailable
z: 50 z: 50
} }
...@@ -193,9 +200,73 @@ Item { ...@@ -193,9 +200,73 @@ Item {
QGCCurrentAltitude { QGCCurrentAltitude {
anchors.right: parent.right anchors.right: parent.right
width: ScreenTools.defaultFontPixelSize * (6.25) width: ScreenTools.defaultFontPixelSize * (6.25)
altitude: parent._altitudeWGS84 altitude: _altitudeWGS84
vertZ: parent._climbRate vertZ: _climbRate
active: multiVehicleManager.activeVehicleAvailable active: multiVehicleManager.activeVehicleAvailable
z: 60 z: 60
} }
// 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
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)
width: flightMap.mapWidgets.width
text: "Options"
menu: optionsMenu
ExclusiveGroup {
id: backgroundTypeGroup
}
Menu {
id: optionsMenu
MenuItem {
id: mapBackgroundMenuItem
exclusiveGroup: backgroundTypeGroup
checkable: true
checked: _showMap
text: "Show map as background"
onTriggered: _showMap = true
}
MenuItem {
id: videoBackgroundMenuItem
exclusiveGroup: backgroundTypeGroup
checkable: true
checked: !_showMap
text: "Show video as background"
onTriggered: _showMap = false
}
MenuSeparator { }
Component.onCompleted: flightMap.addMapMenuItems(optionsMenu)
}
}
} }
...@@ -47,7 +47,6 @@ Map { ...@@ -47,7 +47,6 @@ Map {
property real heading: 0 property real heading: 0
property bool interactive: true property bool interactive: true
property string mapName: 'defaultMap' property string mapName: 'defaultMap'
property alias mapMenu: mapTypeMenu
property alias mapWidgets: controlWidgets property alias mapWidgets: controlWidgets
property bool isSatelliteMap: false property bool isSatelliteMap: false
...@@ -62,22 +61,9 @@ Map { ...@@ -62,22 +61,9 @@ Map {
plugin: Plugin { name: "QGroundControl" } plugin: Plugin { name: "QGroundControl" }
Component.onCompleted: mapTypeMenu.update() ExclusiveGroup { id: mapTypeGroup }
/// Map control widgets /*
Column {
id: controlWidgets
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.right: parent.right
anchors.bottom: parent.bottom
spacing: ScreenTools.defaultFontPixelWidth / 2
//-- Menu to select supported map types
Menu {
id: mapTypeMenu
title: "Map Type..."
enabled: _map.visible
ExclusiveGroup { id: currMapType }
function setCurrentMap(mapID) { function setCurrentMap(mapID) {
for (var i = 0; i < _map.supportedMapTypes.length; i++) { for (var i = 0; i < _map.supportedMapTypes.length; i++) {
if (mapID === _map.supportedMapTypes[i].name) { if (mapID === _map.supportedMapTypes[i].name) {
...@@ -87,6 +73,7 @@ Map { ...@@ -87,6 +73,7 @@ Map {
} }
} }
} }
function addMap(mapID, checked) { function addMap(mapID, checked) {
var mItem = mapTypeMenu.addItem(mapID); var mItem = mapTypeMenu.addItem(mapID);
mItem.checkable = true mItem.checkable = true
...@@ -95,8 +82,8 @@ Map { ...@@ -95,8 +82,8 @@ Map {
var menuSlot = function() {setCurrentMap(mapID);}; var menuSlot = function() {setCurrentMap(mapID);};
mItem.triggered.connect(menuSlot); mItem.triggered.connect(menuSlot);
} }
function update() {
clear() function addMapMenuItems(menu) {
var mapID = '' var mapID = ''
if (_map.supportedMapTypes.length > 0) if (_map.supportedMapTypes.length > 0)
mapID = _map.activeMapType.name; mapID = _map.activeMapType.name;
...@@ -108,20 +95,33 @@ Map { ...@@ -108,20 +95,33 @@ Map {
if(mapID != '') if(mapID != '')
setCurrentMap(mapID); setCurrentMap(mapID);
} }
} */
QGCButton { function addMapMenuItems(menu) {
id: optionsButton for (var i= 0; i < _map.supportedMapTypes.length; i++) {
text: "Options" var name = _map.supportedMapTypes[i].name;
menu: mapTypeMenu var mItem = menu.addItem(name);
mItem.checkable = true
mItem.exclusiveGroup = mapTypeGroup
//var menuSlot = function() {setCurrentMap(mapID);};
//mItem.triggered.connect(menuSlot);
} }
}
/// Map control widgets
Column {
id: controlWidgets
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.right: parent.right
anchors.bottom: parent.bottom
spacing: ScreenTools.defaultFontPixelWidth / 2
Row { Row {
layoutDirection: Qt.RightToLeft layoutDirection: Qt.RightToLeft
spacing: ScreenTools.defaultFontPixelWidth / 2 spacing: ScreenTools.defaultFontPixelWidth / 2
readonly property real _zoomIncrement: 1.0 readonly property real _zoomIncrement: 1.0
property real _buttonWidth: (optionsButton.width - spacing) / 2 property real _buttonWidth: ScreenTools.defaultFontPixelWidth * 5
NumberAnimation { NumberAnimation {
id: animateZoom id: animateZoom
......
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