Added "isWeatherActivated" based on the discussion with LT

This commit is contained in:
Klaus Basan
2019-02-27 21:55:39 +01:00
committed by Mat Sutcliffe
parent f98ba0e494
commit 6ca6d12851
8 changed files with 34 additions and 4 deletions

View File

@@ -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;

View File

@@ -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
{

View File

@@ -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);

View File

@@ -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;

View File

@@ -287,6 +287,11 @@ namespace BlackCore
return m_dBusInterface->callDBusRet<bool>(QLatin1String("resetToModelMatchingAircraft"), callsign);
}
bool CContextSimulatorProxy::isWeatherActivated() const
{
return m_dBusInterface->callDBusRet<bool>(QLatin1String("isWeatherActivated"));
}
void CContextSimulatorProxy::setWeatherActivated(bool activated)
{
m_dBusInterface->callDBus(QLatin1String("setWeatherActivated"), activated);

View File

@@ -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;