Skip to content

Commit 3520ce3

Browse files
committed
Add keyword search to VehicleConfig and Settings pages
- Add keywords to all SettingsUI.json and VehicleConfig.json files - Add keyword search/filter support to VehicleConfigView sidebar - Support translatable keywords via qgc-lupdate-json.py extraction - Add keyword support to config and settings QML generators - Split APM Safety into FlightSafety and Failsafes components - Create dedicated Failsafes summary QML files - Refactor FlightSafety summaries to exclude failsafe params - Rename VehicleComponent internals (_ensureSectionsCached, _sectionsCached) - Rename _safetyComponent to _flightSafetyComponent in APMAutoPilotPlugin - Remove orphaned hand-written QML superseded by generated versions - Fix AppSettings.qml pattern and lupdate empty string guard - Remove debug console.log from GeoFenceMapVisuals
1 parent 37f897f commit 3520ce3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1396
-3189
lines changed

src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
#include "APMPowerComponent.h"
1212
#include "APMRadioComponent.h"
1313
#include "APMRemoteSupportComponent.h"
14-
#include "APMSafetyComponent.h"
14+
#include "APMFailsafesComponent.h"
15+
#include "APMFlightSafetyComponent.h"
1516
#include "APMSensorsComponent.h"
1617
#include "APMSubFrameComponent.h"
1718
#include "APMTuningComponent.h"
@@ -105,9 +106,13 @@ const QVariantList &APMAutoPilotPlugin::vehicleComponents()
105106
_components.append(QVariant::fromValue(qobject_cast<VehicleComponent*>(_servoComponent)));
106107
}
107108

108-
_safetyComponent = new APMSafetyComponent(_vehicle, this);
109-
_safetyComponent->setupTriggerSignals();
110-
_components.append(QVariant::fromValue(qobject_cast<VehicleComponent*>(_safetyComponent)));
109+
_flightSafetyComponent = new APMFlightSafetyComponent(_vehicle, this);
110+
_flightSafetyComponent->setupTriggerSignals();
111+
_components.append(QVariant::fromValue(qobject_cast<VehicleComponent*>(_flightSafetyComponent)));
112+
113+
_failsafesComponent = new APMFailsafesComponent(_vehicle, this);
114+
_failsafesComponent->setupTriggerSignals();
115+
_components.append(QVariant::fromValue(qobject_cast<VehicleComponent*>(_failsafesComponent)));
111116

112117
#ifdef QT_DEBUG
113118
if ((qobject_cast<ArduCopterFirmwarePlugin*>(_vehicle->firmwarePlugin()) || qobject_cast<ArduRoverFirmwarePlugin*>(_vehicle->firmwarePlugin())) &&
@@ -192,7 +197,7 @@ QString APMAutoPilotPlugin::prerequisiteSetup(VehicleComponent *component) const
192197
requiresAirframeCheck = true;
193198
} else if (qobject_cast<const APMESCComponent*>(component)) {
194199
requiresAirframeCheck = true;
195-
} else if (qobject_cast<const APMSafetyComponent*>(component)) {
200+
} else if (qobject_cast<const APMFlightSafetyComponent*>(component)) {
196201
requiresAirframeCheck = true;
197202
} else if (qobject_cast<const APMTuningComponent*>(component)) {
198203
requiresAirframeCheck = true;

src/AutoPilotPlugins/APM/APMAutoPilotPlugin.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ class APMAirspeedComponent;
88
class APMFlightModesComponent;
99
class APMRadioComponent;
1010
class APMTuningComponent;
11-
class APMSafetyComponent;
11+
class APMFailsafesComponent;
12+
class APMFlightSafetyComponent;
1213
class APMSensorsComponent;
1314
class APMESCComponent;
1415
class APMPowerComponent;
@@ -52,7 +53,8 @@ class APMAutoPilotPlugin : public AutoPilotPlugin
5253
APMESCComponent *_escComponent = nullptr;
5354
APMMotorComponent *_motorComponent = nullptr;
5455
APMRadioComponent *_radioComponent = nullptr;
55-
APMSafetyComponent *_safetyComponent = nullptr;
56+
APMFailsafesComponent *_failsafesComponent = nullptr;
57+
APMFlightSafetyComponent *_flightSafetyComponent = nullptr;
5658
APMSensorsComponent *_sensorsComponent = nullptr;
5759
APMTuningComponent *_tuningComponent = nullptr;
5860
ESP8266Component *_esp8266Component = nullptr;
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#include "APMFailsafesComponent.h"
2+
#include "Vehicle.h"
3+
#include "QGCMAVLink.h"
4+
5+
APMFailsafesComponent::APMFailsafesComponent(Vehicle *vehicle, AutoPilotPlugin *autopilot, QObject *parent)
6+
: VehicleComponent(vehicle, autopilot, AutoPilotPlugin::UnknownVehicleComponent, parent)
7+
{
8+
9+
}
10+
11+
QString APMFailsafesComponent::vehicleConfigJson() const
12+
{
13+
return QStringLiteral(":/qml/QGroundControl/AutoPilotPlugins/APM/VehicleConfig/APMFailsafes.VehicleConfig.json");
14+
}
15+
16+
QString APMFailsafesComponent::description() const
17+
{
18+
switch (_vehicle->vehicleType()) {
19+
case MAV_TYPE_SUBMARINE:
20+
return tr("Configure failsafe actions and leak detection.");
21+
case MAV_TYPE_GROUND_ROVER:
22+
return tr("Configure battery, GCS, throttle, and EKF failsafes.");
23+
case MAV_TYPE_FIXED_WING:
24+
return tr("Configure battery, GCS, and throttle failsafes.");
25+
default:
26+
return tr("Configure battery, GCS, RC, throttle, EKF, and dead reckoning failsafes.");
27+
}
28+
}
29+
30+
QUrl APMFailsafesComponent::setupSource() const
31+
{
32+
switch (_vehicle->vehicleType()) {
33+
case MAV_TYPE_SUBMARINE:
34+
case MAV_TYPE_FIXED_WING:
35+
case MAV_TYPE_QUADROTOR:
36+
case MAV_TYPE_COAXIAL:
37+
case MAV_TYPE_HELICOPTER:
38+
case MAV_TYPE_HEXAROTOR:
39+
case MAV_TYPE_OCTOROTOR:
40+
case MAV_TYPE_TRICOPTER:
41+
case MAV_TYPE_GROUND_ROVER:
42+
return QUrl::fromUserInput(QStringLiteral("qrc:/qml/QGroundControl/AutoPilotPlugins/APM/APMFailsafesComponent.qml"));
43+
default:
44+
return QUrl::fromUserInput(QStringLiteral("qrc:/qml/QGroundControl/AutoPilotPlugins/APM/APMNotSupported.qml"));
45+
}
46+
}
47+
48+
QUrl APMFailsafesComponent::summaryQmlSource() const
49+
{
50+
switch (_vehicle->vehicleType()) {
51+
case MAV_TYPE_SUBMARINE:
52+
return QUrl::fromUserInput(QStringLiteral("qrc:/qml/QGroundControl/AutoPilotPlugins/APM/APMFailsafesComponentSummarySub.qml"));
53+
case MAV_TYPE_FIXED_WING:
54+
case MAV_TYPE_QUADROTOR:
55+
case MAV_TYPE_COAXIAL:
56+
case MAV_TYPE_HELICOPTER:
57+
case MAV_TYPE_HEXAROTOR:
58+
case MAV_TYPE_OCTOROTOR:
59+
case MAV_TYPE_TRICOPTER:
60+
case MAV_TYPE_GROUND_ROVER:
61+
return QUrl::fromUserInput(QStringLiteral("qrc:/qml/QGroundControl/AutoPilotPlugins/APM/APMFailsafesComponentSummary.qml"));
62+
default:
63+
return QUrl();
64+
}
65+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#pragma once
2+
3+
#include "VehicleComponent.h"
4+
5+
class APMFailsafesComponent : public VehicleComponent
6+
{
7+
Q_OBJECT
8+
9+
public:
10+
explicit APMFailsafesComponent(Vehicle *vehicle, AutoPilotPlugin *autopilot, QObject *parent = nullptr);
11+
12+
QStringList setupCompleteChangedTriggerList() const final { return QStringList(); }
13+
14+
QString name() const final { return _name; }
15+
QString description() const final;
16+
QString vehicleConfigJson() const final;
17+
QString iconResource() const final { return QStringLiteral("/qmlimages/SafetyComponentIcon.png"); }
18+
bool requiresSetup() const final { return false; }
19+
bool setupComplete() const final { return true; }
20+
QUrl setupSource() const final;
21+
QUrl summaryQmlSource() const final;
22+
bool allowSetupWhileArmed() const final { return true; }
23+
bool allowSetupWhileFlying() const final { return true; }
24+
25+
private:
26+
const QString _name = tr("Failsafes");
27+
};

src/AutoPilotPlugins/APM/APMSafetyComponentSummary.qml renamed to src/AutoPilotPlugins/APM/APMFailsafesComponentSummary.qml

Lines changed: 2 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,10 @@ import QGroundControl.Controls
99
Item {
1010
implicitWidth: mainLayout.implicitWidth
1111
implicitHeight: mainLayout.implicitHeight
12-
width: parent.width // grows when Loader is wider than implicitWidth
12+
width: parent.width
1313

1414
FactPanelController { id: controller; }
1515

16-
property Fact _copterFenceAction: controller.getParameterFact(-1, "FENCE_ACTION", false /* reportMissing */)
17-
property Fact _copterFenceEnable: controller.getParameterFact(-1, "FENCE_ENABLE", false /* reportMissing */)
18-
property Fact _copterFenceType: controller.getParameterFact(-1, "FENCE_TYPE", false /* reportMissing */)
19-
2016
property Fact _batt1Monitor: controller.getParameterFact(-1, "BATT_MONITOR")
2117
property Fact _batt2Monitor: controller.getParameterFact(-1, "BATT2_MONITOR", false /* reportMissing */)
2218
property bool _batt2MonitorAvailable: controller.parameterExists(-1, "BATT2_MONITOR")
@@ -29,29 +25,12 @@ Item {
2925
property Fact _batt2FSCritAct: controller.getParameterFact(-1, "BATT2_FS_CRT_ACT", false /* reportMissing */)
3026
property bool _batt1FSCritActAvailable: controller.parameterExists(-1, "BATT_FS_CRT_ACT")
3127

32-
property bool _roverFirmware: controller.parameterExists(-1, "MODE1") // This catches all usage of ArduRover firmware vehicle types: Rover, Boat...
33-
28+
property bool _roverFirmware: controller.parameterExists(-1, "MODE1")
3429

3530
ColumnLayout {
3631
id: mainLayout
3732
spacing: 0
3833

39-
VehicleSummaryRow {
40-
labelText: qsTr("Arming Checks:")
41-
valueText: {
42-
if (_armingCheckFact) {
43-
return _armingCheckFact.value & 1 ? qsTr("Enabled") : qsTr("Some disabled")
44-
} else if (_armingSkipCheckFact) {
45-
return _armingSkipCheckFact.value === 0 ? qsTr("Enabled") : qsTr("Some disabled")
46-
}
47-
return ""
48-
}
49-
50-
// Older firmwares use ARMING_CHECK. Newer firmwares use ARMING_SKIPCHK.
51-
property Fact _armingCheckFact: controller.getParameterFact(-1, "ARMING_CHECK", false /* reportMissing */)
52-
property Fact _armingSkipCheckFact: controller.getParameterFact(-1, "ARMING_SKIPCHK", false /* reportMissing */)
53-
}
54-
5534
VehicleSummaryRow {
5635
labelText: qsTr("Throttle failsafe:")
5736
valueText: fact ? fact.enumStringValue : ""
@@ -115,50 +94,5 @@ Item {
11594
valueText: _batt2MonitorEnabled ? _batt2FSCritAct.enumStringValue : ""
11695
visible: _batt2MonitorEnabled
11796
}
118-
119-
VehicleSummaryRow {
120-
labelText: qsTr("GeoFence:")
121-
valueText: {
122-
if(_copterFenceEnable && _copterFenceType) {
123-
if(_copterFenceEnable.value == 0 || _copterFenceType == 0) {
124-
return qsTr("Disabled")
125-
} else {
126-
if(_copterFenceType.value == 1) {
127-
return qsTr("Altitude")
128-
}
129-
if(_copterFenceType.value == 2) {
130-
return qsTr("Circle")
131-
}
132-
return qsTr("Altitude,Circle")
133-
}
134-
}
135-
return ""
136-
}
137-
visible: controller.vehicle.multiRotor
138-
}
139-
140-
VehicleSummaryRow {
141-
labelText: qsTr("GeoFence:")
142-
valueText: _copterFenceAction.value == 0 ?
143-
qsTr("Report only") :
144-
(_copterFenceAction.value == 1 ? qsTr("RTL or Land") : qsTr("Unknown"))
145-
visible: controller.vehicle.multiRotor && _copterFenceEnable.value !== 0
146-
}
147-
148-
VehicleSummaryRow {
149-
labelText: qsTr("RTL min alt:")
150-
valueText: fact ? (fact.value == 0 ? qsTr("current") : fact.valueString + " " + fact.units) : ""
151-
visible: controller.vehicle.multiRotor
152-
153-
property Fact fact: controller.getParameterFact(-1, "RTL_ALT_M", false /* reportMissing */)
154-
}
155-
156-
VehicleSummaryRow {
157-
labelText: qsTr("RTL min alt:")
158-
valueText: fact ? (fact.value < 0 ? qsTr("current") : fact.valueString + " " + fact.units) : ""
159-
visible: controller.vehicle.fixedWing
160-
161-
property Fact fact: controller.getParameterFact(-1, "RTL_ALTITUDE", false /* reportMissing */)
162-
}
16397
}
16498
}

src/AutoPilotPlugins/APM/APMSafetyComponentSummarySub.qml renamed to src/AutoPilotPlugins/APM/APMFailsafesComponentSummarySub.qml

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,69 +6,41 @@ import QGroundControl.FactControls
66
import QGroundControl.Controls
77

88
Item {
9-
anchors.fill: parent
9+
anchors.fill: parent
1010

11-
property bool _firmware34: globals.activeVehicle.versionCompare(3, 5, 0) < 0
11+
property bool _firmware34: globals.activeVehicle.versionCompare(3, 5, 0) < 0
1212

1313
FactPanelController { id: controller; }
1414

15-
// Enable/Action parameters
1615
property Fact _failsafeBatteryEnable: controller.getParameterFact(-1, "BATT_FS_LOW_ACT", false)
1716
property Fact _failsafeEKFEnable: controller.getParameterFact(-1, "FS_EKF_ACTION")
1817
property Fact _failsafeGCSEnable: controller.getParameterFact(-1, "FS_GCS_ENABLE")
1918
property Fact _failsafeLeakEnable: controller.getParameterFact(-1, "FS_LEAK_ENABLE")
2019
property Fact _failsafePilotEnable: _firmware34 ? null : controller.getParameterFact(-1, "FS_PILOT_INPUT")
21-
property Fact _failsafePressureEnable: controller.getParameterFact(-1, "FS_PRESS_ENABLE")
2220
property Fact _failsafeTemperatureEnable: controller.getParameterFact(-1, "FS_TEMP_ENABLE")
23-
24-
// Threshold parameters
25-
property Fact _failsafePressureThreshold: controller.getParameterFact(-1, "FS_PRESS_MAX")
26-
property Fact _failsafeTemperatureThreshold: controller.getParameterFact(-1, "FS_TEMP_MAX")
27-
property Fact _failsafePilotTimeout: _firmware34 ? null : controller.getParameterFact(-1, "FS_PILOT_TIMEOUT")
28-
property Fact _failsafeLeakPin: controller.getParameterFact(-1, "LEAK1_PIN")
29-
property Fact _failsafeLeakLogic: controller.getParameterFact(-1, "LEAK1_LOGIC")
30-
property Fact _failsafeEKFThreshold: controller.getParameterFact(-1, "FS_EKF_THRESH")
31-
property Fact _failsafeBatteryVoltage: controller.getParameterFact(-1, "BATT_LOW_VOLT", false)
32-
property Fact _failsafeBatteryCapacity: controller.getParameterFact(-1, "BATT_LOW_MAH", false)
33-
34-
// Older firmwares use ARMING_CHECK. Newer firmwares use ARMING_SKIPCHK.
35-
property Fact _armingCheck: controller.getParameterFact(-1, "ARMING_CHECK", false /* reportMissing */)
36-
property Fact _armingSkipCheck: controller.getParameterFact(-1, "ARMING_SKIPCHK", false /* reportMissing */)
21+
property Fact _failsafePressureEnable: controller.getParameterFact(-1, "FS_PRESS_ENABLE")
3722

3823
Column {
39-
anchors.fill: parent
24+
anchors.fill: parent
4025

41-
VehicleSummaryRow {
42-
labelText: qsTr("Arming Checks:")
43-
valueText: {
44-
if (_armingCheck) {
45-
return _armingCheck.value & 1 ? qsTr("Enabled") : qsTr("Some disabled")
46-
} else if (_armingSkipCheck) {
47-
return _armingSkipCheck.value === 0 ? qsTr("Enabled") : qsTr("Some disabled")
48-
}
49-
return ""
50-
}
51-
}
5226
VehicleSummaryRow {
5327
labelText: qsTr("GCS failsafe:")
5428
valueText: _failsafeGCSEnable.enumOrValueString
5529
}
5630
VehicleSummaryRow {
5731
labelText: qsTr("Leak failsafe:")
58-
valueText: _failsafeLeakEnable.enumOrValueString
32+
valueText: _failsafeLeakEnable.enumOrValueString
5933
}
6034
VehicleSummaryRow {
6135
visible: !_firmware34
6236
labelText: qsTr("Battery failsafe:")
6337
valueText: {
64-
if(_firmware34) {
38+
if (_firmware34) {
6539
return "Firmware not supported"
6640
}
67-
6841
if (!_failsafeBatteryEnable) {
6942
return "Disabled"
7043
}
71-
7244
return _failsafeBatteryEnable.enumOrValueString
7345
}
7446
}
@@ -84,11 +56,11 @@ Item {
8456
}
8557
VehicleSummaryRow {
8658
labelText: qsTr("Int. Temperature failsafe:")
87-
valueText: _failsafeTemperatureEnable.enumOrValueString
59+
valueText: _failsafeTemperatureEnable.enumOrValueString
8860
}
8961
VehicleSummaryRow {
9062
labelText: qsTr("Int. Pressure failsafe:")
91-
valueText: _failsafePressureEnable.enumOrValueString
63+
valueText: _failsafePressureEnable.enumOrValueString
9264
}
9365
}
9466
}

0 commit comments

Comments
 (0)