presentation/MapTileStyles.h
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <QList> | ||
| 4 | #include <QString> | ||
| 5 | |||
| 6 | // Sprint 103 F103-24: the public tile styles offered for the contact map | ||
| 7 | // (resources/contacts/map-styles.json), grouped by provider. "custom" is no | ||
| 8 | // entry: it is the user's own server (contacts/mapTileServer). | ||
| 9 | namespace MapTileStyles { | ||
| 10 | |||
| 11 | struct Provider { | ||
| 12 | QString id; | ||
| 13 | QString name; | ||
| 14 | QString keyUrl; // where to get an API key; empty: no key needed | ||
| 15 | 1112 | bool needsKey() const { return !keyUrl.isEmpty(); } | |
| 16 | }; | ||
| 17 | |||
| 18 | struct Style { | ||
| 19 | QString id; | ||
| 20 | QString provider; // a Provider id | ||
| 21 | QString name; | ||
| 22 | QString templateUrl; // https with {z}, {x} and {y}; {key} for a provider's API key | ||
| 23 | QString attribution; // shown on the map, as the provider requires | ||
| 24 | int maxZoom = 19; | ||
| 25 | int parallel = 2; // requests at a time | ||
| 26 | }; | ||
| 27 | |||
| 28 | const QList<Provider> &providers(); | ||
| 29 | // The provider with `id`, or the first one when unknown. | ||
| 30 | const Provider &providerById(const QString &id); | ||
| 31 | const QList<Style> &all(); | ||
| 32 | // The style with `id`, or the first one (OpenStreetMap) when unknown. | ||
| 33 | const Style &byId(const QString &id); | ||
| 34 | bool known(const QString &id); | ||
| 35 | |||
| 36 | } // namespace MapTileStyles | ||
| 37 |