mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 17:35:34 +08:00
Ref T578, CG null and DB key improvements
This commit is contained in:
committed by
Mat Sutcliffe
parent
254e21ab1f
commit
246d9abca8
@@ -80,7 +80,9 @@ namespace BlackMisc
|
||||
QString CAircraftIcaoCode::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return QStringLiteral("%1 %2 %3").arg(this->getDesignatorDbKey(), this->getCombinedType(), this->getWtc()).trimmed();
|
||||
return (this->hasCategory()) ?
|
||||
QStringLiteral("%1 %2 %3 cat: %4").arg(this->getDesignatorDbKey(), this->getCombinedType(), this->getWtc(), this->getCategory().getDbKeyAsString()).trimmed() :
|
||||
QStringLiteral("%1 %2 %3").arg(this->getDesignatorDbKey(), this->getCombinedType(), this->getWtc()).trimmed();
|
||||
}
|
||||
|
||||
void CAircraftIcaoCode::updateMissingParts(const CAircraftIcaoCode &otherIcaoCode)
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace BlackMisc
|
||||
u' ' % this->getCorrectedAltitude().valueRoundedWithUnit(CLengthUnit::ft(), 1) %
|
||||
u"[cor] | og: " % this->getOnGroundInfo() %
|
||||
(m_onGroundGuessingDetails.isEmpty() ? QString() : u' ' % m_onGroundGuessingDetails) %
|
||||
u" | cg: " %
|
||||
u" | CG: " %
|
||||
(m_cg.isNull() ? QStringLiteral("null") : m_cg.valueRoundedWithUnit(CLengthUnit::m(), 1) % u' ' % m_cg.valueRoundedWithUnit(CLengthUnit::ft(), 1)) %
|
||||
u" | offset: " %
|
||||
(m_sceneryOffset.isNull() ? QStringLiteral("null") : m_sceneryOffset.valueRoundedWithUnit(CLengthUnit::m(), 1) % u' ' % m_sceneryOffset.valueRoundedWithUnit(CLengthUnit::ft(), 1)) %
|
||||
@@ -80,7 +80,7 @@ namespace BlackMisc
|
||||
u" | bank: " % m_bank.toQString(i18n) %
|
||||
u" | pitch: " % m_pitch.toQString(i18n) %
|
||||
u" | heading: " % m_heading.toQString(i18n) %
|
||||
u" | gs: " % m_groundSpeed.valueRoundedWithUnit(CSpeedUnit::kts(), 1, true) %
|
||||
u" | GS: " % m_groundSpeed.valueRoundedWithUnit(CSpeedUnit::kts(), 1, true) %
|
||||
u' ' % m_groundSpeed.valueRoundedWithUnit(CSpeedUnit::m_s(), 1, true) %
|
||||
u" | elevation [" % this->getGroundElevationInfoAsString() % u"]: " % (m_groundElevationPlane.toQString(i18n));
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ namespace BlackMisc
|
||||
template <class MU, class PQ>
|
||||
QString CPhysicalQuantity<MU, PQ>::valueRoundedWithUnit(int digits, bool withGroupSeparator, bool i18n) const
|
||||
{
|
||||
if (this->isNull()) { return this->convertToQString(i18n); }
|
||||
if (this->isNull()) { return QStringLiteral("null"); }
|
||||
return this->valueRoundedWithUnit(m_unit, digits, withGroupSeparator, i18n);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace BlackMisc
|
||||
QString CAircraftModel::convertToQString(bool i18n) const
|
||||
{
|
||||
const QString s =
|
||||
(this->hasAnyModelString() ? inApostrophes(this->getAllModelStringsAndAliases(), true) % QStringLiteral(" ") : QString()) %
|
||||
(this->hasAnyModelString() ? inApostrophes(this->getAllModelStringsAliasesAndDbKey(), true) % QStringLiteral(" ") : QString()) %
|
||||
u" type: '" % this->getModelTypeAsString() %
|
||||
u"' ICAO: '" % this->getAircraftIcaoCode().toQString(i18n) %
|
||||
u" CG: " % this->getCG().valueRoundedWithUnit(1) %
|
||||
@@ -218,6 +218,13 @@ namespace BlackMisc
|
||||
return m_modelString % u", " % m_modelStringAlias;
|
||||
}
|
||||
|
||||
QString CAircraftModel::getAllModelStringsAliasesAndDbKey() const
|
||||
{
|
||||
if (!this->hasModelStringAlias() || m_modelString.isEmpty()) { return this->getModelStringAndDbKey(); }
|
||||
if (!this->isLoadedFromDb()) { return this->getAllModelStringsAndAliases(); }
|
||||
return this->getAllModelStringsAndAliases() % " " % this->getDbKeyAsStringInParentheses();
|
||||
}
|
||||
|
||||
bool CAircraftModel::isVtol() const
|
||||
{
|
||||
return this->getAircraftIcaoCode().isVtol();
|
||||
@@ -926,8 +933,10 @@ namespace BlackMisc
|
||||
const QString modelName(json.value(prefix % u"name").toString());
|
||||
const QString modelMode(json.value(prefix % u"mode").toString());
|
||||
const QString parts(json.value(prefix % u"parts").toString());
|
||||
|
||||
// check for undefined to rule out 0ft values
|
||||
const QJsonValue cgjv = json.value(prefix % u"cgft");
|
||||
const CLength cg = cgjv.isNull() ? CLength::null() : CLength(cgjv.toDouble(), CLengthUnit::ft());
|
||||
const CLength cg = (cgjv.isNull() || cgjv.isUndefined()) ? CLength::null() : CLength(cgjv.toDouble(), CLengthUnit::ft());
|
||||
|
||||
const CSimulatorInfo simInfo = CSimulatorInfo::fromDatabaseJson(json, prefix);
|
||||
CAircraftModel model(modelString, CAircraftModel::TypeDatabaseEntry, simInfo, modelName, modelDescription);
|
||||
|
||||
@@ -188,6 +188,9 @@ namespace BlackMisc
|
||||
//! Get model string and aliases
|
||||
QString getAllModelStringsAndAliases() const;
|
||||
|
||||
//! Get model string and aliases
|
||||
QString getAllModelStringsAliasesAndDbKey() const;
|
||||
|
||||
//! Model string alias
|
||||
void setModelStringAlias(const QString &alias) { m_modelStringAlias = alias.trimmed().toUpper(); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user