diff --git a/src/QmlControls/ScreenTools.qml b/src/QmlControls/ScreenTools.qml index 77d2dfd1081e80d2142fe48afecd56194187a478..a400ec8c0ae184e469663e401c7e1e0fd183e9b6 100644 --- a/src/QmlControls/ScreenTools.qml +++ b/src/QmlControls/ScreenTools.qml @@ -63,7 +63,6 @@ Item { smallFontPointSize = defaultFontPointSize * _screenTools.smallFontPointRatio mediumFontPointSize = defaultFontPointSize * _screenTools.mediumFontPointRatio largeFontPointSize = defaultFontPointSize * _screenTools.largeFontPointRatio - console.log("setBasePointSize", defaultFontPixelWidth) } Text { diff --git a/src/QtLocationPlugin/QGCMapUrlEngine.cpp b/src/QtLocationPlugin/QGCMapUrlEngine.cpp index dab2631962cdd32b47373a41b2bc538d16fcf71a..8a51f7eea976e188d41670d425584ac3c01e686a 100644 --- a/src/QtLocationPlugin/QGCMapUrlEngine.cpp +++ b/src/QtLocationPlugin/QGCMapUrlEngine.cpp @@ -14,6 +14,8 @@ * Original work: The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. */ +//#define DEBUG_GOOGLE_MAPS + #include "QGCMapEngine.h" #include @@ -23,6 +25,11 @@ #include #include +#if defined(DEBUG_GOOGLE_MAPS) +#include +#include +#endif + //----------------------------------------------------------------------------- UrlFactory::UrlFactory() : _timeout(5 * 1000) @@ -36,10 +43,10 @@ UrlFactory::UrlFactory() QNetworkProxyFactory::setUseSystemConfiguration(true); // Google version strings - _versionGoogleMap = "m@336"; - _versionGoogleSatellite = "194"; + _versionGoogleMap = "m@338000000"; + _versionGoogleSatellite = "198"; _versionGoogleLabels = "h@336"; - _versionGoogleTerrain = "t@132,r@336"; + _versionGoogleTerrain = "t@132,r@338000000"; _secGoogleWord = "Galileo"; // BingMaps _versionBingMaps = "563"; @@ -122,12 +129,12 @@ UrlFactory::getTileURL(MapType type, int x, int y, int zoom, QNetworkAccessManag case GoogleLabels: case GoogleTerrain: case GoogleHybrid: - request.setRawHeader("Referrer", "http://maps.google.com/"); + request.setRawHeader("Referrer", "https://www.google.com/maps/preview"); break; case BingHybrid: case BingMap: case BingSatellite: - request.setRawHeader("Referrer", "http://www.bing.com/maps/"); + request.setRawHeader("Referrer", "https://www.bing.com/maps/"); break; /* case OpenStreetMapSurfer: @@ -397,22 +404,29 @@ UrlFactory::_googleVersionCompleted() return; } QString html = QString(_googleReply->readAll()); - QRegExp reg("\"*http://mt0.google.com/vt/lyrs=m@(\\d*)",Qt::CaseInsensitive); - if (reg.indexIn(html) != -1) { - QStringList gc = reg.capturedTexts(); - _versionGoogleMap = QString("m@%1").arg(gc[1]); + +#if defined(DEBUG_GOOGLE_MAPS) + QString filename = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); + filename += "/google.output"; + QFile file(filename); + if (file.open(QIODevice::ReadWrite)) + { + QTextStream stream( &file ); + stream << html << endl; } - reg = QRegExp("\"*http://mt0.google.com/vt/lyrs=h@(\\d*)",Qt::CaseInsensitive); +#endif + + QRegExp reg("\"*https?://mt\\D?\\d..*/vt\\?lyrs=m@(\\d*)", Qt::CaseInsensitive); if (reg.indexIn(html) != -1) { QStringList gc = reg.capturedTexts(); - _versionGoogleLabels = QString("h@%1").arg(gc[1]); + _versionGoogleMap = QString("m@%1").arg(gc[1]); } - reg = QRegExp("\"*http://khm\\D?\\d.google.com/kh/v=(\\d*)",Qt::CaseInsensitive); + reg = QRegExp("\"*https?://khm\\D?\\d.googleapis.com/kh\\?v=(\\d*)", Qt::CaseInsensitive); if (reg.indexIn(html) != -1) { QStringList gc = reg.capturedTexts(); _versionGoogleSatellite = gc[1]; } - reg = QRegExp("\"*http://mt0.google.com/vt/lyrs=t@(\\d*),r@(\\d*)",Qt::CaseInsensitive); + reg = QRegExp("\"*https?://mt\\D?\\d..*/vt\\?lyrs=t@(\\d*),r@(\\d*)", Qt::CaseInsensitive); if (reg.indexIn(html) != -1) { QStringList gc = reg.capturedTexts(); _versionGoogleTerrain = QString("t@%1,r@%2").arg(gc[1]).arg(gc[2]); @@ -423,7 +437,7 @@ UrlFactory::_googleVersionCompleted() //----------------------------------------------------------------------------- void -UrlFactory::_tryCorrectGoogleVersions(QNetworkAccessManager* networkManager) +UrlFactory::_tryCorrectGoogleVersions(QNetworkAccessManager* networkManager) { QMutexLocker locker(&_googleVersionMutex); if (_googleVersionRetrieved) { @@ -437,7 +451,10 @@ UrlFactory::_tryCorrectGoogleVersions(QNetworkAccessManager* networkManager) QNetworkProxy tProxy; tProxy.setType(QNetworkProxy::DefaultProxy); networkManager->setProxy(tProxy); - QString url = "http://maps.google.com/maps"; + QSslConfiguration conf = qheader.sslConfiguration(); + conf.setPeerVerifyMode(QSslSocket::VerifyNone); + qheader.setSslConfiguration(conf); + QString url = "http://maps.google.com/maps/api/js?v=3.2&sensor=false"; qheader.setUrl(QUrl(url)); QByteArray ua; ua.append(getQGCMapEngine()->userAgent());