mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 08:36:52 +08:00
refs #452, updated vPilot reader/sets
* Using ITimestampBased * removed mapping / unsing CAircraftModel * graceful shutdown in reader
This commit is contained in:
committed by
Mathew Sutcliffe
parent
fd8cd9a42a
commit
8dba22f7f0
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "vpilotmodelruleset.h"
|
||||
#include "blackmisc/predicates.h"
|
||||
#include <QStringList>
|
||||
|
||||
using namespace BlackMisc::Network;
|
||||
|
||||
@@ -42,16 +43,6 @@ namespace BlackMisc
|
||||
});
|
||||
}
|
||||
|
||||
CAircraftMappingList CVPilotModelRuleSet::toMappings() const
|
||||
{
|
||||
CAircraftMappingList mappings;
|
||||
for (const CVPilotModelRule &rule : (*this))
|
||||
{
|
||||
mappings.push_back(rule.toMapping());
|
||||
}
|
||||
return mappings;
|
||||
}
|
||||
|
||||
QStringList CVPilotModelRuleSet::toUpper(const QStringList &stringList)
|
||||
{
|
||||
QStringList upper;
|
||||
@@ -120,6 +111,33 @@ namespace BlackMisc
|
||||
return c;
|
||||
}
|
||||
|
||||
CAircraftModelList CVPilotModelRuleSet::toAircraftModels() const
|
||||
{
|
||||
QStringList modelNames;
|
||||
CAircraftModelList models;
|
||||
for (const CVPilotModelRule &rule : *this)
|
||||
{
|
||||
QString m(rule.getModelName());
|
||||
if (m.isEmpty()) { continue; }
|
||||
if (modelNames.contains(m, Qt::CaseInsensitive))
|
||||
{
|
||||
CAircraftModel model(rule.toAircraftModel());
|
||||
for (CAircraftModel &exisitingModel : models)
|
||||
{
|
||||
if (!exisitingModel.matchesModelString(m, Qt::CaseInsensitive)) { continue; }
|
||||
exisitingModel.updateMissingParts(model);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
models.push_back(rule.toAircraftModel());
|
||||
modelNames.append(m);
|
||||
}
|
||||
}
|
||||
return models;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user