diff --git a/src/blackcore/context/contextnetworkimpl.cpp b/src/blackcore/context/contextnetworkimpl.cpp index 119950098..ff69e7675 100644 --- a/src/blackcore/context/contextnetworkimpl.cpp +++ b/src/blackcore/context/contextnetworkimpl.cpp @@ -437,7 +437,7 @@ namespace BlackCore emit this->connectionStatusChanged(from, to); } - void CContextNetwork::simulatorRenderRestrictionsChanged(bool restricted, bool enabled, int maxAircraft, const CLength &maxRenderedDistance) + void CContextNetwork::xCtxSimulatorRenderRestrictionsChanged(bool restricted, bool enabled, int maxAircraft, const CLength &maxRenderedDistance) { // mainly passing changed restrictions from simulator to network if (!m_airspace) { return; } diff --git a/src/blackcore/context/contextnetworkimpl.h b/src/blackcore/context/contextnetworkimpl.h index 0211df185..08c03e99c 100644 --- a/src/blackcore/context/contextnetworkimpl.h +++ b/src/blackcore/context/contextnetworkimpl.h @@ -235,7 +235,8 @@ namespace BlackCore //! Render restrictions have been changed, used with analyzer //! \sa CAirspaceAnalyzer - void simulatorRenderRestrictionsChanged(bool restricted, bool enabled, int maxAircraft, const BlackMisc::PhysicalQuantities::CLength &maxRenderedDistance); + //! \ingroup crosscontextslot + void xCtxSimulatorRenderRestrictionsChanged(bool restricted, bool enabled, int maxAircraft, const BlackMisc::PhysicalQuantities::CLength &maxRenderedDistance); }; } // ns } // ns diff --git a/src/blackcore/context/contextownaircraftimpl.cpp b/src/blackcore/context/contextownaircraftimpl.cpp index 1b104210e..975a46b64 100644 --- a/src/blackcore/context/contextownaircraftimpl.cpp +++ b/src/blackcore/context/contextownaircraftimpl.cpp @@ -322,7 +322,7 @@ namespace BlackCore if (this->getIContextAudio()) this->getIContextAudio()->setVoiceOutputVolume(outputVolume); } - void CContextOwnAircraft::changedAtcStationOnlineConnectionStatus(const CAtcStation &atcStation, bool connected) + void CContextOwnAircraft::xCtxChangedAtcStationOnlineConnectionStatus(const CAtcStation &atcStation, bool connected) { // any of our active frequencies? Q_UNUSED(connected); @@ -331,7 +331,7 @@ namespace BlackCore this->resolveVoiceRooms(); } - void CContextOwnAircraft::changedSimulatorModel(const CAircraftModel &model) + void CContextOwnAircraft::xCtxChangedSimulatorModel(const CAircraftModel &model) { this->updateOwnModel(model); } diff --git a/src/blackcore/context/contextownaircraftimpl.h b/src/blackcore/context/contextownaircraftimpl.h index f0e5d7d38..7ee59114a 100644 --- a/src/blackcore/context/contextownaircraftimpl.h +++ b/src/blackcore/context/contextownaircraftimpl.h @@ -185,11 +185,11 @@ namespace BlackCore //! Station has been changed, needed to tune in/out voice room //! \ingroup crosscontextslot - void changedAtcStationOnlineConnectionStatus(const BlackMisc::Aviation::CAtcStation &atcStation, bool connected); + void xCtxChangedAtcStationOnlineConnectionStatus(const BlackMisc::Aviation::CAtcStation &atcStation, bool connected); //! Simulator model has been changed //! \ingroup crosscontextslot - void changedSimulatorModel(const BlackMisc::Simulation::CAircraftModel &model); + void xCtxChangedSimulatorModel(const BlackMisc::Simulation::CAircraftModel &model); //! Web data loaded void allSwiftWebDataRead(); diff --git a/src/blackcore/context/contextsimulatorimpl.cpp b/src/blackcore/context/contextsimulatorimpl.cpp index 0ea379897..7b789781e 100644 --- a/src/blackcore/context/contextsimulatorimpl.cpp +++ b/src/blackcore/context/contextsimulatorimpl.cpp @@ -63,8 +63,8 @@ namespace BlackCore this->restoreSimulatorPlugins(); connect(&m_weatherManager, &CWeatherManager::weatherGridReceived, this, &CContextSimulator::weatherGridReceived); - connect(&m_modelSetLoader, &CAircraftModelSetLoader::simulatorChanged, this, &CContextSimulator::ps_modelSetChanged); - connect(&m_modelSetLoader, &CAircraftModelSetLoader::cacheChanged, this, &CContextSimulator::ps_modelSetChanged); + connect(&m_modelSetLoader, &CAircraftModelSetLoader::simulatorChanged, this, &CContextSimulator::modelSetChanged); + connect(&m_modelSetLoader, &CAircraftModelSetLoader::cacheChanged, this, &CContextSimulator::modelSetChanged); // deferred init of last model set, if no other data are set in meantime QTimer::singleShot(1250, this, &CContextSimulator::initByLastUsedModelSet); @@ -287,9 +287,9 @@ namespace BlackCore m_aircraftMatcher.setModelSet(m_modelSetLoader.getAircraftModels(), simInfo); m_aircraftMatcher.setDefaultModel(simulator->getDefaultModel()); - bool c = connect(simulator, &ISimulator::simulatorStatusChanged, this, &CContextSimulator::ps_onSimulatorStatusChanged); + bool c = connect(simulator, &ISimulator::simulatorStatusChanged, this, &CContextSimulator::onSimulatorStatusChanged); Q_ASSERT(c); - c = connect(simulator, &ISimulator::physicallyAddingRemoteModelFailed, this, &CContextSimulator::ps_addingRemoteAircraftFailed); + c = connect(simulator, &ISimulator::physicallyAddingRemoteModelFailed, this, &CContextSimulator::addingRemoteAircraftFailed); Q_ASSERT(c); c = connect(simulator, &ISimulator::ownAircraftModelChanged, this, &IContextSimulator::ownAircraftModelChanged); Q_ASSERT(c); @@ -301,9 +301,9 @@ namespace BlackCore Q_ASSERT(c); // log from context to simulator - c = connect(CLogHandler::instance(), &CLogHandler::localMessageLogged, this, &CContextSimulator::ps_relayStatusMessageToSimulator); + c = connect(CLogHandler::instance(), &CLogHandler::localMessageLogged, this, &CContextSimulator::relayStatusMessageToSimulator); Q_ASSERT(c); - c = connect(CLogHandler::instance(), &CLogHandler::remoteMessageLogged, this, &CContextSimulator::ps_relayStatusMessageToSimulator); + c = connect(CLogHandler::instance(), &CLogHandler::remoteMessageLogged, this, &CContextSimulator::relayStatusMessageToSimulator); Q_ASSERT(c); Q_UNUSED(c); @@ -352,7 +352,7 @@ namespace BlackCore { Q_ASSERT_X(!listener->parent(), Q_FUNC_INFO, "Objects with parent cannot be moved to thread"); - const bool c = connect(listener, &ISimulatorListener::simulatorStarted, this, &CContextSimulator::ps_simulatorStarted); + const bool c = connect(listener, &ISimulatorListener::simulatorStarted, this, &CContextSimulator::onSimulatorStarted); if (!c) { CLogMessage(this).error("Unable to use '%1'") << simulatorInfo.toQString(); @@ -406,7 +406,7 @@ namespace BlackCore } } - void CContextSimulator::ps_addedRemoteAircraft(const CSimulatedAircraft &remoteAircraft) + void CContextSimulator::xCtxAddedRemoteAircraft(const CSimulatedAircraft &remoteAircraft) { if (!isSimulatorSimulating()) { return; } const CCallsign callsign = remoteAircraft.getCallsign(); @@ -425,13 +425,13 @@ namespace BlackCore emit modelMatchingCompleted(remoteAircraft); } - void CContextSimulator::ps_removedRemoteAircraft(const CCallsign &callsign) + void CContextSimulator::xCtxRemovedRemoteAircraft(const CCallsign &callsign) { if (!isSimulatorSimulating()) { return; } m_simulatorPlugin.second->logicallyRemoveRemoteAircraft(callsign); } - void CContextSimulator::ps_onSimulatorStatusChanged(ISimulator::SimulatorStatus status) + void CContextSimulator::onSimulatorStatusChanged(ISimulator::SimulatorStatus status) { if (m_initallyAddAircrafts && status.testFlag(ISimulator::Simulating)) { @@ -445,7 +445,7 @@ namespace BlackCore for (const CSimulatedAircraft &simulatedAircraft : aircraft) { BLACK_VERIFY_X(!simulatedAircraft.getCallsign().isEmpty(), Q_FUNC_INFO, "Need callsign"); - ps_addedRemoteAircraft(simulatedAircraft); + xCtxAddedRemoteAircraft(simulatedAircraft); } m_initallyAddAircrafts = false; } @@ -458,13 +458,13 @@ namespace BlackCore emit simulatorStatusChanged(status); } - void CContextSimulator::ps_modelSetChanged(const CSimulatorInfo &simulator) + void CContextSimulator::onModelSetChanged(const CSimulatorInfo &simulator) { Q_UNUSED(simulator); emit this->modelSetChanged(); } - void CContextSimulator::ps_textMessagesReceived(const Network::CTextMessageList &textMessages) + void CContextSimulator::xCtxTextMessagesReceived(const Network::CTextMessageList &textMessages) { if (!isSimulatorSimulating()) { return; } if (!this->getIContextOwnAircraft()) { return; } @@ -477,26 +477,26 @@ namespace BlackCore } } - void CContextSimulator::ps_cockpitChangedFromSimulator(const CSimulatedAircraft &ownAircraft) + void CContextSimulator::onCockpitChangedFromSimulator(const CSimulatedAircraft &ownAircraft) { Q_ASSERT(getIContextOwnAircraft()); emit getIContextOwnAircraft()->changedAircraftCockpit(ownAircraft, IContextSimulator::InterfaceName()); } - void CContextSimulator::ps_changedRemoteAircraftModel(const CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator) + void CContextSimulator::xCtxChangedRemoteAircraftModel(const CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator) { if (CIdentifiable::isMyIdentifier(originator)) { return; } if (!isSimulatorSimulating()) { return; } m_simulatorPlugin.second->changeRemoteAircraftModel(aircraft); } - void CContextSimulator::ps_changedRemoteAircraftEnabled(const CSimulatedAircraft &aircraft) + void CContextSimulator::xCtxChangedRemoteAircraftEnabled(const CSimulatedAircraft &aircraft) { if (!isSimulatorSimulating()) { return; } m_simulatorPlugin.second->changeRemoteAircraftEnabled(aircraft); } - void CContextSimulator::ps_networkConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to) + void CContextSimulator::xCtxNetworkConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to) { Q_UNUSED(from); BLACK_VERIFY_X(getIContextNetwork(), Q_FUNC_INFO, "Missing network context"); @@ -512,13 +512,13 @@ namespace BlackCore } } - void CContextSimulator::ps_addingRemoteAircraftFailed(const CSimulatedAircraft &remoteAircraft, const CStatusMessage &message) + void CContextSimulator::addingRemoteAircraftFailed(const CSimulatedAircraft &remoteAircraft, const CStatusMessage &message) { if (!isSimulatorSimulating()) { return; } - emit addingRemoteModelFailed(remoteAircraft, message); + emit this->addingRemoteModelFailed(remoteAircraft, message); } - void CContextSimulator::ps_updateSimulatorCockpitFromContext(const CSimulatedAircraft &ownAircraft, const CIdentifier &originator) + void CContextSimulator::xCtxUpdateSimulatorCockpitFromContext(const CSimulatedAircraft &ownAircraft, const CIdentifier &originator) { if (!isSimulatorSimulating()) { return; } if (originator.getName().isEmpty() || originator == IContextSimulator::InterfaceName()) { return; } @@ -527,7 +527,7 @@ namespace BlackCore m_simulatorPlugin.second->updateOwnSimulatorCockpit(ownAircraft, originator); } - void CContextSimulator::ps_updateSimulatorSelcalFromContext(const CSelcal &selcal, const CIdentifier &originator) + void CContextSimulator::xCtxUpdateSimulatorSelcalFromContext(const CSelcal &selcal, const CIdentifier &originator) { if (!isSimulatorSimulating()) { return; } if (originator.getName().isEmpty() || originator == IContextSimulator::InterfaceName()) { return; } @@ -536,13 +536,13 @@ namespace BlackCore m_simulatorPlugin.second->updateOwnSimulatorSelcal(selcal, originator); } - void CContextSimulator::ps_networkRequestedNewAircraft(const CCallsign &callsign, const QString &aircraftIcao, const QString &airlineIcao, const QString &livery) + void CContextSimulator::xCtxNetworkRequestedNewAircraft(const CCallsign &callsign, const QString &aircraftIcao, const QString &airlineIcao, const QString &livery) { if (m_networkSessionId.isEmpty()) { return; } m_aircraftMatcher.evaluateStatisticsEntry(m_networkSessionId, callsign, aircraftIcao, airlineIcao, livery); } - void CContextSimulator::ps_relayStatusMessageToSimulator(const BlackMisc::CStatusMessage &message) + void CContextSimulator::relayStatusMessageToSimulator(const BlackMisc::CStatusMessage &message) { if (!isSimulatorSimulating()) { return; } const CSimulatorMessagesSettings simMsg = m_messageSettings.getThreadLocal(); @@ -676,7 +676,7 @@ namespace BlackCore CSimulatedAircraft aircraft = getAircraftInRangeForCallsign(callsign); if (aircraft.getCallsign() != callsign) { return false; } // not found aircraft.setModel(aircraft.getNetworkModel()); - ps_addedRemoteAircraft(aircraft); + xCtxAddedRemoteAircraft(aircraft); return true; } @@ -695,7 +695,7 @@ namespace BlackCore m_weatherManager.requestWeatherGrid(weatherGrid, identifier); } - void CContextSimulator::ps_simulatorStarted(const CSimulatorPluginInfo &info) + void CContextSimulator::onSimulatorStarted(const CSimulatorPluginInfo &info) { stopSimulatorListeners(); loadSimulatorPlugin(info); diff --git a/src/blackcore/context/contextsimulatorimpl.h b/src/blackcore/context/contextsimulatorimpl.h index 85f81f705..f27d2610c 100644 --- a/src/blackcore/context/contextsimulatorimpl.h +++ b/src/blackcore/context/contextsimulatorimpl.h @@ -117,7 +117,9 @@ namespace BlackCore //! @} //! \copydoc IContextSimulator::parseCommandLine virtual bool parseCommandLine(const QString &commandLine, const BlackMisc::CIdentifier &originator) override; + // ----------------------------- context interface ----------------------------- + public: //! Register dot commands static void registerHelp() { @@ -128,8 +130,6 @@ namespace BlackCore BlackMisc::CSimpleCommandParser::registerCommand({".ris parts on|off", "aircraft parts"}); } - // ----------------------------- context interface ----------------------------- - protected: //! Constructor CContextSimulator(CCoreFacadeConfig::ContextMode, CCoreFacade *runtime); @@ -137,59 +137,58 @@ namespace BlackCore //! Register myself in DBus CContextSimulator *registerWithDBus(BlackMisc::CDBusServer *server); - private slots: + private: // ------------ slots connected with network or other contexts --------- //! \ingroup crosscontextslot //! @{ //! Remote aircraft added - void ps_addedRemoteAircraft(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft); + void xCtxAddedRemoteAircraft(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft); //! Remove remote aircraft - void ps_removedRemoteAircraft(const BlackMisc::Aviation::CCallsign &callsign); + void xCtxRemovedRemoteAircraft(const BlackMisc::Aviation::CCallsign &callsign); //! Changed remote aircraft model - void ps_changedRemoteAircraftModel(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator); + void xCtxChangedRemoteAircraftModel(const BlackMisc::Simulation::CSimulatedAircraft &aircraft, const BlackMisc::CIdentifier &originator); //! Enable / disable aircraft - void ps_changedRemoteAircraftEnabled(const BlackMisc::Simulation::CSimulatedAircraft &aircraft); + void xCtxChangedRemoteAircraftEnabled(const BlackMisc::Simulation::CSimulatedAircraft &aircraft); //! Network connection status - void ps_networkConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to); + void xCtxNetworkConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to); //! 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 xCtxUpdateSimulatorCockpitFromContext(const BlackMisc::Simulation::CSimulatedAircraft &ownAircraft, const BlackMisc::CIdentifier &originator); //! Update simulator SELCAL from context, because someone else has changed cockpit (e.g. GUI, 3rd party) - void ps_updateSimulatorSelcalFromContext(const BlackMisc::Aviation::CSelcal &selcal, const BlackMisc::CIdentifier &originator); + void xCtxUpdateSimulatorSelcalFromContext(const BlackMisc::Aviation::CSelcal &selcal, const BlackMisc::CIdentifier &originator); //! Raw data when a new aircraft was requested, used for statistics - void ps_networkRequestedNewAircraft(const BlackMisc::Aviation::CCallsign &callsign, const QString &aircraftIcao, const QString &airlineIcao, const QString &livery); + void xCtxNetworkRequestedNewAircraft(const BlackMisc::Aviation::CCallsign &callsign, const QString &aircraftIcao, const QString &airlineIcao, const QString &livery); + + //! Text message received + void xCtxTextMessagesReceived(const BlackMisc::Network::CTextMessageList &textMessages); //! @} // ------------ slots connected with network or other contexts --------- //! Handle new connection status of simulator - void ps_onSimulatorStatusChanged(ISimulator::SimulatorStatus status); + void onSimulatorStatusChanged(ISimulator::SimulatorStatus status); //! Model set from model set loader changed - void ps_modelSetChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator); - - //! Text message received - void ps_textMessagesReceived(const BlackMisc::Network::CTextMessageList &textMessages); + void onModelSetChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator); //! Listener reports the simulator has started - void ps_simulatorStarted(const BlackMisc::Simulation::CSimulatorPluginInfo &info); + void onSimulatorStarted(const BlackMisc::Simulation::CSimulatorPluginInfo &info); //! Simulator has changed cockpit - void ps_cockpitChangedFromSimulator(const BlackMisc::Simulation::CSimulatedAircraft &ownAircraft); + void onCockpitChangedFromSimulator(const BlackMisc::Simulation::CSimulatedAircraft &ownAircraft); //! Failed adding remote aircraft - void ps_addingRemoteAircraftFailed(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, const BlackMisc::CStatusMessage &message); + void addingRemoteAircraftFailed(const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, const BlackMisc::CStatusMessage &message); //! Relay status message to simulator under consideration of settings - void ps_relayStatusMessageToSimulator(const BlackMisc::CStatusMessage &message); + void relayStatusMessageToSimulator(const BlackMisc::CStatusMessage &message); - private: //! Handle a change in enabled simulators void changeEnabledSimulators(); diff --git a/src/blackcore/corefacade.cpp b/src/blackcore/corefacade.cpp index f4f9e442c..78eaf5026 100644 --- a/src/blackcore/corefacade.cpp +++ b/src/blackcore/corefacade.cpp @@ -194,31 +194,31 @@ namespace BlackCore Q_ASSERT_X(this->getCContextNetwork()->airspace(), Q_FUNC_INFO, "No airspace object"); c = connect(m_contextNetwork, &IContextNetwork::textMessagesReceived, - this->getCContextSimulator(), &CContextSimulator::ps_textMessagesReceived); + this->getCContextSimulator(), &CContextSimulator::xCtxTextMessagesReceived); Q_ASSERT(c); // use readyForModelMatching instead of CAirspaceMonitor::addedAircraft, as it contains client information // ready for model matching is sent delayed when all information are available c = connect(m_contextNetwork, &IContextNetwork::readyForModelMatching, - this->getCContextSimulator(), &CContextSimulator::ps_addedRemoteAircraft); + this->getCContextSimulator(), &CContextSimulator::xCtxAddedRemoteAircraft); Q_ASSERT(c); c = connect(m_contextNetwork, &IContextNetwork::removedAircraft, - this->getCContextSimulator(), &CContextSimulator::ps_removedRemoteAircraft); + this->getCContextSimulator(), &CContextSimulator::xCtxRemovedRemoteAircraft); Q_ASSERT(c); c = connect(m_contextNetwork, &IContextNetwork::changedRemoteAircraftModel, - this->getCContextSimulator(), &CContextSimulator::ps_changedRemoteAircraftModel); + this->getCContextSimulator(), &CContextSimulator::xCtxChangedRemoteAircraftModel); Q_ASSERT(c); c = connect(m_contextNetwork, &IContextNetwork::changedRemoteAircraftEnabled, - this->getCContextSimulator(), &CContextSimulator::ps_changedRemoteAircraftEnabled); + this->getCContextSimulator(), &CContextSimulator::xCtxChangedRemoteAircraftEnabled); Q_ASSERT(c); c = connect(m_contextNetwork, &IContextNetwork::connectionStatusChanged, - this->getCContextSimulator(), &CContextSimulator::ps_networkConnectionStatusChanged); + this->getCContextSimulator(), &CContextSimulator::xCtxNetworkConnectionStatusChanged); Q_ASSERT(c); c = connect(this->getCContextNetwork()->airspace(), &CAirspaceMonitor::requestedNewAircraft, - this->getCContextSimulator(), &CContextSimulator::ps_networkRequestedNewAircraft); + this->getCContextSimulator(), &CContextSimulator::xCtxNetworkRequestedNewAircraft); Q_ASSERT(c); c = connect(this->getCContextSimulator(), &CContextSimulator::renderRestrictionsChanged, - this->getCContextNetwork(), &CContextNetwork::simulatorRenderRestrictionsChanged); + this->getCContextNetwork(), &CContextNetwork::xCtxSimulatorRenderRestrictionsChanged); Q_ASSERT(c); } @@ -226,13 +226,13 @@ namespace BlackCore if (m_contextOwnAircraft && m_contextOwnAircraft->isUsingImplementingObject()) { c = connect(m_contextOwnAircraft, &IContextOwnAircraft::changedAircraftCockpit, - this->getCContextSimulator(), &CContextSimulator::ps_updateSimulatorCockpitFromContext); + this->getCContextSimulator(), &CContextSimulator::xCtxUpdateSimulatorCockpitFromContext); Q_ASSERT(c); c = connect(m_contextOwnAircraft, &IContextOwnAircraft::changedSelcal, - this->getCContextSimulator(), &CContextSimulator::ps_updateSimulatorSelcalFromContext); + this->getCContextSimulator(), &CContextSimulator::xCtxUpdateSimulatorSelcalFromContext); Q_ASSERT(c); c = connect(this->getCContextSimulator(), &CContextSimulator::ownAircraftModelChanged, - this->getCContextOwnAircraft(), &CContextOwnAircraft::changedSimulatorModel); + this->getCContextOwnAircraft(), &CContextOwnAircraft::xCtxChangedSimulatorModel); Q_ASSERT(c); } @@ -245,7 +245,7 @@ namespace BlackCore if (m_contextNetwork && m_contextOwnAircraft && m_contextNetwork->isUsingImplementingObject() && m_contextOwnAircraft->isUsingImplementingObject()) { c = connect(m_contextNetwork, &IContextNetwork::changedAtcStationOnlineConnectionStatus, - this->getCContextOwnAircraft(), &CContextOwnAircraft::changedAtcStationOnlineConnectionStatus); + this->getCContextOwnAircraft(), &CContextOwnAircraft::xCtxChangedAtcStationOnlineConnectionStatus); Q_ASSERT(c); times.insert("Post setup, connects network", time.restart()); }