refs #780, signal installedAircraftModelsChanged dangling

* discovered during testing, signal is not used (since we now use model set)
* renamed context signal to "modelSetChanged"
* prepared context for message settings
This commit is contained in:
Klaus Basan
2016-10-24 16:45:20 +02:00
parent f8c9782da4
commit 99538dd2c2
6 changed files with 29 additions and 12 deletions

View File

@@ -90,8 +90,8 @@ namespace BlackCore
//! Render restrictions have been changed //! Render restrictions have been changed
void renderRestrictionsChanged(bool restricted, bool enabled, int maxAircraft, const BlackMisc::PhysicalQuantities::CLength &maxRenderedDistance, const BlackMisc::PhysicalQuantities::CLength &maxRenderedBoundary); void renderRestrictionsChanged(bool restricted, bool enabled, int maxAircraft, const BlackMisc::PhysicalQuantities::CLength &maxRenderedDistance, const BlackMisc::PhysicalQuantities::CLength &maxRenderedBoundary);
//! Installed aircraft models ready or changed //! Model set ready or changed
void installedAircraftModelsChanged(); void modelSetChanged();
//! A single model has been matched for given aircraft //! A single model has been matched for given aircraft
void modelMatchingCompleted(const BlackMisc::Simulation::CSimulatedAircraft &aircraft); void modelMatchingCompleted(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);

View File

@@ -57,6 +57,9 @@ namespace BlackCore
connect(&m_weatherManager, &CWeatherManager::weatherGridReceived, this, &CContextSimulator::weatherGridReceived); connect(&m_weatherManager, &CWeatherManager::weatherGridReceived, this, &CContextSimulator::weatherGridReceived);
m_plugins->collectPlugins(); m_plugins->collectPlugins();
restoreSimulatorPlugins(); restoreSimulatorPlugins();
connect(&m_modelSetLoader, &CAircraftModelSetLoader::simulatorChanged, this, &CContextSimulator::ps_modelSetChanged);
connect(&m_modelSetLoader, &CAircraftModelSetLoader::cacheChanged, this, &CContextSimulator::ps_modelSetChanged);
} }
CContextSimulator *CContextSimulator::registerWithDBus(CDBusServer *server) CContextSimulator *CContextSimulator::registerWithDBus(CDBusServer *server)
@@ -358,17 +361,15 @@ namespace BlackCore
Q_ASSERT(c); Q_ASSERT(c);
c = connect(simulator, &ISimulator::aircraftRenderingChanged, this, &IContextSimulator::aircraftRenderingChanged); c = connect(simulator, &ISimulator::aircraftRenderingChanged, this, &IContextSimulator::aircraftRenderingChanged);
Q_ASSERT(c); Q_ASSERT(c);
c = connect(simulator, &ISimulator::installedAircraftModelsChanged, this, &IContextSimulator::installedAircraftModelsChanged);
Q_ASSERT(c);
c = connect(simulator, &ISimulator::renderRestrictionsChanged, this, &IContextSimulator::renderRestrictionsChanged); c = connect(simulator, &ISimulator::renderRestrictionsChanged, this, &IContextSimulator::renderRestrictionsChanged);
Q_ASSERT(c); Q_ASSERT(c);
c = connect(simulator, &ISimulator::airspaceSnapshotHandled, this, &IContextSimulator::airspaceSnapshotHandled); c = connect(simulator, &ISimulator::airspaceSnapshotHandled, this, &IContextSimulator::airspaceSnapshotHandled);
Q_ASSERT(c); Q_ASSERT(c);
// log from context to simulator // log from context to simulator
c = connect(CLogHandler::instance(), &CLogHandler::localMessageLogged, simulator, &ISimulator::displayStatusMessage); c = connect(CLogHandler::instance(), &CLogHandler::localMessageLogged, this, &CContextSimulator::ps_relayStatusMessageToSimulator);
Q_ASSERT(c); Q_ASSERT(c);
c = connect(CLogHandler::instance(), &CLogHandler::remoteMessageLogged, simulator, &ISimulator::displayStatusMessage); c = connect(CLogHandler::instance(), &CLogHandler::remoteMessageLogged, this, &CContextSimulator::ps_relayStatusMessageToSimulator);
Q_ASSERT(c); Q_ASSERT(c);
Q_UNUSED(c); Q_UNUSED(c);
@@ -525,6 +526,12 @@ namespace BlackCore
emit simulatorStatusChanged(status); emit simulatorStatusChanged(status);
} }
void CContextSimulator::ps_modelSetChanged(const CSimulatorInfo &simulator)
{
Q_UNUSED(simulator);
emit this->modelSetChanged();
}
void CContextSimulator::ps_textMessagesReceived(const Network::CTextMessageList &textMessages) void CContextSimulator::ps_textMessagesReceived(const Network::CTextMessageList &textMessages)
{ {
if (!isSimulatorSimulating()) { return; } if (!isSimulatorSimulating()) { return; }
@@ -563,6 +570,13 @@ namespace BlackCore
m_simulatorPlugin.second->updateOwnSimulatorCockpit(ownAircraft, originator); m_simulatorPlugin.second->updateOwnSimulatorCockpit(ownAircraft, originator);
} }
void CContextSimulator::ps_relayStatusMessageToSimulator(const BlackMisc::CStatusMessage &message)
{
if (!isSimulatorSimulating()) { return; }
//! \todo add settings and only relay messages as set in settings
m_simulatorPlugin.second->displayStatusMessage(message);
}
void CContextSimulator::restoreSimulatorPlugins() void CContextSimulator::restoreSimulatorPlugins()
{ {
stopSimulatorListeners(); stopSimulatorListeners();

View File

@@ -122,6 +122,9 @@ namespace BlackCore
//! Handle new connection status of simulator //! Handle new connection status of simulator
void ps_onSimulatorStatusChanged(int status); void ps_onSimulatorStatusChanged(int status);
//! Model set from model set loader changed
void ps_modelSetChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
//! Text message received //! Text message received
void ps_textMessagesReceived(const BlackMisc::Network::CTextMessageList &textMessages); void ps_textMessagesReceived(const BlackMisc::Network::CTextMessageList &textMessages);
@@ -141,10 +144,13 @@ namespace BlackCore
//! \remarks set by runtime, only to be used locally (not via DBus) //! \remarks set by runtime, only to be used locally (not via DBus)
void ps_updateSimulatorCockpitFromContext(const BlackMisc::Simulation::CSimulatedAircraft &ownAircraft, const BlackMisc::CIdentifier &originator); void ps_updateSimulatorCockpitFromContext(const BlackMisc::Simulation::CSimulatedAircraft &ownAircraft, const BlackMisc::CIdentifier &originator);
//! Relay status message to simulator under consideration of settings
void ps_relayStatusMessageToSimulator(const BlackMisc::CStatusMessage &message);
private:
//! Reads list of enabled simulators, starts listeners //! Reads list of enabled simulators, starts listeners
void restoreSimulatorPlugins(); void restoreSimulatorPlugins();
private:
//! Load plugin, if required start listeners before //! Load plugin, if required start listeners before
bool loadSimulatorPlugin(const BlackMisc::Simulation::CSimulatorPluginInfo &simulatorPluginInfo, bool withListeners); bool loadSimulatorPlugin(const BlackMisc::Simulation::CSimulatorPluginInfo &simulatorPluginInfo, bool withListeners);

View File

@@ -42,7 +42,7 @@ namespace BlackCore
"simulatorStatusChanged", this, SIGNAL(simulatorStatusChanged(int))); "simulatorStatusChanged", this, SIGNAL(simulatorStatusChanged(int)));
Q_ASSERT(s); Q_ASSERT(s);
s = connection.connect(serviceName, IContextSimulator::ObjectPath(), IContextSimulator::InterfaceName(), s = connection.connect(serviceName, IContextSimulator::ObjectPath(), IContextSimulator::InterfaceName(),
"installedAircraftModelsChanged", this, SIGNAL(installedAircraftModelsChanged())); "modelSetChanged", this, SIGNAL(modelSetChanged()));
Q_ASSERT(s); Q_ASSERT(s);
s = connection.connect(serviceName, IContextSimulator::ObjectPath(), IContextSimulator::InterfaceName(), s = connection.connect(serviceName, IContextSimulator::ObjectPath(), IContextSimulator::InterfaceName(),
"ownAircraftModelChanged", this, SIGNAL(ownAircraftModelChanged(BlackMisc::Simulation::CAircraftModel))); "ownAircraftModelChanged", this, SIGNAL(ownAircraftModelChanged(BlackMisc::Simulation::CAircraftModel)));

View File

@@ -191,9 +191,6 @@ namespace BlackCore
//! Aircraft rendering changed //! Aircraft rendering changed
void aircraftRenderingChanged(const BlackMisc::Simulation::CSimulatedAircraft &aircraft); void aircraftRenderingChanged(const BlackMisc::Simulation::CSimulatedAircraft &aircraft);
//! Installed aircraft models ready or changed
void installedAircraftModelsChanged();
//! An airspace snapshot was handled //! An airspace snapshot was handled
void airspaceSnapshotHandled(); void airspaceSnapshotHandled();

View File

@@ -51,7 +51,7 @@ namespace BlackGui
if (sGui->getIContextSimulator()) if (sGui->getIContextSimulator())
{ {
connect(sGui->getIContextSimulator(), &IContextSimulator::simulatorStatusChanged, this, &CInfoBarStatusComponent::ps_onSimulatorStatusChanged); connect(sGui->getIContextSimulator(), &IContextSimulator::simulatorStatusChanged, this, &CInfoBarStatusComponent::ps_onSimulatorStatusChanged);
connect(sGui->getIContextSimulator(), &IContextSimulator::installedAircraftModelsChanged, this, &CInfoBarStatusComponent::ps_onMapperReady); connect(sGui->getIContextSimulator(), &IContextSimulator::modelSetChanged, this, &CInfoBarStatusComponent::ps_onMapperReady);
// initial values // initial values
this->ps_onMapperReady(); this->ps_onMapperReady();