diff options
author | Mike Morris <michael.patrick.morris@gmail.com> | 2014-10-10 12:24:45 -0400 |
---|---|---|
committer | Mike Morris <michael.patrick.morris@gmail.com> | 2014-10-10 12:24:45 -0400 |
commit | 2d1219fa5154c489cd856bedd04b84573d45ac04 (patch) | |
tree | a8e42e6acd79f73aac228e0fe6876917067db8c4 /macosx | |
parent | 8f6e8eead12c6b2c2de0ce76fa7df39ca2445006 (diff) | |
parent | f390dab0ea7d449bdd89855c84e47f4a07606fe4 (diff) | |
download | qtlocation-mapboxgl-2d1219fa5154c489cd856bedd04b84573d45ac04.tar.gz |
Merge branch 'master' into libuv-0.10-headless-display
Conflicts:
common/curl_request.cpp
common/glfw_view.cpp
common/glfw_view.hpp
include/mbgl/platform/request.hpp
ios/mapbox-gl-cocoa
setup-libraries.sh
src/map/map.cpp
src/platform/request.cpp
test/fixtures/fixture_request.cpp
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/main.mm | 14 | ||||
-rw-r--r-- | macosx/mapboxgl-app.gyp | 7 |
2 files changed, 19 insertions, 2 deletions
diff --git a/macosx/main.mm b/macosx/main.mm index 9ecc307c05..aeb49225cb 100644 --- a/macosx/main.mm +++ b/macosx/main.mm @@ -1,9 +1,12 @@ #include "../common/settings_nsuserdefaults.hpp" #include "../common/glfw_view.hpp" #include "../common/nslog_log.hpp" +#include "../common/Reachability.h" #import <Foundation/Foundation.h> +#include <uv.h> + @interface URLHandler : NSObject @property (nonatomic) mbgl::Map *map; @@ -68,16 +71,25 @@ @end int main() { + fprintf(stderr, "main thread: 0x%lx\n", uv_thread_self()); mbgl::Log::Set<mbgl::NSLogBackend>(); GLFWView view; mbgl::Map map(view); + mbgl::Map *map_ptr = ↦ URLHandler *handler = [[URLHandler alloc] init]; [handler setMap:&map]; NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager]; [appleEventManager setEventHandler:handler andSelector:@selector(handleGetURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL]; + // Notify map object when network reachability status changes. + Reachability* reachability = [Reachability reachabilityForInternetConnection]; + reachability.reachableBlock = ^(Reachability *reachability) { + map_ptr->setReachability(true); + }; + [reachability startNotifier]; + // Load settings mbgl::Settings_NSUserDefaults settings; map.setLonLatZoom(settings.longitude, settings.latitude, settings.zoom); @@ -97,6 +109,8 @@ int main() { int ret = view.run(); + [reachability stopNotifier]; + // Save settings map.getLonLatZoom(settings.longitude, settings.latitude, settings.zoom); settings.bearing = map.getBearing(); diff --git a/macosx/mapboxgl-app.gyp b/macosx/mapboxgl-app.gyp index da5c68ea35..51f591fdd0 100644 --- a/macosx/mapboxgl-app.gyp +++ b/macosx/mapboxgl-app.gyp @@ -15,8 +15,10 @@ '../common/platform_nsstring.mm', '../common/glfw_view.hpp', '../common/glfw_view.cpp', - '../common/foundation_request.h', - '../common/foundation_request.mm', + '../common/reachability.h', + '../common/reachability.m', + '../common/http_request_baton_cocoa.mm', + '../common/osx.mm', '../common/nslog_log.hpp', '../common/nslog_log.mm', ], @@ -33,6 +35,7 @@ ], 'OTHER_LDFLAGS': [ '<@(glfw3_libraries)', + '-framework SystemConfiguration', ], 'SDKROOT': 'macosx', 'INFOPLIST_FILE': 'Info.plist', |