Commit 0c384ff0 authored by DonLakeFlyer's avatar DonLakeFlyer

Fix AutoPilotPlugin::setupCompleteChanged signalling

parent f4f20bb0
......@@ -61,6 +61,17 @@ bool AutoPilotPlugin::setupComplete(void)
void AutoPilotPlugin::parametersReadyPreChecks(void)
{
_recalcSetupComplete();
// Connect signals in order to keep setupComplete up to date
foreach(const QVariant componentVariant, vehicleComponents()) {
VehicleComponent* component = qobject_cast<VehicleComponent*>(qvariant_cast<QObject *>(componentVariant));
if (component) {
connect(component, &VehicleComponent::setupCompleteChanged, this, &AutoPilotPlugin::_recalcSetupComplete);
} else {
qWarning() << "AutoPilotPlugin::_recalcSetupComplete Incorrectly typed VehicleComponent";
}
}
if (!_setupComplete) {
qgcApp()->showMessage(tr("One or more vehicle components require setup prior to flight."));
......
......@@ -66,7 +66,7 @@ protected:
FirmwarePlugin* _firmwarePlugin;
bool _setupComplete;
private:
private slots:
void _recalcSetupComplete(void);
};
......
......@@ -44,6 +44,7 @@ public:
const QVariantList& vehicleComponents(void) override;
void parametersReadyPreChecks(void) override;
QString prerequisiteSetup(VehicleComponent* component) const override;
protected:
bool _incorrectParameterVersion; ///< true: parameter version incorrect, setup not allowed
PX4AirframeLoader* _airframeFacts;
......@@ -58,6 +59,7 @@ protected:
MotorComponent* _motorComponent;
PX4TuningComponent* _tuningComponent;
SyslinkComponent* _syslinkComponent;
private:
QVariantList _components;
};
......
......@@ -56,7 +56,7 @@ public:
virtual void addSummaryQmlComponent(QQmlContext* context, QQuickItem* parent);
/// @brief Returns an list of parameter names for which a change should cause the setupCompleteChanged
/// signal to be emitted. Last element is signalled by NULL.
/// signal to be emitted.
virtual QStringList setupCompleteChangedTriggerList(void) const = 0;
/// Should be called after the component is created (but not in constructor) to setup the
......
......@@ -86,6 +86,7 @@ Rectangle {
text: setupComplete ?
qsTr("Below you will find a summary of the settings for your vehicle. To the left are the setup menus for each component.") :
qsTr("WARNING: Your vehicle requires setup prior to flight. Please resolve the items marked in red using the menu on the left.")
property bool setupComplete: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle.autopilot.setupComplete : false
}
......
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