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
47274448
Commit
47274448
authored
Aug 14, 2017
by
Don Gagne
Committed by
GitHub
Aug 14, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5569 from DonLakeFlyer/StableMerge
Stable merge
parents
11474181
d844cba7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
6 deletions
+27
-6
QGCTileCacheWorker.cpp
src/QtLocationPlugin/QGCTileCacheWorker.cpp
+22
-6
QGCTileCacheWorker.h
src/QtLocationPlugin/QGCTileCacheWorker.h
+5
-0
No files found.
src/QtLocationPlugin/QGCTileCacheWorker.cpp
View file @
47274448
...
...
@@ -52,6 +52,7 @@ QGCCacheWorker::QGCCacheWorker()
,
_defaultCount
(
0
)
,
_lastUpdate
(
0
)
,
_updateTimeout
(
SHORT_TIMEOUT
)
,
_hostLookupID
(
0
)
{
}
...
...
@@ -73,6 +74,9 @@ QGCCacheWorker::setDatabaseFile(const QString& path)
void
QGCCacheWorker
::
quit
()
{
if
(
_hostLookupID
)
{
QHostInfo
::
abortHostLookup
(
_hostLookupID
);
}
_mutex
.
lock
();
while
(
_taskQueue
.
count
())
{
QGCMapTask
*
task
=
_taskQueue
.
dequeue
();
...
...
@@ -1055,12 +1059,24 @@ QGCCacheWorker::_createDB(QSqlDatabase* db, bool createDefault)
void
QGCCacheWorker
::
_testInternet
()
{
QTcpSocket
socket
;
socket
.
connectToHost
(
"www.github.com"
,
80
);
if
(
socket
.
waitForConnected
(
2500
))
{
qCDebug
(
QGCTileCacheLog
)
<<
"Yes Internet Access"
;
emit
internetStatus
(
true
);
return
;
if
(
!
_hostLookupID
)
{
_hostLookupID
=
QHostInfo
::
lookupHost
(
"www.github.com"
,
this
,
SLOT
(
_lookupReady
(
QHostInfo
)));
}
}
//-----------------------------------------------------------------------------
void
QGCCacheWorker
::
_lookupReady
(
QHostInfo
info
)
{
_hostLookupID
=
0
;
if
(
info
.
error
()
==
QHostInfo
::
NoError
&&
info
.
addresses
().
size
())
{
QTcpSocket
socket
;
socket
.
connectToHost
(
info
.
addresses
().
first
(),
80
);
if
(
socket
.
waitForConnected
(
2000
))
{
qCDebug
(
QGCTileCacheLog
)
<<
"Yes Internet Access"
;
emit
internetStatus
(
true
);
return
;
}
}
qWarning
()
<<
"No Internet Access"
;
emit
internetStatus
(
false
);
...
...
src/QtLocationPlugin/QGCTileCacheWorker.h
View file @
47274448
...
...
@@ -26,6 +26,7 @@
#include <QWaitCondition>
#include <QMutexLocker>
#include <QtSql/QSqlDatabase>
#include <QHostInfo>
#include "QGCLoggingCategory.h"
...
...
@@ -49,6 +50,9 @@ public:
protected:
void
run
();
private
slots
:
void
_lookupReady
(
QHostInfo
info
);
private:
void
_saveTile
(
QGCMapTask
*
mtask
);
void
_getTile
(
QGCMapTask
*
mtask
);
...
...
@@ -93,6 +97,7 @@ private:
quint32
_defaultCount
;
time_t
_lastUpdate
;
int
_updateTimeout
;
int
_hostLookupID
;
};
#endif // QGC_TILE_CACHE_WORKER_H
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