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
fe8e61e5
Commit
fe8e61e5
authored
Apr 07, 2017
by
Gus Grubba
Committed by
GitHub
Apr 07, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4936 from dogmaphobic/qtLocation
Handle network availability transitions.
parents
950ee021
0ffd8648
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 @
fe8e61e5
...
@@ -1039,6 +1039,7 @@ QGCCacheWorker::_testInternet()
...
@@ -1039,6 +1039,7 @@ QGCCacheWorker::_testInternet()
QTcpSocket
socket
;
QTcpSocket
socket
;
socket
.
connectToHost
(
"8.8.8.8"
,
53
);
socket
.
connectToHost
(
"8.8.8.8"
,
53
);
if
(
socket
.
waitForConnected
(
2500
))
{
if
(
socket
.
waitForConnected
(
2500
))
{
qCDebug
(
QGCTileCacheLog
)
<<
"Yes Internet Access"
;
emit
internetStatus
(
true
);
emit
internetStatus
(
true
);
return
;
return
;
}
}
...
...
src/QtLocationPlugin/QGeoMapReplyQGC.cpp
View file @
fe8e61e5
...
@@ -62,7 +62,15 @@ QGeoTiledMapReplyQGC::QGeoTiledMapReplyQGC(QNetworkAccessManager *networkManager
...
@@ -62,7 +62,15 @@ QGeoTiledMapReplyQGC::QGeoTiledMapReplyQGC(QNetworkAccessManager *networkManager
,
_networkManager
(
networkManager
)
,
_networkManager
(
networkManager
)
{
{
if
(
_request
.
url
().
isEmpty
())
{
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
{
}
else
{
QGCFetchTileTask
*
task
=
getQGCMapEngine
()
->
createFetchTileTask
((
UrlFactory
::
MapType
)
spec
.
mapId
(),
spec
.
x
(),
spec
.
y
(),
spec
.
zoom
());
QGCFetchTileTask
*
task
=
getQGCMapEngine
()
->
createFetchTileTask
((
UrlFactory
::
MapType
)
spec
.
mapId
(),
spec
.
x
(),
spec
.
y
(),
spec
.
zoom
());
connect
(
task
,
&
QGCFetchTileTask
::
tileFetched
,
this
,
&
QGeoTiledMapReplyQGC
::
cacheReply
);
connect
(
task
,
&
QGCFetchTileTask
::
tileFetched
,
this
,
&
QGeoTiledMapReplyQGC
::
cacheReply
);
...
@@ -89,21 +97,6 @@ QGeoTiledMapReplyQGC::_clearReply()
...
@@ -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
void
QGeoTiledMapReplyQGC
::
abort
()
QGeoTiledMapReplyQGC
::
abort
()
...
@@ -145,8 +138,9 @@ QGeoTiledMapReplyQGC::networkReplyError(QNetworkReply::NetworkError error)
...
@@ -145,8 +138,9 @@ QGeoTiledMapReplyQGC::networkReplyError(QNetworkReply::NetworkError error)
}
}
if
(
error
!=
QNetworkReply
::
OperationCanceledError
)
{
if
(
error
!=
QNetworkReply
::
OperationCanceledError
)
{
qWarning
()
<<
"Fetch tile error:"
<<
_reply
->
errorString
();
qWarning
()
<<
"Fetch tile error:"
<<
_reply
->
errorString
();
setError
(
QGeoTiledMapReply
::
CommunicationError
,
_reply
->
errorString
());
}
}
_returnBadTile
(
);
setFinished
(
true
);
_clearReply
();
_clearReply
();
}
}
...
@@ -154,8 +148,9 @@ QGeoTiledMapReplyQGC::networkReplyError(QNetworkReply::NetworkError error)
...
@@ -154,8 +148,9 @@ QGeoTiledMapReplyQGC::networkReplyError(QNetworkReply::NetworkError error)
void
void
QGeoTiledMapReplyQGC
::
cacheError
(
QGCMapTask
::
TaskType
type
,
QString
/*errorString*/
)
QGeoTiledMapReplyQGC
::
cacheError
(
QGCMapTask
::
TaskType
type
,
QString
/*errorString*/
)
{
{
if
(
_networkManager
->
networkAccessible
()
<
QNetworkAccessManager
::
Accessible
||
!
getQGCMapEngine
()
->
isInternetActive
())
{
if
(
!
getQGCMapEngine
()
->
isInternetActive
())
{
_returnBadTile
();
setError
(
QGeoTiledMapReply
::
CommunicationError
,
"Network not available"
);
setFinished
(
true
);
}
else
{
}
else
{
if
(
type
!=
QGCMapTask
::
taskFetchTile
)
{
if
(
type
!=
QGCMapTask
::
taskFetchTile
)
{
qWarning
()
<<
"QGeoTiledMapReplyQGC::cacheError() for wrong task"
;
qWarning
()
<<
"QGeoTiledMapReplyQGC::cacheError() for wrong task"
;
...
...
src/QtLocationPlugin/QGeoMapReplyQGC.h
View file @
fe8e61e5
...
@@ -70,7 +70,6 @@ private slots:
...
@@ -70,7 +70,6 @@ private slots:
private:
private:
void
_clearReply
();
void
_clearReply
();
void
_returnBadTile
();
private:
private:
QNetworkReply
*
_reply
;
QNetworkReply
*
_reply
;
...
...
src/QtLocationPlugin/QGeoTileFetcherQGC.cpp
View file @
fe8e61e5
...
@@ -82,7 +82,5 @@ QGeoTileFetcherQGC::getTileImage(const QGeoTileSpec &spec)
...
@@ -82,7 +82,5 @@ QGeoTileFetcherQGC::getTileImage(const QGeoTileSpec &spec)
void
void
QGeoTileFetcherQGC
::
timeout
()
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