From 41388d97bd98d31a2231e31fc07b08636e1ac167 Mon Sep 17 00:00:00 2001 From: zedamota Date: Sat, 16 Oct 2010 21:10:29 +0000 Subject: [PATCH] OP37/GCS MapLib - Change to try lowering processor usage. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1969 ebee16cc-31ac-478f-84a7-5cbb03baadba --- .../src/libs/opmapcontrol/src/core/opmaps.cpp | 33 +++++++------------ 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/ground/src/libs/opmapcontrol/src/core/opmaps.cpp b/ground/src/libs/opmapcontrol/src/core/opmaps.cpp index 6f2d0592d..3b2ef6b64 100644 --- a/ground/src/libs/opmapcontrol/src/core/opmaps.cpp +++ b/ground/src/libs/opmapcontrol/src/core/opmaps.cpp @@ -100,9 +100,15 @@ namespace core { } if(accessmode!=AccessMode::CacheOnly) { + QEventLoop q; QNetworkReply *reply; QNetworkRequest qheader; QNetworkAccessManager network; + QTimer tT; + tT.setSingleShot(true); + connect(&network, SIGNAL(finished(QNetworkReply*)), + &q, SLOT(quit())); + connect(&tT, SIGNAL(timeout()), &q, SLOT(quit())); network.setProxy(Proxy); #ifdef DEBUG_GMAPS qDebug()<<"Try Tile from the Internet"; @@ -189,28 +195,13 @@ namespace core { break; } reply=network.get(qheader); -#ifdef DEBUG_GMAPS - qDebug()<<"Starting get response ";//<isFinished() || (time.elapsed()>(Timeout))) ){QCoreApplication::processEvents(QEventLoop::AllEvents);} -#ifdef DEBUG_TIMINGS - qDebug()<<"Network time:"<error()<<" abort?"<<(time.elapsed()>Timeout); -#endif //DEBUG_GMAPS - if( (reply->error()!=QNetworkReply::NoError) || (time.elapsed()>Timeout)) - { -#ifdef DEBUG_GMAPS - qDebug()<<"Request timed out ";//<readAll(); reply->deleteLater();//TODO can't this be global?? if(ret.isEmpty())