Unverified Commit d40f7c17 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #9029 from DonLakeFlyer/ActiveVehicle

Clean up MainRootWindow globals
parents bc9190c1 ea85f1e3
...@@ -33,7 +33,7 @@ Item { ...@@ -33,7 +33,7 @@ Item {
VehicleSummaryRow { VehicleSummaryRow {
labelText: qsTr("Firmware Version") labelText: qsTr("Firmware Version")
valueText: activeVehicle.firmwareMajorVersion == -1 ? qsTr("Unknown") : activeVehicle.firmwareMajorVersion + "." + activeVehicle.firmwareMinorVersion + "." + activeVehicle.firmwarePatchVersion + activeVehicle.firmwareVersionTypeString valueText: globals.activeVehicle.firmwareMajorVersion == -1 ? qsTr("Unknown") : globals.activeVehicle.firmwareMajorVersion + "." + globals.activeVehicle.firmwareMinorVersion + "." + globals.activeVehicle.firmwarePatchVersion + globals.activeVehicle.firmwareVersionTypeString
} }
} }
} }
...@@ -35,7 +35,7 @@ SetupPage { ...@@ -35,7 +35,7 @@ SetupPage {
QGCPalette { id: palette; colorGroupEnabled: true } QGCPalette { id: palette; colorGroupEnabled: true }
property bool _oldFW: !(activeVehicle.firmwareMajorVersion > 3 || activeVehicle.firmwareMinorVersion > 5 || activeVehicle.firmwarePatchVersion >= 2) property bool _oldFW: !(globals.activeVehicle.firmwareMajorVersion > 3 || globals.activeVehicle.firmwareMinorVersion > 5 || globals.activeVehicle.firmwarePatchVersion >= 2)
property Fact _mountRetractX: controller.getParameterFact(-1, "MNT_RETRACT_X") property Fact _mountRetractX: controller.getParameterFact(-1, "MNT_RETRACT_X")
property Fact _mountRetractY: controller.getParameterFact(-1, "MNT_RETRACT_Y") property Fact _mountRetractY: controller.getParameterFact(-1, "MNT_RETRACT_Y")
......
...@@ -35,7 +35,7 @@ SetupPage { ...@@ -35,7 +35,7 @@ SetupPage {
QGCPalette { id: ggcPal; colorGroupEnabled: true } QGCPalette { id: ggcPal; colorGroupEnabled: true }
property bool _firmware34: activeVehicle.versionCompare(3, 5, 0) < 0 property bool _firmware34: globals.activeVehicle.versionCompare(3, 5, 0) < 0
// Enable/Action parameters // Enable/Action parameters
property Fact _failsafeBatteryEnable: controller.getParameterFact(-1, "r.BATT_FS_LOW_ACT") property Fact _failsafeBatteryEnable: controller.getParameterFact(-1, "r.BATT_FS_LOW_ACT")
......
...@@ -10,7 +10,7 @@ import QGroundControl.Palette 1.0 ...@@ -10,7 +10,7 @@ import QGroundControl.Palette 1.0
Item { Item {
anchors.fill: parent anchors.fill: parent
property bool _firmware34: activeVehicle.versionCompare(3, 5, 0) < 0 property bool _firmware34: globals.activeVehicle.versionCompare(3, 5, 0) < 0
FactPanelController { id: controller; } FactPanelController { id: controller; }
......
...@@ -178,7 +178,7 @@ SetupPage { ...@@ -178,7 +178,7 @@ SetupPage {
Component.onCompleted: { Component.onCompleted: {
var usingUDP = controller.usingUDPLink() var usingUDP = controller.usingUDPLink()
var isSub = QGroundControl.multiVehicleManager.activeVehicle.sub; var isSub = globals.activeVehicle.sub;
if (usingUDP && !isSub) { if (usingUDP && !isSub) {
mainWindow.showMessageDialog(qsTr("Sensor Calibration"), qsTr("Performing sensor calibration over a WiFi connection can be unreliable. If you run into problems try using a direct USB connection instead.")) mainWindow.showMessageDialog(qsTr("Sensor Calibration"), qsTr("Performing sensor calibration over a WiFi connection can be unreliable. If you run into problems try using a direct USB connection instead."))
} }
...@@ -562,9 +562,9 @@ SetupPage { ...@@ -562,9 +562,9 @@ SetupPage {
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: _helpText text: _helpText
readonly property string _altText: activeVehicle.sub ? qsTr("depth") : qsTr("altitude") readonly property string _altText: globals.activeVehicle.sub ? qsTr("depth") : qsTr("altitude")
readonly property string _helpText: qsTr("Pressure calibration will set the %1 to zero at the current pressure reading. %2").arg(_altText).arg(_helpTextFW) readonly property string _helpText: qsTr("Pressure calibration will set the %1 to zero at the current pressure reading. %2").arg(_altText).arg(_helpTextFW)
readonly property string _helpTextFW: activeVehicle.fixedWing ? qsTr("To calibrate the airspeed sensor shield it from the wind. Do not touch the sensor or obstruct any holes during the calibration.") : "" readonly property string _helpTextFW: globals.activeVehicle.fixedWing ? qsTr("To calibrate the airspeed sensor shield it from the wind. Do not touch the sensor or obstruct any holes during the calibration.") : ""
} }
} // QGCViewDialog } // QGCViewDialog
} // Component - calibratePressureDialogComponent } // Component - calibratePressureDialogComponent
...@@ -644,7 +644,7 @@ SetupPage { ...@@ -644,7 +644,7 @@ SetupPage {
QGCButton { QGCButton {
width: _buttonWidth width: _buttonWidth
text: qsTr("Gyro") text: qsTr("Gyro")
visible: activeVehicle && (activeVehicle.multiRotor | activeVehicle.rover) visible: globals.activeVehicle && (globals.activeVehicle.multiRotor | globals.activeVehicle.rover)
onClicked: mainWindow.showComponentDialog(calibrateGyroDialogComponent, qsTr("Calibrate Gyro"), mainWindow.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok) onClicked: mainWindow.showComponentDialog(calibrateGyroDialogComponent, qsTr("Calibrate Gyro"), mainWindow.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok)
} }
...@@ -653,13 +653,13 @@ SetupPage { ...@@ -653,13 +653,13 @@ SetupPage {
text: _calibratePressureText text: _calibratePressureText
onClicked: mainWindow.showComponentDialog(calibratePressureDialogComponent, _calibratePressureText, mainWindow.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok) onClicked: mainWindow.showComponentDialog(calibratePressureDialogComponent, _calibratePressureText, mainWindow.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok)
readonly property string _calibratePressureText: activeVehicle.fixedWing ? qsTr("Baro/Airspeed") : qsTr("Pressure") readonly property string _calibratePressureText: globals.activeVehicle.fixedWing ? qsTr("Baro/Airspeed") : qsTr("Pressure")
} }
QGCButton { QGCButton {
width: _buttonWidth width: _buttonWidth
text: qsTr("CompassMot") text: qsTr("CompassMot")
visible: activeVehicle ? activeVehicle.supportsMotorInterference : false visible: globals.activeVehicle ? globals.activeVehicle.supportsMotorInterference : false
onClicked: mainWindow.showComponentDialog(compassMotDialogComponent, qsTr("CompassMot - Compass Motor Interference Calibration"), mainWindow.showDialogFullWidth, StandardButton.Cancel | StandardButton.Ok) onClicked: mainWindow.showComponentDialog(compassMotDialogComponent, qsTr("CompassMot - Compass Motor Interference Calibration"), mainWindow.showDialogFullWidth, StandardButton.Cancel | StandardButton.Ok)
} }
......
...@@ -24,7 +24,7 @@ SetupPage { ...@@ -24,7 +24,7 @@ SetupPage {
id: subFramePage id: subFramePage
pageComponent: subFramePageComponent pageComponent: subFramePageComponent
property bool _oldFW: activeVehicle.versionCompare(3 ,5 ,2) < 0 property bool _oldFW: globals.activeVehicle.versionCompare(3 ,5 ,2) < 0
APMAirframeComponentController { id: controller; } APMAirframeComponentController { id: controller; }
......
...@@ -47,12 +47,12 @@ Item { ...@@ -47,12 +47,12 @@ Item {
VehicleSummaryRow { VehicleSummaryRow {
labelText: qsTr("Firmware Version") labelText: qsTr("Firmware Version")
valueText: activeVehicle.firmwareMajorVersion == -1 ? qsTr("Unknown") : activeVehicle.firmwareMajorVersion + "." + activeVehicle.firmwareMinorVersion + "." + activeVehicle.firmwarePatchVersion + " " + activeVehicle.firmwareVersionTypeString valueText: globals.activeVehicle.firmwareMajorVersion == -1 ? qsTr("Unknown") : globals.activeVehicle.firmwareMajorVersion + "." + globals.activeVehicle.firmwareMinorVersion + "." + globals.activeVehicle.firmwarePatchVersion + " " + globals.activeVehicle.firmwareVersionTypeString
} }
VehicleSummaryRow { VehicleSummaryRow {
labelText: qsTr("Git Revision") labelText: qsTr("Git Revision")
valueText: activeVehicle.gitHash == -1 ? qsTr("Unknown") : activeVehicle.gitHash valueText: globals.activeVehicle.gitHash == -1 ? qsTr("Unknown") : globals.activeVehicle.gitHash
} }
} }
} }
...@@ -157,7 +157,7 @@ SetupPage { ...@@ -157,7 +157,7 @@ SetupPage {
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
sourceComponent: activeVehicle.versionCompare(3, 6, 0) <= 0 ? velColumnUpTo36 :velColumn40 sourceComponent: globals.activeVehicle.versionCompare(3, 6, 0) <= 0 ? velColumnUpTo36 :velColumn40
} }
} // Rectangle - VEL parameters } // Rectangle - VEL parameters
...@@ -224,7 +224,7 @@ SetupPage { ...@@ -224,7 +224,7 @@ SetupPage {
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
sourceComponent: activeVehicle.versionCompare(3, 6, 0) < 0 ? wpnavColumn35 : wpnavColumn36 sourceComponent: globals.activeVehicle.versionCompare(3, 6, 0) < 0 ? wpnavColumn35 : wpnavColumn36
} }
} // Rectangle - WPNAV parameters } // Rectangle - WPNAV parameters
} // Column } // Column
......
...@@ -160,7 +160,7 @@ SetupPage { ...@@ -160,7 +160,7 @@ SetupPage {
// Center point // Center point
Rectangle { Rectangle {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
width: defaultTextWidth / 2 width: globals.defaultTextWidth / 2
height: parent.height height: parent.height
color: qgcPal.window color: qgcPal.window
} }
...@@ -210,10 +210,10 @@ SetupPage { ...@@ -210,10 +210,10 @@ SetupPage {
Item { Item {
width: parent.width width: parent.width
height: defaultTextHeight * 2 height: globals.defaultTextHeight * 2
QGCLabel { QGCLabel {
id: rollLabel id: rollLabel
width: defaultTextWidth * 10 width: globals.defaultTextWidth * 10
text: qsTr("Roll") text: qsTr("Roll")
} }
...@@ -221,11 +221,10 @@ SetupPage { ...@@ -221,11 +221,10 @@ SetupPage {
id: rollLoader id: rollLoader
anchors.left: rollLabel.right anchors.left: rollLabel.right
anchors.right: parent.right anchors.right: parent.right
height: defaultTextHeight height: globals.defaultTextHeight
width: 100 width: 100
sourceComponent: channelMonitorDisplayComponent sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: defaultTextWidth
property bool mapped: controller.rollChannelMapped property bool mapped: controller.rollChannelMapped
property bool reversed: controller.rollChannelReversed property bool reversed: controller.rollChannelReversed
} }
...@@ -239,11 +238,11 @@ SetupPage { ...@@ -239,11 +238,11 @@ SetupPage {
Item { Item {
width: parent.width width: parent.width
height: defaultTextHeight * 2 height: globals.defaultTextHeight * 2
QGCLabel { QGCLabel {
id: pitchLabel id: pitchLabel
width: defaultTextWidth * 10 width: globals.defaultTextWidth * 10
text: qsTr("Pitch") text: qsTr("Pitch")
} }
...@@ -251,11 +250,10 @@ SetupPage { ...@@ -251,11 +250,10 @@ SetupPage {
id: pitchLoader id: pitchLoader
anchors.left: pitchLabel.right anchors.left: pitchLabel.right
anchors.right: parent.right anchors.right: parent.right
height: defaultTextHeight height: globals.defaultTextHeight
width: 100 width: 100
sourceComponent: channelMonitorDisplayComponent sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: defaultTextWidth
property bool mapped: controller.pitchChannelMapped property bool mapped: controller.pitchChannelMapped
property bool reversed: controller.pitchChannelReversed property bool reversed: controller.pitchChannelReversed
} }
...@@ -269,11 +267,11 @@ SetupPage { ...@@ -269,11 +267,11 @@ SetupPage {
Item { Item {
width: parent.width width: parent.width
height: defaultTextHeight * 2 height: globals.defaultTextHeight * 2
QGCLabel { QGCLabel {
id: yawLabel id: yawLabel
width: defaultTextWidth * 10 width: globals.defaultTextWidth * 10
text: qsTr("Yaw") text: qsTr("Yaw")
} }
...@@ -281,11 +279,10 @@ SetupPage { ...@@ -281,11 +279,10 @@ SetupPage {
id: yawLoader id: yawLoader
anchors.left: yawLabel.right anchors.left: yawLabel.right
anchors.right: parent.right anchors.right: parent.right
height: defaultTextHeight height: globals.defaultTextHeight
width: 100 width: 100
sourceComponent: channelMonitorDisplayComponent sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: defaultTextWidth
property bool mapped: controller.yawChannelMapped property bool mapped: controller.yawChannelMapped
property bool reversed: controller.yawChannelReversed property bool reversed: controller.yawChannelReversed
} }
...@@ -299,11 +296,11 @@ SetupPage { ...@@ -299,11 +296,11 @@ SetupPage {
Item { Item {
width: parent.width width: parent.width
height: defaultTextHeight * 2 height: globals.defaultTextHeight * 2
QGCLabel { QGCLabel {
id: throttleLabel id: throttleLabel
width: defaultTextWidth * 10 width: globals.defaultTextWidth * 10
text: qsTr("Throttle") text: qsTr("Throttle")
} }
...@@ -311,11 +308,10 @@ SetupPage { ...@@ -311,11 +308,10 @@ SetupPage {
id: throttleLoader id: throttleLoader
anchors.left: throttleLabel.right anchors.left: throttleLabel.right
anchors.right: parent.right anchors.right: parent.right
height: defaultTextHeight height: globals.defaultTextHeight
width: 100 width: 100
sourceComponent: channelMonitorDisplayComponent sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: defaultTextWidth
property bool mapped: controller.throttleChannelMapped property bool mapped: controller.throttleChannelMapped
property bool reversed: controller.throttleChannelReversed property bool reversed: controller.throttleChannelReversed
} }
......
...@@ -33,9 +33,9 @@ Item { ...@@ -33,9 +33,9 @@ Item {
property bool showAdvanced: false property bool showAdvanced: false
property alias advanced: advancedCheckBox.checked property alias advanced: advancedCheckBox.checked
property bool _vehicleIsRover: activeVehicle ? activeVehicle.rover : false property bool _vehicleIsRover: globals.activeVehicle ? globals.activeVehicle.rover : false
property bool _vehicleArmed: activeVehicle ? activeVehicle.armed : false property bool _vehicleArmed: globals.activeVehicle ? globals.activeVehicle.armed : false
property bool _vehicleFlying: activeVehicle ? activeVehicle.flying : false property bool _vehicleFlying: globals.activeVehicle ? globals.activeVehicle.flying : false
property bool _disableDueToArmed: vehicleComponent ? (!vehicleComponent.allowSetupWhileArmed && _vehicleArmed) : false property bool _disableDueToArmed: vehicleComponent ? (!vehicleComponent.allowSetupWhileArmed && _vehicleArmed) : false
// FIXME: The _vehicleIsRover checkl is a hack to work around https://github.com/PX4/Firmware/issues/10969 // FIXME: The _vehicleIsRover checkl is a hack to work around https://github.com/PX4/Firmware/issues/10969
property bool _disableDueToFlying: vehicleComponent ? (!_vehicleIsRover && !vehicleComponent.allowSetupWhileFlying && _vehicleFlying) : false property bool _disableDueToFlying: vehicleComponent ? (!_vehicleIsRover && !vehicleComponent.allowSetupWhileFlying && _vehicleFlying) : false
......
...@@ -34,12 +34,12 @@ Item { ...@@ -34,12 +34,12 @@ Item {
VehicleSummaryRow { VehicleSummaryRow {
labelText: qsTr("Firmware Version") labelText: qsTr("Firmware Version")
valueText: activeVehicle.firmwareMajorVersion === -1 ? qsTr("Unknown") : activeVehicle.firmwareMajorVersion + "." + activeVehicle.firmwareMinorVersion + "." + activeVehicle.firmwarePatchVersion + activeVehicle.firmwareVersionTypeString valueText: globals.activeVehicle.firmwareMajorVersion === -1 ? qsTr("Unknown") : globals.activeVehicle.firmwareMajorVersion + "." + globals.activeVehicle.firmwareMinorVersion + "." + globals.activeVehicle.firmwarePatchVersion + globals.activeVehicle.firmwareVersionTypeString
} }
VehicleSummaryRow { VehicleSummaryRow {
visible: activeVehicle.firmwareCustomMajorVersion !== -1 visible: globals.activeVehicle.firmwareCustomMajorVersion !== -1
labelText: qsTr("Custom Fw. Ver.") labelText: qsTr("Custom Fw. Ver.")
valueText: activeVehicle.firmwareCustomMajorVersion + "." + activeVehicle.firmwareCustomMinorVersion + "." + activeVehicle.firmwareCustomPatchVersion valueText: globals.activeVehicle.firmwareCustomMajorVersion + "." + globals.activeVehicle.firmwareCustomMinorVersion + "." + globals.activeVehicle.firmwareCustomPatchVersion
} }
} }
} }
...@@ -28,8 +28,8 @@ Item { ...@@ -28,8 +28,8 @@ Item {
property double _ar: QGroundControl.videoManager.aspectRatio property double _ar: QGroundControl.videoManager.aspectRatio
property bool _showGrid: QGroundControl.settingsManager.videoSettings.gridLines.rawValue > 0 property bool _showGrid: QGroundControl.settingsManager.videoSettings.gridLines.rawValue > 0
property var _dynamicCameras: activeVehicle ? activeVehicle.cameraManager : null property var _dynamicCameras: globals.activeVehicle ? globals.activeVehicle.cameraManager : null
property bool _connected: activeVehicle ? !activeVehicle.connectionLost : false property bool _connected: globals.activeVehicle ? !globals.activeVehicle.connectionLost : false
property int _curCameraIndex: _dynamicCameras ? _dynamicCameras.currentCamera : 0 property int _curCameraIndex: _dynamicCameras ? _dynamicCameras.currentCamera : 0
property bool _isCamera: _dynamicCameras ? _dynamicCameras.cameras.count > 0 : false property bool _isCamera: _dynamicCameras ? _dynamicCameras.cameras.count > 0 : false
property var _camera: _isCamera ? _dynamicCameras.cameras.get(_curCameraIndex) : null property var _camera: _isCamera ? _dynamicCameras.cameras.get(_curCameraIndex) : null
......
...@@ -43,10 +43,11 @@ FlightMap { ...@@ -43,10 +43,11 @@ FlightMap {
property bool pipMode: false // true: map is shown in a small pip mode property bool pipMode: false // true: map is shown in a small pip mode
property var toolInsets // Insets for the center viewport area property var toolInsets // Insets for the center viewport area
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property var _planMasterController: planMasterController property var _planMasterController: planMasterController
property var _geoFenceController: planMasterController.geoFenceController property var _geoFenceController: planMasterController.geoFenceController
property var _rallyPointController: planMasterController.rallyPointController property var _rallyPointController: planMasterController.rallyPointController
property var _activeVehicleCoordinate: activeVehicle ? activeVehicle.coordinate : QtPositioning.coordinate() property var _activeVehicleCoordinate: _activeVehicle ? _activeVehicle.coordinate : QtPositioning.coordinate()
property real _toolButtonTopMargin: parent.height - mainWindow.height + (ScreenTools.defaultFontPixelHeight / 2) property real _toolButtonTopMargin: parent.height - mainWindow.height + (ScreenTools.defaultFontPixelHeight / 2)
property bool _airspaceEnabled: QGroundControl.airmapSupported ? (QGroundControl.settingsManager.airMapSettings.enableAirMap.rawValue && QGroundControl.airspaceManager.connected): false property bool _airspaceEnabled: QGroundControl.airmapSupported ? (QGroundControl.settingsManager.airMapSettings.enableAirMap.rawValue && QGroundControl.airspaceManager.connected): false
property var _flyViewSettings: QGroundControl.settingsManager.flyViewSettings property var _flyViewSettings: QGroundControl.settingsManager.flyViewSettings
...@@ -231,11 +232,11 @@ FlightMap { ...@@ -231,11 +232,11 @@ FlightMap {
Connections { Connections {
target: QGroundControl.multiVehicleManager target: QGroundControl.multiVehicleManager
onActiveVehicleChanged: trajectoryPolyline.path = activeVehicle ? activeVehicle.trajectoryPoints.list() : [] onActiveVehicleChanged: trajectoryPolyline.path = _activeVehicle ? _activeVehicle.trajectoryPoints.list() : []
} }
Connections { Connections {
target: activeVehicle ? activeVehicle.trajectoryPoints : null target: _activeVehicle ? _activeVehicle.trajectoryPoints : null
onPointAdded: trajectoryPolyline.addCoordinate(coordinate) onPointAdded: trajectoryPolyline.addCoordinate(coordinate)
onUpdateLastPoint: trajectoryPolyline.replaceCoordinate(trajectoryPolyline.pathLength() - 1, coordinate) onUpdateLastPoint: trajectoryPolyline.replaceCoordinate(trajectoryPolyline.pathLength() - 1, coordinate)
onPointsCleared: trajectoryPolyline.path = [] onPointsCleared: trajectoryPolyline.path = []
...@@ -318,7 +319,7 @@ FlightMap { ...@@ -318,7 +319,7 @@ FlightMap {
myGeoFenceController: _geoFenceController myGeoFenceController: _geoFenceController
interactive: false interactive: false
planView: false planView: false
homePosition: activeVehicle && activeVehicle.homePosition.isValid ? activeVehicle.homePosition : QtPositioning.coordinate() homePosition: _activeVehicle && _activeVehicle.homePosition.isValid ? _activeVehicle.homePosition : QtPositioning.coordinate()
} }
// Rally points on map // Rally points on map
...@@ -341,7 +342,7 @@ FlightMap { ...@@ -341,7 +342,7 @@ FlightMap {
// Camera trigger points // Camera trigger points
MapItemView { MapItemView {
model: activeVehicle ? activeVehicle.cameraTriggerPoints : 0 model: _activeVehicle ? _activeVehicle.cameraTriggerPoints : 0
delegate: CameraTriggerIndicator { delegate: CameraTriggerIndicator {
coordinate: object.coordinate coordinate: object.coordinate
...@@ -362,7 +363,7 @@ FlightMap { ...@@ -362,7 +363,7 @@ FlightMap {
label: qsTr("Go here", "Go to location waypoint") label: qsTr("Go here", "Go to location waypoint")
} }
property bool inGotoFlightMode: activeVehicle ? activeVehicle.flightMode === activeVehicle.gotoFlightMode : false property bool inGotoFlightMode: _activeVehicle ? _activeVehicle.flightMode === _activeVehicle.gotoFlightMode : false
onInGotoFlightModeChanged: { onInGotoFlightModeChanged: {
if (!inGotoFlightMode && gotoLocationItem.visible) { if (!inGotoFlightMode && gotoLocationItem.visible) {
...@@ -372,7 +373,7 @@ FlightMap { ...@@ -372,7 +373,7 @@ FlightMap {
} }
Connections { Connections {
target: mainWindow target: QGroundControl.multiVehicleManager
onActiveVehicleChanged: { onActiveVehicleChanged: {
if (!activeVehicle) { if (!activeVehicle) {
gotoLocationItem.visible = false gotoLocationItem.visible = false
...@@ -410,7 +411,7 @@ FlightMap { ...@@ -410,7 +411,7 @@ FlightMap {
readonly property real defaultRadius: 30 readonly property real defaultRadius: 30
Connections { Connections {
target: mainWindow target: QGroundControl.multiVehicleManager
onActiveVehicleChanged: { onActiveVehicleChanged: {
if (!activeVehicle) { if (!activeVehicle) {
orbitMapCircle.visible = false orbitMapCircle.visible = false
...@@ -441,7 +442,7 @@ FlightMap { ...@@ -441,7 +442,7 @@ FlightMap {
return _mapCircle.radius.rawValue return _mapCircle.radius.rawValue
} }
Component.onCompleted: mainWindow.guidedControllerFlyView.orbitMapCircle = orbitMapCircle Component.onCompleted: globals.guidedControllerFlyView.orbitMapCircle = orbitMapCircle
QGCMapCircle { QGCMapCircle {
id: _mapCircle id: _mapCircle
...@@ -455,7 +456,7 @@ FlightMap { ...@@ -455,7 +456,7 @@ FlightMap {
// ROI Location visuals // ROI Location visuals
MapQuickItem { MapQuickItem {
id: roiLocationItem id: roiLocationItem
visible: activeVehicle && activeVehicle.isROIEnabled visible: _activeVehicle && _activeVehicle.isROIEnabled
z: QGroundControl.zOrderMapItems z: QGroundControl.zOrderMapItems
anchorPoint.x: sourceItem.anchorPointX anchorPoint.x: sourceItem.anchorPointX
anchorPoint.y: sourceItem.anchorPointY anchorPoint.y: sourceItem.anchorPointY
...@@ -484,15 +485,15 @@ FlightMap { ...@@ -484,15 +485,15 @@ FlightMap {
QGCMapCircleVisuals { QGCMapCircleVisuals {
id: orbitTelemetryCircle id: orbitTelemetryCircle
mapControl: parent mapControl: parent
mapCircle: activeVehicle ? activeVehicle.orbitMapCircle : null mapCircle: _activeVehicle ? _activeVehicle.orbitMapCircle : null
visible: activeVehicle ? activeVehicle.orbitActive : false visible: _activeVehicle ? _activeVehicle.orbitActive : false
} }
MapQuickItem { MapQuickItem {
id: orbitCenterIndicator id: orbitCenterIndicator
anchorPoint.x: sourceItem.anchorPointX anchorPoint.x: sourceItem.anchorPointX
anchorPoint.y: sourceItem.anchorPointY anchorPoint.y: sourceItem.anchorPointY
coordinate: activeVehicle ? activeVehicle.orbitMapCircle.center : QtPositioning.coordinate() coordinate: _activeVehicle ? _activeVehicle.orbitMapCircle.center : QtPositioning.coordinate()
visible: orbitTelemetryCircle.visible visible: orbitTelemetryCircle.visible
sourceItem: MissionItemIndexLabel { sourceItem: MissionItemIndexLabel {
...@@ -511,35 +512,35 @@ FlightMap { ...@@ -511,35 +512,35 @@ FlightMap {
property var coord property var coord
QGCMenuItem { QGCMenuItem {
text: qsTr("Go to location") text: qsTr("Go to location")
visible: mainWindow.guidedControllerFlyView.showGotoLocation visible: globals.guidedControllerFlyView.showGotoLocation
onTriggered: { onTriggered: {
gotoLocationItem.show(clickMenu.coord) gotoLocationItem.show(clickMenu.coord)
mainWindow.guidedControllerFlyView.confirmAction(mainWindow.guidedControllerFlyView.actionGoto, clickMenu.coord, gotoLocationItem) globals.guidedControllerFlyView.confirmAction(globals.guidedControllerFlyView.actionGoto, clickMenu.coord, gotoLocationItem)
} }
} }
QGCMenuItem { QGCMenuItem {
text: qsTr("Orbit at location") text: qsTr("Orbit at location")
visible: mainWindow.guidedControllerFlyView.showOrbit visible: globals.guidedControllerFlyView.showOrbit
onTriggered: { onTriggered: {
orbitMapCircle.show(clickMenu.coord) orbitMapCircle.show(clickMenu.coord)
mainWindow.guidedControllerFlyView.confirmAction(mainWindow.guidedControllerFlyView.actionOrbit, clickMenu.coord, orbitMapCircle) globals.guidedControllerFlyView.confirmAction(globals.guidedControllerFlyView.actionOrbit, clickMenu.coord, orbitMapCircle)
} }
} }
QGCMenuItem { QGCMenuItem {
text: qsTr("ROI at location") text: qsTr("ROI at location")
visible: mainWindow.guidedControllerFlyView.showROI visible: globals.guidedControllerFlyView.showROI
onTriggered: { onTriggered: {
roiLocationItem.show(clickMenu.coord) roiLocationItem.show(clickMenu.coord)
mainWindow.guidedControllerFlyView.confirmAction(mainWindow.guidedControllerFlyView.actionROI, clickMenu.coord, roiLocationItem) globals.guidedControllerFlyView.confirmAction(globals.guidedControllerFlyView.actionROI, clickMenu.coord, roiLocationItem)
} }
} }
} }
onClicked: { onClicked: {
if (!mainWindow.guidedControllerFlyView.guidedUIVisible && (mainWindow.guidedControllerFlyView.showGotoLocation || mainWindow.guidedControllerFlyView.showOrbit || mainWindow.guidedControllerFlyView.showROI)) { if (!globals.guidedControllerFlyView.guidedUIVisible && (globals.guidedControllerFlyView.showGotoLocation || globals.guidedControllerFlyView.showOrbit || globals.guidedControllerFlyView.showROI)) {
orbitMapCircle.hide() orbitMapCircle.hide()
gotoLocationItem.hide() gotoLocationItem.hide()
var clickCoord = _root.toCoordinate(Qt.point(mouse.x, mouse.y), false /* clipToViewPort */) var clickCoord = _root.toCoordinate(Qt.point(mouse.x, mouse.y), false /* clipToViewPort */)
......
...@@ -108,15 +108,15 @@ Item { ...@@ -108,15 +108,15 @@ Item {
ColumnLayout { ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
spacing: ScreenTools.defaultFontPixelHeight spacing: ScreenTools.defaultFontPixelHeight
visible: !_activeVehicle.connectionLost && mainWindow.guidedControllerFlyView.showResumeMission visible: !_activeVehicle.connectionLost && globals.guidedControllerFlyView.showResumeMission
QGCButton { QGCButton {
Layout.fillWidth: true Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: qsTr("Resume Mission From Waypoint %1").arg(mainWindow.guidedControllerFlyView._resumeMissionIndex) text: qsTr("Resume Mission From Waypoint %1").arg(globals.guidedControllerFlyView._resumeMissionIndex)
onClicked: { onClicked: {
mainWindow.guidedControllerFlyView.executeAction(mainWindow.guidedControllerFlyView.actionResumeMission, null, null) globals.guidedControllerFlyView.executeAction(globals.guidedControllerFlyView.actionResumeMission, null, null)
hideDialog() hideDialog()
} }
} }
...@@ -133,7 +133,7 @@ Item { ...@@ -133,7 +133,7 @@ Item {
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
color: qgcPal.warningText color: qgcPal.warningText
text: qsTr("If you are changing batteries for Resume Mission do not disconnect from the vehicle.") text: qsTr("If you are changing batteries for Resume Mission do not disconnect from the vehicle.")
visible: mainWindow.guidedControllerFlyView.showResumeMission visible: globals.guidedControllerFlyView.showResumeMission
} }
} }
} }
......
...@@ -39,11 +39,11 @@ Item { ...@@ -39,11 +39,11 @@ Item {
property var mapControl property var mapControl
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property var _planMasterController: mainWindow.planMasterControllerFlyView property var _planMasterController: globals.planMasterControllerFlyView
property var _missionController: _planMasterController.missionController property var _missionController: _planMasterController.missionController
property var _geoFenceController: _planMasterController.geoFenceController property var _geoFenceController: _planMasterController.geoFenceController
property var _rallyPointController: _planMasterController.rallyPointController property var _rallyPointController: _planMasterController.rallyPointController
property var _guidedController: mainWindow.guidedControllerFlyView property var _guidedController: globals.guidedControllerFlyView
property real _margins: ScreenTools.defaultFontPixelWidth / 2 property real _margins: ScreenTools.defaultFontPixelWidth / 2
property real _toolsMargin: ScreenTools.defaultFontPixelWidth * 0.75 property real _toolsMargin: ScreenTools.defaultFontPixelWidth * 0.75
property rect _centerViewport: Qt.rect(0, 0, width, height) property rect _centerViewport: Qt.rect(0, 0, width, height)
...@@ -156,12 +156,12 @@ Item { ...@@ -156,12 +156,12 @@ Item {
z: QGroundControl.zOrderTopMost + 1 z: QGroundControl.zOrderTopMost + 1
width: parent.width - (_pipOverlay.width / 2) width: parent.width - (_pipOverlay.width / 2)
height: Math.min(parent.height * 0.25, ScreenTools.defaultFontPixelWidth * 16) height: Math.min(parent.height * 0.25, ScreenTools.defaultFontPixelWidth * 16)
visible: _virtualJoystickEnabled && !QGroundControl.videoManager.fullScreen && !(activeVehicle ? activeVehicle.highLatencyLink : false) visible: _virtualJoystickEnabled && !QGroundControl.videoManager.fullScreen && !(_activeVehicle ? _activeVehicle.highLatencyLink : false)
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: parentToolInsets.leftEdgeBottomInset + ScreenTools.defaultFontPixelHeight * 2 anchors.bottomMargin: parentToolInsets.leftEdgeBottomInset + ScreenTools.defaultFontPixelHeight * 2
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
source: "qrc:/qml/VirtualJoystick.qml" source: "qrc:/qml/VirtualJoystick.qml"
active: _virtualJoystickEnabled && !(activeVehicle ? activeVehicle.highLatencyLink : false) active: _virtualJoystickEnabled && !(_activeVehicle ? _activeVehicle.highLatencyLink : false)
property bool autoCenterThrottle: QGroundControl.settingsManager.appSettings.virtualJoystickAutoCenterThrottle.rawValue property bool autoCenterThrottle: QGroundControl.settingsManager.appSettings.virtualJoystickAutoCenterThrottle.rawValue
......
...@@ -21,12 +21,13 @@ Rectangle { ...@@ -21,12 +21,13 @@ Rectangle {
readonly property real _maxAlt: 121.92 // 400 feet readonly property real _maxAlt: 121.92 // 400 feet
readonly property real _minAlt: 3 readonly property real _minAlt: 3
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property var _flyViewSettings: QGroundControl.settingsManager.flyViewSettings property var _flyViewSettings: QGroundControl.settingsManager.flyViewSettings
property real _vehicleAltitude: activeVehicle ? activeVehicle.altitudeRelative.rawValue : 0 property real _vehicleAltitude: _activeVehicle ? _activeVehicle.altitudeRelative.rawValue : 0
property bool _fixedWing: activeVehicle ? activeVehicle.fixedWing : false property bool _fixedWing: _activeVehicle ? _activeVehicle.fixedWing : false
property real _sliderMaxAlt: _flyViewSettings ? _flyViewSettings.guidedMaximumAltitude.rawValue : 0 property real _sliderMaxAlt: _flyViewSettings ? _flyViewSettings.guidedMaximumAltitude.rawValue : 0
property real _sliderMinAlt: _flyViewSettings ? _flyViewSettings.guidedMinimumAltitude.rawValue : 0 property real _sliderMinAlt: _flyViewSettings ? _flyViewSettings.guidedMinimumAltitude.rawValue : 0
property bool _flying: activeVehicle ? activeVehicle.flying : false property bool _flying: _activeVehicle ? _activeVehicle.flying : false
function reset() { function reset() {
altSlider.value = 0 altSlider.value = 0
...@@ -77,7 +78,7 @@ Rectangle { ...@@ -77,7 +78,7 @@ Rectangle {
property string newAltitudeAppUnits: QGroundControl.unitsConversion.metersToAppSettingsHorizontalDistanceUnits(newAltitudeMeters).toFixed(1) property string newAltitudeAppUnits: QGroundControl.unitsConversion.metersToAppSettingsHorizontalDistanceUnits(newAltitudeMeters).toFixed(1)
function setToMinimumTakeoff() { function setToMinimumTakeoff() {
altSlider.value = Math.pow(activeVehicle.minimumTakeoffAltitude() / altGainRange, 1.0/3.0) altSlider.value = Math.pow(_activeVehicle.minimumTakeoffAltitude() / altGainRange, 1.0/3.0)
} }
} }
} }
......
...@@ -13,7 +13,7 @@ ToolStripAction { ...@@ -13,7 +13,7 @@ ToolStripAction {
property int actionID property int actionID
property string message property string message
property var _guidedController: mainWindow.guidedControllerFlyView property var _guidedController: globals.guidedControllerFlyView
onTriggered: { onTriggered: {
_guidedController.closeAll() _guidedController.closeAll()
......
...@@ -23,7 +23,7 @@ Item { ...@@ -23,7 +23,7 @@ Item {
property real _widgetHeight: ScreenTools.defaultFontPixelHeight * 3 property real _widgetHeight: ScreenTools.defaultFontPixelHeight * 3
property color _textColor: "black" property color _textColor: "black"
property real _rectOpacity: 0.8 property real _rectOpacity: 0.8
property var _guidedController: mainWindow.guidedControllerFlyView property var _guidedController: globals.guidedControllerFlyView
QGCPalette { id: qgcPal } QGCPalette { id: qgcPal }
......
...@@ -25,7 +25,7 @@ PreFlightCheckButton { ...@@ -25,7 +25,7 @@ PreFlightCheckButton {
property int failurePercent: 40 property int failurePercent: 40
property bool allowFailurePercentOverride: false property bool allowFailurePercentOverride: false
property var _batteryValue: activeVehicle ? activeVehicle.battery.percentRemaining.value : 0 property var _batteryValue: globals.activeVehicle ? globals.activeVehicle.battery.percentRemaining.value : 0
property var _batPercentRemaining: isNaN(_batteryValue) ? 0 : _batteryValue property var _batPercentRemaining: isNaN(_batteryValue) ? 0 : _batteryValue
property bool _batLow: _batPercentRemaining < failurePercent property bool _batLow: _batPercentRemaining < failurePercent
} }
...@@ -19,7 +19,7 @@ import QGroundControl.Vehicle 1.0 ...@@ -19,7 +19,7 @@ import QGroundControl.Vehicle 1.0
Rectangle { Rectangle {
width: mainColumn.width + ScreenTools.defaultFontPixelWidth * 3 width: mainColumn.width + ScreenTools.defaultFontPixelWidth * 3
height: Math.min(mainWindow.availableHeight - (_verticalMargin * 2), mainColumn.height + ScreenTools.defaultFontPixelHeight) height: Math.min(mainWindow.height - (_verticalMargin * 2), mainColumn.height + ScreenTools.defaultFontPixelHeight)
color: qgcPal.windowShade color: qgcPal.windowShade
radius: 3 radius: 3
...@@ -31,7 +31,7 @@ Rectangle { ...@@ -31,7 +31,7 @@ Rectangle {
} }
property bool allChecksPassed: false property bool allChecksPassed: false
property var vehicleCopy: activeVehicle property var vehicleCopy: globals.activeVehicle
onVehicleCopyChanged: { onVehicleCopyChanged: {
checkListRepeater.model.reset() checkListRepeater.model.reset()
...@@ -39,9 +39,9 @@ Rectangle { ...@@ -39,9 +39,9 @@ Rectangle {
onAllChecksPassedChanged: { onAllChecksPassedChanged: {
if (allChecksPassed) { if (allChecksPassed) {
activeVehicle.checkListState = Vehicle.CheckListPassed globals.activeVehicle.checkListState = Vehicle.CheckListPassed
} else { } else {
activeVehicle.checkListState = Vehicle.CheckListFailed globals.activeVehicle.checkListState = Vehicle.CheckListFailed
} }
} }
...@@ -71,7 +71,7 @@ Rectangle { ...@@ -71,7 +71,7 @@ Rectangle {
//-- Pick a checklist model that matches the current airframe type (if any) //-- Pick a checklist model that matches the current airframe type (if any)
function _updateModel() { function _updateModel() {
var vehicle = activeVehicle var vehicle = globals.activeVehicle
if (!vehicle) { if (!vehicle) {
vehicle = QGroundControl.multiVehicleManager.offlineEditingVehicle vehicle = QGroundControl.multiVehicleManager.offlineEditingVehicle
} }
...@@ -97,7 +97,7 @@ Rectangle { ...@@ -97,7 +97,7 @@ Rectangle {
} }
onVisibleChanged: { onVisibleChanged: {
if(activeVehicle) { if(globals.activeVehicle) {
if(visible) { if(visible) {
_updateModel() _updateModel()
} }
......
...@@ -24,8 +24,8 @@ PreFlightCheckButton { ...@@ -24,8 +24,8 @@ PreFlightCheckButton {
property bool allowOverrideSatCount: false ///< true: sat count above failureSatCount reguired to pass, false: user can click past satCount <= failureSetCount property bool allowOverrideSatCount: false ///< true: sat count above failureSatCount reguired to pass, false: user can click past satCount <= failureSetCount
property int failureSatCount: -1 ///< -1 indicates no sat count check property int failureSatCount: -1 ///< -1 indicates no sat count check
property bool _3dLock: activeVehicle ? activeVehicle.gps.lock.rawValue >= 3 : false property bool _3dLock: globals.activeVehicle ? globals.activeVehicle.gps.lock.rawValue >= 3 : false
property int _satCount: activeVehicle ? activeVehicle.gps.count.rawValue : 0 property int _satCount: globals.activeVehicle ? globals.activeVehicle.gps.count.rawValue : 0
property bool _3dLockFailure: !_3dLock property bool _3dLockFailure: !_3dLock
property bool _satCountFailure: failureSatCount !== -1 && _satCount <= failureSatCount property bool _satCountFailure: failureSatCount !== -1 && _satCount <= failureSatCount
property string _satCountFailureText: allowOverrideSatCount ? qsTr("Warning - Sat count below %1.").arg(failureSatCount + 1) : qsTr("Waiting for sat count above %1.").arg(failureSatCount) property string _satCountFailureText: allowOverrideSatCount ? qsTr("Warning - Sat count below %1.").arg(failureSatCount + 1) : qsTr("Waiting for sat count above %1.").arg(failureSatCount)
......
...@@ -19,5 +19,5 @@ PreFlightCheckButton { ...@@ -19,5 +19,5 @@ PreFlightCheckButton {
telemetryTextFailure: qsTr("No signal or invalid autopilot-RC config. Check RC and console.") telemetryTextFailure: qsTr("No signal or invalid autopilot-RC config. Check RC and console.")
telemetryFailure: _unhealthySensors & Vehicle.SysStatusSensorRCReceiver telemetryFailure: _unhealthySensors & Vehicle.SysStatusSensorRCReceiver
property int _unhealthySensors: activeVehicle ? activeVehicle.sensorsUnhealthyBits : 0 property int _unhealthySensors: globals.activeVehicle ? globals.activeVehicle.sensorsUnhealthyBits : 0
} }
...@@ -17,7 +17,7 @@ PreFlightCheckButton { ...@@ -17,7 +17,7 @@ PreFlightCheckButton {
name: qsTr("Sensors") name: qsTr("Sensors")
telemetryFailure: _unhealthySensors & _allCheckedSensors telemetryFailure: _unhealthySensors & _allCheckedSensors
property int _unhealthySensors: activeVehicle ? activeVehicle.sensorsUnhealthyBits : 1 property int _unhealthySensors: globals.activeVehicle ? globals.activeVehicle.sensorsUnhealthyBits : 1
property int _allCheckedSensors: Vehicle.SysStatusSensor3dMag | property int _allCheckedSensors: Vehicle.SysStatusSensor3dMag |
Vehicle.SysStatusSensor3dAccel | Vehicle.SysStatusSensor3dAccel |
Vehicle.SysStatusSensor3dGyro | Vehicle.SysStatusSensor3dGyro |
......
...@@ -27,8 +27,8 @@ Item { ...@@ -27,8 +27,8 @@ Item {
running: QGroundControl.settingsManager.appSettings.virtualJoystick.value && activeVehicle running: QGroundControl.settingsManager.appSettings.virtualJoystick.value && activeVehicle
repeat: true repeat: true
onTriggered: { onTriggered: {
if (activeVehicle) { if (_activeVehicle) {
activeVehicle.virtualTabletJoystickValue(rightStick.xAxis, rightStick.yAxis, leftStick.xAxis, leftStick.yAxis) _activeVehicle.virtualTabletJoystickValue(rightStick.xAxis, rightStick.yAxis, leftStick.xAxis, leftStick.yAxis)
} }
} }
} }
......
...@@ -45,7 +45,8 @@ Map { ...@@ -45,7 +45,8 @@ Map {
readonly property real maxZoomLevel: 20 readonly property real maxZoomLevel: 20
property var activeVehicleCoordinate: activeVehicle ? activeVehicle.coordinate : QtPositioning.coordinate() property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property var _activeVehicleCoordinate: _activeVehicle ? _activeVehicle.coordinate : QtPositioning.coordinate()
function setVisibleRegion(region) { function setVisibleRegion(region) {
// TODO: Is this still necessary with Qt 5.11? // TODO: Is this still necessary with Qt 5.11?
...@@ -57,9 +58,9 @@ Map { ...@@ -57,9 +58,9 @@ Map {
} }
function _possiblyCenterToVehiclePosition() { function _possiblyCenterToVehiclePosition() {
if (!firstVehiclePositionReceived && allowVehicleLocationCenter && activeVehicleCoordinate.isValid) { if (!firstVehiclePositionReceived && allowVehicleLocationCenter && _activeVehicleCoordinate.isValid) {
firstVehiclePositionReceived = true firstVehiclePositionReceived = true
center = activeVehicleCoordinate center = _activeVehicleCoordinate
zoomLevel = QGroundControl.flightMapInitialZoom zoomLevel = QGroundControl.flightMapInitialZoom
} }
} }
...@@ -81,8 +82,8 @@ Map { ...@@ -81,8 +82,8 @@ Map {
if (gcsPosition.isValid && allowGCSLocationCenter && !firstGCSPositionReceived && !firstVehiclePositionReceived) { if (gcsPosition.isValid && allowGCSLocationCenter && !firstGCSPositionReceived && !firstVehiclePositionReceived) {
firstGCSPositionReceived = true firstGCSPositionReceived = true
//-- Only center on gsc if we have no vehicle (and we are supposed to do so) //-- Only center on gsc if we have no vehicle (and we are supposed to do so)
var activeVehicleCoordinate = activeVehicle ? activeVehicle.coordinate : QtPositioning.coordinate() var _activeVehicleCoordinate = _activeVehicle ? _activeVehicle.coordinate : QtPositioning.coordinate()
if(QGroundControl.settingsManager.flyViewSettings.keepMapCenteredOnVehicle.rawValue || !activeVehicleCoordinate.isValid) if(QGroundControl.settingsManager.flyViewSettings.keepMapCenteredOnVehicle.rawValue || !_activeVehicleCoordinate.isValid)
center = gcsPosition center = gcsPosition
} }
} }
...@@ -99,7 +100,7 @@ Map { ...@@ -99,7 +100,7 @@ Map {
} }
} }
onActiveVehicleCoordinateChanged: _possiblyCenterToVehiclePosition() on_ActiveVehicleCoordinateChanged: _possiblyCenterToVehiclePosition()
Component.onCompleted: { Component.onCompleted: {
updateActiveMapType() updateActiveMapType()
......
...@@ -30,7 +30,7 @@ Item { ...@@ -30,7 +30,7 @@ Item {
property var _missionController: masterController.missionController property var _missionController: masterController.missionController
property var _geoFenceController: masterController.geoFenceController property var _geoFenceController: masterController.geoFenceController
property var _rallyPointController: masterController.rallyPointController property var _rallyPointController: masterController.rallyPointController
property var _guidedController: mainWindow.guidedControllerFlyView property var _guidedController: globals.guidedControllerFlyView
property var _missionLineViewComponent property var _missionLineViewComponent
property bool _isActiveVehicle: vehicle.active property bool _isActiveVehicle: vehicle.active
......
...@@ -221,11 +221,11 @@ DropButton { ...@@ -221,11 +221,11 @@ DropButton {
QGCButton { QGCButton {
text: qsTr("Vehicle") text: qsTr("Vehicle")
Layout.fillWidth: true Layout.fillWidth: true
enabled: activeVehicle && activeVehicle.latitude != 0 && activeVehicle.longitude != 0 && !followVehicleCheckBox.checked enabled: globals.activeVehicle && globals.activeVehicle.latitude != 0 && globals.activeVehicle.longitude != 0 && !followVehicleCheckBox.checked
onClicked: { onClicked: {
dropButton.hideDropDown() dropButton.hideDropDown()
map.center = activeVehicle.coordinate map.center = globals.activeVehicle.coordinate
} }
} }
......
...@@ -63,11 +63,11 @@ ColumnLayout { ...@@ -63,11 +63,11 @@ ColumnLayout {
QGCButton { QGCButton {
text: qsTr("Vehicle") text: qsTr("Vehicle")
Layout.fillWidth: true Layout.fillWidth: true
enabled: activeVehicle && activeVehicle.coordinate.isValid enabled: globals.activeVehicle && globals.activeVehicle.coordinate.isValid
onClicked: { onClicked: {
dropPanel.hide() dropPanel.hide()
map.center = activeVehicle.coordinate map.center = globals.activeVehicle.coordinate
} }
} }
......
...@@ -31,14 +31,15 @@ Item { ...@@ -31,14 +31,15 @@ Item {
property real size: _defaultSize property real size: _defaultSize
property var vehicle: null property var vehicle: null
property real _defaultSize: ScreenTools.defaultFontPixelHeight * (10) property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property real _sizeRatio: ScreenTools.isTinyScreen ? (size / _defaultSize) * 0.5 : size / _defaultSize property real _defaultSize: ScreenTools.defaultFontPixelHeight * (10)
property int _fontSize: ScreenTools.defaultFontPointSize * _sizeRatio property real _sizeRatio: ScreenTools.isTinyScreen ? (size / _defaultSize) * 0.5 : size / _defaultSize
property real _heading: vehicle ? vehicle.heading.rawValue : 0 property int _fontSize: ScreenTools.defaultFontPointSize * _sizeRatio
property real _headingToHome: vehicle ? vehicle.headingToHome.rawValue : 0 property real _heading: vehicle ? vehicle.heading.rawValue : 0
property real _groundSpeed: vehicle ? vehicle.groundSpeed.rawValue : 0 property real _headingToHome: vehicle ? vehicle.headingToHome.rawValue : 0
property real _headingToNextWP: vehicle ? vehicle.headingToNextWP.rawValue : 0 property real _groundSpeed: vehicle ? vehicle.groundSpeed.rawValue : 0
property real _courseOverGround:activeVehicle ? activeVehicle.gps.courseOverGround.rawValue : 0 property real _headingToNextWP: vehicle ? vehicle.headingToNextWP.rawValue : 0
property real _courseOverGround: _activeVehicle ? _activeVehicle.gps.courseOverGround.rawValue : 0
property bool usedByMultipleVehicleList: false property bool usedByMultipleVehicleList: false
......
...@@ -43,7 +43,7 @@ ColumnLayout { ...@@ -43,7 +43,7 @@ ColumnLayout {
anchors.leftMargin: _topBottomMargin anchors.leftMargin: _topBottomMargin
anchors.left: parent.left anchors.left: parent.left
size: _innerRadius * 2 size: _innerRadius * 2
vehicle: activeVehicle vehicle: globals.activeVehicle
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
...@@ -52,7 +52,7 @@ ColumnLayout { ...@@ -52,7 +52,7 @@ ColumnLayout {
anchors.leftMargin: _spacing anchors.leftMargin: _spacing
anchors.left: attitude.right anchors.left: attitude.right
size: _innerRadius * 2 size: _innerRadius * 2
vehicle: activeVehicle vehicle: globals.activeVehicle
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
......
...@@ -44,7 +44,7 @@ Rectangle { ...@@ -44,7 +44,7 @@ Rectangle {
anchors.margins : _margins anchors.margins : _margins
anchors.top: parent.top anchors.top: parent.top
size: _innerRadius * 2 size: _innerRadius * 2
vehicle: activeVehicle vehicle: globals.activeVehicle
} }
QGCCompassWidget { QGCCompassWidget {
...@@ -53,6 +53,6 @@ Rectangle { ...@@ -53,6 +53,6 @@ Rectangle {
anchors.margins: _margins anchors.margins: _margins
anchors.top: attitude.bottom anchors.top: attitude.bottom
size: _innerRadius * 2 size: _innerRadius * 2
vehicle: activeVehicle vehicle: globals.activeVehicle
} }
} }
...@@ -97,8 +97,8 @@ Rectangle { ...@@ -97,8 +97,8 @@ Rectangle {
QGCButton { QGCButton {
text: _setToVehicleHeadingStr text: _setToVehicleHeadingStr
visible: activeVehicle visible: globals.activeVehicle
onClicked: missionItem.landingHeading.rawValue = activeVehicle.heading.rawValue onClicked: missionItem.landingHeading.rawValue = globals.activeVehicle.heading.rawValue
} }
} }
...@@ -167,9 +167,9 @@ Rectangle { ...@@ -167,9 +167,9 @@ Rectangle {
QGCButton { QGCButton {
text: _setToVehicleLocationStr text: _setToVehicleLocationStr
visible: activeVehicle visible: globals.activeVehicle
Layout.columnSpan: 2 Layout.columnSpan: 2
onClicked: missionItem.landingCoordinate = activeVehicle.coordinate onClicked: missionItem.landingCoordinate = globals.activeVehicle.coordinate
} }
} }
} }
...@@ -278,17 +278,17 @@ Rectangle { ...@@ -278,17 +278,17 @@ Rectangle {
anchors.right: parent.right anchors.right: parent.right
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: qsTr("- or -") text: qsTr("- or -")
visible: activeVehicle visible: globals.activeVehicle
} }
QGCButton { QGCButton {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
text: _setToVehicleLocationStr text: _setToVehicleLocationStr
visible: activeVehicle visible: globals.activeVehicle
onClicked: { onClicked: {
missionItem.landingCoordinate = activeVehicle.coordinate missionItem.landingCoordinate = globals.activeVehicle.coordinate
missionItem.landingHeading.rawValue = activeVehicle.heading.rawValue missionItem.landingHeading.rawValue = globals.activeVehicle.heading.rawValue
missionItem.setLandingHeadingToTakeoffHeading() missionItem.setLandingHeadingToTakeoffHeading()
} }
} }
......
...@@ -13,8 +13,8 @@ import QGroundControl.Palette 1.0 ...@@ -13,8 +13,8 @@ import QGroundControl.Palette 1.0
Item { Item {
width: missionStats.width + _margins width: missionStats.width + _margins
property var _planMasterController: mainWindow.planMasterControllerPlanView property var _planMasterController: globals.planMasterControllerPlanView
property var _currentMissionItem: mainWindow.currentPlanMissionItem ///< Mission item to display status for property var _currentMissionItem: globals.currentPlanMissionItem ///< Mission item to display status for
property var missionItems: _controllerValid ? _planMasterController.missionController.visualItems : undefined property var missionItems: _controllerValid ? _planMasterController.missionController.visualItems : undefined
property real missionDistance: _controllerValid ? _planMasterController.missionController.missionDistance : NaN property real missionDistance: _controllerValid ? _planMasterController.missionController.missionDistance : NaN
......
...@@ -218,7 +218,7 @@ Item { ...@@ -218,7 +218,7 @@ Item {
Component.onCompleted: { Component.onCompleted: {
_planMasterController.start() _planMasterController.start()
_missionController.setCurrentPlanViewSeqNum(0, true) _missionController.setCurrentPlanViewSeqNum(0, true)
mainWindow.planMasterControllerPlanView = _planMasterController globals.planMasterControllerPlanView = _planMasterController
} }
onPromptForPlanUsageOnVehicleChange: { onPromptForPlanUsageOnVehicleChange: {
...@@ -1040,7 +1040,7 @@ Item { ...@@ -1040,7 +1040,7 @@ Item {
id: unsavedChangedLabel id: unsavedChangedLabel
Layout.fillWidth: true Layout.fillWidth: true
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: activeVehicle ? text: globals.activeVehicle ?
qsTr("You have unsaved changes. You should upload to your vehicle, or save to a file.") : qsTr("You have unsaved changes. You should upload to your vehicle, or save to a file.") :
qsTr("You have unsaved changes.") qsTr("You have unsaved changes.")
visible: _planMasterController.dirty visible: _planMasterController.dirty
......
...@@ -105,8 +105,8 @@ Rectangle { ...@@ -105,8 +105,8 @@ Rectangle {
QGCButton { QGCButton {
text: _setToVehicleHeadingStr text: _setToVehicleHeadingStr
visible: activeVehicle visible: globals.activeVehicle
onClicked: missionItem.landingHeading.rawValue = activeVehicle.heading.rawValue onClicked: missionItem.landingHeading.rawValue = globals.activeVehicle.heading.rawValue
} }
} }
...@@ -154,9 +154,9 @@ Rectangle { ...@@ -154,9 +154,9 @@ Rectangle {
QGCButton { QGCButton {
text: _setToVehicleLocationStr text: _setToVehicleLocationStr
visible: activeVehicle visible: globals.activeVehicle
Layout.columnSpan: 2 Layout.columnSpan: 2
onClicked: missionItem.landingCoordinate = activeVehicle.coordinate onClicked: missionItem.landingCoordinate = globals.activeVehicle.coordinate
} }
} }
} }
...@@ -265,17 +265,17 @@ Rectangle { ...@@ -265,17 +265,17 @@ Rectangle {
anchors.right: parent.right anchors.right: parent.right
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: qsTr("- or -") text: qsTr("- or -")
visible: activeVehicle visible: globals.activeVehicle
} }
QGCButton { QGCButton {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
text: _setToVehicleLocationStr text: _setToVehicleLocationStr
visible: activeVehicle visible: globals.activeVehicle
onClicked: { onClicked: {
missionItem.landingCoordinate = activeVehicle.coordinate missionItem.landingCoordinate = globals.activeVehicle.coordinate
missionItem.landingHeading.rawValue = activeVehicle.heading.rawValue missionItem.landingHeading.rawValue = globals.activeVehicle.heading.rawValue
missionItem.setLandingHeadingToTakeoffHeading() missionItem.setLandingHeadingToTakeoffHeading()
} }
} }
......
...@@ -783,7 +783,7 @@ QObject* QGCApplication::_rootQmlObject() ...@@ -783,7 +783,7 @@ QObject* QGCApplication::_rootQmlObject()
return nullptr; return nullptr;
} }
void QGCApplication::showVehicleMessage(const QString& message) void QGCApplication::showCriticalVehicleMessage(const QString& message)
{ {
// PreArm messages are handled by Vehicle and shown in Map // PreArm messages are handled by Vehicle and shown in Map
if (message.startsWith(QStringLiteral("PreArm")) || message.startsWith(QStringLiteral("preflight"), Qt::CaseInsensitive)) { if (message.startsWith(QStringLiteral("PreArm")) || message.startsWith(QStringLiteral("preflight"), Qt::CaseInsensitive)) {
...@@ -793,10 +793,10 @@ void QGCApplication::showVehicleMessage(const QString& message) ...@@ -793,10 +793,10 @@ void QGCApplication::showVehicleMessage(const QString& message)
if (rootQmlObject) { if (rootQmlObject) {
QVariant varReturn; QVariant varReturn;
QVariant varMessage = QVariant::fromValue(message); QVariant varMessage = QVariant::fromValue(message);
QMetaObject::invokeMethod(_rootQmlObject(), "showVehicleMessage", Q_RETURN_ARG(QVariant, varReturn), Q_ARG(QVariant, varMessage)); QMetaObject::invokeMethod(_rootQmlObject(), "showCriticalVehicleMessage", Q_RETURN_ARG(QVariant, varReturn), Q_ARG(QVariant, varMessage));
} else if (runningUnitTests()) { } else if (runningUnitTests()) {
// Unit tests can run without UI // Unit tests can run without UI
qDebug() << "QGCApplication::showVehicleMessage unittest" << message; qDebug() << "QGCApplication::showCriticalVehicleMessage unittest" << message;
} else { } else {
qWarning() << "Internal error"; qWarning() << "Internal error";
} }
......
...@@ -78,7 +78,7 @@ public: ...@@ -78,7 +78,7 @@ public:
void reportMissingParameter(int componentId, const QString& name); void reportMissingParameter(int componentId, const QString& name);
/// Show non-modal vehicle message to the user /// Show non-modal vehicle message to the user
Q_SLOT void showVehicleMessage(const QString& message); Q_SLOT void showCriticalVehicleMessage(const QString& message);
/// Show modal application message to the user /// Show modal application message to the user
Q_SLOT void showAppMessage(const QString& message, const QString& title = QString()); Q_SLOT void showAppMessage(const QString& message, const QString& title = QString());
......
...@@ -15,7 +15,7 @@ Rectangle { ...@@ -15,7 +15,7 @@ Rectangle {
property var _logReplayLink: null property var _logReplayLink: null
function pickLogFile() { function pickLogFile() {
if (mainWindow.activeVehicle) { if (globals.activeVehicle) {
mainWindow.showMessageDialog(qsTr("Log Replay"), qsTr("You must close all connections prior to replaying a log.")) mainWindow.showMessageDialog(qsTr("Log Replay"), qsTr("You must close all connections prior to replaying a log."))
return return
} }
......
...@@ -27,18 +27,18 @@ RowLayout { ...@@ -27,18 +27,18 @@ RowLayout {
property real _chartHeight: ScreenTools.defaultFontPixelHeight * 20 property real _chartHeight: ScreenTools.defaultFontPixelHeight * 20
property real _margins: ScreenTools.defaultFontPixelHeight / 2 property real _margins: ScreenTools.defaultFontPixelHeight / 2
property string _currentTuneType: tuneList[0] property string _currentTuneType: tuneList[0]
property real _roll: activeVehicle.roll.value property real _roll: globals.activeVehicle.roll.value
property real _rollSetpoint: activeVehicle.setpoint.roll.value property real _rollSetpoint: globals.activeVehicle.setpoint.roll.value
property real _rollRate: activeVehicle.rollRate.value property real _rollRate: globals.activeVehicle.rollRate.value
property real _rollRateSetpoint: activeVehicle.setpoint.rollRate.value property real _rollRateSetpoint: globals.activeVehicle.setpoint.rollRate.value
property real _pitch: activeVehicle.pitch.value property real _pitch: globals.activeVehicle.pitch.value
property real _pitchSetpoint: activeVehicle.setpoint.pitch.value property real _pitchSetpoint: globals.activeVehicle.setpoint.pitch.value
property real _pitchRate: activeVehicle.pitchRate.value property real _pitchRate: globals.activeVehicle.pitchRate.value
property real _pitchRateSetpoint: activeVehicle.setpoint.pitchRate.value property real _pitchRateSetpoint: globals.activeVehicle.setpoint.pitchRate.value
property real _yaw: activeVehicle.heading.value property real _yaw: globals.activeVehicle.heading.value
property real _yawSetpoint: activeVehicle.setpoint.yaw.value property real _yawSetpoint: globals.activeVehicle.setpoint.yaw.value
property real _yawRate: activeVehicle.yawRate.value property real _yawRate: globals.activeVehicle.yawRate.value
property real _yawRateSetpoint: activeVehicle.setpoint.yawRate.value property real _yawRateSetpoint: globals.activeVehicle.setpoint.yawRate.value
property var _valueXAxis: valueXAxis property var _valueXAxis: valueXAxis
property var _valueRateXAxis: valueRateXAxis property var _valueRateXAxis: valueRateXAxis
property var _valueYAxis: valueYAxis property var _valueYAxis: valueYAxis
...@@ -142,11 +142,11 @@ RowLayout { ...@@ -142,11 +142,11 @@ RowLayout {
} }
Component.onCompleted: { Component.onCompleted: {
activeVehicle.setPIDTuningTelemetryMode(true) globals.activeVehicle.setPIDTuningTelemetryMode(true)
saveTuningParamValues() saveTuningParamValues()
} }
Component.onDestruction: activeVehicle.setPIDTuningTelemetryMode(false) Component.onDestruction: globals.activeVehicle.setPIDTuningTelemetryMode(false)
on_CurrentTuneTypeChanged: { on_CurrentTuneTypeChanged: {
saveTuningParamValues() saveTuningParamValues()
...@@ -369,7 +369,7 @@ RowLayout { ...@@ -369,7 +369,7 @@ RowLayout {
onClicked: { onClicked: {
dataTimer.running = !dataTimer.running dataTimer.running = !dataTimer.running
if (autoModeChange.checked) { if (autoModeChange.checked) {
activeVehicle.flightMode = dataTimer.running ? "Stabilized" : activeVehicle.pauseFlightMode globals.activeVehicle.flightMode = dataTimer.running ? "Stabilized" : globals.activeVehicle.pauseFlightMode
} }
} }
} }
...@@ -388,7 +388,7 @@ RowLayout { ...@@ -388,7 +388,7 @@ RowLayout {
} }
QGCLabel { QGCLabel {
text: qsTr("Switches to '%1' when you click Stop.").arg(activeVehicle.pauseFlightMode) text: qsTr("Switches to '%1' when you click Stop.").arg(globals.activeVehicle.pauseFlightMode)
font.pointSize: ScreenTools.smallFontPointSize font.pointSize: ScreenTools.smallFontPointSize
} }
} }
......
...@@ -112,7 +112,7 @@ Item { ...@@ -112,7 +112,7 @@ Item {
} }
QGCMenuItem { QGCMenuItem {
text: qsTr("Reset to vehicle's configuration defaults") text: qsTr("Reset to vehicle's configuration defaults")
visible: !activeVehicle.apmFirmware visible: !_activeVehicle.apmFirmware
onTriggered: mainWindow.showComponentDialog(resetToVehicleConfigurationConfirmComponent, qsTr("Reset All"), mainWindow.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Reset) onTriggered: mainWindow.showComponentDialog(resetToVehicleConfigurationConfirmComponent, qsTr("Reset All"), mainWindow.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Reset)
} }
QGCMenuSeparator { } QGCMenuSeparator { }
...@@ -345,7 +345,7 @@ Item { ...@@ -345,7 +345,7 @@ Item {
QGCViewDialog { QGCViewDialog {
function accept() { function accept() {
activeVehicle.rebootVehicle() _activeVehicle.rebootVehicle()
hideDialog() hideDialog()
} }
......
...@@ -101,7 +101,7 @@ QGCViewDialog { ...@@ -101,7 +101,7 @@ QGCViewDialog {
Column { Column {
id: _column id: _column
spacing: defaultTextHeight spacing: globals.defaultTextHeight
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
......
...@@ -1959,7 +1959,7 @@ bool Vehicle::xConfigMotors() ...@@ -1959,7 +1959,7 @@ bool Vehicle::xConfigMotors()
return _firmwarePlugin->multiRotorXConfig(this); return _firmwarePlugin->multiRotorXConfig(this);
} }
QString Vehicle::formatedMessages() QString Vehicle::formattedMessages()
{ {
QString messages; QString messages;
for(UASMessage* message: _toolbox->uasMessageHandler()->messages()) { for(UASMessage* message: _toolbox->uasMessageHandler()->messages()) {
...@@ -1975,10 +1975,8 @@ void Vehicle::clearMessages() ...@@ -1975,10 +1975,8 @@ void Vehicle::clearMessages()
void Vehicle::_handletextMessageReceived(UASMessage* message) void Vehicle::_handletextMessageReceived(UASMessage* message)
{ {
if(message) if (message) {
{ emit newFormattedMessage(message->getFormatedText());
_formatedMessage = message->getFormatedText();
emit formatedMessageChanged();
} }
} }
......
...@@ -149,8 +149,7 @@ public: ...@@ -149,8 +149,7 @@ public:
Q_PROPERTY(bool messageTypeError READ messageTypeError NOTIFY messageTypeChanged) Q_PROPERTY(bool messageTypeError READ messageTypeError NOTIFY messageTypeChanged)
Q_PROPERTY(int newMessageCount READ newMessageCount NOTIFY newMessageCountChanged) Q_PROPERTY(int newMessageCount READ newMessageCount NOTIFY newMessageCountChanged)
Q_PROPERTY(int messageCount READ messageCount NOTIFY messageCountChanged) Q_PROPERTY(int messageCount READ messageCount NOTIFY messageCountChanged)
Q_PROPERTY(QString formatedMessages READ formatedMessages NOTIFY formatedMessagesChanged) Q_PROPERTY(QString formattedMessages READ formattedMessages NOTIFY formattedMessagesChanged)
Q_PROPERTY(QString formatedMessage READ formatedMessage NOTIFY formatedMessageChanged)
Q_PROPERTY(QString latestError READ latestError NOTIFY latestErrorChanged) Q_PROPERTY(QString latestError READ latestError NOTIFY latestErrorChanged)
Q_PROPERTY(bool joystickEnabled READ joystickEnabled WRITE setJoystickEnabled NOTIFY joystickEnabledChanged) Q_PROPERTY(bool joystickEnabled READ joystickEnabled WRITE setJoystickEnabled NOTIFY joystickEnabledChanged)
Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged) Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
...@@ -227,7 +226,7 @@ public: ...@@ -227,7 +226,7 @@ public:
Q_PROPERTY(qreal gimbalPitch READ gimbalPitch NOTIFY gimbalPitchChanged) Q_PROPERTY(qreal gimbalPitch READ gimbalPitch NOTIFY gimbalPitchChanged)
Q_PROPERTY(qreal gimbalYaw READ gimbalYaw NOTIFY gimbalYawChanged) Q_PROPERTY(qreal gimbalYaw READ gimbalYaw NOTIFY gimbalYawChanged)
Q_PROPERTY(bool gimbalData READ gimbalData NOTIFY gimbalDataChanged) Q_PROPERTY(bool gimbalData READ gimbalData NOTIFY gimbalDataChanged)
Q_PROPERTY(bool iARDURsROIEnabled READ isROIEnabled NOTIFY isROIEnabledChanged) Q_PROPERTY(bool isROIEnabled READ isROIEnabled NOTIFY isROIEnabledChanged)
Q_PROPERTY(CheckList checkListState READ checkListState WRITE setCheckListState NOTIFY checkListStateChanged) Q_PROPERTY(CheckList checkListState READ checkListState WRITE setCheckListState NOTIFY checkListStateChanged)
Q_PROPERTY(bool readyToFlyAvailable READ readyToFlyAvailable NOTIFY readyToFlyAvailableChanged) ///< true: readyToFly signalling is available on this vehicle Q_PROPERTY(bool readyToFlyAvailable READ readyToFlyAvailable NOTIFY readyToFlyAvailableChanged) ///< true: readyToFly signalling is available on this vehicle
Q_PROPERTY(bool readyToFly READ readyToFly NOTIFY readyToFlyChanged) Q_PROPERTY(bool readyToFly READ readyToFly NOTIFY readyToFlyChanged)
...@@ -506,8 +505,7 @@ public: ...@@ -506,8 +505,7 @@ public:
bool messageTypeError () { return _currentMessageType == MessageError; } bool messageTypeError () { return _currentMessageType == MessageError; }
int newMessageCount () { return _currentMessageCount; } int newMessageCount () { return _currentMessageCount; }
int messageCount () { return _messageCount; } int messageCount () { return _messageCount; }
QString formatedMessages (); QString formattedMessages ();
QString formatedMessage () { return _formatedMessage; }
QString latestError () { return _latestError; } QString latestError () { return _latestError; }
float latitude () { return static_cast<float>(_coordinate.latitude()); } float latitude () { return static_cast<float>(_coordinate.latitude()); }
float longitude () { return static_cast<float>(_coordinate.longitude()); } float longitude () { return static_cast<float>(_coordinate.longitude()); }
...@@ -814,8 +812,8 @@ signals: ...@@ -814,8 +812,8 @@ signals:
void messageTypeChanged (); void messageTypeChanged ();
void newMessageCountChanged (); void newMessageCountChanged ();
void messageCountChanged (); void messageCountChanged ();
void formatedMessagesChanged (); void formattedMessagesChanged ();
void formatedMessageChanged (); void newFormattedMessage (QString formattedMessage);
void latestErrorChanged (); void latestErrorChanged ();
void longitudeChanged (); void longitudeChanged ();
void currentConfigChanged (); void currentConfigChanged ();
...@@ -1015,7 +1013,6 @@ private: ...@@ -1015,7 +1013,6 @@ private:
MessageType_t _currentMessageType; MessageType_t _currentMessageType;
QString _latestError; QString _latestError;
int _updateCount; int _updateCount;
QString _formatedMessage;
int _rcRSSI; int _rcRSSI;
double _rcRSSIstore; double _rcRSSIstore;
bool _autoDisconnect; ///< true: Automatically disconnect vehicle when last connection goes away or lost heartbeat bool _autoDisconnect; ///< true: Automatically disconnect vehicle when last connection goes away or lost heartbeat
......
...@@ -26,7 +26,7 @@ SetupPage { ...@@ -26,7 +26,7 @@ SetupPage {
id: firmwarePage id: firmwarePage
pageComponent: firmwarePageComponent pageComponent: firmwarePageComponent
pageName: qsTr("Firmware") pageName: qsTr("Firmware")
showAdvanced: activeVehicle && activeVehicle.apmFirmware showAdvanced: globals.activeVehicle && globals.activeVehicle.apmFirmware
Component { Component {
id: firmwarePageComponent id: firmwarePageComponent
...@@ -97,7 +97,7 @@ SetupPage { ...@@ -97,7 +97,7 @@ SetupPage {
property var activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
onActiveVehicleChanged: { onActiveVehicleChanged: {
if (!activeVehicle) { if (!globals.activeVehicle) {
statusTextArea.append(plugInText) statusTextArea.append(plugInText)
} }
} }
...@@ -303,7 +303,7 @@ SetupPage { ...@@ -303,7 +303,7 @@ SetupPage {
id: mainColumn id: mainColumn
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
spacing: defaultTextHeight spacing: globals.defaultTextHeight
QGCLabel { QGCLabel {
width: parent.width width: parent.width
...@@ -511,7 +511,7 @@ SetupPage { ...@@ -511,7 +511,7 @@ SetupPage {
id: flashBootloaderButton id: flashBootloaderButton
text: qsTr("Flash ChibiOS Bootloader") text: qsTr("Flash ChibiOS Bootloader")
visible: firmwarePage.advanced visible: firmwarePage.advanced
onClicked: activeVehicle.flashBootloader() onClicked: globals.activeVehicle.flashBootloader()
} }
TextArea { TextArea {
......
...@@ -59,12 +59,12 @@ Item { ...@@ -59,12 +59,12 @@ Item {
//------------------------------------------------------------- //-------------------------------------------------------------
QGCLabel { QGCLabel {
text: qsTr("Allow negative Thrust") text: qsTr("Allow negative Thrust")
visible: activeVehicle.supportsNegativeThrust visible: globals.activeVehicle.supportsNegativeThrust
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
} }
QGCCheckBox { QGCCheckBox {
visible: activeVehicle.supportsNegativeThrust visible: globals.activeVehicle.supportsNegativeThrust
enabled: _activeJoystick.negativeThrust = activeVehicle.supportsNegativeThrust enabled: _activeJoystick.negativeThrust = globals.activeVehicle.supportsNegativeThrust
checked: _activeJoystick ? _activeJoystick.negativeThrust : false checked: _activeJoystick ? _activeJoystick.negativeThrust : false
onClicked: _activeJoystick.negativeThrust = checked onClicked: _activeJoystick.negativeThrust = checked
} }
...@@ -96,10 +96,10 @@ Item { ...@@ -96,10 +96,10 @@ Item {
} }
QGCCheckBox { QGCCheckBox {
id: advancedSettings id: advancedSettings
checked: activeVehicle.joystickMode !== 0 checked: globals.activeVehicle.joystickMode !== 0
onClicked: { onClicked: {
if (!checked) { if (!checked) {
activeVehicle.joystickMode = 0 globals.activeVehicle.joystickMode = 0
} }
} }
} }
...@@ -171,7 +171,7 @@ Item { ...@@ -171,7 +171,7 @@ Item {
visible: advancedSettings.checked visible: advancedSettings.checked
} }
QGCCheckBox { QGCCheckBox {
checked: activeVehicle.joystickMode !== 0 checked: globals.activeVehicle.joystickMode !== 0
enabled: advancedSettings.checked enabled: advancedSettings.checked
Component.onCompleted: { Component.onCompleted: {
checked = _activeJoystick.circleCorrection checked = _activeJoystick.circleCorrection
......
...@@ -22,7 +22,7 @@ import QGroundControl.FactControls 1.0 ...@@ -22,7 +22,7 @@ import QGroundControl.FactControls 1.0
Item { Item {
width: availableWidth width: availableWidth
height: (activeVehicle.supportsJSButton ? buttonCol.height : flowColumn.height) + (ScreenTools.defaultFontPixelHeight * 2) height: (globals.activeVehicle.supportsJSButton ? buttonCol.height : flowColumn.height) + (ScreenTools.defaultFontPixelHeight * 2)
Connections { Connections {
target: _activeJoystick target: _activeJoystick
onRawButtonPressedChanged: { onRawButtonPressedChanged: {
...@@ -48,7 +48,7 @@ Item { ...@@ -48,7 +48,7 @@ Item {
id: buttonFlow id: buttonFlow
Layout.preferredWidth: parent.width Layout.preferredWidth: parent.width
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
visible: !activeVehicle.supportsJSButton visible: !globals.activeVehicle.supportsJSButton
Repeater { Repeater {
id: buttonActionRepeater id: buttonActionRepeater
model: _activeJoystick ? Math.min(_activeJoystick.totalButtonCount, _maxButtons) : [] model: _activeJoystick ? Math.min(_activeJoystick.totalButtonCount, _maxButtons) : []
...@@ -113,7 +113,7 @@ Item { ...@@ -113,7 +113,7 @@ Item {
Column { Column {
id: buttonCol id: buttonCol
width: parent.width width: parent.width
visible: activeVehicle.supportsJSButton visible: globals.activeVehicle.supportsJSButton
spacing: ScreenTools.defaultFontPixelHeight / 3 spacing: ScreenTools.defaultFontPixelHeight / 3
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
...@@ -137,7 +137,7 @@ Item { ...@@ -137,7 +137,7 @@ Item {
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
visible: activeVehicle.supportsJSButton visible: globals.activeVehicle.supportsJSButton
property bool pressed property bool pressed
......
...@@ -42,21 +42,21 @@ Item { ...@@ -42,21 +42,21 @@ Item {
QGCCheckBox { QGCCheckBox {
id: enabledSwitch id: enabledSwitch
enabled: _activeJoystick ? _activeJoystick.calibrated : false enabled: _activeJoystick ? _activeJoystick.calibrated : false
onClicked: activeVehicle.joystickEnabled = checked onClicked: globals.activeVehicle.joystickEnabled = checked
Component.onCompleted: { Component.onCompleted: {
checked = activeVehicle.joystickEnabled checked = globals.activeVehicle.joystickEnabled
} }
Connections { Connections {
target: activeVehicle target: globals.activeVehicle
onJoystickEnabledChanged: { onJoystickEnabledChanged: {
enabledSwitch.checked = activeVehicle.joystickEnabled enabledSwitch.checked = globals.activeVehicle.joystickEnabled
} }
} }
Connections { Connections {
target: joystickManager target: joystickManager
onActiveJoystickChanged: { onActiveJoystickChanged: {
if(_activeJoystick) { if(_activeJoystick) {
enabledSwitch.checked = Qt.binding(function() { return _activeJoystick.calibrated && activeVehicle.joystickEnabled }) enabledSwitch.checked = Qt.binding(function() { return _activeJoystick.calibrated && globals.activeVehicle.joystickEnabled })
} }
} }
} }
...@@ -148,7 +148,7 @@ Item { ...@@ -148,7 +148,7 @@ Item {
rowSpacing: ScreenTools.defaultFontPixelHeight rowSpacing: ScreenTools.defaultFontPixelHeight
anchors.centerIn: parent anchors.centerIn: parent
QGCLabel { QGCLabel {
text: activeVehicle.sub ? qsTr("Lateral") : qsTr("Roll") text: globals.activeVehicle.sub ? qsTr("Lateral") : qsTr("Roll")
Layout.minimumWidth: ScreenTools.defaultFontPixelWidth * 12 Layout.minimumWidth: ScreenTools.defaultFontPixelWidth * 12
} }
AxisMonitor { AxisMonitor {
...@@ -162,7 +162,7 @@ Item { ...@@ -162,7 +162,7 @@ Item {
QGCLabel { QGCLabel {
id: pitchLabel id: pitchLabel
width: _attitudeLabelWidth width: _attitudeLabelWidth
text: activeVehicle.sub ? qsTr("Forward") : qsTr("Pitch") text: globals.activeVehicle.sub ? qsTr("Forward") : qsTr("Pitch")
} }
AxisMonitor { AxisMonitor {
id: pitchAxis id: pitchAxis
......
...@@ -24,7 +24,7 @@ Item { ...@@ -24,7 +24,7 @@ Item {
font.family: ScreenTools.demiboldFontFamily font.family: ScreenTools.demiboldFontFamily
} }
Image { Image {
source: activeVehicle ? "image://QGCImages/" + activeVehicle.id + "/" + activeVehicle.flowImageIndex : "" source: globals.activeVehicle ? "image://QGCImages/" + globals.activeVehicle.id + "/" + globals.activeVehicle.flowImageIndex : ""
width: parent.width * 0.5 width: parent.width * 0.5
height: width * 0.75 height: width * 0.75
cache: false cache: false
......
...@@ -1252,7 +1252,7 @@ void MockLink::_sendStatusTextMessages(void) ...@@ -1252,7 +1252,7 @@ void MockLink::_sendStatusTextMessages(void)
status->msg, status->msg,
0, // Not a chunked sequence 0, // Not a chunked sequence
0); // Not a chunked sequence 0); // Not a chunked sequence
//respondWithMavlinkMessage(msg); respondWithMavlinkMessage(msg);
} }
_sendChunkedStatusText(1, false /* missingChunks */); _sendChunkedStatusText(1, false /* missingChunks */);
......
...@@ -202,7 +202,7 @@ void UASMessageHandler::handleTextMessage(int, int compId, int severity, QString ...@@ -202,7 +202,7 @@ void UASMessageHandler::handleTextMessage(int, int compId, int severity, QString
emit textMessageCountChanged(count); emit textMessageCountChanged(count);
if (_showErrorsInToolbar && message->severityIsError()) { if (_showErrorsInToolbar && message->severityIsError()) {
_app->showVehicleMessage(message->getText()); _app->showCriticalVehicleMessage(message->getText());
} }
} }
......
This diff is collapsed.
...@@ -311,7 +311,7 @@ Rectangle { ...@@ -311,7 +311,7 @@ Rectangle {
} }
QGCLabel { QGCLabel {
width: _valueWidth width: _valueWidth
text: activeVehicle ? activeVehicle.mavlinkSentCount : qsTr("Not Connected") text: globals.activeVehicle ? globals.activeVehicle.mavlinkSentCount : qsTr("Not Connected")
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
...@@ -326,7 +326,7 @@ Rectangle { ...@@ -326,7 +326,7 @@ Rectangle {
} }
QGCLabel { QGCLabel {
width: _valueWidth width: _valueWidth
text: activeVehicle ? activeVehicle.mavlinkReceivedCount : qsTr("Not Connected") text: globals.activeVehicle ? globals.activeVehicle.mavlinkReceivedCount : qsTr("Not Connected")
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
...@@ -341,7 +341,7 @@ Rectangle { ...@@ -341,7 +341,7 @@ Rectangle {
} }
QGCLabel { QGCLabel {
width: _valueWidth width: _valueWidth
text: activeVehicle ? activeVehicle.mavlinkLossCount : qsTr("Not Connected") text: globals.activeVehicle ? globals.activeVehicle.mavlinkLossCount : qsTr("Not Connected")
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
...@@ -356,7 +356,7 @@ Rectangle { ...@@ -356,7 +356,7 @@ Rectangle {
} }
QGCLabel { QGCLabel {
width: _valueWidth width: _valueWidth
text: activeVehicle ? activeVehicle.mavlinkLossPercent.toFixed(0) + '%' : qsTr("Not Connected") text: globals.activeVehicle ? globals.activeVehicle.mavlinkLossPercent.toFixed(0) + '%' : qsTr("Not Connected")
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
......
...@@ -27,13 +27,15 @@ Item { ...@@ -27,13 +27,15 @@ Item {
property bool showIndicator: true property bool showIndicator: true
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
Row { Row {
id: batteryIndicatorRow id: batteryIndicatorRow
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
Repeater { Repeater {
model: activeVehicle ? activeVehicle.batteries : 0 model: _activeVehicle ? _activeVehicle.batteries : 0
Loader { Loader {
anchors.top: parent.top anchors.top: parent.top
...@@ -149,7 +151,7 @@ Item { ...@@ -149,7 +151,7 @@ Item {
ColumnLayout { ColumnLayout {
Repeater { Repeater {
model: activeVehicle ? activeVehicle.batteries : 0 model: _activeVehicle ? _activeVehicle.batteries : 0
ColumnLayout { ColumnLayout {
spacing: 0 spacing: 0
...@@ -177,7 +179,7 @@ Item { ...@@ -177,7 +179,7 @@ Item {
ColumnLayout { ColumnLayout {
Repeater { Repeater {
model: activeVehicle ? activeVehicle.batteries : 0 model: _activeVehicle ? _activeVehicle.batteries : 0
ColumnLayout { ColumnLayout {
spacing: 0 spacing: 0
......
...@@ -26,6 +26,8 @@ Item { ...@@ -26,6 +26,8 @@ Item {
property bool showIndicator: true property bool showIndicator: true
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
Component { Component {
id: gpsInfo id: gpsInfo
...@@ -45,29 +47,29 @@ Item { ...@@ -45,29 +47,29 @@ Item {
QGCLabel { QGCLabel {
id: gpsLabel id: gpsLabel
text: (activeVehicle && activeVehicle.gps.count.value >= 0) ? qsTr("GPS Status") : qsTr("GPS Data Unavailable") text: (_activeVehicle && _activeVehicle.gps.count.value >= 0) ? qsTr("GPS Status") : qsTr("GPS Data Unavailable")
font.family: ScreenTools.demiboldFontFamily font.family: ScreenTools.demiboldFontFamily
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
GridLayout { GridLayout {
id: gpsGrid id: gpsGrid
visible: (activeVehicle && activeVehicle.gps.count.value >= 0) visible: (_activeVehicle && _activeVehicle.gps.count.value >= 0)
anchors.margins: ScreenTools.defaultFontPixelHeight anchors.margins: ScreenTools.defaultFontPixelHeight
columnSpacing: ScreenTools.defaultFontPixelWidth columnSpacing: ScreenTools.defaultFontPixelWidth
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
columns: 2 columns: 2
QGCLabel { text: qsTr("GPS Count:") } QGCLabel { text: qsTr("GPS Count:") }
QGCLabel { text: activeVehicle ? activeVehicle.gps.count.valueString : qsTr("N/A", "No data to display") } QGCLabel { text: _activeVehicle ? _activeVehicle.gps.count.valueString : qsTr("N/A", "No data to display") }
QGCLabel { text: qsTr("GPS Lock:") } QGCLabel { text: qsTr("GPS Lock:") }
QGCLabel { text: activeVehicle ? activeVehicle.gps.lock.enumStringValue : qsTr("N/A", "No data to display") } QGCLabel { text: _activeVehicle ? _activeVehicle.gps.lock.enumStringValue : qsTr("N/A", "No data to display") }
QGCLabel { text: qsTr("HDOP:") } QGCLabel { text: qsTr("HDOP:") }
QGCLabel { text: activeVehicle ? activeVehicle.gps.hdop.valueString : qsTr("--.--", "No data to display") } QGCLabel { text: _activeVehicle ? _activeVehicle.gps.hdop.valueString : qsTr("--.--", "No data to display") }
QGCLabel { text: qsTr("VDOP:") } QGCLabel { text: qsTr("VDOP:") }
QGCLabel { text: activeVehicle ? activeVehicle.gps.vdop.valueString : qsTr("--.--", "No data to display") } QGCLabel { text: _activeVehicle ? _activeVehicle.gps.vdop.valueString : qsTr("--.--", "No data to display") }
QGCLabel { text: qsTr("Course Over Ground:") } QGCLabel { text: qsTr("Course Over Ground:") }
QGCLabel { text: activeVehicle ? activeVehicle.gps.courseOverGround.valueString : qsTr("--.--", "No data to display") } QGCLabel { text: _activeVehicle ? _activeVehicle.gps.courseOverGround.valueString : qsTr("--.--", "No data to display") }
} }
} }
} }
...@@ -81,7 +83,7 @@ Item { ...@@ -81,7 +83,7 @@ Item {
source: "/qmlimages/Gps.svg" source: "/qmlimages/Gps.svg"
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
sourceSize.height: height sourceSize.height: height
opacity: (activeVehicle && activeVehicle.gps.count.value >= 0) ? 1 : 0.5 opacity: (_activeVehicle && _activeVehicle.gps.count.value >= 0) ? 1 : 0.5
color: qgcPal.buttonText color: qgcPal.buttonText
} }
...@@ -93,16 +95,16 @@ Item { ...@@ -93,16 +95,16 @@ Item {
QGCLabel { QGCLabel {
anchors.horizontalCenter: hdopValue.horizontalCenter anchors.horizontalCenter: hdopValue.horizontalCenter
visible: activeVehicle && !isNaN(activeVehicle.gps.hdop.value) visible: _activeVehicle && !isNaN(_activeVehicle.gps.hdop.value)
color: qgcPal.buttonText color: qgcPal.buttonText
text: activeVehicle ? activeVehicle.gps.count.valueString : "" text: _activeVehicle ? _activeVehicle.gps.count.valueString : ""
} }
QGCLabel { QGCLabel {
id: hdopValue id: hdopValue
visible: activeVehicle && !isNaN(activeVehicle.gps.hdop.value) visible: _activeVehicle && !isNaN(_activeVehicle.gps.hdop.value)
color: qgcPal.buttonText color: qgcPal.buttonText
text: activeVehicle ? activeVehicle.gps.hdop.value.toFixed(1) : "" text: _activeVehicle ? _activeVehicle.gps.hdop.value.toFixed(1) : ""
} }
} }
......
...@@ -22,7 +22,7 @@ Item { ...@@ -22,7 +22,7 @@ Item {
width: joystickRow.width * 1.1 width: joystickRow.width * 1.1
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
visible: activeVehicle ? activeVehicle.sub : false visible: globals.activeVehicle ? globals.activeVehicle.sub : false
Component { Component {
...@@ -63,8 +63,8 @@ Item { ...@@ -63,8 +63,8 @@ Item {
} }
QGCLabel { text: qsTr("Enabled:") } QGCLabel { text: qsTr("Enabled:") }
QGCLabel { QGCLabel {
text: activeVehicle && activeVehicle.joystickEnabled ? "Yes" : "No" text: globals.activeVehicle && globals.activeVehicle.joystickEnabled ? "Yes" : "No"
color: activeVehicle && activeVehicle.joystickEnabled ? qgcPal.buttonText : "red" color: globals.activeVehicle && globals.activeVehicle.joystickEnabled ? qgcPal.buttonText : "red"
} }
} }
} }
...@@ -84,7 +84,7 @@ Item { ...@@ -84,7 +84,7 @@ Item {
sourceSize.height: height sourceSize.height: height
source: "/qmlimages/Joystick.png" source: "/qmlimages/Joystick.png"
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
color: activeVehicle && activeVehicle.joystickEnabled && joystickManager.activeJoystick ? qgcPal.buttonText : "red" color: globals.activeVehicle && globals.activeVehicle.joystickEnabled && joystickManager.activeJoystick ? qgcPal.buttonText : "red"
} }
} }
......
...@@ -27,9 +27,11 @@ Item { ...@@ -27,9 +27,11 @@ Item {
property bool showIndicator: false property bool showIndicator: false
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
QGCLabel { QGCLabel {
id: priorityLinkSelector id: priorityLinkSelector
text: activeVehicle ? activeVehicle.priorityLinkName : qsTr("N/A", "No data to display") text: _activeVehicle ? _activeVehicle.priorityLinkName : qsTr("N/A", "No data to display")
font.pointSize: ScreenTools.mediumFontPointSize font.pointSize: ScreenTools.mediumFontPointSize
color: qgcPal.buttonText color: qgcPal.buttonText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
...@@ -39,12 +41,12 @@ Item { ...@@ -39,12 +41,12 @@ Item {
Component { Component {
id: linkSelectionMenuItemComponent id: linkSelectionMenuItemComponent
QGCMenuItem { QGCMenuItem {
onTriggered: activeVehicle.priorityLinkName = text onTriggered: _activeVehicle.priorityLinkName = text
} }
} }
property var linkSelectionMenuItems: [] property var linkSelectionMenuItems: []
function updatelinkSelectionMenu() { function updatelinkSelectionMenu() {
if (activeVehicle) { if (_activeVehicle) {
// Remove old menu items // Remove old menu items
var i var i
for (i = 0; i < linkSelectionMenuItems.length; i++) { for (i = 0; i < linkSelectionMenuItems.length; i++) {
...@@ -54,9 +56,9 @@ Item { ...@@ -54,9 +56,9 @@ Item {
// Add new items // Add new items
var has_hl = false; var has_hl = false;
var links = activeVehicle.links var links = _activeVehicle.links
for (i = 0; i < links.length; i++) { for (i = 0; i < links.length; i++) {
var menuItem = linkSelectionMenuItemComponent.createObject(null, { "text": links[i].getName(), "enabled": links[i].link_active(activeVehicle.id)}) var menuItem = linkSelectionMenuItemComponent.createObject(null, { "text": links[i].getName(), "enabled": links[i].link_active(_activeVehicle.id)})
linkSelectionMenuItems.push(menuItem) linkSelectionMenuItems.push(menuItem)
linkSelectionMenu.insertItem(i, menuItem) linkSelectionMenu.insertItem(i, menuItem)
...@@ -77,17 +79,17 @@ Item { ...@@ -77,17 +79,17 @@ Item {
} }
Connections { Connections {
target: activeVehicle target: _activeVehicle
onLinksChanged: priorityLinkSelector.updatelinkSelectionMenu() onLinksChanged: priorityLinkSelector.updatelinkSelectionMenu()
} }
Connections { Connections {
target: activeVehicle target: _activeVehicle
onLinksPropertiesChanged: priorityLinkSelector.updatelinkSelectionMenu() onLinksPropertiesChanged: priorityLinkSelector.updatelinkSelectionMenu()
} }
MouseArea { MouseArea {
visible: activeVehicle visible: _activeVehicle
anchors.fill: parent anchors.fill: parent
onClicked: linkSelectionMenu.popup() onClicked: linkSelectionMenu.popup()
} }
......
...@@ -126,22 +126,40 @@ Rectangle { ...@@ -126,22 +126,40 @@ Rectangle {
property string _userBrandImageOutdoor: QGroundControl.settingsManager.brandImageSettings.userBrandImageOutdoor.value property string _userBrandImageOutdoor: QGroundControl.settingsManager.brandImageSettings.userBrandImageOutdoor.value
property bool _userBrandingIndoor: _userBrandImageIndoor.length != 0 property bool _userBrandingIndoor: _userBrandImageIndoor.length != 0
property bool _userBrandingOutdoor: _userBrandImageOutdoor.length != 0 property bool _userBrandingOutdoor: _userBrandImageOutdoor.length != 0
property string _brandImageIndoor: _userBrandingIndoor ? property string _brandImageIndoor: brandImageIndoor()
_userBrandImageIndoor : (_userBrandingOutdoor ? property string _brandImageOutdoor: brandImageOutdoor()
_userBrandImageOutdoor : (_corePluginBranding ?
QGroundControl.corePlugin.brandImageIndoor : (activeVehicle ? function brandImageIndoor() {
activeVehicle.brandImageIndoor : "" if (_userBrandingIndoor) {
) return _userBrandImageIndoor
) } else {
) if (_userBrandingOutdoor) {
property string _brandImageOutdoor: _userBrandingOutdoor ? return _userBrandingOutdoor
_userBrandImageOutdoor : (_userBrandingIndoor ? } else {
_userBrandImageIndoor : (_corePluginBranding ? if (_corePluginBranding) {
QGroundControl.corePlugin.brandImageOutdoor : (activeVehicle ? return QGroundControl.corePlugin.brandImageIndoor
activeVehicle.brandImageOutdoor : "" } else {
) return _activeVehicle ? _activeVehicle.brandImageIndoor : ""
) }
) }
}
}
function brandImageOutdoor() {
if (_userBrandingOutdoor) {
return _userBrandingOutdoor
} else {
if (_userBrandingIndoor) {
return _userBrandingIndoor
} else {
if (_corePluginBranding) {
return QGroundControl.corePlugin.brandImageOutdoor
} else {
return _activeVehicle ? _activeVehicle.brandImageOutdoor : ""
}
}
}
}
} }
// Small parameter download progress bar // Small parameter download progress bar
......
...@@ -21,26 +21,28 @@ import QGroundControl.Palette 1.0 ...@@ -21,26 +21,28 @@ import QGroundControl.Palette 1.0
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
//-- Message Indicator //-- Message Indicator
Item { Item {
id: _root
width: height width: height
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
property bool showIndicator: true property bool showIndicator: true
property bool _isMessageImportant: activeVehicle ? !activeVehicle.messageTypeNormal && !activeVehicle.messageTypeNone : false property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _isMessageImportant: _activeVehicle ? !_activeVehicle.messageTypeNormal && !_activeVehicle.messageTypeNone : false
function getMessageColor() { function getMessageColor() {
if (activeVehicle) { if (_activeVehicle) {
if (activeVehicle.messageTypeNone) if (_activeVehicle.messageTypeNone)
return qgcPal.colorGrey return qgcPal.colorGrey
if (activeVehicle.messageTypeNormal) if (_activeVehicle.messageTypeNormal)
return qgcPal.colorBlue; return qgcPal.colorBlue;
if (activeVehicle.messageTypeWarning) if (_activeVehicle.messageTypeWarning)
return qgcPal.colorOrange; return qgcPal.colorOrange;
if (activeVehicle.messageTypeError) if (_activeVehicle.messageTypeError)
return qgcPal.colorRed; return qgcPal.colorRed;
// Cannot be so make make it obnoxious to show error // Cannot be so make make it obnoxious to show error
console.log("Invalid vehicle message type") console.warn("MessageIndicator.qml:getMessageColor Invalid vehicle message type", _activeVehicle.messageTypeNone)
return "purple"; return "purple";
} }
//-- It can only get here when closing (vehicle gone while window active) //-- It can only get here when closing (vehicle gone while window active)
...@@ -54,7 +56,7 @@ Item { ...@@ -54,7 +56,7 @@ Item {
sourceSize.height: height sourceSize.height: height
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
cache: false cache: false
visible: activeVehicle && activeVehicle.messageCount > 0 && _isMessageImportant visible: _activeVehicle && _activeVehicle.messageCount > 0 && _isMessageImportant
} }
QGCColoredImage { QGCColoredImage {
...@@ -68,6 +70,89 @@ Item { ...@@ -68,6 +70,89 @@ Item {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: mainWindow.showVehicleMessages() onClicked: mainWindow.showIndicatorPopup(_root, vehicleMessagesPopup)
}
Component {
id: vehicleMessagesPopup
Rectangle {
width: mainWindow.width * 0.666
height: mainWindow.height * 0.666
radius: ScreenTools.defaultFontPixelHeight / 2
color: qgcPal.window
border.color: qgcPal.text
function formatMessage(message) {
message = message.replace(new RegExp("<#E>", "g"), "color: " + qgcPal.warningText + "; font: " + (ScreenTools.defaultFontPointSize.toFixed(0) - 1) + "pt monospace;");
message = message.replace(new RegExp("<#I>", "g"), "color: " + qgcPal.warningText + "; font: " + (ScreenTools.defaultFontPointSize.toFixed(0) - 1) + "pt monospace;");
message = message.replace(new RegExp("<#N>", "g"), "color: " + qgcPal.text + "; font: " + (ScreenTools.defaultFontPointSize.toFixed(0) - 1) + "pt monospace;");
return message;
}
Component.onCompleted: {
messageText.text = formatMessage(_activeVehicle.formattedMessages)
//-- Hack to scroll to last message
for (var i = 0; i < _activeVehicle.messageCount; i++)
messageFlick.flick(0,-5000)
_activeVehicle.resetMessages()
}
Connections {
target: _activeVehicle
onNewFormattedMessage :{
messageText.append(formatMessage(formattedMessage))
//-- Hack to scroll down
messageFlick.flick(0,-500)
}
}
QGCLabel {
anchors.centerIn: parent
text: qsTr("No Messages")
visible: messageText.length === 0
}
//-- Clear Messages
QGCColoredImage {
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.margins: ScreenTools.defaultFontPixelHeight * 0.5
height: ScreenTools.isMobile ? ScreenTools.defaultFontPixelHeight * 1.5 : ScreenTools.defaultFontPixelHeight
width: height
sourceSize.height: height
source: "/res/TrashDelete.svg"
fillMode: Image.PreserveAspectFit
mipmap: true
smooth: true
color: qgcPal.text
visible: messageText.length !== 0
MouseArea {
anchors.fill: parent
onClicked: {
if (_activeVehicle) {
_activeVehicle.clearMessages()
mainWindow.hideIndicatorPopup()
}
}
}
}
QGCFlickable {
id: messageFlick
anchors.margins: ScreenTools.defaultFontPixelHeight
anchors.fill: parent
contentHeight: messageText.height
contentWidth: messageText.width
pixelAligned: true
TextEdit {
id: messageText
readOnly: true
textFormat: TextEdit.RichText
color: qgcPal.text
}
}
}
} }
} }
...@@ -27,7 +27,7 @@ Item { ...@@ -27,7 +27,7 @@ Item {
property bool showIndicator: _activeVehicle.supportsRadio property bool showIndicator: _activeVehicle.supportsRadio
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _rcRSSIAvailable: activeVehicle ? activeVehicle.rcRSSI > 0 && activeVehicle.rcRSSI <= 100 : false property bool _rcRSSIAvailable: _activeVehicle ? _activeVehicle.rcRSSI > 0 && _activeVehicle.rcRSSI <= 100 : false
Component { Component {
id: rcRSSIInfo id: rcRSSIInfo
...@@ -48,7 +48,7 @@ Item { ...@@ -48,7 +48,7 @@ Item {
QGCLabel { QGCLabel {
id: rssiLabel id: rssiLabel
text: activeVehicle ? (activeVehicle.rcRSSI !== 255 ? qsTr("RC RSSI Status") : qsTr("RC RSSI Data Unavailable")) : qsTr("N/A", "No data available") text: _activeVehicle ? (_activeVehicle.rcRSSI !== 255 ? qsTr("RC RSSI Status") : qsTr("RC RSSI Data Unavailable")) : qsTr("N/A", "No data available")
font.family: ScreenTools.demiboldFontFamily font.family: ScreenTools.demiboldFontFamily
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
...@@ -62,7 +62,7 @@ Item { ...@@ -62,7 +62,7 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
QGCLabel { text: qsTr("RSSI:") } QGCLabel { text: qsTr("RSSI:") }
QGCLabel { text: activeVehicle ? (activeVehicle.rcRSSI + "%") : 0 } QGCLabel { text: _activeVehicle ? (_activeVehicle.rcRSSI + "%") : 0 }
} }
} }
} }
...@@ -88,7 +88,7 @@ Item { ...@@ -88,7 +88,7 @@ Item {
SignalStrength { SignalStrength {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
size: parent.height * 0.5 size: parent.height * 0.5
percent: _rcRSSIAvailable ? activeVehicle.rcRSSI : 0 percent: _rcRSSIAvailable ? _activeVehicle.rcRSSI : 0
} }
} }
......
...@@ -28,7 +28,9 @@ Item { ...@@ -28,7 +28,9 @@ Item {
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
property bool showIndicator: activeVehicle && activeVehicle.roiModeSupported property bool showIndicator: _activeVehicle && _activeVehicle.roiModeSupported
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
Component { Component {
id: roiInfo id: roiInfo
...@@ -56,11 +58,11 @@ Item { ...@@ -56,11 +58,11 @@ Item {
QGCButton { QGCButton {
id: roiButton id: roiButton
visible: activeVehicle && activeVehicle.isROIEnabled visible: _activeVehicle && _activeVehicle.isROIEnabled
text: qsTr("Disable ROI") text: qsTr("Disable ROI")
onClicked: { onClicked: {
if(activeVehicle) if(_activeVehicle)
activeVehicle.stopGuidedModeROI() _activeVehicle.stopGuidedModeROI()
mainWindow.hideIndicatorPopup() mainWindow.hideIndicatorPopup()
} }
} }
...@@ -75,9 +77,9 @@ Item { ...@@ -75,9 +77,9 @@ Item {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
sourceSize.height: height sourceSize.height: height
source: "/qmlimages/roi.svg" source: "/qmlimages/roi.svg"
color: activeVehicle && activeVehicle.isROIEnabled ? qgcPal.colorGreen : qgcPal.text color: _activeVehicle && _activeVehicle.isROIEnabled ? qgcPal.colorGreen : qgcPal.text
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
opacity: activeVehicle && activeVehicle.isROIEnabled ? 1 : 0.5 opacity: _activeVehicle && _activeVehicle.isROIEnabled ? 1 : 0.5
} }
MouseArea { MouseArea {
......
...@@ -56,19 +56,19 @@ Item { ...@@ -56,19 +56,19 @@ Item {
columns: 2 columns: 2
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
QGCLabel { text: qsTr("Local RSSI:") } QGCLabel { text: qsTr("Local RSSI:") }
QGCLabel { text: activeVehicle.telemetryLRSSI + " dBm"} QGCLabel { text: _activeVehicle.telemetryLRSSI + " dBm"}
QGCLabel { text: qsTr("Remote RSSI:") } QGCLabel { text: qsTr("Remote RSSI:") }
QGCLabel { text: activeVehicle.telemetryRRSSI + " dBm"} QGCLabel { text: _activeVehicle.telemetryRRSSI + " dBm"}
QGCLabel { text: qsTr("RX Errors:") } QGCLabel { text: qsTr("RX Errors:") }
QGCLabel { text: activeVehicle.telemetryRXErrors } QGCLabel { text: _activeVehicle.telemetryRXErrors }
QGCLabel { text: qsTr("Errors Fixed:") } QGCLabel { text: qsTr("Errors Fixed:") }
QGCLabel { text: activeVehicle.telemetryFixed } QGCLabel { text: _activeVehicle.telemetryFixed }
QGCLabel { text: qsTr("TX Buffer:") } QGCLabel { text: qsTr("TX Buffer:") }
QGCLabel { text: activeVehicle.telemetryTXBuffer } QGCLabel { text: _activeVehicle.telemetryTXBuffer }
QGCLabel { text: qsTr("Local Noise:") } QGCLabel { text: qsTr("Local Noise:") }
QGCLabel { text: activeVehicle.telemetryLNoise } QGCLabel { text: _activeVehicle.telemetryLNoise }
QGCLabel { text: qsTr("Remote Noise:") } QGCLabel { text: qsTr("Remote Noise:") }
QGCLabel { text: activeVehicle.telemetryRNoise } QGCLabel { text: _activeVehicle.telemetryRNoise }
} }
} }
} }
......
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