mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
Ref T701, reduce by airline name and/or telephony designator if possible
This commit is contained in:
committed by
Mat Sutcliffe
parent
53d637acb0
commit
cd63712cd7
@@ -190,6 +190,35 @@ namespace BlackMisc
|
||||
});
|
||||
}
|
||||
|
||||
CAircraftModelList CAircraftModelList::findByAirlineNameAndTelephonyDesignator(const QString &name, const QString &telephony, bool onlyIfExistInModel) const
|
||||
{
|
||||
return this->findBy([ & ](const CAircraftModel & model)
|
||||
{
|
||||
if (!model.hasAirlineDesignator() || !model.hasValidDbKey()) { return false; }
|
||||
const CAirlineIcaoCode &icao = model.getAirlineIcaoCode();
|
||||
if (!name.isEmpty() && (icao.hasName() || !onlyIfExistInModel))
|
||||
{
|
||||
if (!icao.getName().contains(name, Qt::CaseInsensitive)) { return false; }
|
||||
}
|
||||
|
||||
if (!telephony.isEmpty() && (icao.hasTelephonyDesignator() || !onlyIfExistInModel))
|
||||
{
|
||||
if (!icao.getTelephonyDesignator().contains(name, Qt::CaseInsensitive)) { return false; }
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
CAircraftModelList CAircraftModelList::findByAirlineNamesOrTelephonyDesignator(const QString &name) const
|
||||
{
|
||||
return this->findBy([ & ](const CAircraftModel & model)
|
||||
{
|
||||
if (!model.hasAirlineDesignator() || !model.hasValidDbKey()) { return false; }
|
||||
const CAirlineIcaoCode &icao = model.getAirlineIcaoCode();
|
||||
return icao.matchesNamesOrTelephonyDesignator(name);
|
||||
});
|
||||
}
|
||||
|
||||
CAircraftModelList CAircraftModelList::findByLiveryCode(const CLivery &livery) const
|
||||
{
|
||||
if (!livery.hasCombinedCode()) { return CAircraftModelList(); }
|
||||
|
||||
@@ -154,6 +154,12 @@ namespace BlackMisc
|
||||
//! Find by the corresponding airline group
|
||||
CAircraftModelList findByAirlineGroup(const BlackMisc::Aviation::CAirlineIcaoCode &airline) const;
|
||||
|
||||
//! Find by airline name and telephony
|
||||
CAircraftModelList findByAirlineNameAndTelephonyDesignator(const QString &name, const QString &telephony, bool onlyIfExistInModel = true) const;
|
||||
|
||||
//! Find by airline name and telephony, similar to CAirlineIcaoCodeList::findByNamesOrTelephonyDesignator
|
||||
CAircraftModelList findByAirlineNamesOrTelephonyDesignator(const QString &name) const;
|
||||
|
||||
//! Find by livery code
|
||||
CAircraftModelList findByLiveryCode(const Aviation::CLivery &livery) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user