mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-22 00:06:12 -05:00
[processing] Rename grass7 provider to grass provider
And transparently map requests for grass7 provider to grass provider It's misleading putting an old version number in the provider name, when this provider supports grass versions 8 +
This commit is contained in:
parent
b51290c183
commit
4ba4eae72a
@ -87,7 +87,7 @@ Returns ``False`` if the provider could not be removed (eg provider does not exi
|
||||
.. seealso:: :py:func:`addProvider`
|
||||
%End
|
||||
|
||||
QgsProcessingProvider *providerById( const QString &id ) /HoldGIL/;
|
||||
QgsProcessingProvider *providerById( const QString &id ) const /HoldGIL/;
|
||||
%Docstring
|
||||
Returns a matching provider by provider ID.
|
||||
%End
|
||||
|
@ -87,7 +87,7 @@ Returns ``False`` if the provider could not be removed (eg provider does not exi
|
||||
.. seealso:: :py:func:`addProvider`
|
||||
%End
|
||||
|
||||
QgsProcessingProvider *providerById( const QString &id ) /HoldGIL/;
|
||||
QgsProcessingProvider *providerById( const QString &id ) const /HoldGIL/;
|
||||
%Docstring
|
||||
Returns a matching provider by provider ID.
|
||||
%End
|
||||
|
@ -139,7 +139,7 @@ class Grass7AlgorithmProvider(QgsProcessingProvider):
|
||||
return 'GRASS GIS ({})'.format(version) if version is not None else "GRASS GIS"
|
||||
|
||||
def id(self):
|
||||
return 'grass7'
|
||||
return 'grass'
|
||||
|
||||
def helpId(self):
|
||||
return 'grass7'
|
||||
|
@ -103,7 +103,7 @@ bool QgsProcessingRegistry::addProvider( QgsProcessingProvider *provider )
|
||||
if ( !provider )
|
||||
return false;
|
||||
|
||||
if ( mProviders.contains( provider->id() ) )
|
||||
if ( providerById( provider->id() ) )
|
||||
{
|
||||
QgsLogger::warning( QStringLiteral( "Duplicate provider %1 registered" ).arg( provider->id() ) );
|
||||
delete provider;
|
||||
@ -156,9 +156,17 @@ bool QgsProcessingRegistry::removeProvider( const QString &providerId )
|
||||
return removeProvider( p );
|
||||
}
|
||||
|
||||
QgsProcessingProvider *QgsProcessingRegistry::providerById( const QString &id )
|
||||
QgsProcessingProvider *QgsProcessingRegistry::providerById( const QString &id ) const
|
||||
{
|
||||
return mProviders.value( id, nullptr );
|
||||
auto it = mProviders.constFind( id );
|
||||
if ( it != mProviders.constEnd() )
|
||||
return it.value();
|
||||
|
||||
// transparently map old references to "grass7" provider to "grass" provider
|
||||
if ( id.compare( QLatin1String( "grass7" ), Qt::CaseInsensitive ) == 0 )
|
||||
return providerById( QStringLiteral( "grass" ) );
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QList< const QgsProcessingAlgorithm * > QgsProcessingRegistry::algorithms() const
|
||||
@ -201,7 +209,7 @@ const QgsProcessingAlgorithm *QgsProcessingRegistry::algorithmById( const QStrin
|
||||
const QRegularExpressionMatch match = reSplitProviderId.match( id );
|
||||
if ( match.hasMatch() )
|
||||
{
|
||||
if ( QgsProcessingProvider *provider = mProviders.value( match.captured( 1 ) ) )
|
||||
if ( QgsProcessingProvider *provider = providerById( match.captured( 1 ) ) )
|
||||
{
|
||||
if ( const QgsProcessingAlgorithm *algorithm = provider->algorithm( match.captured( 2 ) ) )
|
||||
return algorithm;
|
||||
|
@ -105,7 +105,7 @@ class CORE_EXPORT QgsProcessingRegistry : public QObject
|
||||
/**
|
||||
* Returns a matching provider by provider ID.
|
||||
*/
|
||||
QgsProcessingProvider *providerById( const QString &id ) SIP_HOLDGIL;
|
||||
QgsProcessingProvider *providerById( const QString &id ) const SIP_HOLDGIL;
|
||||
|
||||
/**
|
||||
* Returns a list of all available algorithms from registered providers.
|
||||
|
Loading…
x
Reference in New Issue
Block a user