diff --git a/src/AutoPilotPlugins/APM/APMCameraSubComponent.qml b/src/AutoPilotPlugins/APM/APMCameraSubComponent.qml index a59da7492e26bf2c4073c387c11c302a4024b87f..868ab973fbc05fc237c4e3a763648d39202ab647 100644 --- a/src/AutoPilotPlugins/APM/APMCameraSubComponent.qml +++ b/src/AutoPilotPlugins/APM/APMCameraSubComponent.qml @@ -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") diff --git a/src/AutoPilotPlugins/APM/APMLightsComponent.qml b/src/AutoPilotPlugins/APM/APMLightsComponent.qml index 1c78d82a2d39d4f8c24cd838cdee415494e263b6..700a6a6b5b3c5c6d50c86f4bc8f4cd3595bd7e49 100644 --- a/src/AutoPilotPlugins/APM/APMLightsComponent.qml +++ b/src/AutoPilotPlugins/APM/APMLightsComponent.qml @@ -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") diff --git a/src/AutoPilotPlugins/APM/APMSafetyComponentSub.qml b/src/AutoPilotPlugins/APM/APMSafetyComponentSub.qml index 93c3d41ec2c24f358f008f3c5cadbd4cc88e8256..695a483b47ebc2b9e8c1533c4525a2c06a3d13cf 100644 --- a/src/AutoPilotPlugins/APM/APMSafetyComponentSub.qml +++ b/src/AutoPilotPlugins/APM/APMSafetyComponentSub.qml @@ -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") diff --git a/src/AutoPilotPlugins/APM/APMSensorsComponent.qml b/src/AutoPilotPlugins/APM/APMSensorsComponent.qml index e6519caee7d3fa4308315585720748388c26be67..a4b944c8ad2af92323688ee11f374336886ace00 100644 --- a/src/AutoPilotPlugins/APM/APMSensorsComponent.qml +++ b/src/AutoPilotPlugins/APM/APMSensorsComponent.qml @@ -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) } diff --git a/src/AutoPilotPlugins/APM/APMSubFrameComponent.qml b/src/AutoPilotPlugins/APM/APMSubFrameComponent.qml index b5a62fd5946a15ab1d52a0fd9ea34ba64be50e01..2a61de995d1c23b91786b9e2e9344266c35467d6 100644 --- a/src/AutoPilotPlugins/APM/APMSubFrameComponent.qml +++ b/src/AutoPilotPlugins/APM/APMSubFrameComponent.qml @@ -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; } diff --git a/src/AutoPilotPlugins/Common/SetupPage.qml b/src/AutoPilotPlugins/Common/SetupPage.qml index 479e4bc3ec2feff35975daa0c3567edecb41614a..5ed0bffea085d03971d3571a2bc96d029f980e2a 100644 --- a/src/AutoPilotPlugins/Common/SetupPage.qml +++ b/src/AutoPilotPlugins/Common/SetupPage.qml @@ -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 diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index 1c33a8a584b227c90f483ca65864d217d8e3901c..ddfb96bd6f251080784d2d379c50de3ee59610c3 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -37,9 +37,8 @@ Item { Component.onCompleted: start(true /* flyView */) } - property alias guidedController: guidedActionsController - - property bool activeVehicleJoystickEnabled: activeVehicle ? activeVehicle.joystickEnabled : false + property alias guidedController: guidedActionsController + property bool activeVehicleJoystickEnabled: activeVehicle ? activeVehicle.joystickEnabled : false property var _missionController: planMasterController.missionController property var _geoFenceController: planMasterController.geoFenceController @@ -49,7 +48,7 @@ Item { property bool _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist.rawValue property real _savedZoomLevel: 0 property real _margins: ScreenTools.defaultFontPixelWidth / 2 - property real _pipSize: flightView.width * 0.2 + property real _pipSize: mainWindow.width * 0.2 property alias _guidedController: guidedActionsController property alias _altitudeSlider: altitudeSlider @@ -116,6 +115,20 @@ Item { onResumeMissionUploadFail: guidedActionsController.confirmAction(guidedActionsController.actionResumeMissionUploadFail) } + Connections { + target: mainWindow + onArmVehicle: guidedController.confirmAction(guidedController.actionArm) + onDisarmVehicle: { + if (guidedController.showEmergenyStop) { + guidedController.confirmAction(guidedController.actionEmergencyStop) + } else { + guidedController.confirmAction(guidedController.actionDisarm) + } + } + onVtolTransitionToFwdFlight: guidedController.confirmAction(guidedController.actionVtolTransitionToFwdFlight) + onVtolTransitionToMRFlight: guidedController.confirmAction(guidedController.actionVtolTransitionToMRFlight) + } + Component.onCompleted: { setStates() if(QGroundControl.corePlugin.options.flyViewOverlay.toString().length) { @@ -254,8 +267,8 @@ Item { Window { id: videoWindow - width: !_mainIsMap ? _panel.width : _pipSize - height: !_mainIsMap ? _panel.height : _pipSize * (9/16) + width: !_mainIsMap ? _mapAndVideo.width : _pipSize + height: !_mainIsMap ? _mapAndVideo.height : _pipSize * (9/16) visible: false Item { @@ -289,20 +302,18 @@ Item { QGCMapPalette { id: mapPal; lightColors: _mainIsMap ? _flightMap.isSatelliteMap : true } Item { - id: _panel + id: _mapAndVideo anchors.fill: parent //-- Map View - // For whatever reason, if FlightDisplayViewMap is the _panel item, changing - // width/height has no effect. Item { id: _flightMapContainer - z: _mainIsMap ? _panel.z + 1 : _panel.z + 2 - anchors.left: _panel.left - anchors.bottom: _panel.bottom + z: _mainIsMap ? _mapAndVideo.z + 1 : _mapAndVideo.z + 2 + anchors.left: _mapAndVideo.left + anchors.bottom: _mapAndVideo.bottom visible: _mainIsMap || _isPipVisible && !QGroundControl.videoManager.fullScreen - width: _mainIsMap ? _panel.width : _pipSize - height: _mainIsMap ? _panel.height : _pipSize * (9/16) + width: _mainIsMap ? _mapAndVideo.width : _pipSize + height: _mainIsMap ? _mapAndVideo.height : _pipSize * (9/16) states: [ State { name: "pipMode" @@ -333,11 +344,11 @@ Item { //-- Video View Item { id: _flightVideo - z: _mainIsMap ? _panel.z + 2 : _panel.z + 1 - width: !_mainIsMap ? _panel.width : _pipSize - height: !_mainIsMap ? _panel.height : _pipSize * (9/16) - anchors.left: _panel.left - anchors.bottom: _panel.bottom + z: _mainIsMap ? _mapAndVideo.z + 2 : _mapAndVideo.z + 1 + width: !_mainIsMap ? _mapAndVideo.width : _pipSize + height: !_mainIsMap ? _mapAndVideo.height : _pipSize * (9/16) + anchors.left: _mapAndVideo.left + anchors.bottom: _mapAndVideo.bottom visible: QGroundControl.videoManager.hasVideo && (!_mainIsMap || _isPipVisible) onParentChanged: { @@ -345,10 +356,10 @@ Item { * correct anchors. * Such thing is not possible with ParentChange. */ - if(parent == _panel) { + if(parent == _mapAndVideo) { // Do anchors again after popup - anchors.left = _panel.left - anchors.bottom = _panel.bottom + anchors.left = _mapAndVideo.left + anchors.bottom = _mapAndVideo.bottom anchors.margins = ScreenTools.defaultFontPixelHeight } } @@ -412,7 +423,7 @@ Item { } ParentChange { target: _flightVideo - parent: _panel + parent: _mapAndVideo } PropertyChanges { target: _flightVideoPipControl @@ -440,8 +451,8 @@ Item { z: _flightVideo.z + 3 width: _pipSize height: _pipSize * (9/16) - anchors.left: _panel.left - anchors.bottom: _panel.bottom + anchors.left: _mapAndVideo.left + anchors.bottom: _mapAndVideo.bottom anchors.margins: ScreenTools.defaultFontPixelHeight visible: QGroundControl.videoManager.hasVideo && !QGroundControl.videoManager.fullScreen && _flightVideo.state != "popup" isHidden: !_isPipVisible @@ -470,7 +481,7 @@ Item { anchors.right: parent.right anchors.top: parent.top spacing: ScreenTools.defaultFontPixelWidth - z: _panel.z + 4 + z: _mapAndVideo.z + 4 visible: QGroundControl.multiVehicleManager.vehicles.count > 1 ExclusiveGroup { id: multiVehicleSelectorGroup } @@ -492,8 +503,8 @@ Item { FlightDisplayViewWidgets { id: flightDisplayViewWidgets - z: _panel.z + 4 - height: ScreenTools.availableHeight - (singleMultiSelector.visible ? singleMultiSelector.height + _margins : 0) + z: _mapAndVideo.z + 4 + height: availableHeight - (singleMultiSelector.visible ? singleMultiSelector.height + _margins : 0) - (ScreenTools.defaultFontPixelHeight * 0.5) anchors.left: parent.left anchors.right: altitudeSlider.visible ? altitudeSlider.left : parent.right anchors.bottom: parent.bottom @@ -508,7 +519,7 @@ Item { id: flyViewOverlay z: flightDisplayViewWidgets.z + 1 visible: !QGroundControl.videoManager.fullScreen - height: ScreenTools.availableHeight + height: mainWindow.height anchors.left: parent.left anchors.right: altitudeSlider.visible ? altitudeSlider.left : parent.right anchors.bottom: parent.bottom @@ -521,16 +532,16 @@ Item { anchors.bottom: parent.bottom width: ScreenTools.defaultFontPixelWidth * 30 visible: !singleVehicleView.checked && !QGroundControl.videoManager.fullScreen - z: _panel.z + 4 + z: _mapAndVideo.z + 4 guidedActionsController: _guidedController } //-- Virtual Joystick Loader { id: virtualJoystickMultiTouch - z: _panel.z + 5 + z: _mapAndVideo.z + 5 width: parent.width - (_flightVideoPipControl.width / 2) - height: Math.min(ScreenTools.availableHeight * 0.25, ScreenTools.defaultFontPixelWidth * 16) + height: Math.min(mainWindow.height * 0.25, ScreenTools.defaultFontPixelWidth * 16) visible: (_virtualJoystick ? _virtualJoystick.value : false) && !QGroundControl.videoManager.fullScreen && !(activeVehicle ? activeVehicle.highLatencyLink : false) anchors.bottom: _flightVideoPipControl.top anchors.bottomMargin: ScreenTools.defaultFontPixelHeight * 2 @@ -547,12 +558,12 @@ Item { visible: (activeVehicle ? activeVehicle.guidedModeSupported : true) && !QGroundControl.videoManager.fullScreen id: toolStrip anchors.leftMargin: isInstrumentRight() ? ScreenTools.defaultFontPixelWidth : undefined - anchors.left: isInstrumentRight() ? _panel.left : undefined + anchors.left: isInstrumentRight() ? _mapAndVideo.left : undefined anchors.rightMargin:isInstrumentRight() ? undefined : ScreenTools.defaultFontPixelWidth - anchors.right: isInstrumentRight() ? undefined : _panel.right + anchors.right: isInstrumentRight() ? undefined : _mapAndVideo.right anchors.topMargin: ScreenTools.toolbarHeight + (_margins * 2) - anchors.top: _panel.top - z: _panel.z + 4 + anchors.top: _mapAndVideo.top + z: _mapAndVideo.z + 4 title: qsTr("Fly") maxHeight: (_flightVideo.visible ? _flightVideo.y : parent.height) - toolStrip.y buttonVisible: [ _useChecklist, _guidedController.showTakeoff || !_guidedController.showLand, _guidedController.showLand && !_guidedController.showTakeoff, true, true, true ] diff --git a/src/FlightDisplay/FlightDisplayViewMap.qml b/src/FlightDisplay/FlightDisplayViewMap.qml index 447695430f5e7af2e588df2a0add66d95f9ef66d..faaebb6780ca5c2832480ed53288b3f829969e3b 100644 --- a/src/FlightDisplay/FlightDisplayViewMap.qml +++ b/src/FlightDisplay/FlightDisplayViewMap.qml @@ -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 diff --git a/src/FlightDisplay/FlightDisplayViewWidgets.qml b/src/FlightDisplay/FlightDisplayViewWidgets.qml index 07b943670d12a1d9ce681def49adb531765a242a..3395a9d850e1e0187f0704b4f86ea022cf24628d 100644 --- a/src/FlightDisplay/FlightDisplayViewWidgets.qml +++ b/src/FlightDisplay/FlightDisplayViewWidgets.qml @@ -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 } } ] diff --git a/src/FlightDisplay/PreFlightBatteryCheck.qml b/src/FlightDisplay/PreFlightBatteryCheck.qml index 00449582446a64f97156bc8139fe5833cb8e532c..d5ec21c970d79b1d595691494fb018c2bd336fbd 100644 --- a/src/FlightDisplay/PreFlightBatteryCheck.qml +++ b/src/FlightDisplay/PreFlightBatteryCheck.qml @@ -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 } diff --git a/src/FlightDisplay/PreFlightGPSCheck.qml b/src/FlightDisplay/PreFlightGPSCheck.qml index 4005d80e283d13fb3c7f8c986b2e458d3f79a2f6..34e3e9495dd95a725cfa1311c3c1d150fb254b5b 100644 --- a/src/FlightDisplay/PreFlightGPSCheck.qml +++ b/src/FlightDisplay/PreFlightGPSCheck.qml @@ -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) diff --git a/src/FlightDisplay/PreFlightRCCheck.qml b/src/FlightDisplay/PreFlightRCCheck.qml index 9b010824a67039789e73187f2eef85e70f8e0faa..0a24bd66a397c151b86f5c6c3e85b952dd05a6ed 100644 --- a/src/FlightDisplay/PreFlightRCCheck.qml +++ b/src/FlightDisplay/PreFlightRCCheck.qml @@ -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 } diff --git a/src/FlightDisplay/PreFlightSensorsHealthCheck.qml b/src/FlightDisplay/PreFlightSensorsHealthCheck.qml index d242c8380f5d5d8aa404c41f6a8f80a48de08562..cb663ae29b33811edd582e0ad60898e099fffbf7 100644 --- a/src/FlightDisplay/PreFlightSensorsHealthCheck.qml +++ b/src/FlightDisplay/PreFlightSensorsHealthCheck.qml @@ -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 | diff --git a/src/FlightDisplay/VirtualJoystick.qml b/src/FlightDisplay/VirtualJoystick.qml index 777f0ca0d7c479d3c085747073e9da91525e1356..9a7b52cd4cb018917e3f8c2cbde8c62460eaf13b 100644 --- a/src/FlightDisplay/VirtualJoystick.qml +++ b/src/FlightDisplay/VirtualJoystick.qml @@ -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) } } } diff --git a/src/FlightMap/MapItems/PolygonEditor.qml b/src/FlightMap/MapItems/PolygonEditor.qml index 1fa7a8dbe244c71f9d056f3953663ba76bae1b06..e564a61b69153baa38481039b6a28df9f7b2e5dc 100644 --- a/src/FlightMap/MapItems/PolygonEditor.qml +++ b/src/FlightMap/MapItems/PolygonEditor.qml @@ -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 diff --git a/src/FlightMap/Widgets/CenterMapDropButton.qml b/src/FlightMap/Widgets/CenterMapDropButton.qml index 5d9cca2551f5713c904232d7c93ddda89ec22a02..df3c449331027d4eca8d2f3eae44a87ffdaa62c2 100644 --- a/src/FlightMap/Widgets/CenterMapDropButton.qml +++ b/src/FlightMap/Widgets/CenterMapDropButton.qml @@ -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() diff --git a/src/FlightMap/Widgets/CenterMapDropPanel.qml b/src/FlightMap/Widgets/CenterMapDropPanel.qml index db60b88547082b01231ef5add3e8603d65272298..a27c4ec785c96fef8ae88c4c49aa479b061fa843 100644 --- a/src/FlightMap/Widgets/CenterMapDropPanel.qml +++ b/src/FlightMap/Widgets/CenterMapDropPanel.qml @@ -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() diff --git a/src/PlanView/FWLandingPatternEditor.qml b/src/PlanView/FWLandingPatternEditor.qml index 2bfbd1e70830991878e371d14e02e15478a9ca8d..d8b133259c191466364303bb87af61de6e5e69c5 100644 --- a/src/PlanView/FWLandingPatternEditor.qml +++ b/src/PlanView/FWLandingPatternEditor.qml @@ -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 } } } diff --git a/src/PlanView/PlanToolBar.qml b/src/PlanView/PlanToolBar.qml index f6cfca0c514687a76432f34dd2032a0ce5da1fb2..94e9920834c4a4a9889e835050c4e9495b32b20d 100644 --- a/src/PlanView/PlanToolBar.qml +++ b/src/PlanView/PlanToolBar.qml @@ -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 } diff --git a/src/PlanView/PlanView.qml b/src/PlanView/PlanView.qml index 2cd3f8f515b55945d2d7a5620076ead3c15ad0b7..40204cbb7f43c53f06dd839aaf87ed7f6cc5ac57 100644 --- a/src/PlanView/PlanView.qml +++ b/src/PlanView/PlanView.qml @@ -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 diff --git a/src/QmlControls/DropButton.qml b/src/QmlControls/DropButton.qml index 7815ffed7f4b211e5f60ae675592c233995817bc..d987b9b2e7d4278b53a3167d315d37a50d19ab5f 100644 --- a/src/QmlControls/DropButton.qml +++ b/src/QmlControls/DropButton.qml @@ -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 diff --git a/src/QmlControls/PIDTuning.qml b/src/QmlControls/PIDTuning.qml index 6467ce0109451f4ce55df7fc6264c6d63ef1dda2..f8eb9a1bbefb3ae146615e7b7799d5d8a56b230e 100644 --- a/src/QmlControls/PIDTuning.qml +++ b/src/QmlControls/PIDTuning.qml @@ -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 } diff --git a/src/QmlControls/ParameterEditor.qml b/src/QmlControls/ParameterEditor.qml index 04f8b89e04147200eec60306beb7056dfdedd51f..b55a2ebffeb499b92a709b5b498e2e4c01bf8334 100644 --- a/src/QmlControls/ParameterEditor.qml +++ b/src/QmlControls/ParameterEditor.qml @@ -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() } diff --git a/src/QmlControls/PreFlightCheckButton.qml b/src/QmlControls/PreFlightCheckButton.qml index b0a26c82ef6f1ec4a1e2d5c3f59926b5e2b7ac76..0e50e3325cb68e71907405ec6ea3f397bcd6326c 100644 --- a/src/QmlControls/PreFlightCheckButton.qml +++ b/src/QmlControls/PreFlightCheckButton.qml @@ -59,8 +59,6 @@ QGCButton { _pendingColor : _failedColor)) - property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle - width: 40 * ScreenTools.defaultFontPixelWidth style: ButtonStyle { diff --git a/src/QmlControls/QGCFlickableVerticalIndicator.qml b/src/QmlControls/QGCFlickableVerticalIndicator.qml index 9ab426f437718f59c15982c385df03197983ce24..b41a016a4ce1185a0e871e3f2d7a08170cda490b 100644 --- a/src/QmlControls/QGCFlickableVerticalIndicator.qml +++ b/src/QmlControls/QGCFlickableVerticalIndicator.qml @@ -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 diff --git a/src/QmlControls/ScreenTools.qml b/src/QmlControls/ScreenTools.qml index 3e6d456f76faa0e7949a785d86b051689a38ef57..9cb00a097a9993649350dd4d1d369f5a94649ba3 100644 --- a/src/QmlControls/ScreenTools.qml +++ b/src/QmlControls/ScreenTools.qml @@ -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 diff --git a/src/VehicleSetup/FirmwareUpgrade.qml b/src/VehicleSetup/FirmwareUpgrade.qml index 13c58f03090d971e8a3f5be335d503fcc7bf74b7..60d0c4147fa2d9d072822f351cb1012bd2f3ef7c 100644 --- a/src/VehicleSetup/FirmwareUpgrade.qml +++ b/src/VehicleSetup/FirmwareUpgrade.qml @@ -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 { diff --git a/src/VehicleSetup/JoystickConfig.qml b/src/VehicleSetup/JoystickConfig.qml index 782d97853a308389f7bcf92d06a7a28c6a3f88a6..45d990f4d331015aede427fbd69af297330fbf8e 100644 --- a/src/VehicleSetup/JoystickConfig.qml +++ b/src/VehicleSetup/JoystickConfig.qml @@ -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 diff --git a/src/ui/MainQmlWindow.qml b/src/ui/MainQmlWindow.qml index 98b5e8a54d0df1aada5f63d1e74638b219420d9d..d331db0d45170421c7d10fcb57fee1438912cd5a 100644 --- a/src/ui/MainQmlWindow.qml +++ b/src/ui/MainQmlWindow.qml @@ -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 diff --git a/src/ui/preferences/MavlinkSettings.qml b/src/ui/preferences/MavlinkSettings.qml index e0757696dcf7a2d39f17aceb850925558cbf6acb..319a0cc3228dfdee1d61f643e20e639149edf730 100644 --- a/src/ui/preferences/MavlinkSettings.qml +++ b/src/ui/preferences/MavlinkSettings.qml @@ -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 } } diff --git a/src/ui/toolbar/ArmedIndicator.qml b/src/ui/toolbar/ArmedIndicator.qml index 3b549dd7334c5d0f585817632b1b5fde11b8002b..d0f5d2c1f65429c6ea8d3802faed0a9846f0d1a1 100644 --- a/src/ui/toolbar/ArmedIndicator.qml +++ b/src/ui/toolbar/ArmedIndicator.qml @@ -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() } } diff --git a/src/ui/toolbar/BatteryIndicator.qml b/src/ui/toolbar/BatteryIndicator.qml index cdbdb50da824821a7157ab4db72b930c52238f2a..eba657161e193e33935ff2694b163ef0b8b1ce34 100644 --- a/src/ui/toolbar/BatteryIndicator.qml +++ b/src/ui/toolbar/BatteryIndicator.qml @@ -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 diff --git a/src/ui/toolbar/LinkIndicator.qml b/src/ui/toolbar/LinkIndicator.qml index a7238d44d6a85941ed1b92304d119ca03e973c88..f386cd9fcc7267f4ef782907253f14bddb8994ce 100644 --- a/src/ui/toolbar/LinkIndicator.qml +++ b/src/ui/toolbar/LinkIndicator.qml @@ -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() } diff --git a/src/ui/toolbar/MessageIndicator.qml b/src/ui/toolbar/MessageIndicator.qml index abc7e3d02ddb609de544e0c2fa7225ac6181b0aa..eecf5087ceaadc87ab81318ff9273f3e9c401f91 100644 --- a/src/ui/toolbar/MessageIndicator.qml +++ b/src/ui/toolbar/MessageIndicator.qml @@ -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 { diff --git a/src/ui/toolbar/ModeIndicator.qml b/src/ui/toolbar/ModeIndicator.qml index bb540ceec8be2a33982be59393e2401f135bf399..618bafd2d17fe1cbbef1a14add26e2640e37d6a2 100644 --- a/src/ui/toolbar/ModeIndicator.qml +++ b/src/ui/toolbar/ModeIndicator.qml @@ -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() } diff --git a/src/ui/toolbar/RCRSSIIndicator.qml b/src/ui/toolbar/RCRSSIIndicator.qml index e86c5a209942507403792e329210d953f3f3313a..06ef1ae3c8618c22d871026bde912f70723ebdf1 100644 --- a/src/ui/toolbar/RCRSSIIndicator.qml +++ b/src/ui/toolbar/RCRSSIIndicator.qml @@ -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 } } diff --git a/src/ui/toolbar/TelemetryRSSIIndicator.qml b/src/ui/toolbar/TelemetryRSSIIndicator.qml index c4932acc5e0d2bcc5156ebd62ac2aea77013c006..ff0b012757442ea1f35621d67a3c8d093c804ee9 100644 --- a/src/ui/toolbar/TelemetryRSSIIndicator.qml +++ b/src/ui/toolbar/TelemetryRSSIIndicator.qml @@ -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 } } } } diff --git a/src/ui/toolbar/VTOLModeIndicator.qml b/src/ui/toolbar/VTOLModeIndicator.qml index 1e147d36c55dc3a9aab9da64eb45dfe021d1d684..2b0258fca7a1268829bf95ad7699bec270b008c2 100644 --- a/src/ui/toolbar/VTOLModeIndicator.qml +++ b/src/ui/toolbar/VTOLModeIndicator.qml @@ -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() } }