Skip to content

Commit

Permalink
Merge pull request #5473 from DonLakeFlyer/MultiVehicleIndicators
Browse files Browse the repository at this point in the history
Better display of vehicle indicators for multi-vehicle
  • Loading branch information
DonLakeFlyer authored Jul 19, 2017
2 parents 8bfc4df + ea72b8b commit 37bf5d3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
20 changes: 13 additions & 7 deletions src/FlightMap/MapItems/VehicleMapItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,17 @@ MapQuickItem {
property real _uavSize: ScreenTools.defaultFontPixelHeight * 5
property real _adsbSize: ScreenTools.defaultFontPixelHeight * 1.5
property var _map: map
property bool _multiVehicle: QGroundControl.multiVehicleManager.vehicles.count > 1

sourceItem: Item {
id: vehicleItem
width: vehicleIcon.width
height: vehicleIcon.height
id: vehicleItem
width: vehicleIcon.width
height: vehicleIcon.height
opacity: vehicle ? (vehicle.active ? 1.0 : 0.5) : 1.0

Image {
id: vehicleIcon
source: _adsbVehicle ? "/qmlimages/adsbVehicle.svg" : (map.isSatelliteMap ? vehicle.vehicleImageOpaque : vehicle.vehicleImageOutline)
source: _adsbVehicle ? "/qmlimages/adsbVehicle.svg" : vehicle.vehicleImageOpaque
mipmap: true
width: size
sourceSize.width: size
Expand All @@ -57,11 +59,15 @@ MapQuickItem {
anchors.top: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
map: _map
text: altText
text: vehicleLabelText
font.pointSize: ScreenTools.smallFontPointSize
visible: !isNaN(altitude)
visible: _adsbVehicle ? !isNaN(altitude) : _multiVehicle

property string altText: visible ? QGroundControl.metersToAppSettingsDistanceUnits(altitude).toFixed(0) + " " + QGroundControl.appSettingsDistanceUnitsString : ""
property string vehicleLabelText: visible ?
(_adsbVehicle ?
QGroundControl.metersToAppSettingsDistanceUnits(altitude).toFixed(0) + " " + QGroundControl.appSettingsDistanceUnitsString :
(_multiVehicle ? qsTr("Vehicle %1").arg(vehicle.id) : "")) :
""

}
}
Expand Down
5 changes: 4 additions & 1 deletion src/Vehicle/Vehicle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,10 @@ bool Vehicle::active(void)

void Vehicle::setActive(bool active)
{
_active = active;
if (_active != active) {
_active = active;
emit activeChanged(_active);
}

_startJoystick(_active);
}
Expand Down

0 comments on commit 37bf5d3

Please sign in to comment.