From df4043b5f14d3b12a87092ff5978f702e2dcb796 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 18 Jan 2016 16:27:54 -0200 Subject: [PATCH] Simplify creation of Plugin Members Signed-off-by: Tomaz Canabrava --- .../APM/APMAutoPilotPlugin.cc | 56 +++++-------------- 1 file changed, 14 insertions(+), 42 deletions(-) diff --git a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc index 418edb25e..97ae76277 100644 --- a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc +++ b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc @@ -70,64 +70,36 @@ const QVariantList& APMAutoPilotPlugin::vehicleComponents(void) if (parametersReady()) { _airframeComponent = new APMAirframeComponent(_vehicle, this); - if(_airframeComponent) { - _airframeComponent->setupTriggerSignals(); - _components.append(QVariant::fromValue((VehicleComponent*)_airframeComponent)); - } else { - qWarning() << "new APMAirframeComponent failed"; - } + _airframeComponent->setupTriggerSignals(); + _components.append(QVariant::fromValue((VehicleComponent*)_airframeComponent)); _cameraComponent = new APMCameraComponent(_vehicle, this); _cameraComponent->setupTriggerSignals(); _components.append(QVariant::fromValue((VehicleComponent*)_cameraComponent)); _flightModesComponent = new APMFlightModesComponent(_vehicle, this); - if (_flightModesComponent) { - _flightModesComponent->setupTriggerSignals(); - _components.append(QVariant::fromValue((VehicleComponent*)_flightModesComponent)); - } else { - qWarning() << "new APMFlightModesComponent failed"; - } + _flightModesComponent->setupTriggerSignals(); + _components.append(QVariant::fromValue((VehicleComponent*)_flightModesComponent)); _powerComponent = new APMPowerComponent(_vehicle, this); - if (_powerComponent) { - _powerComponent->setupTriggerSignals(); - _components.append(QVariant::fromValue((VehicleComponent*)_powerComponent)); - } else { - qWarning() << "new APMPowerComponent failed"; - } + _powerComponent->setupTriggerSignals(); + _components.append(QVariant::fromValue((VehicleComponent*)_powerComponent)); _radioComponent = new APMRadioComponent(_vehicle, this); - if (_radioComponent) { - _radioComponent->setupTriggerSignals(); - _components.append(QVariant::fromValue((VehicleComponent*)_radioComponent)); - } else { - qWarning() << "new APMRadioComponent failed"; - } + _radioComponent->setupTriggerSignals(); + _components.append(QVariant::fromValue((VehicleComponent*)_radioComponent)); _sensorsComponent = new APMSensorsComponent(_vehicle, this); - if (_sensorsComponent) { - _sensorsComponent->setupTriggerSignals(); - _components.append(QVariant::fromValue((VehicleComponent*)_sensorsComponent)); - } else { - qWarning() << "new APMSensorsComponent failed"; - } + _sensorsComponent->setupTriggerSignals(); + _components.append(QVariant::fromValue((VehicleComponent*)_sensorsComponent)); _safetyComponent = new APMSafetyComponent(_vehicle, this); - if (_safetyComponent) { - _safetyComponent->setupTriggerSignals(); - _components.append(QVariant::fromValue((VehicleComponent*)_safetyComponent)); - } else { - qWarning() << "new APMSafetyComponent failed"; - } + _safetyComponent->setupTriggerSignals(); + _components.append(QVariant::fromValue((VehicleComponent*)_safetyComponent)); _tuningComponent = new APMTuningComponent(_vehicle, this); - if (_tuningComponent) { - _tuningComponent->setupTriggerSignals(); - _components.append(QVariant::fromValue((VehicleComponent*)_tuningComponent)); - } else { - qWarning() << "new APMTuningComponent failed"; - } + _tuningComponent->setupTriggerSignals(); + _components.append(QVariant::fromValue((VehicleComponent*)_tuningComponent)); } else { qWarning() << "Call to vehicleCompenents prior to parametersReady"; } -- 2.22.0