From 794200dc1a36e7d9ef13e79963953f8e61d52d38 Mon Sep 17 00:00:00 2001 From: DonLakeFlyer Date: Sun, 10 Dec 2017 05:10:18 -0800 Subject: [PATCH] Allows toolbarIndicators to signal change Needed to support different indicators for advanced mode --- src/FirmwarePlugin/FirmwarePlugin.h | 4 ++++ src/Vehicle/Vehicle.cc | 2 ++ src/Vehicle/Vehicle.h | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/FirmwarePlugin/FirmwarePlugin.h b/src/FirmwarePlugin/FirmwarePlugin.h index d549fdd65..353b4c79b 100644 --- a/src/FirmwarePlugin/FirmwarePlugin.h +++ b/src/FirmwarePlugin/FirmwarePlugin.h @@ -257,6 +257,7 @@ public: virtual QString vehicleImageCompass(const Vehicle* vehicle) const; /// Allows the core plugin to override the toolbar indicators + /// signals toolbarIndicatorsChanged /// @return A list of QUrl with the indicators (see MainToolBarIndicators.qml) virtual const QVariantList& toolBarIndicators(const Vehicle* vehicle); @@ -298,6 +299,9 @@ public: // FIXME: Hack workaround for non pluginize FollowMe support static const QString px4FollowMeFlightMode; +signals: + void toolbarIndicatorsChanged(void); + protected: // Arms the vehicle with validation and retries // @return: true - vehicle armed, false - vehicle failed to arm diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index 99b8ba000..549811204 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -357,6 +357,8 @@ void Vehicle::_commonInit(void) { _firmwarePlugin = _firmwarePluginManager->firmwarePluginForAutopilot(_firmwareType, _vehicleType); + connect(_firmwarePlugin, &FirmwarePlugin::toolbarIndicatorsChanged, this, &Vehicle::toolBarIndicatorsChanged); + connect(this, &Vehicle::coordinateChanged, this, &Vehicle::_updateDistanceToHome); connect(this, &Vehicle::homePositionChanged, this, &Vehicle::_updateDistanceToHome); connect(this, &Vehicle::hobbsMeterChanged, this, &Vehicle::_updateHobbsMeter); diff --git a/src/Vehicle/Vehicle.h b/src/Vehicle/Vehicle.h index e1ff02c72..0a8d762b4 100644 --- a/src/Vehicle/Vehicle.h +++ b/src/Vehicle/Vehicle.h @@ -314,7 +314,7 @@ public: Q_PROPERTY(unsigned int telemetryTXBuffer READ telemetryTXBuffer NOTIFY telemetryTXBufferChanged) Q_PROPERTY(int telemetryLNoise READ telemetryLNoise NOTIFY telemetryLNoiseChanged) Q_PROPERTY(int telemetryRNoise READ telemetryRNoise NOTIFY telemetryRNoiseChanged) - Q_PROPERTY(QVariantList toolBarIndicators READ toolBarIndicators CONSTANT) + Q_PROPERTY(QVariantList toolBarIndicators READ toolBarIndicators NOTIFY toolBarIndicatorsChanged) Q_PROPERTY(QmlObjectListModel* adsbVehicles READ adsbVehicles CONSTANT) Q_PROPERTY(bool initialPlanRequestComplete READ initialPlanRequestComplete NOTIFY initialPlanRequestCompleteChanged) Q_PROPERTY(QVariantList staticCameraList READ staticCameraList CONSTANT) @@ -745,6 +745,7 @@ signals: void capabilitiesKnownChanged(bool capabilitiesKnown); void initialPlanRequestCompleteChanged(bool initialPlanRequestComplete); void capabilityBitsChanged(uint64_t capabilityBits); + void toolBarIndicatorsChanged(void); void messagesReceivedChanged (); void messagesSentChanged (); -- 2.22.0