diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2015-05-20 08:21:29 -0700 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-05-26 12:14:10 +0200 |
commit | 87b1da761156ec339ab4ccd159e6ba6997f9e7d0 (patch) | |
tree | a5b9bdedbff7f6d4edd6945d5ca4f29523b87c06 /linux | |
parent | f11a9f8fd9f4a53195168518f6ef1efe782f1cf8 (diff) | |
download | qtlocation-mapboxgl-87b1da761156ec339ab4ccd159e6ba6997f9e7d0.tar.gz |
DefaultFileSource has responsibility for handling mapbox:// URLs
Diffstat (limited to 'linux')
-rw-r--r-- | linux/main.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/linux/main.cpp b/linux/main.cpp index d279e9d8fe..558f95dbed 100644 --- a/linux/main.cpp +++ b/linux/main.cpp @@ -70,6 +70,15 @@ int main(int argc, char *argv[]) { mbgl::SQLiteCache cache("/tmp/mbgl-cache.db"); mbgl::DefaultFileSource fileSource(&cache); + + // Set access token if present + const char *token = getenv("MAPBOX_ACCESS_TOKEN"); + if (token == nullptr) { + mbgl::Log::Warning(mbgl::Event::Setup, "no access token set. mapbox.com tiles won't work."); + } else { + fileSource.setAccessToken(std::string(token)); + } + mbgl::Map map(*view, fileSource); // Load settings @@ -92,14 +101,6 @@ int main(int argc, char *argv[]) { mbgl::Log::Info(mbgl::Event::Setup, std::string("Changed style to: ") + newStyle.first); }); - // Set access token if present - const char *token = getenv("MAPBOX_ACCESS_TOKEN"); - if (token == nullptr) { - mbgl::Log::Warning(mbgl::Event::Setup, "no access token set. mapbox.com tiles won't work."); - } else { - map.setAccessToken(std::string(token)); - } - // Load style if (style.empty()) { const auto& newStyle = mbgl::util::defaultStyles.front(); |