diff options
author | Thiago Marcos P. Santos <thiago@mapbox.com> | 2017-02-24 15:07:13 +0200 |
---|---|---|
committer | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2017-02-25 14:03:38 +0200 |
commit | 92e6e48699f5f94a80d69a94202f0f9c803fa2a7 (patch) | |
tree | 43d98fcea65b0b6fc9e8697310c9135810b40606 /platform/glfw/main.cpp | |
parent | 4c2e720b1522d2a45980ac8dcf34d2a3783cf426 (diff) | |
download | qtlocation-mapboxgl-92e6e48699f5f94a80d69a94202f0f9c803fa2a7.tar.gz |
[glfw] Make P pause/resume the network thread
Simple test of the DefaultFileSource pause/resume API.
Diffstat (limited to 'platform/glfw/main.cpp')
-rw-r--r-- | platform/glfw/main.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/platform/glfw/main.cpp b/platform/glfw/main.cpp index 1f683b185f..fbfba0b7fb 100644 --- a/platform/glfw/main.cpp +++ b/platform/glfw/main.cpp @@ -153,6 +153,18 @@ int main(int argc, char *argv[]) { mbgl::Log::Info(mbgl::Event::Setup, "Changed style to: %s", newStyle.name); }); + view->setPauseResumeCallback([&fileSource] () { + static bool isPaused = false; + + if (isPaused) { + fileSource.resume(); + } else { + fileSource.pause(); + } + + isPaused = !isPaused; + }); + // Load style if (style.empty()) { const char *url = getenv("MAPBOX_STYLE_URL"); |