mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 12:55:31 +08:00
Ref T298, matching setup changed signal in contexts/matcher
This commit is contained in:
@@ -50,6 +50,14 @@ namespace BlackCore
|
|||||||
CAircraftMatcher::~CAircraftMatcher()
|
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(
|
CAirlineIcaoCode CAircraftMatcher::failoverValidAirlineIcaoDesignator(
|
||||||
const CCallsign &callsign, const QString &primaryIcao, const QString &secondaryIcao,
|
const CCallsign &callsign, const QString &primaryIcao, const QString &secondaryIcao,
|
||||||
bool airlineFromCallsign, bool useWebServices, CStatusMessageList *log)
|
bool airlineFromCallsign, bool useWebServices, CStatusMessageList *log)
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace BlackCore
|
|||||||
virtual ~CAircraftMatcher();
|
virtual ~CAircraftMatcher();
|
||||||
|
|
||||||
//! Set the setup
|
//! Set the setup
|
||||||
void setSetup(const BlackMisc::Simulation::CAircraftMatcherSetup &setup) { m_setup = setup; }
|
bool setSetup(const BlackMisc::Simulation::CAircraftMatcherSetup &setup);
|
||||||
|
|
||||||
//! Get the setup
|
//! Get the setup
|
||||||
BlackMisc::Simulation::CAircraftMatcherSetup getSetup() const { return m_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
|
//! 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);
|
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:
|
private:
|
||||||
//! The search based implementation
|
//! 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);
|
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);
|
||||||
|
|||||||
@@ -98,6 +98,9 @@ namespace BlackCore
|
|||||||
//! Setup changed
|
//! Setup changed
|
||||||
void interpolationAndRenderingSetupChanged();
|
void interpolationAndRenderingSetupChanged();
|
||||||
|
|
||||||
|
//! Matching setup changed
|
||||||
|
void matchingSetupChanged();
|
||||||
|
|
||||||
//! Model set ready or changed
|
//! Model set ready or changed
|
||||||
void modelSetChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
void modelSetChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ namespace BlackCore
|
|||||||
this->restoreSimulatorPlugins();
|
this->restoreSimulatorPlugins();
|
||||||
|
|
||||||
connect(&m_weatherManager, &CWeatherManager::weatherGridReceived, this, &CContextSimulator::weatherGridReceived);
|
connect(&m_weatherManager, &CWeatherManager::weatherGridReceived, this, &CContextSimulator::weatherGridReceived);
|
||||||
|
connect(&m_aircraftMatcher, &CAircraftMatcher::setupChanged, this, &CContextSimulator::matchingSetupChanged);
|
||||||
connect(&CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance(), &CCentralMultiSimulatorModelSetCachesProvider::cacheChanged, this, &CContextSimulator::modelSetChanged);
|
connect(&CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance(), &CCentralMultiSimulatorModelSetCachesProvider::cacheChanged, this, &CContextSimulator::modelSetChanged);
|
||||||
|
|
||||||
// deferred init of last model set, if no other data are set in meantime
|
// deferred init of last model set, if no other data are set in meantime
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ namespace BlackCore
|
|||||||
s = connection.connect(serviceName, IContextSimulator::ObjectPath(), IContextSimulator::InterfaceName(),
|
s = connection.connect(serviceName, IContextSimulator::ObjectPath(), IContextSimulator::InterfaceName(),
|
||||||
"interpolationAndRenderingSetupChanged", this, SIGNAL(interpolationAndRenderingSetupChanged()));
|
"interpolationAndRenderingSetupChanged", this, SIGNAL(interpolationAndRenderingSetupChanged()));
|
||||||
Q_ASSERT(s);
|
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(),
|
s = connection.connect(serviceName, IContextSimulator::ObjectPath(), IContextSimulator::InterfaceName(),
|
||||||
"simulatorPluginChanged", this, SIGNAL(simulatorPluginChanged(BlackMisc::Simulation::CSimulatorPluginInfo)));
|
"simulatorPluginChanged", this, SIGNAL(simulatorPluginChanged(BlackMisc::Simulation::CSimulatorPluginInfo)));
|
||||||
Q_ASSERT(s);
|
Q_ASSERT(s);
|
||||||
@@ -258,6 +261,11 @@ namespace BlackCore
|
|||||||
return m_dBusInterface->callDBusRet<bool>(QLatin1String("parseCommandLine"), commandLine, originator);
|
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
|
CMatchingStatistics CContextSimulatorProxy::getCurrentMatchingStatistics(bool missingOnly) const
|
||||||
{
|
{
|
||||||
return m_dBusInterface->callDBusRet<CMatchingStatistics>(QLatin1String("getCurrentMatchingStatistics"), missingOnly);
|
return m_dBusInterface->callDBusRet<CMatchingStatistics>(QLatin1String("getCurrentMatchingStatistics"), missingOnly);
|
||||||
|
|||||||
@@ -28,6 +28,12 @@ namespace BlackGui
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
connect(ui->pb_Save, &QPushButton::released, this, &CSettingsMatchingComponent::onSavePressed);
|
connect(ui->pb_Save, &QPushButton::released, this, &CSettingsMatchingComponent::onSavePressed);
|
||||||
connect(ui->pb_Reload, &QPushButton::released, this, &CSettingsMatchingComponent::onReloadPressed);
|
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);
|
this->deferredReload(5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,6 +53,13 @@ namespace BlackGui
|
|||||||
this->deferredReload(0);
|
this->deferredReload(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSettingsMatchingComponent::onSetupChanged()
|
||||||
|
{
|
||||||
|
const IContextSimulator *simContext = simulatorContext();
|
||||||
|
if (!simContext) { return; }
|
||||||
|
this->deferredReload(0);
|
||||||
|
}
|
||||||
|
|
||||||
void CSettingsMatchingComponent::deferredReload(int deferMs)
|
void CSettingsMatchingComponent::deferredReload(int deferMs)
|
||||||
{
|
{
|
||||||
if (deferMs < 1)
|
if (deferMs < 1)
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ namespace BlackGui
|
|||||||
//! Reload pressed
|
//! Reload pressed
|
||||||
void onReloadPressed();
|
void onReloadPressed();
|
||||||
|
|
||||||
|
//! Setup has been changed
|
||||||
|
void onSetupChanged();
|
||||||
|
|
||||||
//! Deferred reload
|
//! Deferred reload
|
||||||
void deferredReload(int deferMs);
|
void deferredReload(int deferMs);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user