mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 18:55:38 +08:00
Ref T509, utility function
This commit is contained in:
committed by
Mat Sutcliffe
parent
66c2059538
commit
c67ca53aa1
@@ -388,6 +388,24 @@ namespace BlackMisc
|
|||||||
return modelStrings;
|
return modelStrings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QMap<CDistributor, int> CAircraftModelList::countPerDistributor() const
|
||||||
|
{
|
||||||
|
QMap<CDistributor, int> distributors;
|
||||||
|
for (const CAircraftModel &model : *this)
|
||||||
|
{
|
||||||
|
if (!model.hasDistributor()) { continue; }
|
||||||
|
if (distributors.contains(model.getDistributor()))
|
||||||
|
{
|
||||||
|
distributors[model.getDistributor()]++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
distributors[model.getDistributor()] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return distributors;
|
||||||
|
}
|
||||||
|
|
||||||
QString CAircraftModelList::findModelIconPathByModelString(const QString &modelString) const
|
QString CAircraftModelList::findModelIconPathByModelString(const QString &modelString) const
|
||||||
{
|
{
|
||||||
if (modelString.isEmpty()) { return {}; }
|
if (modelString.isEmpty()) { return {}; }
|
||||||
|
|||||||
@@ -299,6 +299,9 @@ namespace BlackMisc
|
|||||||
//! Model strings plus count
|
//! Model strings plus count
|
||||||
QMap<QString, int> countPerModelString() const;
|
QMap<QString, int> countPerModelString() const;
|
||||||
|
|
||||||
|
//! Distributor plus count
|
||||||
|
QMap<BlackMisc::Simulation::CDistributor, int> countPerDistributor() const;
|
||||||
|
|
||||||
//! Which simulator(s) have the most entries?
|
//! Which simulator(s) have the most entries?
|
||||||
CSimulatorInfo simulatorsWithMaxEntries() const;
|
CSimulatorInfo simulatorsWithMaxEntries() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user