Commit db013115 authored by Volker Krause's avatar Volker Krause
Browse files

Properly show attributions for the same entity with different licenses

Happens frequently now due to the additionally supported asset licenses
from Wikimedia Commons for line logos.
parent 24a1bbe5
......@@ -379,9 +379,16 @@ QString PublicTransport::attributionSummary(const QVariantList& attributions) co
l.reserve(attributions.size());
for (const auto &v : attributions) {
const auto attr = v.value<KPublicTransport::Attribution>();
l.push_back(QLatin1String("<a href=\"") + attr.url().toString() + QLatin1String("\">") + attr.name() + QLatin1String("</a>"));
const auto multi = std::count_if(attributions.begin(), attributions.end(), [attr](const auto &other) {
return other.template value<KPublicTransport::Attribution>().name() == attr.name();
});
if (multi > 1) {
l.push_back(QLatin1String("<a href=\"") + attr.url().toString() + QLatin1String("\">") + attr.name() + QLatin1String(" (") + attr.license() + QLatin1String(")</a>"));
} else {
l.push_back(QLatin1String("<a href=\"") + attr.url().toString() + QLatin1String("\">") + attr.name() + QLatin1String("</a>"));
}
}
return l.join(QLatin1String(", "));
return QLocale().createSeparatedList(l);
}
bool PublicTransport::warnAboutSection(const KPublicTransport::JourneySection &section) const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment