Add ClientOptions to be able to pass around client name and version (#365)

* ClientOptions and Qt user agent

* Update CHANGELOG.md

Co-authored-by: Oliver Wipfli <oliver.wipfli@leichteralsluft.ch>

Co-authored-by: Oliver Wipfli <oliver.wipfli@leichteralsluft.ch>
This commit is contained in:
Tadej Novak
2022-08-13 15:36:50 +02:00
committed by GitHub
parent c2d91477b1
commit 1341f33ba4
71 changed files with 830 additions and 249 deletions

View File

@@ -28,6 +28,7 @@
#include <mbgl/style/sources/vector_source.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/util/async_task.hpp>
#include <mbgl/util/client_options.hpp>
#include <mbgl/util/color.hpp>
#include <mbgl/util/image.hpp>
#include <mbgl/util/io.hpp>
@@ -49,7 +50,7 @@ public:
MapAdapter map;
MapTest(float pixelRatio = 1, MapMode mode = MapMode::Static)
: fileSource(std::make_shared<FileSource>(ResourceOptions::Default()))
: fileSource(std::make_shared<FileSource>(ResourceOptions::Default(), ClientOptions()))
, frontend(pixelRatio)
, map(frontend, observer, fileSource,
MapOptions().withMapMode(mode).withSize(frontend.getSize()).withPixelRatio(pixelRatio)) {}
@@ -65,7 +66,7 @@ public:
float pixelRatio = 1,
MapMode mode = MapMode::Static,
typename std::enable_if<std::is_same<T, MainResourceLoader>::value>::type* = nullptr)
: fileSource(std::make_shared<T>(ResourceOptions().withCachePath(cachePath).withAssetPath(assetPath))),
: fileSource(std::make_shared<T>(ResourceOptions().withCachePath(cachePath).withAssetPath(assetPath), ClientOptions())),
frontend(pixelRatio),
map(frontend,
observer,
@@ -73,10 +74,11 @@ public:
MapOptions().withMapMode(mode).withSize(frontend.getSize()).withPixelRatio(pixelRatio)) {}
template <typename T = FileSource>
MapTest(const ResourceOptions& options,
MapTest(const ResourceOptions& resourceOptions,
const ClientOptions& clientOptions = ClientOptions(),
float pixelRatio = 1,
MapMode mode = MapMode::Static)
: fileSource(std::make_shared<T>(options)),
: fileSource(std::make_shared<T>(resourceOptions, clientOptions)),
frontend(pixelRatio),
map(frontend,
observer,