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

Read attribution information in the transport APIs format as well

parent 5b149152
...@@ -47,7 +47,17 @@ std::vector<Attribution> Attribution::fromJson(const QJsonArray &a) ...@@ -47,7 +47,17 @@ std::vector<Attribution> Attribution::fromJson(const QJsonArray &a)
Attribution Attribution::fromJson(const QJsonObject &obj) Attribution Attribution::fromJson(const QJsonObject &obj)
{ {
return Json::fromJson<Attribution>(obj); // read compatibility with github.com/public-transport/transport-apis
if (obj.value(QLatin1String("isProprietary")).toBool() == true) {
return {};
}
auto attr = Json::fromJson<Attribution>(obj);
if (attr.url().isEmpty()) {
attr.setUrl(QUrl(obj.value(QLatin1String("homepage")).toString()));
}
return attr;
} }
QJsonArray Attribution::toJson(const std::vector<Attribution> &attrs) QJsonArray Attribution::toJson(const std::vector<Attribution> &attrs)
......
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