mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
Cancel WCS requests just like it is done in WMS
(cherry picked from commit 50258e6f01ef7dededbf057c03813ecf3442f5b9)
This commit is contained in:
parent
aeeb5d9525
commit
ed3b0714dd
@ -1653,7 +1653,18 @@ QgsWcsDownloadHandler::QgsWcsDownloadHandler( const QUrl& url, QgsWcsAuthorizati
|
||||
, mCachedData( cachedData )
|
||||
, mWcsVersion( wcsVersion )
|
||||
, mCachedError( cachedError )
|
||||
, mFeedback( feedback )
|
||||
{
|
||||
if ( feedback )
|
||||
{
|
||||
connect( feedback, SIGNAL( cancelled() ), this, SLOT( cancelled() ), Qt::QueuedConnection );
|
||||
|
||||
// rendering could have been cancelled before we started to listen to cancelled() signal
|
||||
// so let's check before doing the download and maybe quit prematurely
|
||||
if ( feedback->isCancelled() )
|
||||
return;
|
||||
}
|
||||
|
||||
QNetworkRequest request( url );
|
||||
if ( !mAuth.setAuthorization( request ) )
|
||||
{
|
||||
@ -1676,9 +1687,6 @@ QgsWcsDownloadHandler::QgsWcsDownloadHandler( const QUrl& url, QgsWcsAuthorizati
|
||||
}
|
||||
connect( mCacheReply, SIGNAL( finished() ), this, SLOT( cacheReplyFinished() ) );
|
||||
connect( mCacheReply, SIGNAL( downloadProgress( qint64, qint64 ) ), this, SLOT( cacheReplyProgress( qint64, qint64 ) ) );
|
||||
|
||||
if ( feedback )
|
||||
connect( feedback, SIGNAL( cancelled() ), this, SLOT( cancelled() ), Qt::QueuedConnection );
|
||||
}
|
||||
|
||||
QgsWcsDownloadHandler::~QgsWcsDownloadHandler()
|
||||
@ -1688,6 +1696,9 @@ QgsWcsDownloadHandler::~QgsWcsDownloadHandler()
|
||||
|
||||
void QgsWcsDownloadHandler::blockingDownload()
|
||||
{
|
||||
if ( mFeedback && mFeedback->isCancelled() )
|
||||
return; // nothing to do
|
||||
|
||||
mEventLoop->exec( QEventLoop::ExcludeUserInputEvents );
|
||||
|
||||
Q_ASSERT( !mCacheReply );
|
||||
|
@ -443,6 +443,8 @@ class QgsWcsDownloadHandler : public QObject
|
||||
QString mWcsVersion;
|
||||
QgsError& mCachedError;
|
||||
|
||||
QgsRasterBlockFeedback* mFeedback;
|
||||
|
||||
static int sErrors; // this should be ideally per-provider...?
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user