mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 12:55:31 +08:00
Ref T182, "private slots" -> "private" in model matcher component
This commit is contained in:
@@ -67,12 +67,12 @@ namespace BlackGui
|
|||||||
ui->le_Manufacturer->setValidator(validator);
|
ui->le_Manufacturer->setValidator(validator);
|
||||||
ui->le_Callsign->setValidator(validator);
|
ui->le_Callsign->setValidator(validator);
|
||||||
|
|
||||||
connect(ui->comp_SimulatorSelector, &CSimulatorSelector::changed, this, &CModelMatcherComponent::ps_simulatorChanged);
|
connect(ui->comp_SimulatorSelector, &CSimulatorSelector::changed, this, &CModelMatcherComponent::onSimulatorChanged);
|
||||||
connect(ui->pb_ModelMatching, &QPushButton::pressed, this, &CModelMatcherComponent::ps_testModelMatching);
|
connect(ui->pb_ModelMatching, &QPushButton::pressed, this, &CModelMatcherComponent::testModelMatching);
|
||||||
connect(ui->pb_ReverseLookup, &QPushButton::pressed, this, &CModelMatcherComponent::ps_reverseLookup);
|
connect(ui->pb_ReverseLookup, &QPushButton::pressed, this, &CModelMatcherComponent::reverseLookup);
|
||||||
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CModelMatcherComponent::ps_webDataRed);
|
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CModelMatcherComponent::onWebDataRed);
|
||||||
|
|
||||||
const CSimulatorInfo sim(this->m_modelSetLoader.getSimulator());
|
const CSimulatorInfo sim(m_modelSetLoader.getSimulator());
|
||||||
ui->comp_SimulatorSelector->setValue(sim);
|
ui->comp_SimulatorSelector->setValue(sim);
|
||||||
this->redisplay();
|
this->redisplay();
|
||||||
}
|
}
|
||||||
@@ -91,25 +91,25 @@ namespace BlackGui
|
|||||||
this->redisplay();
|
this->redisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CModelMatcherComponent::ps_simulatorChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator)
|
void CModelMatcherComponent::onSimulatorChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
|
||||||
this->m_modelSetLoader.changeSimulator(simulator);
|
m_modelSetLoader.changeSimulator(simulator);
|
||||||
this->m_matcher.setModelSet(this->m_modelSetLoader.getAircraftModels(), simulator);
|
m_matcher.setModelSet(m_modelSetLoader.getAircraftModels(), simulator);
|
||||||
this->redisplay();
|
this->redisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CModelMatcherComponent::ps_cacheChanged(CSimulatorInfo &simulator)
|
void CModelMatcherComponent::onCacheChanged(CSimulatorInfo &simulator)
|
||||||
{
|
{
|
||||||
Q_UNUSED(simulator);
|
Q_UNUSED(simulator);
|
||||||
this->redisplay();
|
this->redisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CModelMatcherComponent::ps_testModelMatching()
|
void CModelMatcherComponent::testModelMatching()
|
||||||
{
|
{
|
||||||
ui->te_Results->clear();
|
ui->te_Results->clear();
|
||||||
CStatusMessageList msgs;
|
CStatusMessageList msgs;
|
||||||
this->ps_simulatorChanged(ui->comp_SimulatorSelector->getValue()); // update model set to latest version
|
this->onSimulatorChanged(ui->comp_SimulatorSelector->getValue()); // update model set to latest version
|
||||||
CSimulatedAircraft remoteAircraft(createAircraft());
|
CSimulatedAircraft remoteAircraft(createAircraft());
|
||||||
if (ui->cb_withReverseLookup->isChecked())
|
if (ui->cb_withReverseLookup->isChecked())
|
||||||
{
|
{
|
||||||
@@ -118,17 +118,17 @@ namespace BlackGui
|
|||||||
remoteAircraft.setModel(reverseModel);
|
remoteAircraft.setModel(reverseModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->m_matcher.setDefaultModel(CModelMatcherComponent::defaultModel());
|
m_matcher.setDefaultModel(CModelMatcherComponent::defaultModel());
|
||||||
const CAircraftModel matched = this->m_matcher.getClosestMatch(remoteAircraft, &msgs); // test model matching
|
const CAircraftModel matched = m_matcher.getClosestMatch(remoteAircraft, &msgs); // test model matching
|
||||||
ui->te_Results->setText(matched.toQString(true));
|
ui->te_Results->setText(matched.toQString(true));
|
||||||
ui->tvp_ResultMessages->updateContainer(msgs);
|
ui->tvp_ResultMessages->updateContainer(msgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CModelMatcherComponent::ps_reverseLookup()
|
void CModelMatcherComponent::reverseLookup()
|
||||||
{
|
{
|
||||||
ui->te_Results->clear();
|
ui->te_Results->clear();
|
||||||
CStatusMessageList msgs;
|
CStatusMessageList msgs;
|
||||||
this->m_matcher.setDefaultModel(CModelMatcherComponent::defaultModel());
|
m_matcher.setDefaultModel(CModelMatcherComponent::defaultModel());
|
||||||
const CSimulatedAircraft remoteAircraft(createAircraft());
|
const CSimulatedAircraft remoteAircraft(createAircraft());
|
||||||
const QString livery(ui->comp_LiverySelector->getRawCombinedCode());
|
const QString livery(ui->comp_LiverySelector->getRawCombinedCode());
|
||||||
const CAircraftModel matched = CAircraftMatcher::reverseLookupModel(remoteAircraft.getModel(), livery, &msgs);
|
const CAircraftModel matched = CAircraftMatcher::reverseLookupModel(remoteAircraft.getModel(), livery, &msgs);
|
||||||
@@ -136,7 +136,7 @@ namespace BlackGui
|
|||||||
ui->tvp_ResultMessages->updateContainer(msgs);
|
ui->tvp_ResultMessages->updateContainer(msgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CModelMatcherComponent::ps_webDataRed(CEntityFlags::Entity entity, CEntityFlags::ReadState state, int number)
|
void CModelMatcherComponent::onWebDataRed(CEntityFlags::Entity entity, CEntityFlags::ReadState state, int number)
|
||||||
{
|
{
|
||||||
if (number > 0 && entity.testFlag(CEntityFlags::ModelEntity) && state == CEntityFlags::ReadFinished)
|
if (number > 0 && entity.testFlag(CEntityFlags::ModelEntity) && state == CEntityFlags::ReadFinished)
|
||||||
{
|
{
|
||||||
@@ -148,7 +148,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CModelMatcherComponent::redisplay()
|
void CModelMatcherComponent::redisplay()
|
||||||
{
|
{
|
||||||
const int c = this->m_modelSetLoader.getAircraftModelsCount();
|
const int c = m_modelSetLoader.getAircraftModelsCount();
|
||||||
ui->le_ModelSetCount->setText(QString::number(c));
|
ui->le_ModelSetCount->setText(QString::number(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,29 +43,28 @@ namespace BlackGui
|
|||||||
explicit CModelMatcherComponent(QWidget *parent = nullptr);
|
explicit CModelMatcherComponent(QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
~CModelMatcherComponent();
|
virtual ~CModelMatcherComponent();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
//! Tab where this is embedded has been changed
|
//! Tab (where this component is embedded) has been changed
|
||||||
void tabIndexChanged(int index);
|
void tabIndexChanged(int index);
|
||||||
|
|
||||||
private slots:
|
private:
|
||||||
//! Simulator switched
|
//! Simulator switched
|
||||||
void ps_simulatorChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
void onSimulatorChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||||
|
|
||||||
//! Cache changed
|
//! Cache changed
|
||||||
void ps_cacheChanged(BlackMisc::Simulation::CSimulatorInfo &simulator);
|
void onCacheChanged(BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||||
|
|
||||||
//! Run the matcher
|
|
||||||
void ps_testModelMatching();
|
|
||||||
|
|
||||||
//! Reverse lookup
|
|
||||||
void ps_reverseLookup();
|
|
||||||
|
|
||||||
//! Web data have been read
|
//! Web data have been read
|
||||||
void ps_webDataRed(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState state, int number);
|
void onWebDataRed(BlackMisc::Network::CEntityFlags::Entity entity, BlackMisc::Network::CEntityFlags::ReadState state, int number);
|
||||||
|
|
||||||
|
//! Run the matcher
|
||||||
|
void testModelMatching();
|
||||||
|
|
||||||
|
//! Reverse lookup
|
||||||
|
void reverseLookup();
|
||||||
|
|
||||||
private:
|
|
||||||
//! Init
|
//! Init
|
||||||
void redisplay();
|
void redisplay();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user