mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 21:15:33 +08:00
Ref T298, matching setup changed signal in contexts/matcher
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -42,6 +42,9 @@ namespace BlackGui
|
||||
//! Reload pressed
|
||||
void onReloadPressed();
|
||||
|
||||
//! Setup has been changed
|
||||
void onSetupChanged();
|
||||
|
||||
//! Deferred reload
|
||||
void deferredReload(int deferMs);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user