Ref T77, tooltip for models (HTML Summary)

This commit is contained in:
Klaus Basan
2017-05-08 02:57:34 +02:00
parent afbb87298f
commit a4100d7efa
6 changed files with 63 additions and 21 deletions

View File

@@ -67,14 +67,22 @@ namespace BlackMisc
QString CLivery::getCombinedCodePlusInfo() const
{
QString s(getCombinedCode());
QString s = this->getCombinedCode();
if (!this->getDescription().isEmpty())
{
s += QLatin1String(" (") % this->getDescription() % QLatin1String(")");
s += " ";
s += this->getDescription();
}
return s;
}
QString CLivery::getCombinedCodePlusInfoAndId() const
{
QString s = this->getCombinedCodePlusInfo();
s += this->getDbKeyAsStringInParentheses(" ");
return s;
}
bool CLivery::isContainedInSimplifiedAirlineName(const QString &candidate) const
{
return this->getAirlineIcaoCode().isContainedInSimplifiedName(candidate);
@@ -383,9 +391,13 @@ namespace BlackMisc
}
}
QString CLivery::asHtmlSummary() const
QString CLivery::asHtmlSummary(const QString &separator) const
{
return this->getCombinedCodePlusInfo();
static const QString html = "%1%2Airline: %3";
return html.arg(
this->getCombinedCodePlusInfoAndId(), separator,
this->getAirlineIcaoCode().getDesignator().isEmpty() ? "No airline" : this->getAirlineIcaoCode().getCombinedStringWithKey()
).replace(" ", " ");
}
int CLivery::calculateScore(const CLivery &otherLivery, bool preferColorLiveries) const