From 34b9ae293d293b5442d821a981fef648442662ea Mon Sep 17 00:00:00 2001 From: Harrissou Sant-anna Date: Tue, 5 Sep 2017 22:02:58 +0200 Subject: [PATCH 1/4] Set the most accurate User Manual page to Options tabs Because some of the tabs in Options dialog have a dedicated chapter where they are fully described, better use those links instead of the global one. --- src/app/qgsoptions.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/app/qgsoptions.cpp b/src/app/qgsoptions.cpp index 7d128329a20..83bfc396bd4 100644 --- a/src/app/qgsoptions.cpp +++ b/src/app/qgsoptions.cpp @@ -2354,5 +2354,20 @@ void QgsOptions::setZoomFactorValue() void QgsOptions::showHelp() { - QgsHelp::openHelp( QStringLiteral( "introduction/qgis_configuration.html#options" ) ); + QWidget *activeTab = mOptionsStackedWidget->currentWidget(); + QString link = QStringLiteral( "introduction/qgis_configuration.html" ); + + if ( activeTab == mOptionsPageAuth ) + { + link = QStringLiteral( "auth_system/index.html" ); + } + else if ( activeTab == mOptionsPageVariables ) + { + link = QStringLiteral( "introduction/general_tools.html#variables" ); + } + else if ( activeTab == mOptionsPageCRS ) + { + link = QStringLiteral( "working_with_projections/working_with_projections.html" ); + } + QgsHelp::openHelp( link ); } From 8dffa33a27cf42a823be24e4653bd45d476624fe Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Sun, 24 Sep 2017 08:29:39 +1000 Subject: [PATCH 2/4] Allow QgsOptionsPageWidget to set a specific help key to view when clicking help in the options dialog --- python/gui/qgsoptionswidgetfactory.sip | 13 ++++++++++ src/app/qgsoptions.cpp | 33 +++++++++++++++++++------- src/gui/qgsoptionswidgetfactory.h | 12 ++++++++++ 3 files changed, 49 insertions(+), 9 deletions(-) diff --git a/python/gui/qgsoptionswidgetfactory.sip b/python/gui/qgsoptionswidgetfactory.sip index cb8289e3490..f86e1ee7c21 100644 --- a/python/gui/qgsoptionswidgetfactory.sip +++ b/python/gui/qgsoptionswidgetfactory.sip @@ -25,6 +25,19 @@ class QgsOptionsPageWidget : QWidget Constructor for QgsOptionsPageWidget. %End + virtual QString helpKey() const; +%Docstring + Returns the optional help key for the options page. The default implementation + returns an empty string. + + If a non-empty string is returned by this method, it will be used as the help key + retrieved when the "help" button is clicked while this options page is active. + + If an empty string is returned by this method the default QGIS options + help will be retrieved. + :rtype: str +%End + public slots: virtual void apply() = 0; diff --git a/src/app/qgsoptions.cpp b/src/app/qgsoptions.cpp index 83bfc396bd4..dcf9d4eb5b0 100644 --- a/src/app/qgsoptions.cpp +++ b/src/app/qgsoptions.cpp @@ -2355,19 +2355,34 @@ void QgsOptions::setZoomFactorValue() void QgsOptions::showHelp() { QWidget *activeTab = mOptionsStackedWidget->currentWidget(); - QString link = QStringLiteral( "introduction/qgis_configuration.html" ); + QString link; - if ( activeTab == mOptionsPageAuth ) + // give first priority to created pages which have specified a help key + for ( const QgsOptionsPageWidget *widget : qgsAsConst( mAdditionalOptionWidgets ) ) { - link = QStringLiteral( "auth_system/index.html" ); + if ( widget == activeTab ) + { + link = widget->helpKey(); + break; + } } - else if ( activeTab == mOptionsPageVariables ) + + if ( link.isEmpty() ) { - link = QStringLiteral( "introduction/general_tools.html#variables" ); - } - else if ( activeTab == mOptionsPageCRS ) - { - link = QStringLiteral( "working_with_projections/working_with_projections.html" ); + link = QStringLiteral( "introduction/qgis_configuration.html" ); + + if ( activeTab == mOptionsPageAuth ) + { + link = QStringLiteral( "auth_system/index.html" ); + } + else if ( activeTab == mOptionsPageVariables ) + { + link = QStringLiteral( "introduction/general_tools.html#variables" ); + } + else if ( activeTab == mOptionsPageCRS ) + { + link = QStringLiteral( "working_with_projections/working_with_projections.html" ); + } } QgsHelp::openHelp( link ); } diff --git a/src/gui/qgsoptionswidgetfactory.h b/src/gui/qgsoptionswidgetfactory.h index 6c106bdf087..bf7ff4ec60b 100644 --- a/src/gui/qgsoptionswidgetfactory.h +++ b/src/gui/qgsoptionswidgetfactory.h @@ -38,6 +38,18 @@ class GUI_EXPORT QgsOptionsPageWidget : public QWidget : QWidget( parent ) {} + /** + * Returns the optional help key for the options page. The default implementation + * returns an empty string. + * + * If a non-empty string is returned by this method, it will be used as the help key + * retrieved when the "help" button is clicked while this options page is active. + * + * If an empty string is returned by this method the default QGIS options + * help will be retrieved. + */ + virtual QString helpKey() const { return QString(); } + public slots: /** From db04d65593557f92a033c07aa6ea1d45fe3eb5b3 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Sun, 24 Sep 2017 08:30:28 +1000 Subject: [PATCH 3/4] Use processing config help key --- python/plugins/processing/gui/ConfigDialog.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/plugins/processing/gui/ConfigDialog.py b/python/plugins/processing/gui/ConfigDialog.py index b2c4b31faf4..389f5875570 100644 --- a/python/plugins/processing/gui/ConfigDialog.py +++ b/python/plugins/processing/gui/ConfigDialog.py @@ -81,6 +81,9 @@ class ConfigOptionsPage(QgsOptionsPageWidget): def apply(self): self.config_widget.accept() + def helpKey(self): + return 'processing/toolbox.html#configuring-the-processing-framework' + class ConfigDialog(BASE, WIDGET): From 99def105bbcac6583af217cb8e13907385e3628d Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 25 Sep 2017 08:34:22 +1000 Subject: [PATCH 4/4] Correct link for processing options help --- python/plugins/processing/gui/ConfigDialog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/plugins/processing/gui/ConfigDialog.py b/python/plugins/processing/gui/ConfigDialog.py index 389f5875570..62f016ff9f8 100644 --- a/python/plugins/processing/gui/ConfigDialog.py +++ b/python/plugins/processing/gui/ConfigDialog.py @@ -82,7 +82,7 @@ class ConfigOptionsPage(QgsOptionsPageWidget): self.config_widget.accept() def helpKey(self): - return 'processing/toolbox.html#configuring-the-processing-framework' + return 'processing/index.html' class ConfigDialog(BASE, WIDGET):