Skip to content
Permalink
Browse files
Merge pull request #6298 from nyalldawson/fix_17231
[processing] Allow providers to return a different helpId() vs their unique id()
  • Loading branch information
alexbruy committed Feb 9, 2018
2 parents bcb68dd + 2d1e918 commit 90cc17b
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 2 deletions.
@@ -33,6 +33,8 @@ Constructor for QgsNativeAlgorithms.

virtual QString id() const;

virtual QString helpId() const;

virtual QString name() const;

virtual bool supportsNonFileBasedOutput() const;
@@ -53,6 +53,17 @@ should be a unique, short, character only string, eg "qgis" or "gdal". This
string should not be localised.

.. seealso:: :py:func:`name`

.. seealso:: :py:func:`helpId`
%End

virtual QString helpId() const;
%Docstring
Returns the provider help id string, used for creating QgsHelp urls for algorithms
belong to this provider. By default, this returns the provider's id(). This string
should not be localised.

.. seealso:: :py:func:`id`
%End

virtual QString name() const = 0;
@@ -367,7 +367,7 @@ def openHelp(self):
algHelp = self._alg.helpUrl()
if not algHelp:
algHelp = QgsHelp.helpUrl("processing_algs/{}/{}.html{}".format(
self._alg.provider().id(), self._alg.groupId(), self._alg.name())).toString()
self._alg.provider().helpId(), self._alg.groupId(), self._alg.name())).toString()

if algHelp not in [None, ""]:
webbrowser.open(algHelp)
@@ -40,6 +40,11 @@ QString Qgs3DAlgorithms::id() const
return QStringLiteral( "3d" );
}

QString Qgs3DAlgorithms::helpId() const
{
return QStringLiteral( "qgis" );
}

QString Qgs3DAlgorithms::name() const
{
return tr( "QGIS (3D)" );
@@ -42,6 +42,7 @@ class _3D_EXPORT Qgs3DAlgorithms: public QgsProcessingProvider
QIcon icon() const override;
QString svgIconPath() const override;
QString id() const override;
QString helpId() const override;
QString name() const override;
bool supportsNonFileBasedOutput() const override;

@@ -86,6 +86,11 @@ QString QgsNativeAlgorithms::id() const
return QStringLiteral( "native" );
}

QString QgsNativeAlgorithms::helpId() const
{
return QStringLiteral( "qgis" );
}

QString QgsNativeAlgorithms::name() const
{
return tr( "QGIS (native c++)" );
@@ -42,6 +42,7 @@ class ANALYSIS_EXPORT QgsNativeAlgorithms: public QgsProcessingProvider
QIcon icon() const override;
QString svgIconPath() const override;
QString id() const override;
QString helpId() const override;
QString name() const override;
bool supportsNonFileBasedOutput() const override;

@@ -41,6 +41,11 @@ QString QgsProcessingProvider::svgIconPath() const
return QgsApplication::iconPath( QStringLiteral( "processingAlgorithm.svg" ) );
}

QString QgsProcessingProvider::helpId() const
{
return id();
}

QString QgsProcessingProvider::longName() const
{
return name();
@@ -66,9 +66,18 @@ class CORE_EXPORT QgsProcessingProvider : public QObject
* should be a unique, short, character only string, eg "qgis" or "gdal". This
* string should not be localised.
* \see name()
* \see helpId()
*/
virtual QString id() const = 0;

/**
* Returns the provider help id string, used for creating QgsHelp urls for algorithms
* belong to this provider. By default, this returns the provider's id(). This string
* should not be localised.
* \see id()
*/
virtual QString helpId() const;

/**
* Returns the provider name, which is used to describe the provider within the GUI.
* This string should be short (e.g. "Lastools") and localised.
@@ -233,7 +233,7 @@ void QgsProcessingAlgorithmDialogBase::openHelp()
QUrl algHelp = mAlgorithm->helpUrl();
if ( algHelp.isEmpty() )
{
algHelp = QgsHelp::helpUrl( QStringLiteral( "processing_algs/%1/%2.html#%3" ).arg( mAlgorithm->provider()->id(), mAlgorithm->groupId(), mAlgorithm->name() ) );
algHelp = QgsHelp::helpUrl( QStringLiteral( "processing_algs/%1/%2.html#%3" ).arg( mAlgorithm->provider()->helpId(), mAlgorithm->groupId(), mAlgorithm->name() ) );
}

if ( !algHelp.isEmpty() )

0 comments on commit 90cc17b

Please sign in to comment.