mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 00:16:51 +08:00
refs #748, add airport completers
* in flight plan * in login * utility functions
This commit is contained in:
@@ -21,7 +21,6 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Aviation
|
||||
{
|
||||
|
||||
CAirportList::CAirportList() { }
|
||||
|
||||
CAirportList::CAirportList(const CSequence<CAirport> &other) :
|
||||
@@ -44,11 +43,27 @@ namespace BlackMisc
|
||||
return this->findFirstByOrDefault(&CAirport::getIcao, icao, ifNotFound);
|
||||
}
|
||||
|
||||
QStringList CAirportList::allIcaoCodes(bool sorted) const
|
||||
{
|
||||
QStringList icaos;
|
||||
for (const CAirport &airport : *this)
|
||||
{
|
||||
if (!airport.getIcaoAsString().isEmpty())
|
||||
{
|
||||
icaos.push_back(airport.getIcaoAsString());
|
||||
}
|
||||
}
|
||||
if (sorted)
|
||||
{
|
||||
icaos.sort();
|
||||
}
|
||||
return icaos;
|
||||
}
|
||||
|
||||
void CAirportList::convertFromDatabaseJson(const QJsonArray &json)
|
||||
{
|
||||
clear();
|
||||
|
||||
for (const QJsonValue& value: json)
|
||||
for (const QJsonValue &value : json)
|
||||
{
|
||||
QJsonObject object = value.toObject();
|
||||
CAirport airport;
|
||||
@@ -56,6 +71,5 @@ namespace BlackMisc
|
||||
push_back(airport);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user