mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 23:25:53 +08:00
* fixed missing tuple attribute * improved toQString conversion
This commit is contained in:
@@ -278,6 +278,12 @@ namespace BlackMisc
|
||||
return this->m_livery.hasValidAirlineDesignator();
|
||||
}
|
||||
|
||||
bool CAircraftModel::isMilitary() const
|
||||
{
|
||||
return this->getAircraftIcaoCode().isMilitary() ||
|
||||
this->getLivery().isMilitary();
|
||||
}
|
||||
|
||||
bool CAircraftModel::hasDistributor() const
|
||||
{
|
||||
return this->m_distributor.hasValidDbKey();
|
||||
@@ -329,6 +335,15 @@ namespace BlackMisc
|
||||
return (static_cast<int>(simulator.getSimulator()) & static_cast<int>(this->getSimulatorInfo().getSimulator())) > 0;
|
||||
}
|
||||
|
||||
QString CAircraftModel::getSwiftLiveryString() const
|
||||
{
|
||||
const QString cc(this->getLivery().getCombinedCode());
|
||||
if (cc.isEmpty() && !this->hasModelString()) { return ""; }
|
||||
if (cc.isEmpty()) { return this->getModelString(); }
|
||||
if (!this->hasModelString()) { return cc; }
|
||||
return cc + " [" + this->getModelString() + "]";
|
||||
}
|
||||
|
||||
void CAircraftModel::updateMissingParts(const CAircraftModel &otherModel, bool dbModelPriority)
|
||||
{
|
||||
if (dbModelPriority && !this->hasValidDbKey() && otherModel.hasValidDbKey())
|
||||
@@ -472,5 +487,36 @@ namespace BlackMisc
|
||||
model.setKeyAndTimestampFromDatabaseJson(json, prefix);
|
||||
return model;
|
||||
}
|
||||
|
||||
QStringList CAircraftModel::splitNetworkLiveryString(const QString &liveryString)
|
||||
{
|
||||
QStringList liveryModelStrings({ "", "" });
|
||||
if (liveryString.isEmpty()) { return liveryModelStrings; }
|
||||
const QString l(liveryString.toUpper().trimmed());
|
||||
if (liveryString.contains('[') && liveryString.contains(']'))
|
||||
{
|
||||
// seems to be a valid swift string
|
||||
const QStringList split = l.split("[");
|
||||
if (split.size() > 0)
|
||||
{
|
||||
liveryModelStrings[0] = split[0].trimmed();
|
||||
}
|
||||
if (split.size() > 1)
|
||||
{
|
||||
QString m = split[1];
|
||||
m.replace('[', ' ');
|
||||
m.replace(']', ' ');
|
||||
liveryModelStrings[1] = m.trimmed();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CLivery::isValidCombinedCode(l))
|
||||
{
|
||||
liveryModelStrings[0] = l;
|
||||
}
|
||||
}
|
||||
return liveryModelStrings;
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user