Ref T77, prefix for getDbKeyAsStringInParentheses

This commit is contained in:
Klaus Basan
2017-05-08 02:57:02 +02:00
parent ba85e3851b
commit afbb87298f
7 changed files with 11 additions and 11 deletions

View File

@@ -336,7 +336,7 @@ namespace BlackMisc
if (s.isEmpty()) s = "????";
if (hasManufacturer()) { s = s.append(" ").append(getManufacturer()); }
if (hasModelDescription()) { s = s.append(" ").append(getModelDescription()); }
return s.append(" ").append(getDbKeyAsStringInParentheses());
return s.append(getDbKeyAsStringInParentheses(" "));
}
QString CAircraftIcaoCode::getCombinedIataStringWithKey() const
@@ -347,7 +347,7 @@ namespace BlackMisc
if (hasDesignator()) { s.append(" ").append(getDesignator()); }
if (hasManufacturer()) { s = s.append(" ").append(getManufacturer()); }
if (hasModelDescription()) { s = s.append(" ").append(getModelDescription()); }
return s.append(" ").append(getDbKeyAsStringInParentheses());
return s.append(getDbKeyAsStringInParentheses(" "));
}
QString CAircraftIcaoCode::getCombinedFamilyStringWithKey() const
@@ -358,7 +358,7 @@ namespace BlackMisc
if (hasDesignator()) { s.append(" ").append(getDesignator()); }
if (hasManufacturer()) { s.append(" ").append(getManufacturer()); }
if (hasModelDescription()) { s.append(" ").append(getModelDescription()); }
return s.append(" ").append(getDbKeyAsStringInParentheses());
return s.append(getDbKeyAsStringInParentheses(" "));
}
bool CAircraftIcaoCode::hasCompleteData() const

View File

@@ -62,7 +62,7 @@ namespace BlackMisc
{
if (this->isLoadedFromDb())
{
return this->getVDesignator() % QLatin1Char(' ') % this->getDbKeyAsStringInParentheses();
return this->getVDesignator() % this->getDbKeyAsStringInParentheses(" ");
}
else
{
@@ -350,7 +350,7 @@ namespace BlackMisc
QString s(getVDesignator());
if (s.isEmpty()) s = "????";
if (hasName()) { s = s.append(" ").append(getName()); }
return s.append(" ").append(getDbKeyAsStringInParentheses());
return s.append(getDbKeyAsStringInParentheses(" "));
}
CAirlineIcaoCode CAirlineIcaoCode::thisOrCallsignCode(const CCallsign &callsign) const

View File

@@ -25,10 +25,10 @@ namespace BlackMisc
return QString::number(this->m_dbKey);
}
QString IDatastoreObjectWithIntegerKey::getDbKeyAsStringInParentheses() const
QString IDatastoreObjectWithIntegerKey::getDbKeyAsStringInParentheses(const QString &prefix) const
{
if (this->m_dbKey < 0) { return ""; }
return "(" + QString::number(this->m_dbKey) + ")";
return prefix + "(" + QString::number(this->m_dbKey) + ")";
}
void IDatastoreObjectWithIntegerKey::setDbKey(const QString &key)

View File

@@ -62,7 +62,7 @@ namespace BlackMisc
QJsonValue getDbKeyAsJsonValue() const;
//! Db ley in parentheses, e.g. "(3)"
QString getDbKeyAsStringInParentheses() const;
QString getDbKeyAsStringInParentheses(const QString &prefix = {}) const;
//! Set the DB key
void setDbKey(int key) { m_dbKey = key; }

View File

@@ -53,7 +53,7 @@ namespace BlackMisc
QString s = this->m_realname;
if (this->hasValidDbKey())
{
s.append(" ").append(this->getDbKeyAsStringInParentheses());
s.append(this->getDbKeyAsStringInParentheses(" "));
}
return s;
}

View File

@@ -24,7 +24,7 @@ namespace BlackMisc
Q_UNUSED(i18n);
return "Role: " + m_name +
" description: " + m_description +
" " + this->getDbKeyAsStringInParentheses();
this->getDbKeyAsStringInParentheses(" ");
}
CVariant CRole::propertyByIndex(const CPropertyIndex &index) const

View File

@@ -145,7 +145,7 @@ namespace BlackMisc
if (this->hasValidDbKey())
{
return this->hasModelString() ?
QString(this->getModelString()).append(" ").append(this->getDbKeyAsStringInParentheses()) :
QString(this->getModelString() + this->getDbKeyAsStringInParentheses(" ")) :
this->getDbKeyAsString();
}
else