From 62d3098e694b2739a73576b3d8e1908fb2bdd16c Mon Sep 17 00:00:00 2001 From: DonLakeFlyer Date: Mon, 7 Aug 2017 13:22:57 -0700 Subject: [PATCH] Internet availability test fixes --- src/QGCApplication.cc | 5 +++++ src/QGCApplication.h | 3 +++ src/QtLocationPlugin/QGCTileCacheWorker.cpp | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/QGCApplication.cc b/src/QGCApplication.cc index 7abc033aa7..26a5656d8f 100644 --- a/src/QGCApplication.cc +++ b/src/QGCApplication.cc @@ -668,3 +668,8 @@ void QGCApplication::qmlAttemptWindowClose(void) { QMetaObject::invokeMethod(_rootQmlObject(), "attemptWindowClose"); } + +bool QGCApplication::isInternetAvailable() +{ + return getQGCMapEngine()->isInternetActive(); +} diff --git a/src/QGCApplication.h b/src/QGCApplication.h index 4d264d0f7f..fb4ec5d94e 100644 --- a/src/QGCApplication.h +++ b/src/QGCApplication.h @@ -92,6 +92,9 @@ public: /// Do we have Bluetooth Support? bool isBluetoothAvailable() { return _bluetoothAvailable; } + /// Is Internet available? + bool isInternetAvailable(); + public slots: /// You can connect to this slot to show an information message box from a different thread. void informationMessageBoxOnMainThread(const QString& title, const QString& msg); diff --git a/src/QtLocationPlugin/QGCTileCacheWorker.cpp b/src/QtLocationPlugin/QGCTileCacheWorker.cpp index df5118bac1..eca022cbe8 100644 --- a/src/QtLocationPlugin/QGCTileCacheWorker.cpp +++ b/src/QtLocationPlugin/QGCTileCacheWorker.cpp @@ -1056,7 +1056,7 @@ void QGCCacheWorker::_testInternet() { QTcpSocket socket; - socket.connectToHost("8.8.8.8", 53); + socket.connectToHost("www.github.com", 80); if (socket.waitForConnected(2500)) { qCDebug(QGCTileCacheLog) << "Yes Internet Access"; emit internetStatus(true); -- GitLab