Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
0ffd8648
Commit
0ffd8648
authored
Apr 07, 2017
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle network availability transitions.
parent
950ee021
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
23 deletions
+16
-23
QGCTileCacheWorker.cpp
src/QtLocationPlugin/QGCTileCacheWorker.cpp
+1
-0
QGeoMapReplyQGC.cpp
src/QtLocationPlugin/QGeoMapReplyQGC.cpp
+14
-19
QGeoMapReplyQGC.h
src/QtLocationPlugin/QGeoMapReplyQGC.h
+0
-1
QGeoTileFetcherQGC.cpp
src/QtLocationPlugin/QGeoTileFetcherQGC.cpp
+1
-3
No files found.
src/QtLocationPlugin/QGCTileCacheWorker.cpp
View file @
0ffd8648
...
...
@@ -1039,6 +1039,7 @@ QGCCacheWorker::_testInternet()
QTcpSocket
socket
;
socket
.
connectToHost
(
"8.8.8.8"
,
53
);
if
(
socket
.
waitForConnected
(
2500
))
{
qCDebug
(
QGCTileCacheLog
)
<<
"Yes Internet Access"
;
emit
internetStatus
(
true
);
return
;
}
...
...
src/QtLocationPlugin/QGeoMapReplyQGC.cpp
View file @
0ffd8648
...
...
@@ -62,7 +62,15 @@ QGeoTiledMapReplyQGC::QGeoTiledMapReplyQGC(QNetworkAccessManager *networkManager
,
_networkManager
(
networkManager
)
{
if
(
_request
.
url
().
isEmpty
())
{
_returnBadTile
();
if
(
!
_badMapBox
.
size
())
{
QFile
b
(
":/res/notile.png"
);
if
(
b
.
open
(
QFile
::
ReadOnly
))
_badMapBox
=
b
.
readAll
();
}
setMapImageData
(
_badMapBox
);
setMapImageFormat
(
"png"
);
setFinished
(
true
);
setCached
(
false
);
}
else
{
QGCFetchTileTask
*
task
=
getQGCMapEngine
()
->
createFetchTileTask
((
UrlFactory
::
MapType
)
spec
.
mapId
(),
spec
.
x
(),
spec
.
y
(),
spec
.
zoom
());
connect
(
task
,
&
QGCFetchTileTask
::
tileFetched
,
this
,
&
QGeoTiledMapReplyQGC
::
cacheReply
);
...
...
@@ -89,21 +97,6 @@ QGeoTiledMapReplyQGC::_clearReply()
}
}
//-----------------------------------------------------------------------------
void
QGeoTiledMapReplyQGC
::
_returnBadTile
()
{
if
(
!
_badMapBox
.
size
())
{
QFile
b
(
":/res/notile.png"
);
if
(
b
.
open
(
QFile
::
ReadOnly
))
_badMapBox
=
b
.
readAll
();
}
setMapImageData
(
_badMapBox
);
setMapImageFormat
(
"png"
);
setFinished
(
true
);
setCached
(
false
);
}
//-----------------------------------------------------------------------------
void
QGeoTiledMapReplyQGC
::
abort
()
...
...
@@ -145,8 +138,9 @@ QGeoTiledMapReplyQGC::networkReplyError(QNetworkReply::NetworkError error)
}
if
(
error
!=
QNetworkReply
::
OperationCanceledError
)
{
qWarning
()
<<
"Fetch tile error:"
<<
_reply
->
errorString
();
setError
(
QGeoTiledMapReply
::
CommunicationError
,
_reply
->
errorString
());
}
_returnBadTile
(
);
setFinished
(
true
);
_clearReply
();
}
...
...
@@ -154,8 +148,9 @@ QGeoTiledMapReplyQGC::networkReplyError(QNetworkReply::NetworkError error)
void
QGeoTiledMapReplyQGC
::
cacheError
(
QGCMapTask
::
TaskType
type
,
QString
/*errorString*/
)
{
if
(
_networkManager
->
networkAccessible
()
<
QNetworkAccessManager
::
Accessible
||
!
getQGCMapEngine
()
->
isInternetActive
())
{
_returnBadTile
();
if
(
!
getQGCMapEngine
()
->
isInternetActive
())
{
setError
(
QGeoTiledMapReply
::
CommunicationError
,
"Network not available"
);
setFinished
(
true
);
}
else
{
if
(
type
!=
QGCMapTask
::
taskFetchTile
)
{
qWarning
()
<<
"QGeoTiledMapReplyQGC::cacheError() for wrong task"
;
...
...
src/QtLocationPlugin/QGeoMapReplyQGC.h
View file @
0ffd8648
...
...
@@ -70,7 +70,6 @@ private slots:
private:
void
_clearReply
();
void
_returnBadTile
();
private:
QNetworkReply
*
_reply
;
...
...
src/QtLocationPlugin/QGeoTileFetcherQGC.cpp
View file @
0ffd8648
...
...
@@ -82,7 +82,5 @@ QGeoTileFetcherQGC::getTileImage(const QGeoTileSpec &spec)
void
QGeoTileFetcherQGC
::
timeout
()
{
if
(
!
getQGCMapEngine
()
->
isInternetActive
())
{
getQGCMapEngine
()
->
testInternet
();
}
getQGCMapEngine
()
->
testInternet
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment