Ref T182, use enum instead of int in ps_networkConnectionStatusChanged

This commit is contained in:
Klaus Basan
2017-11-07 01:41:42 +01:00
parent ad31868a3a
commit 89db83f3c7
2 changed files with 9 additions and 9 deletions

View File

@@ -494,12 +494,11 @@ namespace BlackCore
m_simulatorPlugin.second->changeRemoteAircraftEnabled(aircraft); m_simulatorPlugin.second->changeRemoteAircraftEnabled(aircraft);
} }
void CContextSimulator::ps_networkConnectionStatusChanged(int from, int to) void CContextSimulator::ps_networkConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to)
{ {
Q_UNUSED(from); Q_UNUSED(from);
BLACK_VERIFY_X(getIContextNetwork(), Q_FUNC_INFO, "Missing network context"); BLACK_VERIFY_X(getIContextNetwork(), Q_FUNC_INFO, "Missing network context");
const INetwork::ConnectionStatus statusTo = static_cast<INetwork::ConnectionStatus>(to); if (to == INetwork::Connected && this->getIContextNetwork())
if (statusTo == INetwork::Connected && this->getIContextNetwork())
{ {
m_networkSessionId = this->getIContextNetwork()->getConnectedServer().getServerSessionId(); m_networkSessionId = this->getIContextNetwork()->getConnectedServer().getServerSessionId();
} }
@@ -507,6 +506,7 @@ namespace BlackCore
{ {
m_networkSessionId.clear(); m_networkSessionId.clear();
m_aircraftMatcher.clearMatchingStatistics(); m_aircraftMatcher.clearMatchingStatistics();
m_matchingMessages.clear();
} }
} }

View File

@@ -155,7 +155,7 @@ namespace BlackCore
void ps_changedRemoteAircraftEnabled(const BlackMisc::Simulation::CSimulatedAircraft &aircraft); void ps_changedRemoteAircraftEnabled(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
//! Network connection status //! Network connection status
void ps_networkConnectionStatusChanged(int from, int to); void ps_networkConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to);
//! Update simulator cockpit from context, because someone else has changed cockpit (e.g. GUI, 3rd party) //! Update simulator cockpit from context, because someone else has changed cockpit (e.g. GUI, 3rd party)
void ps_updateSimulatorCockpitFromContext(const BlackMisc::Simulation::CSimulatedAircraft &ownAircraft, const BlackMisc::CIdentifier &originator); void ps_updateSimulatorCockpitFromContext(const BlackMisc::Simulation::CSimulatedAircraft &ownAircraft, const BlackMisc::CIdentifier &originator);
@@ -169,7 +169,7 @@ namespace BlackCore
// ------------ slots connected with network or other contexts --------- // ------------ slots connected with network or other contexts ---------
//! Handle new connection status of simulator //! Handle new connection status of simulator
void ps_onSimulatorStatusChanged(BlackCore::ISimulator::SimulatorStatus status); void ps_onSimulatorStatusChanged(ISimulator::SimulatorStatus status);
//! Model set from model set loader changed //! Model set from model set loader changed
void ps_modelSetChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator); void ps_modelSetChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
@@ -220,13 +220,13 @@ namespace BlackCore
QPair<BlackMisc::Simulation::CSimulatorPluginInfo, ISimulator *> m_simulatorPlugin; //!< Currently loaded simulator plugin QPair<BlackMisc::Simulation::CSimulatorPluginInfo, ISimulator *> m_simulatorPlugin; //!< Currently loaded simulator plugin
CPluginManagerSimulator *m_plugins = nullptr; CPluginManagerSimulator *m_plugins = nullptr;
BlackMisc::CRegularThread m_listenersThread; //!< waiting for plugin BlackMisc::CRegularThread m_listenersThread; //!< waiting for plugin
BlackCore::CWeatherManager m_weatherManager { this }; CWeatherManager m_weatherManager { this };
BlackCore::CAircraftMatcher m_aircraftMatcher; //!< Model matcher CAircraftMatcher m_aircraftMatcher; //!< Model matcher
BlackMisc::Simulation::CAircraftModelSetLoader m_modelSetLoader { this }; //!< load model set from caches BlackMisc::Simulation::CAircraftModelSetLoader m_modelSetLoader { this }; //!< load model set from caches
QMap<BlackMisc::Aviation::CCallsign, BlackMisc::CStatusMessageList> m_matchingMessages; QMap<BlackMisc::Aviation::CCallsign, BlackMisc::CStatusMessageList> m_matchingMessages;
BlackMisc::CSettingReadOnly<BlackMisc::Simulation::Settings::TSimulatorMessages> m_messageSettings { this }; //!< settings for messages BlackMisc::CSettingReadOnly<BlackMisc::Simulation::Settings::TSimulatorMessages> m_messageSettings { this }; //!< settings for messages
BlackMisc::CSettingReadOnly<BlackCore::Application::TEnabledSimulators> m_enabledSimulators { this, &CContextSimulator::changeEnabledSimulators }; BlackMisc::CSettingReadOnly<Application::TEnabledSimulators> m_enabledSimulators { this, &CContextSimulator::changeEnabledSimulators };
QString m_networkSessionId; //! Network session, if not connected empty QString m_networkSessionId; //! Network session of CServer, if not connected empty
bool m_initallyAddAircrafts = false; bool m_initallyAddAircrafts = false;
bool m_enableMatchingMessages = true; bool m_enableMatchingMessages = true;
bool m_isWeatherActivated = false; bool m_isWeatherActivated = false;