mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 00:16:51 +08:00
Add control button to activate and deactivate swift weather
- GUI changes - Context and ISimulator APIs - Refactored settings and static weather injection in CSimulatorCommon refs #807
This commit is contained in:
committed by
Mathew Sutcliffe
parent
2cea07f174
commit
1a6c7fa192
@@ -199,6 +199,9 @@ namespace BlackCore
|
||||
//! Reset model by matching it again
|
||||
virtual bool resetToModelMatchingAircraft(const BlackMisc::Aviation::CCallsign &callsign) = 0;
|
||||
|
||||
//! Activates or deactivates simulator weather
|
||||
virtual void setWeatherActivated(bool activated) = 0;
|
||||
|
||||
//! Request weather grid. Argument identifier is past in the signal to identify the requestor
|
||||
virtual void requestWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid, const BlackMisc::CIdentifier &identifier) = 0;
|
||||
|
||||
|
||||
@@ -185,6 +185,13 @@ namespace BlackCore
|
||||
return false;
|
||||
}
|
||||
|
||||
//! \copydoc IContextSimulator::setWeatherActivated
|
||||
virtual void setWeatherActivated(bool activated) override
|
||||
{
|
||||
Q_UNUSED(activated);
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
}
|
||||
|
||||
//! \copydoc IContextSimulator::requestWeatherGrid
|
||||
virtual void requestWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid, const BlackMisc::CIdentifier &identifier) override
|
||||
{
|
||||
|
||||
@@ -324,6 +324,8 @@ namespace BlackCore
|
||||
emit simulatorPluginChanged(simulatorPluginInfo);
|
||||
CLogMessage(this).info("Simulator plugin loaded: %1") << simulatorPluginInfo.toQString(true);
|
||||
|
||||
simulator->setWeatherActivated(m_isWeatherActivated);
|
||||
|
||||
m_matchingMessages.clear();
|
||||
return true;
|
||||
}
|
||||
@@ -646,6 +648,15 @@ namespace BlackCore
|
||||
return true;
|
||||
}
|
||||
|
||||
void CContextSimulator::setWeatherActivated(bool activated)
|
||||
{
|
||||
m_isWeatherActivated = activated;
|
||||
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (m_simulatorPlugin.first.isUnspecified()) { return; }
|
||||
m_simulatorPlugin.second->setWeatherActivated(activated);
|
||||
}
|
||||
|
||||
void CContextSimulator::requestWeatherGrid(const Weather::CWeatherGrid &weatherGrid, const CIdentifier &identifier)
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << identifier; }
|
||||
|
||||
@@ -96,6 +96,7 @@ namespace BlackCore
|
||||
virtual BlackMisc::CPixmap iconForModel(const QString &modelString) const override;
|
||||
virtual void highlightAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraftToHighlight, bool enableHighlight, const BlackMisc::PhysicalQuantities::CTime &displayTime) override;
|
||||
virtual bool resetToModelMatchingAircraft(const BlackMisc::Aviation::CCallsign &callsign) 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;
|
||||
virtual bool isMatchingMessagesEnabled() const override;
|
||||
@@ -207,6 +208,7 @@ namespace BlackCore
|
||||
bool m_initallyAddAircrafts = false;
|
||||
bool m_enableMatchingMessages = true;
|
||||
QString m_networkSessionId; //! Network session, if not connected empty
|
||||
bool m_isWeatherActivated = false;
|
||||
};
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -174,6 +174,11 @@ namespace BlackCore
|
||||
return m_dBusInterface->callDBusRet<bool>(QLatin1Literal("resetToModelMatchingAircraft"), callsign, callsign);
|
||||
}
|
||||
|
||||
void CContextSimulatorProxy::setWeatherActivated(bool activated)
|
||||
{
|
||||
m_dBusInterface->callDBus(QLatin1Literal("setWeatherActivated"), activated);
|
||||
}
|
||||
|
||||
void CContextSimulatorProxy::requestWeatherGrid(const Weather::CWeatherGrid &weatherGrid, const CIdentifier &identifier)
|
||||
{
|
||||
m_dBusInterface->callDBus(QLatin1Literal("requestWeatherGrid"), weatherGrid, identifier);
|
||||
|
||||
@@ -74,6 +74,7 @@ namespace BlackCore
|
||||
virtual BlackMisc::CPixmap iconForModel(const QString &modelString) const override;
|
||||
virtual void highlightAircraft(const BlackMisc::Simulation::CSimulatedAircraft &aircraftToHighlight, bool enableHighlight, const BlackMisc::PhysicalQuantities::CTime &displayTime) override;
|
||||
virtual bool resetToModelMatchingAircraft(const BlackMisc::Aviation::CCallsign &callsign) 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;
|
||||
virtual bool isMatchingMessagesEnabled() const override;
|
||||
|
||||
Reference in New Issue
Block a user