mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-29 12:45:40 +08:00
refs #706, model string and DB key utility function
This commit is contained in:
@@ -111,6 +111,25 @@ namespace BlackMisc
|
|||||||
return nw;
|
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
|
CVariant CAircraftModel::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||||
{
|
{
|
||||||
if (index.isMyself()) { return CVariant::from(*this); }
|
if (index.isMyself()) { return CVariant::from(*this); }
|
||||||
|
|||||||
@@ -147,6 +147,9 @@ namespace BlackMisc
|
|||||||
//! Model key, either queried or loaded from simulator model
|
//! Model key, either queried or loaded from simulator model
|
||||||
const QString &getModelString() const { return this->m_modelString; }
|
const QString &getModelString() const { return this->m_modelString; }
|
||||||
|
|
||||||
|
//! Model string and DB key (if available)
|
||||||
|
QString getModelStringAndDbKey() const;
|
||||||
|
|
||||||
//! Model string
|
//! Model string
|
||||||
void setModelString(const QString &modelString) { this->m_modelString = modelString.trimmed().toUpper(); }
|
void setModelString(const QString &modelString) { this->m_modelString = modelString.trimmed().toUpper(); }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user