diff --git a/src/blackmisc/aviation/aircrafticaocode.cpp b/src/blackmisc/aviation/aircrafticaocode.cpp index 0a598e557..96f0c281c 100644 --- a/src/blackmisc/aviation/aircrafticaocode.cpp +++ b/src/blackmisc/aviation/aircrafticaocode.cpp @@ -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) diff --git a/src/blackmisc/aviation/aircraftsituation.cpp b/src/blackmisc/aviation/aircraftsituation.cpp index 0447f2016..199e18efd 100644 --- a/src/blackmisc/aviation/aircraftsituation.cpp +++ b/src/blackmisc/aviation/aircraftsituation.cpp @@ -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)); } diff --git a/src/blackmisc/pq/physicalquantity.cpp b/src/blackmisc/pq/physicalquantity.cpp index 4b08e8aa6..29eeefd72 100644 --- a/src/blackmisc/pq/physicalquantity.cpp +++ b/src/blackmisc/pq/physicalquantity.cpp @@ -333,7 +333,7 @@ namespace BlackMisc template QString CPhysicalQuantity::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); } diff --git a/src/blackmisc/simulation/aircraftmodel.cpp b/src/blackmisc/simulation/aircraftmodel.cpp index d4dd6de19..b65831148 100644 --- a/src/blackmisc/simulation/aircraftmodel.cpp +++ b/src/blackmisc/simulation/aircraftmodel.cpp @@ -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); diff --git a/src/blackmisc/simulation/aircraftmodel.h b/src/blackmisc/simulation/aircraftmodel.h index 32921a42e..9b7b2be60 100644 --- a/src/blackmisc/simulation/aircraftmodel.h +++ b/src/blackmisc/simulation/aircraftmodel.h @@ -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(); }