diff --git a/ground/src/libs/opmapcontrol/src/core/urlfactory.cpp b/ground/src/libs/opmapcontrol/src/core/urlfactory.cpp index 07eb3664a..4db850f46 100644 --- a/ground/src/libs/opmapcontrol/src/core/urlfactory.cpp +++ b/ground/src/libs/opmapcontrol/src/core/urlfactory.cpp @@ -25,7 +25,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "urlfactory.h" - +#include namespace core { @@ -126,116 +126,49 @@ void UrlFactory::TryCorrectGoogleVersions() qDebug()<<"Try corrected version withou abort or error:"<errorString(); #endif //DEBUG_URLFACTORY QString html=QString(reply->readAll()); - // find it - // apiCallback(["http://mt0.google.com/vt/v\x3dw2.106\x26hl\x3dlt\x26","http://mt1.google.com/vt/v\x3dw2.106\x26hl\x3dlt\x26","http://mt2.google.com/vt/v\x3dw2.106\x26hl\x3dlt\x26","http://mt3.google.com/vt/v\x3dw2.106\x26hl\x3dlt\x26"], - // ["http://khm0.google.com/kh/v\x3d45\x26","http://khm1.google.com/kh/v\x3d45\x26","http://khm2.google.com/kh/v\x3d45\x26","http://khm3.google.com/kh/v\x3d45\x26"], - // ["http://mt0.google.com/vt/v\x3dw2t.106\x26hl\x3dlt\x26","http://mt1.google.com/vt/v\x3dw2t.106\x26hl\x3dlt\x26","http://mt2.google.com/vt/v\x3dw2t.106\x26hl\x3dlt\x26","http://mt3.google.com/vt/v\x3dw2t.106\x26hl\x3dlt\x26"], - // "","","",false,"G",opts,["http://mt0.google.com/vt/v\x3dw2p.106\x26hl\x3dlt\x26","http://mt1.google.com/vt/v\x3dw2p.106\x26hl\x3dlt\x26","http://mt2.google.com/vt/v\x3dw2p.106\x26hl\x3dlt\x26","http://mt3.google.com/vt/v\x3dw2p.106\x26hl\x3dlt\x26"],jslinker,pageArgs); - - int id = html.lastIndexOf("apiCallback(["); - if(id > 0) + QRegExp reg("\"*http://mt0.google.com/vt/lyrs=m@(\\d*)",Qt::CaseInsensitive); + if(reg.indexIn(html)!=-1) { - int idEnd = html.indexOf("jslinker,pageArgs", id); - if(idEnd > id) - { - QString api = html.mid(id, idEnd - id); - if(!(api.isNull()|api.isEmpty())) - { - int i = 0; - QStringList opts = api.split("["); //"[\"" - QString opt; - foreach( opt ,opts) - { - if(opt.contains("http://")) - { - int start = opt.indexOf("x3d"); - if(start > 0) - { - int end = opt.indexOf("\\x26", start); - if(end > start) - { - start += 3; - QString u = opt.mid(start, end - start); - - if(i == 0) - { - if(u.startsWith("m@")) - { + QStringList gc=reg.capturedTexts(); + VersionGoogleMap = QString("m@%1").arg(gc[1]); + VersionGoogleMapChina = VersionGoogleMap; #ifdef DEBUG_URLFACTORY - qDebug()<<("TryCorrectGoogleVersions[map]: " + u); + qDebug()<<"TryCorrectGoogleVersions, VersionGoogleMap: "<deleteLater(); }