77 *
88 ****************************************************************************/
99
10-
11- // / @file
12- // / @author Don Gagne <don@thegagnes.com>
13-
1410#include " AutoPilotPlugin.h"
15- #include " QGCApplication.h"
1611#include " FirmwarePlugin.h"
12+ #include " QGCApplication.h"
13+ #include " QGCLoggingCategory.h"
1714#include " Vehicle.h"
1815#include " VehicleComponent.h"
16+
1917#include < QtCore/QCoreApplication>
2018
21- AutoPilotPlugin::AutoPilotPlugin (Vehicle* vehicle, QObject* parent)
19+ QGC_LOGGING_CATEGORY (AutoPilotPluginLog, " qgc.autopilotplugin.autopilotplugin" );
20+
21+ AutoPilotPlugin::AutoPilotPlugin (Vehicle *vehicle, QObject *parent)
2222 : QObject(parent)
2323 , _vehicle(vehicle)
2424 , _firmwarePlugin(vehicle->firmwarePlugin ())
25- , _setupComplete(false )
2625{
27-
26+ // qCDebug(AutoPilotPluginLog) << Q_FUNC_INFO << this;
2827}
2928
3029AutoPilotPlugin::~AutoPilotPlugin ()
3130{
32-
31+ // qCDebug(AutoPilotPluginLog) << Q_FUNC_INFO << this;
3332}
3433
35- void AutoPilotPlugin::_recalcSetupComplete (void )
34+ void AutoPilotPlugin::_recalcSetupComplete ()
3635{
3736 bool newSetupComplete = true ;
3837
39- for (const QVariant& componentVariant: vehicleComponents ()) {
40- VehicleComponent* component = qobject_cast<VehicleComponent*>(qvariant_cast<QObject *>(componentVariant));
38+ for (const QVariant & componentVariant : vehicleComponents ()) {
39+ const VehicleComponent * const component = qobject_cast<const VehicleComponent*>(qvariant_cast<const QObject *>(componentVariant));
4140 if (component) {
4241 if (!component->setupComplete ()) {
4342 newSetupComplete = false ;
4443 break ;
4544 }
4645 } else {
47- qWarning ( ) << " AutoPilotPlugin::_recalcSetupComplete Incorrectly typed VehicleComponent" ;
46+ qCWarning (AutoPilotPluginLog ) << " Incorrectly typed VehicleComponent" ;
4847 }
4948 }
5049
@@ -54,22 +53,17 @@ void AutoPilotPlugin::_recalcSetupComplete(void)
5453 }
5554}
5655
57- bool AutoPilotPlugin::setupComplete (void ) const
58- {
59- return _setupComplete;
60- }
61-
62- void AutoPilotPlugin::parametersReadyPreChecks (void )
56+ void AutoPilotPlugin::parametersReadyPreChecks ()
6357{
6458 _recalcSetupComplete ();
6559
6660 // Connect signals in order to keep setupComplete up to date
67- for (QVariant componentVariant: vehicleComponents ()) {
68- VehicleComponent* component = qobject_cast<VehicleComponent*>(qvariant_cast<QObject *>(componentVariant));
61+ for (QVariant componentVariant : vehicleComponents ()) {
62+ VehicleComponent * const component = qobject_cast<VehicleComponent*>(qvariant_cast<QObject*>(componentVariant));
6963 if (component) {
70- connect (component, &VehicleComponent::setupCompleteChanged, this , &AutoPilotPlugin::_recalcSetupComplete);
64+ ( void ) connect (component, &VehicleComponent::setupCompleteChanged, this , &AutoPilotPlugin::_recalcSetupComplete);
7165 } else {
72- qWarning ( ) << " AutoPilotPlugin::_recalcSetupComplete Incorrectly typed VehicleComponent" ;
66+ qCWarning (AutoPilotPluginLog ) << " Incorrectly typed VehicleComponent" ;
7367 }
7468 }
7569
@@ -82,12 +76,12 @@ void AutoPilotPlugin::parametersReadyPreChecks(void)
8276 }
8377}
8478
85- VehicleComponent* AutoPilotPlugin::findKnownVehicleComponent (KnownVehicleComponent knownVehicleComponent)
79+ VehicleComponent * AutoPilotPlugin::findKnownVehicleComponent (KnownVehicleComponent knownVehicleComponent)
8680{
8781 if (knownVehicleComponent != UnknownVehicleComponent) {
88- for (const QVariant& componentVariant: vehicleComponents ()) {
89- VehicleComponent* component = qobject_cast<VehicleComponent*>(qvariant_cast<QObject *>(componentVariant));
90- if (component && component->KnownVehicleComponent () == knownVehicleComponent) {
82+ for (const QVariant & componentVariant: vehicleComponents ()) {
83+ VehicleComponent * const component = qobject_cast<VehicleComponent*>(qvariant_cast<QObject *>(componentVariant));
84+ if (component && ( component->KnownVehicleComponent () == knownVehicleComponent) ) {
9185 return component;
9286 }
9387 }
0 commit comments