10 changed files with 922 additions and 793 deletions
@ -0,0 +1,160 @@
@@ -0,0 +1,160 @@
|
||||
/*===================================================================== |
||||
|
||||
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() |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,145 @@
@@ -0,0 +1,145 @@
|
||||
/*===================================================================== |
||||
|
||||
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) |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
Module QGroundControl.FlightDisplay |
||||
|
||||
FlightDisplayView 1.0 FlightDisplayView.qml |
||||
FlightDisplayViewDelayLoadInner 1.0 FlightDisplayViewDelayLoadInner.qml |
||||
FlightDisplayViewDelayLoadOuter 1.0 FlightDisplayViewDelayLoadOuter.qml |
||||
|
@ -0,0 +1,426 @@
@@ -0,0 +1,426 @@
|
||||
/*===================================================================== |
||||
|
||||
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 |
Loading…
Reference in new issue