Browse Source

Route Internet test function to main app.

Switch test from 8.8.8.8:53 to "www.github.com:80"
QGC4.4
Gus Grubba 8 years ago
parent
commit
1ca359f541
  1. 5
      src/QGCApplication.cc
  2. 3
      src/QGCApplication.h
  3. 2
      src/QtLocationPlugin/QGCTileCacheWorker.cpp

5
src/QGCApplication.cc

@ -668,3 +668,8 @@ void QGCApplication::qmlAttemptWindowClose(void)
{ {
QMetaObject::invokeMethod(_rootQmlObject(), "attemptWindowClose"); QMetaObject::invokeMethod(_rootQmlObject(), "attemptWindowClose");
} }
bool QGCApplication::isInternetAvailable()
{
return getQGCMapEngine()->isInternetActive();
}

3
src/QGCApplication.h

@ -92,6 +92,9 @@ public:
/// Do we have Bluetooth Support? /// Do we have Bluetooth Support?
bool isBluetoothAvailable() { return _bluetoothAvailable; } bool isBluetoothAvailable() { return _bluetoothAvailable; }
/// Is Internet available?
bool isInternetAvailable();
public slots: public slots:
/// You can connect to this slot to show an information message box from a different thread. /// You can connect to this slot to show an information message box from a different thread.
void informationMessageBoxOnMainThread(const QString& title, const QString& msg); void informationMessageBoxOnMainThread(const QString& title, const QString& msg);

2
src/QtLocationPlugin/QGCTileCacheWorker.cpp

@ -1056,7 +1056,7 @@ void
QGCCacheWorker::_testInternet() QGCCacheWorker::_testInternet()
{ {
QTcpSocket socket; QTcpSocket socket;
socket.connectToHost("8.8.8.8", 53); socket.connectToHost("www.github.com", 80);
if (socket.waitForConnected(2500)) { if (socket.waitForConnected(2500)) {
qCDebug(QGCTileCacheLog) << "Yes Internet Access"; qCDebug(QGCTileCacheLog) << "Yes Internet Access";
emit internetStatus(true); emit internetStatus(true);

Loading…
Cancel
Save