Ref T298, matching setup changed signal in contexts/matcher

This commit is contained in:
Klaus Basan
2018-08-08 20:46:20 +02:00
parent ac128eb786
commit 8f9cc645e9
7 changed files with 41 additions and 1 deletions

View File

@@ -50,6 +50,14 @@ namespace BlackCore
CAircraftMatcher::~CAircraftMatcher()
{ }
bool CAircraftMatcher::setSetup(const CAircraftMatcherSetup &setup)
{
if (m_setup == setup) { return false; }
m_setup = setup;
emit this->setupChanged();
return true;
}
CAirlineIcaoCode CAircraftMatcher::failoverValidAirlineIcaoDesignator(
const CCallsign &callsign, const QString &primaryIcao, const QString &secondaryIcao,
bool airlineFromCallsign, bool useWebServices, CStatusMessageList *log)

View File

@@ -55,7 +55,7 @@ namespace BlackCore
virtual ~CAircraftMatcher();
//! Set the setup
void setSetup(const BlackMisc::Simulation::CAircraftMatcherSetup &setup) { m_setup = setup; }
bool setSetup(const BlackMisc::Simulation::CAircraftMatcherSetup &setup);
//! Get the setup
BlackMisc::Simulation::CAircraftMatcherSetup getSetup() const { return m_setup; }
@@ -174,6 +174,10 @@ namespace BlackCore
//! Evaluate if a statistics entry makes sense and add it
void evaluateStatisticsEntry(const QString &sessionId, const BlackMisc::Aviation::CCallsign &callsign, const QString &aircraftIcao, const QString &airlineIcao, const QString &livery);
signals:
//! Setup changed
void setupChanged();
private:
//! The search based implementation
static BlackMisc::Simulation::CAircraftModel getClosestMatchStepwiseReduceImplementation(const BlackMisc::Simulation::CAircraftModelList &modelSet, const BlackMisc::Simulation::CAircraftMatcherSetup &setup, const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, const BlackMisc::Simulation::CAircraftModel &defaultModel, BlackMisc::CStatusMessageList *log = nullptr);

View File

@@ -98,6 +98,9 @@ namespace BlackCore
//! Setup changed
void interpolationAndRenderingSetupChanged();
//! Matching setup changed
void matchingSetupChanged();
//! Model set ready or changed
void modelSetChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);

View File

@@ -71,6 +71,7 @@ namespace BlackCore
this->restoreSimulatorPlugins();
connect(&m_weatherManager, &CWeatherManager::weatherGridReceived, this, &CContextSimulator::weatherGridReceived);
connect(&m_aircraftMatcher, &CAircraftMatcher::setupChanged, this, &CContextSimulator::matchingSetupChanged);
connect(&CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance(), &CCentralMultiSimulatorModelSetCachesProvider::cacheChanged, this, &CContextSimulator::modelSetChanged);
// deferred init of last model set, if no other data are set in meantime

View File

@@ -65,6 +65,9 @@ namespace BlackCore
s = connection.connect(serviceName, IContextSimulator::ObjectPath(), IContextSimulator::InterfaceName(),
"interpolationAndRenderingSetupChanged", this, SIGNAL(interpolationAndRenderingSetupChanged()));
Q_ASSERT(s);
s = connection.connect(serviceName, IContextSimulator::ObjectPath(), IContextSimulator::InterfaceName(),
"matchingSetupChanged", this, SIGNAL(matchingSetupChanged()));
Q_ASSERT(s);
s = connection.connect(serviceName, IContextSimulator::ObjectPath(), IContextSimulator::InterfaceName(),
"simulatorPluginChanged", this, SIGNAL(simulatorPluginChanged(BlackMisc::Simulation::CSimulatorPluginInfo)));
Q_ASSERT(s);
@@ -258,6 +261,11 @@ namespace BlackCore
return m_dBusInterface->callDBusRet<bool>(QLatin1String("parseCommandLine"), commandLine, originator);
}
bool CContextSimulatorProxy::doMappingAgain(const CCallsign &callsign)
{
return m_dBusInterface->callDBusRet<bool>(QLatin1String("doMappingAgain"), callsign);
}
CMatchingStatistics CContextSimulatorProxy::getCurrentMatchingStatistics(bool missingOnly) const
{
return m_dBusInterface->callDBusRet<CMatchingStatistics>(QLatin1String("getCurrentMatchingStatistics"), missingOnly);

View File

@@ -28,6 +28,12 @@ namespace BlackGui
ui->setupUi(this);
connect(ui->pb_Save, &QPushButton::released, this, &CSettingsMatchingComponent::onSavePressed);
connect(ui->pb_Reload, &QPushButton::released, this, &CSettingsMatchingComponent::onReloadPressed);
IContextSimulator *simContext = simulatorContext();
if (simContext)
{
connect(simContext, &IContextSimulator::matchingSetupChanged, this, &CSettingsMatchingComponent::onSetupChanged, Qt::QueuedConnection);
}
this->deferredReload(5000);
}
@@ -47,6 +53,13 @@ namespace BlackGui
this->deferredReload(0);
}
void CSettingsMatchingComponent::onSetupChanged()
{
const IContextSimulator *simContext = simulatorContext();
if (!simContext) { return; }
this->deferredReload(0);
}
void CSettingsMatchingComponent::deferredReload(int deferMs)
{
if (deferMs < 1)

View File

@@ -42,6 +42,9 @@ namespace BlackGui
//! Reload pressed
void onReloadPressed();
//! Setup has been changed
void onSetupChanged();
//! Deferred reload
void deferredReload(int deferMs);