Delay initial weather injection until simulator is connected

Up to know, the initial weather injection was done in the constructor
of ISimulator implementation. This was to early, since in the best case
the injection was not doing anything and in the worst case, crashed
the application because the plugin wasn't ready yet.
This change also replaces ps_reloadSettings with a specific non-slot
version to avoid code duplication.
This commit is contained in:
Roland Winklmeier
2016-08-13 13:38:11 +02:00
committed by Mathew Sutcliffe
parent e3fc72d775
commit 4e6c4a076a
6 changed files with 52 additions and 44 deletions

View File

@@ -99,9 +99,6 @@ namespace BlackSimPlugin
//! Process incoming FS9 message
void ps_processFs9Message(const QByteArray &message);
//! Reload settings
void ps_reloadSettings();
private:
//! Called when data about our own aircraft are received
@@ -112,6 +109,9 @@ namespace BlackSimPlugin
//! Inject weather grid to simulator
void injectWeatherGrid(const BlackMisc::Weather::CWeatherGrid &weatherGrid);
//! Reload Weather settings
void reloadWeatherSettings();
QHash<BlackMisc::Aviation::CCallsign, QPointer<CFs9Client>> m_hashFs9Clients;
QMetaObject::Connection m_connectionHostMessages;
int m_dispatchTimerId = -1;
@@ -120,7 +120,7 @@ namespace BlackSimPlugin
QSharedPointer<CLobbyClient> m_lobbyClient;
BlackMisc::Geo::CCoordinateGeodetic m_lastWeatherPosition; //!< Own aircraft position at which weather was fetched and injected last
BlackMisc::CSetting<BlackCore::Simulator::TSelectedWeatherScenario> m_weatherScenarioSettings { this, &CSimulatorFs9::ps_reloadSettings };
BlackMisc::CSetting<BlackCore::Simulator::TSelectedWeatherScenario> m_weatherScenarioSettings { this, &CSimulatorFs9::reloadWeatherSettings };
};
//! Listener for FS9