Commit 355b8064 authored by Gus Grubba's avatar Gus Grubba

Remove overly redundant activeVehicle redefinitions.

Fixed flight widget position.
parent e95c0951
......@@ -35,8 +35,7 @@ SetupPage {
QGCPalette { id: palette; colorGroupEnabled: true }
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _oldFW: !(_activeVehicle.firmwareMajorVersion > 3 || _activeVehicle.firmwareMinorVersion > 5 || _activeVehicle.firmwarePatchVersion >= 2)
property bool _oldFW: !(activeVehicle.firmwareMajorVersion > 3 || activeVehicle.firmwareMinorVersion > 5 || activeVehicle.firmwarePatchVersion >= 2)
property Fact _mountRetractX: controller.getParameterFact(-1, "MNT_RETRACT_X")
property Fact _mountRetractY: controller.getParameterFact(-1, "MNT_RETRACT_Y")
......
......@@ -33,8 +33,7 @@ SetupPage {
QGCPalette { id: palette; colorGroupEnabled: true }
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _oldFW: _activeVehicle.versionCompare(3, 5, 2) < 0
property bool _oldFW: activeVehicle.versionCompare(3, 5, 2) < 0
property Fact _rc5Function: controller.getParameterFact(-1, "r.SERVO5_FUNCTION")
property Fact _rc6Function: controller.getParameterFact(-1, "r.SERVO6_FUNCTION")
property Fact _rc7Function: controller.getParameterFact(-1, "r.SERVO7_FUNCTION")
......
......@@ -35,8 +35,7 @@ SetupPage {
QGCPalette { id: ggcPal; colorGroupEnabled: true }
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _firmware34: _activeVehicle.versionCompare(3, 5, 0) < 0
property bool _firmware34: activeVehicle.versionCompare(3, 5, 0) < 0
// Enable/Action parameters
property Fact _failsafeBatteryEnable: controller.getParameterFact(-1, "r.BATT_FS_LOW_ACT")
......
......@@ -77,7 +77,6 @@ SetupPage {
property bool _orientationsDialogShowCompass: true
property string _orientationDialogHelp: orientationHelpSet
property int _orientationDialogCalType
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property real _margins: ScreenTools.defaultFontPixelHeight / 2
property bool _compassAutoRotAvailable: controller.parameterExists(-1, "COMPASS_AUTO_ROT")
property Fact _compassAutoRotFact: controller.getParameterFact(-1, "COMPASS_AUTO_ROT", false /* reportMissing */)
......@@ -518,9 +517,9 @@ SetupPage {
wrapMode: Text.WordWrap
text: _helpText
readonly property string _altText: _activeVehicle.sub ? qsTr("depth") : qsTr("altitude")
readonly property string _altText: 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: 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
......@@ -582,13 +581,13 @@ SetupPage {
text: _calibratePressureText
onClicked: mainWindow.showDialog(calibratePressureDialogComponent, _calibratePressureText, mainWindow.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok)
readonly property string _calibratePressureText: _activeVehicle.fixedWing ? qsTr("Cal Baro/Airspeed") : qsTr("Calibrate Pressure")
readonly property string _calibratePressureText: activeVehicle.fixedWing ? qsTr("Cal Baro/Airspeed") : qsTr("Calibrate Pressure")
}
QGCButton {
width: _buttonWidth
text: qsTr("CompassMot")
visible: _activeVehicle ? _activeVehicle.supportsMotorInterference : false
visible: activeVehicle ? activeVehicle.supportsMotorInterference : false
onClicked: mainWindow.showDialog(compassMotDialogComponent, qsTr("CompassMot - Compass Motor Interference Calibration"), mainWindow.showDialogFullWidth, StandardButton.Cancel | StandardButton.Ok)
}
......
......@@ -24,8 +24,7 @@ SetupPage {
id: subFramePage
pageComponent: subFramePageComponent
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _oldFW: _activeVehicle.versionCompare(3 ,5 ,2) < 0
property bool _oldFW: activeVehicle.versionCompare(3 ,5 ,2) < 0
APMAirframeComponentController { id: controller; }
......
......@@ -33,10 +33,9 @@ Item {
property bool showAdvanced: false
property alias advanced: advancedCheckBox.checked
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _vehicleIsRover: _activeVehicle ? _activeVehicle.rover : false
property bool _vehicleArmed: _activeVehicle ? _activeVehicle.armed : false
property bool _vehicleFlying: _activeVehicle ? _activeVehicle.flying : false
property bool _vehicleIsRover: activeVehicle ? activeVehicle.rover : false
property bool _vehicleArmed: activeVehicle ? activeVehicle.armed : false
property bool _vehicleFlying: activeVehicle ? 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
......
This diff is collapsed.
......@@ -46,7 +46,7 @@ FlightMap {
property var _geoFenceController: planMasterController.geoFenceController
property var _rallyPointController: planMasterController.rallyPointController
property var _activeVehicleCoordinate: activeVehicle ? activeVehicle.coordinate : QtPositioning.coordinate()
property real _toolButtonTopMargin: parent.height - ScreenTools.availableHeight + (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 _disableVehicleTracking: false
......
......@@ -38,7 +38,6 @@ Item {
readonly property real _margins: ScreenTools.defaultFontPixelHeight * 0.5
QGCMapPalette { id: mapPal; lightColors: useLightColors }
QGCPalette { id: qgcPal }
function getPreferredInstrumentWidth() {
// Don't allow instrument panel to chew more than 1/4 of full window
......@@ -180,8 +179,8 @@ Item {
target: instrumentsLoader
anchors.verticalCenter: undefined
anchors.bottom: undefined
anchors.top: _root ? _root.top : undefined
anchors.right: _root ? _root.right : undefined
anchors.top: widgetRoot ? widgetRoot.top : undefined
anchors.right: widgetRoot ? widgetRoot.right : undefined
anchors.left: undefined
}
},
......@@ -191,8 +190,8 @@ Item {
target: instrumentsLoader
anchors.top: undefined
anchors.bottom: undefined
anchors.verticalCenter: _root ? _root.verticalCenter : undefined
anchors.right: _root ? _root.right : undefined
anchors.verticalCenter: widgetRoot ? widgetRoot.verticalCenter : undefined
anchors.right: widgetRoot ? widgetRoot.right : undefined
anchors.left: undefined
}
},
......@@ -202,8 +201,8 @@ Item {
target: instrumentsLoader
anchors.top: undefined
anchors.verticalCenter: undefined
anchors.bottom: _root ? _root.bottom : undefined
anchors.right: _root ? _root.right : undefined
anchors.bottom: widgetRoot ? widgetRoot.bottom : undefined
anchors.right: widgetRoot ? widgetRoot.right : undefined
anchors.left: undefined
}
},
......@@ -213,9 +212,9 @@ Item {
target: instrumentsLoader
anchors.verticalCenter: undefined
anchors.bottom: undefined
anchors.top: _root ? _root.top : undefined
anchors.top: widgetRoot ? widgetRoot.top : undefined
anchors.right: undefined
anchors.left: _root ? _root.left : undefined
anchors.left: widgetRoot ? widgetRoot.left : undefined
}
},
State {
......@@ -224,9 +223,9 @@ Item {
target: instrumentsLoader
anchors.top: undefined
anchors.bottom: undefined
anchors.verticalCenter: _root ? _root.verticalCenter : undefined
anchors.verticalCenter: widgetRoot ? widgetRoot.verticalCenter : undefined
anchors.right: undefined
anchors.left: _root ? _root.left : undefined
anchors.left: widgetRoot ? widgetRoot.left : undefined
}
},
State {
......@@ -235,9 +234,9 @@ Item {
target: instrumentsLoader
anchors.top: undefined
anchors.verticalCenter: undefined
anchors.bottom: _root ? _root.bottom : undefined
anchors.bottom: widgetRoot ? widgetRoot.bottom : undefined
anchors.right: undefined
anchors.left: _root ? _root.left : undefined
anchors.left: widgetRoot ? widgetRoot.left : undefined
}
}
]
......
......@@ -25,8 +25,6 @@ PreFlightCheckButton {
property int failurePercent: 40
property bool allowFailurePercentOverride: false
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property var _batPercentRemaining: _activeVehicle ? _activeVehicle.battery.percentRemaining.value : 0
property bool _batLow: _batPercentRemaining < failurePercent
property var _batPercentRemaining: activeVehicle ? activeVehicle.battery.percentRemaining.value : 0
property bool _batLow: _batPercentRemaining < failurePercent
}
......@@ -24,9 +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 var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _3dLock: _activeVehicle ? _activeVehicle.gps.lock.rawValue >= 3 : false
property int _satCount: _activeVehicle ? _activeVehicle.gps.count.rawValue : 0
property bool _3dLock: activeVehicle ? activeVehicle.gps.lock.rawValue >= 3 : false
property int _satCount: activeVehicle ? 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,6 +19,5 @@ PreFlightCheckButton {
telemetryTextFailure: qsTr("No signal or invalid autopilot-RC config. Check RC and console.")
telemetryFailure: _unhealthySensors & Vehicle.SysStatusSensorRCReceiver
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property int _unhealthySensors: _activeVehicle ? _activeVehicle.sensorsUnhealthyBits : 0
property int _unhealthySensors: activeVehicle ? activeVehicle.sensorsUnhealthyBits : 0
}
......@@ -17,8 +17,7 @@ PreFlightCheckButton {
name: qsTr("Sensors")
telemetryFailure: _unhealthySensors & _allCheckedSensors
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property int _unhealthySensors: _activeVehicle ? _activeVehicle.sensorsUnhealthyBits : 0
property int _unhealthySensors: activeVehicle ? activeVehicle.sensorsUnhealthyBits : 0
property int _allCheckedSensors: Vehicle.SysStatusSensor3dMag |
Vehicle.SysStatusSensor3dAccel |
Vehicle.SysStatusSensor3dGyro |
......
......@@ -17,15 +17,15 @@ import QGroundControl.Palette 1.0
import QGroundControl.Vehicle 1.0
Item {
//property bool useLightColors - Must be passed in from loaded
//property bool useLightColors - Must be passed in from loader
Timer {
interval: 40 // 25Hz, same as real joystick rate
running: QGroundControl.settingsManager.appSettings.virtualJoystick.value && _activeVehicle
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)
}
}
}
......
......@@ -169,7 +169,7 @@ Item {
QGCMapLabel {
id: polygonHelp
anchors.topMargin: parent.height - ScreenTools.availableHeight
anchors.topMargin: parent.height - mainWindow.height
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
......
......@@ -35,8 +35,6 @@ DropButton {
property bool showFollowVehicle: false
property bool followVehicle: false
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
function fitHomePosition() {
var homePosition = QtPositioning.coordinate()
var activeVehicle = QGroundControl.multiVehicleManager.activeVehicle
......@@ -223,7 +221,7 @@ DropButton {
QGCButton {
text: qsTr("Vehicle")
Layout.fillWidth: true
enabled: _activeVehicle && _activeVehicle.latitude != 0 && _activeVehicle.longitude != 0 && !followVehicleCheckBox.checked
enabled: activeVehicle && activeVehicle.latitude != 0 && activeVehicle.longitude != 0 && !followVehicleCheckBox.checked
onClicked: {
dropButton.hideDropDown()
......
......@@ -26,8 +26,6 @@ ColumnLayout {
property bool showMission: true
property bool showAllItems: true
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
QGCLabel { text: qsTr("Center map on:") }
QGCButton {
......@@ -65,7 +63,7 @@ ColumnLayout {
QGCButton {
text: qsTr("Vehicle")
Layout.fillWidth: true
enabled: _activeVehicle && _activeVehicle.coordinate.isValid
enabled: activeVehicle && activeVehicle.coordinate.isValid
onClicked: {
dropPanel.hide()
......
......@@ -34,7 +34,6 @@ Rectangle {
property real _margin: ScreenTools.defaultFontPixelWidth / 2
property real _spacer: ScreenTools.defaultFontPixelWidth / 2
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property string _setToVehicleHeadingStr: qsTr("Set to vehicle heading")
property string _setToVehicleLocationStr: qsTr("Set to vehicle location")
......@@ -79,8 +78,8 @@ Rectangle {
QGCButton {
text: _setToVehicleHeadingStr
visible: _activeVehicle
onClicked: missionItem.landingHeading.rawValue = _activeVehicle.heading.rawValue
visible: activeVehicle
onClicked: missionItem.landingHeading.rawValue = activeVehicle.heading.rawValue
}
}
......@@ -148,9 +147,9 @@ Rectangle {
QGCButton {
text: _setToVehicleLocationStr
visible: _activeVehicle
visible: activeVehicle
Layout.columnSpan: 2
onClicked: missionItem.landingCoordinate = _activeVehicle.coordinate
onClicked: missionItem.landingCoordinate = activeVehicle.coordinate
}
}
}
......@@ -216,17 +215,17 @@ Rectangle {
anchors.right: parent.right
horizontalAlignment: Text.AlignHCenter
text: qsTr("- or -")
visible: _activeVehicle
visible: activeVehicle
}
QGCButton {
anchors.horizontalCenter: parent.horizontalCenter
text: _setToVehicleLocationStr
visible: _activeVehicle
visible: activeVehicle
onClicked: {
missionItem.landingCoordinate = _activeVehicle.coordinate
missionItem.landingHeading.rawValue = _activeVehicle.heading.rawValue
missionItem.landingCoordinate = activeVehicle.coordinate
missionItem.landingHeading.rawValue = activeVehicle.heading.rawValue
}
}
}
......
......@@ -322,7 +322,7 @@ Rectangle {
Rectangle {
anchors.bottom: parent.bottom
height: toolBar.height * 0.05
width: _activeVehicle ? _activeVehicle.parameterManager.loadProgress * parent.width : 0
width: activeVehicle ? activeVehicle.parameterManager.loadProgress * parent.width : 0
color: qgcPal.colorGreen
visible: !largeProgressBar.visible
}
......
......@@ -44,7 +44,7 @@ Item {
readonly property real _margin: ScreenTools.defaultFontPixelHeight * 0.5
readonly property real _radius: ScreenTools.defaultFontPixelWidth * 0.5
readonly property real _rightPanelWidth: Math.min(parent.width / 3, ScreenTools.defaultFontPixelWidth * 30)
readonly property real _toolButtonTopMargin: parent.height - ScreenTools.availableHeight + (ScreenTools.defaultFontPixelHeight / 2)
readonly property real _toolButtonTopMargin: parent.height - mainWindow.height + (ScreenTools.defaultFontPixelHeight / 2)
readonly property var _defaultVehicleCoordinate: QtPositioning.coordinate(37.803784, -122.462276)
readonly property bool _waypointsOnlyMode: QGroundControl.corePlugin.options.missionWaypointsOnly
......@@ -58,7 +58,7 @@ Item {
property bool _addWaypointOnClick: false
property bool _addROIOnClick: false
property bool _singleComplexItem: _missionController.complexMissionItemNames.length === 1
property real _toolbarHeight: _root.height - ScreenTools.availableHeight
property real _toolbarHeight: _root.height - mainWindow.height
property int _editingLayer: _layerMission
property int _toolStripBottom: toolStrip.height + toolStrip.y
property var _appSettings: QGroundControl.settingsManager.appSettings
......@@ -476,7 +476,7 @@ Item {
editorMap.focus = true
//-- Don't pay attention to items beneath the toolbar.
var topLimit = parent.height - ScreenTools.availableHeight
var topLimit = parent.height - mainWindow.height
if(mouse.y < topLimit) {
return
}
......@@ -653,7 +653,7 @@ Item {
// Right pane for mission editing controls
Rectangle {
id: rightPanel
height: ScreenTools.availableHeight
height: mainWindow.height
width: _rightPanelWidth
color: qgcPal.window
opacity: planExpanded.visible ? 0.2 : 0
......
......@@ -17,7 +17,7 @@ Item {
property int dropDirection: dropDown
property alias dropDownComponent: dropDownLoader.sourceComponent
property real viewportMargins: 0
property real topMargin: parent.height - ScreenTools.availableHeight
property real topMargin: parent.height - mainWindow.height
property alias lightBorders: roundButton.lightBorders
width: radius * 2
......
......@@ -27,18 +27,18 @@ RowLayout {
property real _chartHeight: ScreenTools.defaultFontPixelHeight * 20
property real _margins: ScreenTools.defaultFontPixelHeight / 2
property string _currentTuneType: tuneList[0]
property real _roll: _activeVehicle.roll.value
property real _rollSetpoint: _activeVehicle.setpoint.roll.value
property real _rollRate: _activeVehicle.rollRate.value
property real _rollRateSetpoint: _activeVehicle.setpoint.rollRate.value
property real _pitch: _activeVehicle.pitch.value
property real _pitchSetpoint: _activeVehicle.setpoint.pitch.value
property real _pitchRate: _activeVehicle.pitchRate.value
property real _pitchRateSetpoint: _activeVehicle.setpoint.pitchRate.value
property real _yaw: _activeVehicle.heading.value
property real _yawSetpoint: _activeVehicle.setpoint.yaw.value
property real _yawRate: _activeVehicle.yawRate.value
property real _yawRateSetpoint: _activeVehicle.setpoint.yawRate.value
property real _roll: activeVehicle.roll.value
property real _rollSetpoint: activeVehicle.setpoint.roll.value
property real _rollRate: activeVehicle.rollRate.value
property real _rollRateSetpoint: activeVehicle.setpoint.rollRate.value
property real _pitch: activeVehicle.pitch.value
property real _pitchSetpoint: activeVehicle.setpoint.pitch.value
property real _pitchRate: activeVehicle.pitchRate.value
property real _pitchRateSetpoint: activeVehicle.setpoint.pitchRate.value
property real _yaw: activeVehicle.heading.value
property real _yawSetpoint: activeVehicle.setpoint.yaw.value
property real _yawRate: activeVehicle.yawRate.value
property real _yawRateSetpoint: activeVehicle.setpoint.yawRate.value
property var _valueXAxis: valueXAxis
property var _valueRateXAxis: valueRateXAxis
property var _valueYAxis: valueYAxis
......@@ -229,7 +229,6 @@ RowLayout {
*/
}
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property int _maxPointCount: 10000 / interval
}
......
......@@ -29,7 +29,6 @@ Item {
property bool _searchFilter: searchText.text.trim() != "" ///< true: showing results of search
property var _searchResults ///< List of parameter names from search results
property bool _showRCToParam: !ScreenTools.isMobile && QGroundControl.multiVehicleManager.activeVehicle.px4Firmware
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property var _appSettings: QGroundControl.settingsManager.appSettings
ParameterEditorController {
......@@ -107,7 +106,7 @@ Item {
}
MenuItem {
text: qsTr("Reset all to defaults")
visible: !_activeVehicle.apmFirmware
visible: !activeVehicle.apmFirmware
onTriggered: mainWindow.showDialog(resetToDefaultConfirmComponent, qsTr("Reset All"), mainWindow.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Reset)
}
MenuSeparator { }
......@@ -330,7 +329,7 @@ Item {
QGCViewDialog {
function accept() {
_activeVehicle.rebootVehicle()
activeVehicle.rebootVehicle()
hideDialog()
}
......
......@@ -59,8 +59,6 @@ QGCButton {
_pendingColor :
_failedColor))
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
width: 40 * ScreenTools.defaultFontPixelWidth
style: ButtonStyle {
......
......@@ -16,9 +16,9 @@ Rectangle {
parent.flickableDirection === Flickable.HorizontalAndVerticalFlick) &&
(parent.contentHeight > parent.height)
Component.onCompleted: animateOpacity.restart()
onVisibleChanged: animateOpacity.restart()
onHeightChanged: animateOpacity.restart()
Component.onCompleted: { if(animateOpacity) animateOpacity.restart() }
onVisibleChanged: { if(animateOpacity) animateOpacity.restart() }
onHeightChanged: { if(animateOpacity) animateOpacity.restart() }
Connections {
target: verticalIndicator.parent
......
......@@ -46,7 +46,6 @@ Item {
property real mediumFontPointSize: 10
property real largeFontPointSize: 10
property real availableHeight: 0
property real toolbarHeight: 0
readonly property real smallFontPointRatio: 0.75
......
......@@ -26,9 +26,7 @@ SetupPage {
id: firmwarePage
pageComponent: firmwarePageComponent
pageName: qsTr("Firmware")
showAdvanced: _activeVehicle && _activeVehicle.apmFirmware
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
showAdvanced: activeVehicle && activeVehicle.apmFirmware
signal cancelDialog
......@@ -459,7 +457,7 @@ SetupPage {
id: flashBootloaderButton
text: qsTr("Flash ChibiOS Bootloader")
visible: firmwarePage.advanced
onClicked: _activeVehicle.flashBootloader()
onClicked: activeVehicle.flashBootloader()
}
TextArea {
......
......@@ -51,7 +51,6 @@ SetupPage {
readonly property real labelToMonitorMargin: ScreenTools.defaultFontPixelWidth * 3
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property var _activeJoystick: joystickManager.activeJoystick
JoystickConfigController {
......@@ -188,7 +187,7 @@ SetupPage {
QGCLabel {
id: rollLabel
width: ScreenTools.defaultFontPixelWidth * 10
text: _activeVehicle.sub ? qsTr("Lateral") : qsTr("Roll")
text: activeVehicle.sub ? qsTr("Lateral") : qsTr("Roll")
}
Loader {
......@@ -218,7 +217,7 @@ SetupPage {
QGCLabel {
id: pitchLabel
width: ScreenTools.defaultFontPixelWidth * 10
text: _activeVehicle.sub ? qsTr("Forward") : qsTr("Pitch")
text: activeVehicle.sub ? qsTr("Forward") : qsTr("Pitch")
}
Loader {
......@@ -365,14 +364,14 @@ SetupPage {
id: enabledCheckBox
enabled: _activeJoystick ? _activeJoystick.calibrated : false
text: _activeJoystick ? _activeJoystick.calibrated ? qsTr("Enable joystick input") : qsTr("Enable not allowed (Calibrate First)") : ""
onClicked: _activeVehicle.joystickEnabled = checked
Component.onCompleted: checked = _activeVehicle.joystickEnabled
onClicked: activeVehicle.joystickEnabled = checked
Component.onCompleted: checked = activeVehicle.joystickEnabled
Connections {
target: _activeVehicle
target: activeVehicle
onJoystickEnabledChanged: {
enabledCheckBox.checked = _activeVehicle.joystickEnabled
enabledCheckBox.checked = activeVehicle.joystickEnabled
}
}
......@@ -381,7 +380,7 @@ SetupPage {
onActiveJoystickChanged: {
if(_activeJoystick) {
enabledCheckBox.checked = Qt.binding(function() { return _activeJoystick.calibrated && _activeVehicle.joystickEnabled })
enabledCheckBox.checked = Qt.binding(function() { return _activeJoystick.calibrated && activeVehicle.joystickEnabled })
}
}
}
......@@ -427,7 +426,7 @@ SetupPage {
Column {
spacing: ScreenTools.defaultFontPixelHeight / 3
visible: _activeVehicle.supportsThrottleModeCenterZero
visible: activeVehicle.supportsThrottleModeCenterZero
ExclusiveGroup { id: throttleModeExclusiveGroup }
......@@ -463,10 +462,10 @@ SetupPage {
}
QGCCheckBox {
visible: _activeVehicle.supportsNegativeThrust
visible: activeVehicle.supportsNegativeThrust
id: negativeThrust
text: qsTr("Allow negative Thrust")
enabled: _activeJoystick.negativeThrust = _activeVehicle.supportsNegativeThrust
enabled: _activeJoystick.negativeThrust = activeVehicle.supportsNegativeThrust
checked: _activeJoystick ? _activeJoystick.negativeThrust : false
onClicked: _activeJoystick.negativeThrust = checked
}
......@@ -499,12 +498,12 @@ SetupPage {
QGCCheckBox {
id: advancedSettings
checked: _activeVehicle.joystickMode != 0
checked: activeVehicle.joystickMode != 0
text: qsTr("Advanced settings (careful!)")
onClicked: {
if (!checked) {
_activeVehicle.joystickMode = 0
activeVehicle.joystickMode = 0
}
}
}
......@@ -522,11 +521,11 @@ SetupPage {
QGCComboBox {
id: joystickModeCombo
currentIndex: _activeVehicle.joystickMode
currentIndex: activeVehicle.joystickMode
width: ScreenTools.defaultFontPixelWidth * 20
model: _activeVehicle.joystickModes
model: activeVehicle.joystickModes
onActivated: _activeVehicle.joystickMode = index
onActivated: activeVehicle.joystickMode = index
}
}
......@@ -554,7 +553,7 @@ SetupPage {
visible: advancedSettings.checked
QGCCheckBox {
id: joystickCircleCorrection
checked: _activeVehicle.joystickMode != 0
checked: activeVehicle.joystickMode != 0
text: qsTr("Enable circle correction")
Component.onCompleted: checked = _activeJoystick.circleCorrection
......@@ -625,7 +624,7 @@ SetupPage {
Row {
spacing: ScreenTools.defaultFontPixelWidth
visible: !_activeVehicle.supportsJSButton
visible: !activeVehicle.supportsJSButton
property bool pressed
......@@ -667,7 +666,7 @@ SetupPage {
Row {
spacing: ScreenTools.defaultFontPixelWidth
visible: _activeVehicle.supportsJSButton
visible: activeVehicle.supportsJSButton
QGCLabel {
horizontalAlignment: Text.AlignHCenter
......@@ -692,7 +691,7 @@ SetupPage {
Row {
spacing: ScreenTools.defaultFontPixelWidth
visible: _activeVehicle.supportsJSButton
visible: activeVehicle.supportsJSButton
property bool pressed
......
......@@ -44,13 +44,21 @@ ApplicationWindow {
property var activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool communicationLost: activeVehicle ? activeVehicle.connectionLost : false
property string formatedMessage: activeVehicle ? activeVehicle.formatedMessage : ""
property real availableHeight: mainWindow.height - mainWindow.header.height
readonly property string navButtonWidth: ScreenTools.defaultFontPixelWidth * 24
readonly property real defaultTextHeight: ScreenTools.defaultFontPixelHeight
readonly property real defaultTextWidth: ScreenTools.defaultFontPixelWidth
QGCPalette { id: qgcPal; colorGroupEnabled: true }
//-------------------------------------------------------------------------
//-- Actions
signal armVehicle
signal disarmVehicle
signal vtolTransitionToFwdFlight
signal vtolTransitionToMRFlight
//-------------------------------------------------------------------------
//-- Global Scope Functions
......
......@@ -32,7 +32,6 @@ Rectangle {
property int _selectedCount: 0
property real _columnSpacing: ScreenTools.defaultFontPixelHeight * 0.25
property bool _uploadedSelected: false
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _showMavlinkLog: QGroundControl.corePlugin.options.showMavlinkLogOptions
property bool _showAPMStreamRates: QGroundControl.apmFirmwareSupported && QGroundControl.settingsManager.apmMavlinkStreamRateSettings.visible
property Fact _disableDataPersistenceFact: QGroundControl.settingsManager.appSettings.disableAllPersistence
......@@ -282,7 +281,7 @@ Rectangle {
}
QGCLabel {
width: _valueWidth
text: _activeVehicle ? _activeVehicle.mavlinkSentCount : qsTr("Not Connected")
text: activeVehicle ? activeVehicle.mavlinkSentCount : qsTr("Not Connected")
anchors.verticalCenter: parent.verticalCenter
}
}
......@@ -297,7 +296,7 @@ Rectangle {
}
QGCLabel {
width: _valueWidth
text: _activeVehicle ? _activeVehicle.mavlinkReceivedCount : qsTr("Not Connected")
text: activeVehicle ? activeVehicle.mavlinkReceivedCount : qsTr("Not Connected")
anchors.verticalCenter: parent.verticalCenter
}
}
......@@ -312,7 +311,7 @@ Rectangle {
}
QGCLabel {
width: _valueWidth
text: _activeVehicle ? _activeVehicle.mavlinkLossCount : qsTr("Not Connected")
text: activeVehicle ? activeVehicle.mavlinkLossCount : qsTr("Not Connected")
anchors.verticalCenter: parent.verticalCenter
}
}
......@@ -327,7 +326,7 @@ Rectangle {
}
QGCLabel {
width: _valueWidth
text: _activeVehicle ? _activeVehicle.mavlinkLossPercent.toFixed(0) + '%' : qsTr("Not Connected")
text: activeVehicle ? activeVehicle.mavlinkLossPercent.toFixed(0) + '%' : qsTr("Not Connected")
anchors.verticalCenter: parent.verticalCenter
}
}
......
......@@ -27,13 +27,12 @@ QGCLabel {
font.pointSize: ScreenTools.mediumFontPointSize
color: qgcPal.buttonText
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _armed: _activeVehicle ? _activeVehicle.armed : false
property bool _armed: activeVehicle ? activeVehicle.armed : false
QGCPalette { id: qgcPal }
QGCMouseArea {
fillItem: parent
onClicked: _armed ? toolBar.disarmVehicle() : toolBar.armVehicle()
onClicked: _armed ? mainWindow.disarmVehicle() : mainWindow.armVehicle()
}
}
......@@ -23,17 +23,15 @@ Item {
anchors.bottom: parent.bottom
width: batteryIndicatorRow.width
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
function getBatteryColor() {
if(_activeVehicle) {
if(_activeVehicle.battery.percentRemaining.value > 75) {
if(activeVehicle) {
if(activeVehicle.battery.percentRemaining.value > 75) {
return qgcPal.text
}
if(_activeVehicle.battery.percentRemaining.value > 50) {
if(activeVehicle.battery.percentRemaining.value > 50) {
return qgcPal.colorOrange
}
if(_activeVehicle.battery.percentRemaining.value > 0.1) {
if(activeVehicle.battery.percentRemaining.value > 0.1) {
return qgcPal.colorRed
}
}
......@@ -41,15 +39,15 @@ Item {
}
function getBatteryPercentageText() {
if(_activeVehicle) {
if(_activeVehicle.battery.percentRemaining.value > 98.9) {
if(activeVehicle) {
if(activeVehicle.battery.percentRemaining.value > 98.9) {
return "100%"
}
if(_activeVehicle.battery.percentRemaining.value > 0.1) {
return _activeVehicle.battery.percentRemaining.valueString + _activeVehicle.battery.percentRemaining.units
if(activeVehicle.battery.percentRemaining.value > 0.1) {
return activeVehicle.battery.percentRemaining.valueString + activeVehicle.battery.percentRemaining.units
}
if(_activeVehicle.battery.voltage.value >= 0) {
return _activeVehicle.battery.voltage.valueString + _activeVehicle.battery.voltage.units
if(activeVehicle.battery.voltage.value >= 0) {
return activeVehicle.battery.voltage.valueString + activeVehicle.battery.voltage.units
}
}
return "N/A"
......@@ -87,9 +85,9 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter
QGCLabel { text: qsTr("Voltage:") }
QGCLabel { text: (_activeVehicle && _activeVehicle.battery.voltage.value != -1) ? (_activeVehicle.battery.voltage.valueString + " " + _activeVehicle.battery.voltage.units) : "N/A" }
QGCLabel { text: (activeVehicle && activeVehicle.battery.voltage.value != -1) ? (activeVehicle.battery.voltage.valueString + " " + activeVehicle.battery.voltage.units) : "N/A" }
QGCLabel { text: qsTr("Accumulated Consumption:") }
QGCLabel { text: (_activeVehicle && _activeVehicle.battery.mahConsumed.value != -1) ? (_activeVehicle.battery.mahConsumed.valueString + " " + _activeVehicle.battery.mahConsumed.units) : "N/A" }
QGCLabel { text: (activeVehicle && activeVehicle.battery.mahConsumed.value != -1) ? (activeVehicle.battery.mahConsumed.valueString + " " + activeVehicle.battery.mahConsumed.units) : "N/A" }
}
}
}
......@@ -99,7 +97,7 @@ Item {
id: batteryIndicatorRow
anchors.top: parent.top
anchors.bottom: parent.bottom
opacity: (_activeVehicle && _activeVehicle.battery.voltage.value >= 0) ? 1 : 0.5
opacity: (activeVehicle && activeVehicle.battery.voltage.value >= 0) ? 1 : 0.5
QGCColoredImage {
anchors.top: parent.top
anchors.bottom: parent.bottom
......
......@@ -25,12 +25,11 @@ Item {
anchors.bottom: parent.bottom
width: priorityLinkSelector.width
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _visible: false
QGCLabel {
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
color: qgcPal.buttonText
anchors.verticalCenter: parent.verticalCenter
......@@ -41,12 +40,12 @@ Item {
Component {
id: linkSelectionMenuItemComponent
MenuItem {
onTriggered: _activeVehicle.priorityLinkName = text
onTriggered: activeVehicle.priorityLinkName = text
}
}
property var linkSelectionMenuItems: []
function updatelinkSelectionMenu() {
if (_activeVehicle) {
if (activeVehicle) {
// Remove old menu items
for (var i = 0; i < linkSelectionMenuItems.length; i++) {
linkSelectionMenu.removeItem(linkSelectionMenuItems[i])
......@@ -55,9 +54,9 @@ Item {
// Add new items
var has_hl = false;
var links = _activeVehicle.links
var links = activeVehicle.links
for (var 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)
linkSelectionMenu.insertItem(i, menuItem)
......@@ -78,17 +77,17 @@ Item {
}
Connections {
target: _activeVehicle
target: activeVehicle
onLinksChanged: priorityLinkSelector.updatelinkSelectionMenu()
}
Connections {
target: _activeVehicle
target: activeVehicle
onLinksPropertiesChanged: priorityLinkSelector.updatelinkSelectionMenu()
}
MouseArea {
visible: _activeVehicle
visible: activeVehicle
anchors.fill: parent
onClicked: linkSelectionMenu.popup()
}
......
......@@ -25,18 +25,17 @@ Item {
anchors.top: parent.top
anchors.bottom: parent.bottom
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _isMessageImportant: _activeVehicle ? !_activeVehicle.messageTypeNormal && !_activeVehicle.messageTypeNone : false
property bool _isMessageImportant: activeVehicle ? !activeVehicle.messageTypeNormal && !activeVehicle.messageTypeNone : false
function getMessageColor() {
if (_activeVehicle) {
if (_activeVehicle.messageTypeNone)
if (activeVehicle) {
if (activeVehicle.messageTypeNone)
return qgcPal.colorGrey
if (_activeVehicle.messageTypeNormal)
if (activeVehicle.messageTypeNormal)
return qgcPal.colorBlue;
if (_activeVehicle.messageTypeWarning)
if (activeVehicle.messageTypeWarning)
return qgcPal.colorOrange;
if (_activeVehicle.messageTypeError)
if (activeVehicle.messageTypeError)
return qgcPal.colorRed;
// Cannot be so make make it obnoxious to show error
console.log("Invalid vehicle message type")
......@@ -53,7 +52,7 @@ Item {
sourceSize.height: height
fillMode: Image.PreserveAspectFit
cache: false
visible: _activeVehicle && _activeVehicle.messageCount > 0 && _isMessageImportant
visible: activeVehicle && activeVehicle.messageCount > 0 && _isMessageImportant
}
QGCColoredImage {
......
......@@ -24,14 +24,13 @@ Item {
anchors.bottom: parent.bottom
width: flightModeSelector.width
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property var _flightModes: _activeVehicle ? _activeVehicle.flightModes : [ ]
property var _flightModes: activeVehicle ? activeVehicle.flightModes : [ ]
on_FlightModesChanged: flightModeSelector.updateFlightModesMenu()
QGCLabel {
id: flightModeSelector
text: _activeVehicle ? _activeVehicle.flightMode : qsTr("N/A", "No data to display")
text: activeVehicle ? activeVehicle.flightMode : qsTr("N/A", "No data to display")
font.pointSize: ScreenTools.mediumFontPointSize
color: qgcPal.buttonText
anchors.verticalCenter: parent.verticalCenter
......@@ -41,12 +40,12 @@ Item {
Component {
id: flightModeMenuItemComponent
MenuItem {
onTriggered: _activeVehicle.flightMode = text
onTriggered: activeVehicle.flightMode = text
}
}
property var flightModesMenuItems: []
function updateFlightModesMenu() {
if (_activeVehicle && _activeVehicle.flightModeSetAvailable) {
if (activeVehicle && activeVehicle.flightModeSetAvailable) {
// Remove old menu items
for (var i = 0; i < flightModesMenuItems.length; i++) {
flightModesMenu.removeItem(flightModesMenuItems[i])
......@@ -62,7 +61,7 @@ Item {
}
Component.onCompleted: flightModeSelector.updateFlightModesMenu()
MouseArea {
visible: _activeVehicle && _activeVehicle.flightModeSetAvailable
visible: activeVehicle && activeVehicle.flightModeSetAvailable
anchors.fill: parent
onClicked: flightModesMenu.popup()
}
......
......@@ -22,10 +22,9 @@ Item {
width: rssiRow.width * 1.1
anchors.top: parent.top
anchors.bottom: parent.bottom
visible: _activeVehicle ? _activeVehicle.supportsRadio : true
visible: activeVehicle ? activeVehicle.supportsRadio : true
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 {
id: rcRSSIInfo
......@@ -46,7 +45,7 @@ Item {
QGCLabel {
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
anchors.horizontalCenter: parent.horizontalCenter
}
......@@ -60,7 +59,7 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter
QGCLabel { text: qsTr("RSSI:") }
QGCLabel { text: _activeVehicle ? (_activeVehicle.rcRSSI + "%") : 0 }
QGCLabel { text: activeVehicle ? (activeVehicle.rcRSSI + "%") : 0 }
}
}
}
......@@ -86,7 +85,7 @@ Item {
SignalStrength {
anchors.verticalCenter: parent.verticalCenter
size: parent.height * 0.5
percent: _rcRSSIAvailable ? _activeVehicle.rcRSSI : 0
percent: _rcRSSIAvailable ? activeVehicle.rcRSSI : 0
}
}
......
......@@ -24,8 +24,7 @@ Item {
width: _hasTelemetry ? telemIcon.width * 1.1 : 0
visible: _hasTelemetry
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _hasTelemetry: _activeVehicle ? _activeVehicle.telemetryLRSSI !== 0 : false
property bool _hasTelemetry: activeVehicle ? activeVehicle.telemetryLRSSI !== 0 : false
Component {
id: telemRSSIInfo
......@@ -54,19 +53,19 @@ Item {
columns: 2
anchors.horizontalCenter: parent.horizontalCenter
QGCLabel { text: qsTr("Local RSSI:") }
QGCLabel { text: _activeVehicle.telemetryLRSSI + " dBm"}
QGCLabel { text: activeVehicle.telemetryLRSSI + " dBm"}
QGCLabel { text: qsTr("Remote RSSI:") }
QGCLabel { text: _activeVehicle.telemetryRRSSI + " dBm"}
QGCLabel { text: activeVehicle.telemetryRRSSI + " dBm"}
QGCLabel { text: qsTr("RX Errors:") }
QGCLabel { text: _activeVehicle.telemetryRXErrors }
QGCLabel { text: activeVehicle.telemetryRXErrors }
QGCLabel { text: qsTr("Errors Fixed:") }
QGCLabel { text: _activeVehicle.telemetryFixed }
QGCLabel { text: activeVehicle.telemetryFixed }
QGCLabel { text: qsTr("TX Buffer:") }
QGCLabel { text: _activeVehicle.telemetryTXBuffer }
QGCLabel { text: activeVehicle.telemetryTXBuffer }
QGCLabel { text: qsTr("Local Noise:") }
QGCLabel { text: _activeVehicle.telemetryLNoise }
QGCLabel { text: activeVehicle.telemetryLNoise }
QGCLabel { text: qsTr("Remote Noise:") }
QGCLabel { text: _activeVehicle.telemetryRNoise }
QGCLabel { text: activeVehicle.telemetryRNoise }
}
}
}
......
......@@ -26,16 +26,13 @@ QGCLabel {
text: _fwdFlight ? qsTr("VTOL: Fixed Wing") : qsTr("VTOL: Multi-Rotor")
font.pointSize: ScreenTools.mediumFontPointSize
color: qgcPal.buttonText
visible: _activeVehicle ? _activeVehicle.vtol && _activeVehicle.px4Firmware : false
visible: activeVehicle ? activeVehicle.vtol && activeVehicle.px4Firmware : false
width: visible ? implicitWidth : 0
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _fwdFlight: _activeVehicle ? _activeVehicle.vtolInFwdFlight : false
QGCPalette { id: qgcPal }
property bool _fwdFlight: activeVehicle ? activeVehicle.vtolInFwdFlight : false
QGCMouseArea {
fillItem: parent
onClicked: _activeVehicle.vtolInFwdFlight ? toolBar.vtolTransitionToMRFlight() : toolBar.vtolTransitionToFwdFlight()
onClicked: activeVehicle.vtolInFwdFlight ? toolBar.vtolTransitionToMRFlight() : toolBar.vtolTransitionToFwdFlight()
}
}
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