mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-25 10:15:43 +08:00
Ref T472, further utility functions for category handling
This commit is contained in:
committed by
Mat Sutcliffe
parent
c899bfbea7
commit
54adb40329
@@ -57,6 +57,13 @@ namespace BlackMisc
|
||||
return levels;
|
||||
}
|
||||
|
||||
QString CAircraftCategoryList::getLevelsString(const QString &separator) const
|
||||
{
|
||||
const QSet<QString> levels = this->getLevelStrings();
|
||||
if (levels.isEmpty()) {return {}; }
|
||||
return levels.toList().join(separator);
|
||||
}
|
||||
|
||||
QList<int> CAircraftCategoryList::getFirstLevels() const
|
||||
{
|
||||
QSet<int> levels;
|
||||
|
||||
@@ -55,6 +55,9 @@ namespace BlackMisc
|
||||
//! Get all level strings
|
||||
QSet<QString> getLevelStrings() const;
|
||||
|
||||
//! Get all level strings
|
||||
QString getLevelsString(const QString &separator = ", ") const;
|
||||
|
||||
//! All levels sorted
|
||||
QList<int> getFirstLevels() const;
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ namespace BlackMisc
|
||||
this->removeIf(&CAircraftIcaoCode::isDbDuplicate, true);
|
||||
}
|
||||
|
||||
QStringList CAircraftIcaoCodeList::toCompleterStrings(bool withIataCodes, bool withFamily, bool sort) const
|
||||
QStringList CAircraftIcaoCodeList::toCompleterStrings(bool withIataCodes, bool withFamily, bool withCategory, bool sort) const
|
||||
{
|
||||
QStringList c;
|
||||
CAircraftIcaoCodeList icaos(*this);
|
||||
@@ -225,7 +225,7 @@ namespace BlackMisc
|
||||
// 3 steps to get a proper sort order of the string list
|
||||
for (const CAircraftIcaoCode &icao : as_const(icaos))
|
||||
{
|
||||
c.append(icao.getCombinedIcaoStringWithKey());
|
||||
c.append(withCategory ? icao.getCombinedIcaoCategoryStringWithKey() : icao.getCombinedIcaoStringWithKey());
|
||||
}
|
||||
|
||||
if (withFamily)
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace BlackMisc
|
||||
void removeDuplicates();
|
||||
|
||||
//! For selection completion
|
||||
QStringList toCompleterStrings(bool withIataCodes = false, bool withFamily = false, bool sort = true) const;
|
||||
QStringList toCompleterStrings(bool withIataCodes = false, bool withFamily = false, bool withCategory = true, bool sort = true) const;
|
||||
|
||||
//! All ICAO codes, no duplicates
|
||||
QSet<QString> allDesignators(bool noUnspecified = true) const;
|
||||
|
||||
Reference in New Issue
Block a user