diff --git a/src/blackcore/context/contextsimulator.h b/src/blackcore/context/contextsimulator.h index 2d892ef12..cb2790d03 100644 --- a/src/blackcore/context/contextsimulator.h +++ b/src/blackcore/context/contextsimulator.h @@ -278,6 +278,9 @@ namespace BlackCore //! Reset model by matching it again virtual bool resetToModelMatchingAircraft(const BlackMisc::Aviation::CCallsign &callsign) = 0; + //! Is simulator weather activated or deactivated? + virtual bool isWeatherActivated() const = 0; + //! Activates or deactivates simulator weather virtual void setWeatherActivated(bool activated) = 0; diff --git a/src/blackcore/context/contextsimulatorempty.h b/src/blackcore/context/contextsimulatorempty.h index 94e27c3fa..14553b4aa 100644 --- a/src/blackcore/context/contextsimulatorempty.h +++ b/src/blackcore/context/contextsimulatorempty.h @@ -318,6 +318,13 @@ namespace BlackCore return false; } + //! \copydoc IContextSimulator::isWeatherActivated + virtual bool isWeatherActivated() const override + { + logEmptyContextWarning(Q_FUNC_INFO); + return false; + } + //! \copydoc IContextSimulator::setWeatherActivated virtual void setWeatherActivated(bool activated) override { diff --git a/src/blackcore/context/contextsimulatorimpl.cpp b/src/blackcore/context/contextsimulatorimpl.cpp index bc2949641..14e8aa32b 100644 --- a/src/blackcore/context/contextsimulatorimpl.cpp +++ b/src/blackcore/context/contextsimulatorimpl.cpp @@ -979,10 +979,15 @@ namespace BlackCore return true; } + bool CContextSimulator::isWeatherActivated() const + { + if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; } + if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return m_isWeatherActivated; } + return m_simulatorPlugin.second->isWeatherActivated(); + } + void CContextSimulator::setWeatherActivated(bool activated) { - m_isWeatherActivated = activated; - if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; } if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return; } m_simulatorPlugin.second->setWeatherActivated(activated); diff --git a/src/blackcore/context/contextsimulatorimpl.h b/src/blackcore/context/contextsimulatorimpl.h index 598cb8701..9f66e32b4 100644 --- a/src/blackcore/context/contextsimulatorimpl.h +++ b/src/blackcore/context/contextsimulatorimpl.h @@ -111,9 +111,10 @@ namespace BlackCore virtual bool followAircraft(const BlackMisc::Aviation::CCallsign &callsign) override; virtual void recalculateAllAircraft() override; virtual bool resetToModelMatchingAircraft(const BlackMisc::Aviation::CCallsign &callsign) override; + virtual bool isWeatherActivated() const override; virtual void setWeatherActivated(bool activated) override; virtual void requestWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid, const BlackMisc::CIdentifier &identifier) override; - virtual int doMatchingsAgain() override; + virtual int doMatchingsAgain() override; virtual bool doMatchingAgain(const BlackMisc::Aviation::CCallsign &callsign) override; virtual BlackMisc::CStatusMessageList getMatchingMessages(const BlackMisc::Aviation::CCallsign &callsign) const override; virtual bool isMatchingMessagesEnabled() const override; @@ -267,7 +268,7 @@ namespace BlackCore bool m_wasSimulating = false; bool m_initallyAddAircraft = false; bool m_enableMatchingMessages = true; - bool m_isWeatherActivated = false; + bool m_isWeatherActivated = false; // used to activate after plugin is loaded QString m_networkSessionId; //!< Network session of CServer::getServerSessionId, if not connected empty (for statistics, ..) BlackMisc::Simulation::CBackgroundValidation *m_validator = nullptr; diff --git a/src/blackcore/context/contextsimulatorproxy.cpp b/src/blackcore/context/contextsimulatorproxy.cpp index 6eda26bbe..5f5739527 100644 --- a/src/blackcore/context/contextsimulatorproxy.cpp +++ b/src/blackcore/context/contextsimulatorproxy.cpp @@ -287,6 +287,11 @@ namespace BlackCore return m_dBusInterface->callDBusRet(QLatin1String("resetToModelMatchingAircraft"), callsign); } + bool CContextSimulatorProxy::isWeatherActivated() const + { + return m_dBusInterface->callDBusRet(QLatin1String("isWeatherActivated")); + } + void CContextSimulatorProxy::setWeatherActivated(bool activated) { m_dBusInterface->callDBus(QLatin1String("setWeatherActivated"), activated); diff --git a/src/blackcore/context/contextsimulatorproxy.h b/src/blackcore/context/contextsimulatorproxy.h index 4bae6dad0..2630791f9 100644 --- a/src/blackcore/context/contextsimulatorproxy.h +++ b/src/blackcore/context/contextsimulatorproxy.h @@ -94,6 +94,7 @@ namespace BlackCore virtual bool followAircraft(const BlackMisc::Aviation::CCallsign &callsign) override; virtual void recalculateAllAircraft() override; virtual bool resetToModelMatchingAircraft(const BlackMisc::Aviation::CCallsign &callsign) override; + virtual bool isWeatherActivated() const override; virtual void setWeatherActivated(bool activated) override; virtual void requestWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid, const BlackMisc::CIdentifier &identifier) override; virtual BlackMisc::CStatusMessageList getMatchingMessages(const BlackMisc::Aviation::CCallsign &callsign) const override; diff --git a/src/blackcore/simulator.cpp b/src/blackcore/simulator.cpp index 53f696c46..45d326fe2 100644 --- a/src/blackcore/simulator.cpp +++ b/src/blackcore/simulator.cpp @@ -116,6 +116,11 @@ namespace BlackCore this->setUpdateAllRemoteAircraft(); } + bool ISimulator::isWeatherActivated() const + { + return m_isWeatherActivated; + } + void ISimulator::setWeatherActivated(bool activated) { m_isWeatherActivated = activated; diff --git a/src/blackcore/simulator.h b/src/blackcore/simulator.h index 17258cca0..beedbd5a4 100644 --- a/src/blackcore/simulator.h +++ b/src/blackcore/simulator.h @@ -177,6 +177,9 @@ namespace BlackCore //! Recalculate all aircraft virtual void recalculateAllAircraft(); + //! Weather activated + virtual bool isWeatherActivated() const ; + //! Activates or deactivates simulator weather virtual void setWeatherActivated(bool activated);