Skip to content

Commit

Permalink
Deprecate older thread-unsafe signals
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 23, 2019
1 parent ca592b7 commit 535965b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
14 changes: 12 additions & 2 deletions python/core/auto_generated/qgsnetworkaccessmanager.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,12 @@ Returns whether the system proxy should be used
%End

signals:
void requestAboutToBeCreated( QNetworkAccessManager::Operation, const QNetworkRequest &, QIODevice * );

void requestAboutToBeCreated( QNetworkAccessManager::Operation, const QNetworkRequest &, QIODevice * ) /Deprecated/;
%Docstring

.. deprecated:: Use the thread-safe requestAboutToBeCreated( QgsNetworkRequestParameters ) signal instead.
%End

void requestAboutToBeCreated( QgsNetworkRequestParameters request );
%Docstring
Expand Down Expand Up @@ -211,7 +216,12 @@ created in any thread.
.. versionadded:: 3.6
%End

void requestCreated( QNetworkReply * );
void requestCreated( QNetworkReply * ) /Deprecated/;
%Docstring

.. deprecated:: Use the thread-safe requestAboutToBeCreated( QgsNetworkRequestParameters ) signal instead.
%End

void requestTimedOut( QNetworkReply * );

protected:
Expand Down
4 changes: 4 additions & 0 deletions src/core/qgsnetworkaccessmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,15 @@ QNetworkReply *QgsNetworkAccessManager::createRequest( QNetworkAccessManager::Op
const int requestId = ++sRequestId;

emit requestAboutToBeCreated( QgsNetworkRequestParameters( op, req, requestId ) );
Q_NOWARN_DEPRECATED_PUSH
emit requestAboutToBeCreated( op, req, outgoingData );
Q_NOWARN_DEPRECATED_POP
QNetworkReply *reply = QNetworkAccessManager::createRequest( op, req, outgoingData );
reply->setProperty( "requestId", requestId );

Q_NOWARN_DEPRECATED_PUSH
emit requestCreated( reply );
Q_NOWARN_DEPRECATED_POP

// The timer will call abortRequest slot to abort the connection if needed.
// The timer is stopped by the finished signal and is restarted on downloadProgress and
Expand Down
13 changes: 11 additions & 2 deletions src/core/qgsnetworkaccessmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <QNetworkRequest>

#include "qgis_core.h"
#include "qgis_sip.h"

/**
* \class QgsNetworkRequestParameters
Expand Down Expand Up @@ -164,7 +165,11 @@ class CORE_EXPORT QgsNetworkAccessManager : public QNetworkAccessManager
bool useSystemProxy() const { return mUseSystemProxy; }

signals:
void requestAboutToBeCreated( QNetworkAccessManager::Operation, const QNetworkRequest &, QIODevice * );

/**
* \deprecated Use the thread-safe requestAboutToBeCreated( QgsNetworkRequestParameters ) signal instead.
*/
Q_DECL_DEPRECATED void requestAboutToBeCreated( QNetworkAccessManager::Operation, const QNetworkRequest &, QIODevice * ) SIP_DEPRECATED;

/**
* Emitted when a network request is about to be created.
Expand Down Expand Up @@ -208,7 +213,11 @@ class CORE_EXPORT QgsNetworkAccessManager : public QNetworkAccessManager
*/
void requestTimedOut( QgsNetworkRequestParameters request );

void requestCreated( QNetworkReply * );
/**
* \deprecated Use the thread-safe requestAboutToBeCreated( QgsNetworkRequestParameters ) signal instead.
*/
Q_DECL_DEPRECATED void requestCreated( QNetworkReply * ) SIP_DEPRECATED;

void requestTimedOut( QNetworkReply * );

private slots:
Expand Down

0 comments on commit 535965b

Please sign in to comment.