refs #706, model string and DB key utility function

This commit is contained in:
Klaus Basan
2016-07-13 02:53:00 +02:00
parent 9810aa04b8
commit e497b43e06
2 changed files with 22 additions and 0 deletions

View File

@@ -111,6 +111,25 @@ namespace BlackMisc
return nw;
}
QString CAircraftModel::getModelStringAndDbKey() const
{
if (this->hasValidDbKey())
{
if (this->hasModelString())
{
return QString(this->getModelString()).append(" ").append(this->getDbKeyAsStringInParentheses());
}
else
{
return this->getDbKeyAsString();
}
}
else
{
return this->getModelString();
}
}
CVariant CAircraftModel::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
{
if (index.isMyself()) { return CVariant::from(*this); }

View File

@@ -147,6 +147,9 @@ namespace BlackMisc
//! Model key, either queried or loaded from simulator model
const QString &getModelString() const { return this->m_modelString; }
//! Model string and DB key (if available)
QString getModelStringAndDbKey() const;
//! Model string
void setModelString(const QString &modelString) { this->m_modelString = modelString.trimmed().toUpper(); }