Skip to content
Permalink
Browse files

Deprecate QgsFeatureRequest::(set)connectionTimeout, replace with

more generic QgsFeatureRequest::timeout
  • Loading branch information
nyalldawson committed Aug 18, 2018
1 parent 7e24ec6 commit aa512636f0134823ae6f7ec0355a833d260efb94
@@ -635,7 +635,7 @@ Check if a feature is accepted by this requests filter
.. versionadded:: 2.1
%End

int connectionTimeout() const;
int connectionTimeout() const /Deprecated/;
%Docstring
Returns the timeout (in milliseconds) for how long we should wait for a connection if none is available from the pool
at this moment. A negative value (which is set by default) will wait forever.
@@ -644,10 +644,12 @@ at this moment. A negative value (which is set by default) will wait forever.

Only works if the provider supports this option.

.. deprecated:: Use timeout() instead.

.. versionadded:: 3.0
%End

QgsFeatureRequest &setConnectionTimeout( int connectionTimeout );
QgsFeatureRequest &setConnectionTimeout( int connectionTimeout ) /Deprecated/;
%Docstring
Sets the timeout (in milliseconds) for how long we should wait for a connection if none is available from the pool
at this moment. A negative value (which is set by default) will wait forever.
@@ -656,7 +658,33 @@ at this moment. A negative value (which is set by default) will wait forever.

Only works if the provider supports this option.

.. deprecated:: Use setTimeout() instead.

.. versionadded:: 3.0
%End

int timeout() const;
%Docstring
Returns the timeout (in milliseconds) for the maximum time we should wait during feature requests before a
feature is returned. A negative value (which is set by default) will wait forever.

.. note::

Only works if the provider supports this option.

.. versionadded:: 3.4
%End

QgsFeatureRequest &setTimeout( int timeout );
%Docstring
Sets the ``timeout`` (in milliseconds) for the maximum time we should wait during feature requests before a
feature is returned. A negative value (which is set by default) will wait forever.

.. note::

Only works if the provider supports this option.

.. versionadded:: 3.4
%End

bool requestMayBeNested() const;
@@ -85,7 +85,7 @@ QgsFeatureRequest &QgsFeatureRequest::operator=( const QgsFeatureRequest &rh )
mOrderBy = rh.mOrderBy;
mCrs = rh.mCrs;
mTransformErrorCallback = rh.mTransformErrorCallback;
mConnectionTimeout = rh.mConnectionTimeout;
mTimeout = rh.mTimeout;
mRequestMayBeNested = rh.mRequestMayBeNested;
return *this;
}
@@ -291,12 +291,23 @@ bool QgsFeatureRequest::acceptFeature( const QgsFeature &feature )

int QgsFeatureRequest::connectionTimeout() const
{
return mConnectionTimeout;
return mTimeout;
}

QgsFeatureRequest &QgsFeatureRequest::setConnectionTimeout( int connectionTimeout )
{
mConnectionTimeout = connectionTimeout;
mTimeout = connectionTimeout;
return *this;
}

int QgsFeatureRequest::timeout() const
{
return mTimeout;
}

QgsFeatureRequest &QgsFeatureRequest::setTimeout( int timeout )
{
mTimeout = timeout;
return *this;
}

@@ -621,20 +621,42 @@ class CORE_EXPORT QgsFeatureRequest
* at this moment. A negative value (which is set by default) will wait forever.
*
* \note Only works if the provider supports this option.
* \deprecated Use timeout() instead.
*
* \since QGIS 3.0
*/
int connectionTimeout() const;
Q_DECL_DEPRECATED int connectionTimeout() const SIP_DEPRECATED;

/**
* Sets the timeout (in milliseconds) for how long we should wait for a connection if none is available from the pool
* at this moment. A negative value (which is set by default) will wait forever.
*
* \note Only works if the provider supports this option.
* \deprecated Use setTimeout() instead.
*
* \since QGIS 3.0
*/
QgsFeatureRequest &setConnectionTimeout( int connectionTimeout );
Q_DECL_DEPRECATED QgsFeatureRequest &setConnectionTimeout( int connectionTimeout ) SIP_DEPRECATED;

/**
* Returns the timeout (in milliseconds) for the maximum time we should wait during feature requests before a
* feature is returned. A negative value (which is set by default) will wait forever.
*
* \note Only works if the provider supports this option.
*
* \since QGIS 3.4
*/
int timeout() const;

/**
* Sets the \a timeout (in milliseconds) for the maximum time we should wait during feature requests before a
* feature is returned. A negative value (which is set by default) will wait forever.
*
* \note Only works if the provider supports this option.
*
* \since QGIS 3.4
*/
QgsFeatureRequest &setTimeout( int timeout );

/**
* In case this request may be run nested within another already running
@@ -681,7 +703,7 @@ class CORE_EXPORT QgsFeatureRequest
std::function< void( const QgsFeature & ) > mTransformErrorCallback;
QgsCoordinateReferenceSystem mCrs;
QgsCoordinateTransformContext mTransformContext;
int mConnectionTimeout = -1;
int mTimeout = -1;
int mRequestMayBeNested = false;
};

0 comments on commit aa51263

Please sign in to comment.
You can’t perform that action at this time.