Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/QtLocationPlugin/QGCCachedTileSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ QString QGCCachedTileSet::downloadStatus() const

void QGCCachedTileSet::createDownloadTask()
{
if (_cancelPending) {
setDownloading(false);
return;
}

if (!_downloading) {
setErrorCount(0);
setDownloading(true);
Expand All @@ -82,11 +87,17 @@ void QGCCachedTileSet::createDownloadTask()

void QGCCachedTileSet::resumeDownloadTask()
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we only resume if it is already canceled? If you click Ok or Cancel the UI stops updating the download and this value can get out of sync with whether the button shows to resume/cancel

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay since its merged now I guess it is not necessary anymore

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it out and it didn't help the problem I was noticing, so I figured just merge this and I'll look more into it later. I think it's partly on the QML side of things

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay got it, thanks for explanation

_cancelPending = false;
QGCUpdateTileDownloadStateTask* const task = new QGCUpdateTileDownloadStateTask(_id, QGCTile::StatePending, "*");
getQGCMapEngine()->addTask(task);
createDownloadTask();
}

void QGCCachedTileSet::cancelDownloadTask()
{
_cancelPending = true;
}

void QGCCachedTileSet::_tileListFetched(const QQueue<QGCTile*> &tiles)
{
_batchRequested = false;
Expand Down
3 changes: 2 additions & 1 deletion src/QtLocationPlugin/QGCCachedTileSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class QGCCachedTileSet : public QObject

Q_INVOKABLE void createDownloadTask();
Q_INVOKABLE void resumeDownloadTask();
Q_INVOKABLE void cancelDownloadTask() { setDownloading(false); }
Q_INVOKABLE void cancelDownloadTask();

const QString &name() const { return _name; }
const QString &mapTypeStr() const { return _mapTypeStr; }
Expand Down Expand Up @@ -184,6 +184,7 @@ private slots:
bool _noMoreTiles = false;
bool _batchRequested = false;
bool _selected = false;
bool _cancelPending = false;
QDateTime _creationDate;

QHash<QString, QNetworkReply*> _replies;
Expand Down
Loading