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 {
VehicleSummaryRow {
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 {
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 _mountRetractY: controller.getParameterFact(-1, "MNT_RETRACT_Y")
......
......@@ -35,7 +35,7 @@ SetupPage {
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
property Fact _failsafeBatteryEnable: controller.getParameterFact(-1, "r.BATT_FS_LOW_ACT")
......
......@@ -10,7 +10,7 @@ import QGroundControl.Palette 1.0
Item {
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; }
......
......@@ -178,7 +178,7 @@ SetupPage {
Component.onCompleted: {
var usingUDP = controller.usingUDPLink()
var isSub = QGroundControl.multiVehicleManager.activeVehicle.sub;
var isSub = globals.activeVehicle.sub;
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."))
}
......@@ -562,9 +562,9 @@ SetupPage {
wrapMode: Text.WordWrap
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 _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
} // Component - calibratePressureDialogComponent
......@@ -644,7 +644,7 @@ SetupPage {
QGCButton {
width: _buttonWidth
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)
}
......@@ -653,13 +653,13 @@ SetupPage {
text: _calibratePressureText
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 {
width: _buttonWidth
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)
}
......
......@@ -24,7 +24,7 @@ SetupPage {
id: subFramePage
pageComponent: subFramePageComponent
property bool _oldFW: activeVehicle.versionCompare(3 ,5 ,2) < 0
property bool _oldFW: globals.activeVehicle.versionCompare(3 ,5 ,2) < 0
APMAirframeComponentController { id: controller; }
......
......@@ -47,12 +47,12 @@ Item {
VehicleSummaryRow {
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 {
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 {
anchors.right: parent.right
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
......@@ -224,7 +224,7 @@ SetupPage {
anchors.right: parent.right
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
} // Column
......
......@@ -160,7 +160,7 @@ SetupPage {
// Center point
Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
width: defaultTextWidth / 2
width: globals.defaultTextWidth / 2
height: parent.height
color: qgcPal.window
}
......@@ -210,10 +210,10 @@ SetupPage {
Item {
width: parent.width
height: defaultTextHeight * 2
height: globals.defaultTextHeight * 2
QGCLabel {
id: rollLabel
width: defaultTextWidth * 10
width: globals.defaultTextWidth * 10
text: qsTr("Roll")
}
......@@ -221,11 +221,10 @@ SetupPage {
id: rollLoader
anchors.left: rollLabel.right
anchors.right: parent.right
height: defaultTextHeight
height: globals.defaultTextHeight
width: 100
sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: defaultTextWidth
property bool mapped: controller.rollChannelMapped
property bool reversed: controller.rollChannelReversed
}
......@@ -239,11 +238,11 @@ SetupPage {
Item {
width: parent.width
height: defaultTextHeight * 2
height: globals.defaultTextHeight * 2
QGCLabel {
id: pitchLabel
width: defaultTextWidth * 10
width: globals.defaultTextWidth * 10
text: qsTr("Pitch")
}
......@@ -251,11 +250,10 @@ SetupPage {
id: pitchLoader
anchors.left: pitchLabel.right
anchors.right: parent.right
height: defaultTextHeight
height: globals.defaultTextHeight
width: 100
sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: defaultTextWidth
property bool mapped: controller.pitchChannelMapped
property bool reversed: controller.pitchChannelReversed
}
......@@ -269,11 +267,11 @@ SetupPage {
Item {
width: parent.width
height: defaultTextHeight * 2
height: globals.defaultTextHeight * 2
QGCLabel {
id: yawLabel
width: defaultTextWidth * 10
width: globals.defaultTextWidth * 10
text: qsTr("Yaw")
}
......@@ -281,11 +279,10 @@ SetupPage {
id: yawLoader
anchors.left: yawLabel.right
anchors.right: parent.right
height: defaultTextHeight
height: globals.defaultTextHeight
width: 100
sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: defaultTextWidth
property bool mapped: controller.yawChannelMapped
property bool reversed: controller.yawChannelReversed
}
......@@ -299,11 +296,11 @@ SetupPage {
Item {
width: parent.width
height: defaultTextHeight * 2
height: globals.defaultTextHeight * 2
QGCLabel {
id: throttleLabel
width: defaultTextWidth * 10
width: globals.defaultTextWidth * 10
text: qsTr("Throttle")
}
......@@ -311,11 +308,10 @@ SetupPage {
id: throttleLoader
anchors.left: throttleLabel.right
anchors.right: parent.right
height: defaultTextHeight
height: globals.defaultTextHeight
width: 100
sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: defaultTextWidth
property bool mapped: controller.throttleChannelMapped
property bool reversed: controller.throttleChannelReversed
}
......
......@@ -33,9 +33,9 @@ Item {
property bool showAdvanced: false
property alias advanced: advancedCheckBox.checked
property bool _vehicleIsRover: activeVehicle ? activeVehicle.rover : false
property bool _vehicleArmed: activeVehicle ? activeVehicle.armed : false
property bool _vehicleFlying: activeVehicle ? activeVehicle.flying : false
property bool _vehicleIsRover: globals.activeVehicle ? globals.activeVehicle.rover : false
property bool _vehicleArmed: globals.activeVehicle ? globals.activeVehicle.armed : false
property bool _vehicleFlying: globals.activeVehicle ? globals.activeVehicle.flying : 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
property bool _disableDueToFlying: vehicleComponent ? (!_vehicleIsRover && !vehicleComponent.allowSetupWhileFlying && _vehicleFlying) : false
......
......@@ -34,12 +34,12 @@ Item {
VehicleSummaryRow {
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 {
visible: activeVehicle.firmwareCustomMajorVersion !== -1
visible: globals.activeVehicle.firmwareCustomMajorVersion !== -1
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 {
property double _ar: QGroundControl.videoManager.aspectRatio
property bool _showGrid: QGroundControl.settingsManager.videoSettings.gridLines.rawValue > 0
property var _dynamicCameras: activeVehicle ? activeVehicle.cameraManager : null
property bool _connected: activeVehicle ? !activeVehicle.connectionLost : false
property var _dynamicCameras: globals.activeVehicle ? globals.activeVehicle.cameraManager : null
property bool _connected: globals.activeVehicle ? !globals.activeVehicle.connectionLost : false
property int _curCameraIndex: _dynamicCameras ? _dynamicCameras.currentCamera : 0
property bool _isCamera: _dynamicCameras ? _dynamicCameras.cameras.count > 0 : false
property var _camera: _isCamera ? _dynamicCameras.cameras.get(_curCameraIndex) : null
......
......@@ -43,10 +43,11 @@ FlightMap {
property bool pipMode: false // true: map is shown in a small pip mode
property var toolInsets // Insets for the center viewport area
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property var _planMasterController: planMasterController
property var _geoFenceController: planMasterController.geoFenceController
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 bool _airspaceEnabled: QGroundControl.airmapSupported ? (QGroundControl.settingsManager.airMapSettings.enableAirMap.rawValue && QGroundControl.airspaceManager.connected): false
property var _flyViewSettings: QGroundControl.settingsManager.flyViewSettings
......@@ -231,11 +232,11 @@ FlightMap {
Connections {
target: QGroundControl.multiVehicleManager
onActiveVehicleChanged: trajectoryPolyline.path = activeVehicle ? activeVehicle.trajectoryPoints.list() : []
onActiveVehicleChanged: trajectoryPolyline.path = _activeVehicle ? _activeVehicle.trajectoryPoints.list() : []
}
Connections {
target: activeVehicle ? activeVehicle.trajectoryPoints : null
target: _activeVehicle ? _activeVehicle.trajectoryPoints : null
onPointAdded: trajectoryPolyline.addCoordinate(coordinate)
onUpdateLastPoint: trajectoryPolyline.replaceCoordinate(trajectoryPolyline.pathLength() - 1, coordinate)
onPointsCleared: trajectoryPolyline.path = []
......@@ -318,7 +319,7 @@ FlightMap {
myGeoFenceController: _geoFenceController
interactive: 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
......@@ -341,7 +342,7 @@ FlightMap {
// Camera trigger points
MapItemView {
model: activeVehicle ? activeVehicle.cameraTriggerPoints : 0
model: _activeVehicle ? _activeVehicle.cameraTriggerPoints : 0
delegate: CameraTriggerIndicator {
coordinate: object.coordinate
......@@ -362,7 +363,7 @@ FlightMap {
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: {
if (!inGotoFlightMode && gotoLocationItem.visible) {
......@@ -372,7 +373,7 @@ FlightMap {
}
Connections {
target: mainWindow
target: QGroundControl.multiVehicleManager
onActiveVehicleChanged: {
if (!activeVehicle) {
gotoLocationItem.visible = false
......@@ -410,7 +411,7 @@ FlightMap {
readonly property real defaultRadius: 30
Connections {
target: mainWindow
target: QGroundControl.multiVehicleManager
onActiveVehicleChanged: {
if (!activeVehicle) {
orbitMapCircle.visible = false
......@@ -441,7 +442,7 @@ FlightMap {
return _mapCircle.radius.rawValue
}
Component.onCompleted: mainWindow.guidedControllerFlyView.orbitMapCircle = orbitMapCircle
Component.onCompleted: globals.guidedControllerFlyView.orbitMapCircle = orbitMapCircle
QGCMapCircle {
id: _mapCircle
......@@ -455,7 +456,7 @@ FlightMap {
// ROI Location visuals
MapQuickItem {
id: roiLocationItem
visible: activeVehicle && activeVehicle.isROIEnabled
visible: _activeVehicle && _activeVehicle.isROIEnabled
z: QGroundControl.zOrderMapItems
anchorPoint.x: sourceItem.anchorPointX
anchorPoint.y: sourceItem.anchorPointY
......@@ -484,15 +485,15 @@ FlightMap {
QGCMapCircleVisuals {
id: orbitTelemetryCircle
mapControl: parent
mapCircle: activeVehicle ? activeVehicle.orbitMapCircle : null
visible: activeVehicle ? activeVehicle.orbitActive : false
mapCircle: _activeVehicle ? _activeVehicle.orbitMapCircle : null
visible: _activeVehicle ? _activeVehicle.orbitActive : false
}
MapQuickItem {
id: orbitCenterIndicator
anchorPoint.x: sourceItem.anchorPointX
anchorPoint.y: sourceItem.anchorPointY
coordinate: activeVehicle ? activeVehicle.orbitMapCircle.center : QtPositioning.coordinate()
coordinate: _activeVehicle ? _activeVehicle.orbitMapCircle.center : QtPositioning.coordinate()
visible: orbitTelemetryCircle.visible
sourceItem: MissionItemIndexLabel {
......@@ -511,35 +512,35 @@ FlightMap {
property var coord
QGCMenuItem {
text: qsTr("Go to location")
visible: mainWindow.guidedControllerFlyView.showGotoLocation
visible: globals.guidedControllerFlyView.showGotoLocation
onTriggered: {
gotoLocationItem.show(clickMenu.coord)
mainWindow.guidedControllerFlyView.confirmAction(mainWindow.guidedControllerFlyView.actionGoto, clickMenu.coord, gotoLocationItem)
globals.guidedControllerFlyView.confirmAction(globals.guidedControllerFlyView.actionGoto, clickMenu.coord, gotoLocationItem)
}
}
QGCMenuItem {
text: qsTr("Orbit at location")
visible: mainWindow.guidedControllerFlyView.showOrbit
visible: globals.guidedControllerFlyView.showOrbit
onTriggered: {
orbitMapCircle.show(clickMenu.coord)
mainWindow.guidedControllerFlyView.confirmAction(mainWindow.guidedControllerFlyView.actionOrbit, clickMenu.coord, orbitMapCircle)
globals.guidedControllerFlyView.confirmAction(globals.guidedControllerFlyView.actionOrbit, clickMenu.coord, orbitMapCircle)
}
}
QGCMenuItem {
text: qsTr("ROI at location")
visible: mainWindow.guidedControllerFlyView.showROI
visible: globals.guidedControllerFlyView.showROI
onTriggered: {
roiLocationItem.show(clickMenu.coord)
mainWindow.guidedControllerFlyView.confirmAction(mainWindow.guidedControllerFlyView.actionROI, clickMenu.coord, roiLocationItem)
globals.guidedControllerFlyView.confirmAction(globals.guidedControllerFlyView.actionROI, clickMenu.coord, roiLocationItem)
}
}
}
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()
gotoLocationItem.hide()
var clickCoord = _root.toCoordinate(Qt.point(mouse.x, mouse.y), false /* clipToViewPort */)
......
......@@ -108,15 +108,15 @@ Item {
ColumnLayout {
Layout.fillWidth: true
spacing: ScreenTools.defaultFontPixelHeight
visible: !_activeVehicle.connectionLost && mainWindow.guidedControllerFlyView.showResumeMission
visible: !_activeVehicle.connectionLost && globals.guidedControllerFlyView.showResumeMission
QGCButton {
Layout.fillWidth: true
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: {
mainWindow.guidedControllerFlyView.executeAction(mainWindow.guidedControllerFlyView.actionResumeMission, null, null)
globals.guidedControllerFlyView.executeAction(globals.guidedControllerFlyView.actionResumeMission, null, null)
hideDialog()
}
}
......@@ -133,7 +133,7 @@ Item {
wrapMode: Text.WordWrap
color: qgcPal.warningText
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 {
property var mapControl
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property var _planMasterController: mainWindow.planMasterControllerFlyView
property var _planMasterController: globals.planMasterControllerFlyView
property var _missionController: _planMasterController.missionController
property var _geoFenceController: _planMasterController.geoFenceController
property var _rallyPointController: _planMasterController.rallyPointController
property var _guidedController: mainWindow.guidedControllerFlyView
property var _guidedController: globals.guidedControllerFlyView
property real _margins: ScreenTools.defaultFontPixelWidth / 2
property real _toolsMargin: ScreenTools.defaultFontPixelWidth * 0.75
property rect _centerViewport: Qt.rect(0, 0, width, height)
......@@ -156,12 +156,12 @@ Item {
z: QGroundControl.zOrderTopMost + 1
width: parent.width - (_pipOverlay.width / 2)
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.bottomMargin: parentToolInsets.leftEdgeBottomInset + ScreenTools.defaultFontPixelHeight * 2
anchors.horizontalCenter: parent.horizontalCenter
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
......
......@@ -21,12 +21,13 @@ Rectangle {
readonly property real _maxAlt: 121.92 // 400 feet
readonly property real _minAlt: 3
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property var _flyViewSettings: QGroundControl.settingsManager.flyViewSettings
property real _vehicleAltitude: activeVehicle ? activeVehicle.altitudeRelative.rawValue : 0
property bool _fixedWing: activeVehicle ? activeVehicle.fixedWing : false
property real _vehicleAltitude: _activeVehicle ? _activeVehicle.altitudeRelative.rawValue : 0
property bool _fixedWing: _activeVehicle ? _activeVehicle.fixedWing : false
property real _sliderMaxAlt: _flyViewSettings ? _flyViewSettings.guidedMaximumAltitude.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() {
altSlider.value = 0
......@@ -77,7 +78,7 @@ Rectangle {
property string newAltitudeAppUnits: QGroundControl.unitsConversion.metersToAppSettingsHorizontalDistanceUnits(newAltitudeMeters).toFixed(1)
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 {
property int actionID
property string message
property var _guidedController: mainWindow.guidedControllerFlyView
property var _guidedController: globals.guidedControllerFlyView
onTriggered: {
_guidedController.closeAll()
......
......@@ -23,7 +23,7 @@ Item {
property real _widgetHeight: ScreenTools.defaultFontPixelHeight * 3
property color _textColor: "black"
property real _rectOpacity: 0.8
property var _guidedController: mainWindow.guidedControllerFlyView
property var _guidedController: globals.guidedControllerFlyView
QGCPalette { id: qgcPal }
......
......@@ -25,7 +25,7 @@ PreFlightCheckButton {
property int failurePercent: 40
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 bool _batLow: _batPercentRemaining < failurePercent
}
......@@ -19,7 +19,7 @@ import QGroundControl.Vehicle 1.0
Rectangle {
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
radius: 3
......@@ -31,7 +31,7 @@ Rectangle {
}
property bool allChecksPassed: false
property var vehicleCopy: activeVehicle
property var vehicleCopy: globals.activeVehicle
onVehicleCopyChanged: {
checkListRepeater.model.reset()
......@@ -39,9 +39,9 @@ Rectangle {
onAllChecksPassedChanged: {
if (allChecksPassed) {
activeVehicle.checkListState = Vehicle.CheckListPassed
globals.activeVehicle.checkListState = Vehicle.CheckListPassed
} else {
activeVehicle.checkListState = Vehicle.CheckListFailed
globals.activeVehicle.checkListState = Vehicle.CheckListFailed
}
}
......@@ -71,7 +71,7 @@ Rectangle {
//-- Pick a checklist model that matches the current airframe type (if any)
function _updateModel() {
var vehicle = activeVehicle
var vehicle = globals.activeVehicle
if (!vehicle) {
vehicle = QGroundControl.multiVehicleManager.offlineEditingVehicle
}
......@@ -97,7 +97,7 @@ Rectangle {
}
onVisibleChanged: {
if(activeVehicle) {
if(globals.activeVehicle) {
if(visible) {
_updateModel()
}
......
......@@ -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 int failureSatCount: -1 ///< -1 indicates no sat count check
property bool _3dLock: activeVehicle ? activeVehicle.gps.lock.rawValue >= 3 : false
property int _satCount: activeVehicle ? activeVehicle.gps.count.rawValue : 0
property bool _3dLock: globals.activeVehicle ? globals.activeVehicle.gps.lock.rawValue >= 3 : false
property int _satCount: globals.activeVehicle ? globals.activeVehicle.gps.count.rawValue : 0
property bool _3dLockFailure: !_3dLock
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)
......
......@@ -19,5 +19,5 @@ PreFlightCheckButton {
telemetryTextFailure: qsTr("No signal or invalid autopilot-RC config. Check RC and console.")
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 {
name: qsTr("Sensors")
telemetryFailure: _unhealthySensors & _allCheckedSensors
property int _unhealthySensors: activeVehicle ? activeVehicle.sensorsUnhealthyBits : 1
property int _unhealthySensors: globals.activeVehicle ? globals.activeVehicle.sensorsUnhealthyBits : 1
property int _allCheckedSensors: Vehicle.SysStatusSensor3dMag |
Vehicle.SysStatusSensor3dAccel |
Vehicle.SysStatusSensor3dGyro |
......
......@@ -27,8 +27,8 @@ Item {
running: QGroundControl.settingsManager.appSettings.virtualJoystick.value && activeVehicle
repeat: true
onTriggered: {
if (activeVehicle) {
activeVehicle.virtualTabletJoystickValue(rightStick.xAxis, rightStick.yAxis, leftStick.xAxis, leftStick.yAxis)
if (_activeVehicle) {
_activeVehicle.virtualTabletJoystickValue(rightStick.xAxis, rightStick.yAxis, leftStick.xAxis, leftStick.yAxis)
}
}
}
......
......@@ -45,7 +45,8 @@ Map {
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) {
// TODO: Is this still necessary with Qt 5.11?
......@@ -57,9 +58,9 @@ Map {
}