Skip to content

Commit

Permalink
Refactoring of all help calls, deprecating QgsContextHelp and the for…
Browse files Browse the repository at this point in the history
…mer helviewer
  • Loading branch information
jgrocha committed Aug 9, 2017
1 parent 518ffe3 commit 3a103b7
Show file tree
Hide file tree
Showing 60 changed files with 130 additions and 323 deletions.
8 changes: 4 additions & 4 deletions python/console/console.py
Expand Up @@ -31,8 +31,8 @@
from .console_output import ShellOutputScintilla
from .console_editor import EditorTabWidget
from .console_settings import optionsDialog
from qgis.core import QgsApplication, QgsContextHelp, QgsSettings
from qgis.gui import QgsFilterLineEdit
from qgis.core import QgsApplication, QgsSettings
from qgis.gui import QgsFilterLineEdit, QgsHelp
from functools import partial

import sys
Expand All @@ -59,7 +59,7 @@ def show_console():
# Shows help on first launch of the console
settings = QgsSettings()
if settings.value('pythonConsole/contextHelpOnFirstLaunch', True, type=bool):
QgsContextHelp.run("PythonConsole")
QgsHelp.openHelp("../pyqgis_developer_cookbook/intro.html#python-console")
settings.setValue('pythonConsole/contextHelpOnFirstLaunch', False)

return _console
Expand Down Expand Up @@ -657,7 +657,7 @@ def saveAsScriptFile(self, index=None):
self.updateTabListScript(pathFileName, action='remove')

def openHelp(self):
QgsContextHelp.run("PythonConsole")
QgsHelp.openHelp("../pyqgis_developer_cookbook/intro.html#python-console")

def openSettings(self):
if optionsDialog(self).exec_():
Expand Down
1 change: 0 additions & 1 deletion python/core/core_auto.sip
Expand Up @@ -19,7 +19,6 @@
%Include qgscolorramp.sip
%Include qgscolorscheme.sip
%Include qgscolorschemeregistry.sip
%Include qgscontexthelp.sip
%Include qgsconditionalstyle.sip
%Include qgscoordinatetransform.sip
%Include qgscrscache.sip
Expand Down
41 changes: 0 additions & 41 deletions python/core/qgscontexthelp.sip

This file was deleted.

10 changes: 7 additions & 3 deletions python/gui/qgsnewhttpconnection.sip
Expand Up @@ -8,6 +8,9 @@






class QgsNewHttpConnection : QDialog
{
%Docstring
Expand All @@ -28,12 +31,13 @@ Constructor
virtual void accept();


void helpRequest();
%Docstring
Open the help in a browser
%End
void on_txtName_textChanged( const QString & );

void on_txtUrl_textChanged( const QString & );

void on_buttonBox_helpRequested();

};

/************************************************************************
Expand Down
5 changes: 4 additions & 1 deletion python/gui/qgssearchquerybuilder.sip
Expand Up @@ -78,7 +78,10 @@ change search string shown in text field
are inserted into the values list box.
%End

void on_buttonBox_helpRequested();
void helpRequest();
%Docstring
Open the help in a browser
%End

void saveQuery();
void loadQuery();
Expand Down
1 change: 0 additions & 1 deletion python/gui/qgssublayersdialog.sip
Expand Up @@ -77,7 +77,6 @@ class QgsSublayersDialog : QDialog
%End

public slots:
void on_buttonBox_helpRequested();
int exec();
%Docstring
:rtype: int
Expand Down
37 changes: 37 additions & 0 deletions scripts/chkdoclink.sh
@@ -0,0 +1,37 @@
#!/bin/bash
###########################################################################
# chkdoclink.sh
# ---------------------
# Date : August 2017
# Copyright : (C) 2017 by Jorge Gustavo Rocha
# Email : jgr at geomaster dot pt
###########################################################################
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
###########################################################################

# This script is used to check missing links to the documentation
# This script only reports missing links
# An option argument can be used to indicate the base URL of the documentation, for example:
#
# scripts/chkdoclink.sh http://docs.qgis.org/2.18/en/docs/user_manual/
#
# When no link is indicated, the link used is:
# http://docs.qgis.org/testing/en/docs/user_manual/
#
# Nødebo, August 2017

prefix=${1:-http://docs.qgis.org/testing/en/docs/user_manual/}
find .. \( -name \*.h -o -name \*.cpp \) -exec grep -H "QgsHelp::openHelp(" \{\} \; | sed 's/:[^"]\+/\t/;s/" .\+$/"/' | sort | sed 's/^\.\.\/QGIS\///' | awk -F $'\t' '{print $1 ";" $2;}' | grep -v ";$" | sed 's/"//g' | while read line; do
file=${line%;*}
suffix=${line##*;}
link=$prefix$suffix
if ! wget --spider $link 2>/dev/null; then
echo "Documentation missing for: $file Key: $suffix"
fi
done

27 changes: 0 additions & 27 deletions scripts/process_contexthelp.py

This file was deleted.

1 change: 1 addition & 0 deletions scripts/update_ts_files.sh
Expand Up @@ -22,6 +22,7 @@
# name is reserved for the Windows qmake project file

echo "deprecated - use push_ts.sh and pull_ts.sh" >&2
echo "deprecated - src/core/qgscontexthelp_texts.cpp are no longer used" >&2

set -e

Expand Down
1 change: 0 additions & 1 deletion src/app/composer/qgscomposer.cpp
Expand Up @@ -57,7 +57,6 @@
#include "qgsproject.h"
#include "qgsmapcanvas.h"
#include "qgsmessageviewer.h"
#include "qgscontexthelp.h"
#include "qgscursors.h"
#include "qgsmaplayeractionregistry.h"
#include "qgsgeometry.h"
Expand Down
1 change: 0 additions & 1 deletion src/app/qgsbookmarks.cpp
Expand Up @@ -17,7 +17,6 @@
#include "qgisapp.h"
#include "qgsapplication.h"
#include "qgsbookmarks.h"
#include "qgscontexthelp.h"
#include "qgsmapcanvas.h"
#include "qgsproject.h"
#include "qgsmessagelog.h"
Expand Down
6 changes: 6 additions & 0 deletions src/app/qgsfieldcalculator.cpp
Expand Up @@ -53,6 +53,7 @@ QgsFieldCalculator::QgsFieldCalculator( QgsVectorLayer *vl, QWidget *parent )

connect( builder, &QgsExpressionBuilderWidget::expressionParsed, this, &QgsFieldCalculator::setOkButtonState );
connect( mOutputFieldWidthSpinBox, &QAbstractSpinBox::editingFinished, this, &QgsFieldCalculator::setPrecisionMinMax );
connect( mButtonBox, &QDialogButtonBox::helpRequested, this, &QgsFieldCalculator::helpRequest );

QgsDistanceArea myDa;
myDa.setSourceCrs( vl->crs() );
Expand Down Expand Up @@ -482,3 +483,8 @@ void QgsFieldCalculator::setPrecisionMinMax()
mOutputFieldPrecisionSpinBox->setMinimum( minPrecType );
mOutputFieldPrecisionSpinBox->setMaximum( qMax( minPrecType, qMin( maxPrecType, mOutputFieldWidthSpinBox->value() ) ) );
}

void QgsFieldCalculator::helpRequest()
{
QgsHelp::openHelp( "working_with_vector/attribute_table.html#field-calculator" );
}
4 changes: 1 addition & 3 deletions src/app/qgsfieldcalculator.h
Expand Up @@ -41,9 +41,7 @@ class APP_EXPORT QgsFieldCalculator: public QDialog, private Ui::QgsFieldCalcula
void on_mCreateVirtualFieldCheckbox_stateChanged( int state );
void on_mOutputFieldNameLineEdit_textChanged( const QString &text );
void on_mOutputFieldTypeComboBox_activated( int index );

void on_mButtonBox_helpRequested() { QgsHelp::openHelp( QStringLiteral( "working_with_vector/attribute_table.html#editing-attribute-values" ) ); }

void helpRequest();

private slots:
//! Sets the OK button enabled / disabled
Expand Down
1 change: 0 additions & 1 deletion src/app/qgsprojectproperties.cpp
Expand Up @@ -23,7 +23,6 @@
#include "qgsdistancearea.h"
#include "qgisapp.h"
#include "qgscomposer.h"
#include "qgscontexthelp.h"
#include "qgscoordinatetransform.h"
#include "qgslayoutmanager.h"
#include "qgslogger.h"
Expand Down
1 change: 0 additions & 1 deletion src/app/qgsrasterlayerproperties.cpp
Expand Up @@ -22,7 +22,6 @@
#include "qgsapplication.h"
#include "qgsbilinearrasterresampler.h"
#include "qgsbrightnesscontrastfilter.h"
#include "qgscontexthelp.h"
#include "qgscontrastenhancement.h"
#include "qgscoordinatetransform.h"
#include "qgscubicrasterresampler.h"
Expand Down
1 change: 0 additions & 1 deletion src/app/qgsvectorlayerproperties.cpp
Expand Up @@ -25,7 +25,6 @@
#include "qgsapplication.h"
#include "qgsattributeactiondialog.h"
#include "qgsapplydialog.h"
#include "qgscontexthelp.h"
#include "qgscoordinatetransform.h"
#include "qgsdiagramproperties.h"
#include "qgsdiagramrenderer.h"
Expand Down
18 changes: 3 additions & 15 deletions src/core/CMakeLists.txt
Expand Up @@ -139,8 +139,7 @@ SET(QGIS_CORE_SRCS
qgscolorscheme.cpp
qgscolorschemeregistry.cpp
qgsconditionalstyle.cpp
qgscontexthelp.cpp
qgscoordinatereferencesystem.cpp
qgscoordinatereferencesystem.cpp
qgscoordinatetransform.cpp
qgscoordinatetransform_p.cpp
qgscoordinateutils.cpp
Expand Down Expand Up @@ -459,7 +458,6 @@ SET(QGIS_CORE_SRCS
fieldformatter/qgsvaluemapfieldformatter.cpp
fieldformatter/qgsvaluerelationfieldformatter.cpp

${CMAKE_CURRENT_BINARY_DIR}/qgscontexthelp_texts.cpp
${CMAKE_CURRENT_BINARY_DIR}/qgsexpression_texts.cpp

qgsuserprofile.cpp
Expand All @@ -480,14 +478,6 @@ ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/qgsexpression_texts.cpp
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

FILE(GLOB CONTEXT_HELP_FILES "${CMAKE_SOURCE_DIR}/resources/context_help/*")
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/qgscontexthelp_texts.cpp
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripts/process_contexthelp.py ${CMAKE_CURRENT_BINARY_DIR}/qgscontexthelp_texts.cpp.temp
COMMAND ${CMAKE_COMMAND} -DSRC=${CMAKE_CURRENT_BINARY_DIR}/qgscontexthelp_texts.cpp.temp -DDST=${CMAKE_CURRENT_BINARY_DIR}/qgscontexthelp_texts.cpp -P ${CMAKE_SOURCE_DIR}/cmake/CopyIfChanged.cmake
DEPENDS ${CONTEXT_HELP_FILES}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

IF(ENABLE_MODELTEST)
SET(MODELTEST_SRCS
../../tests/qt_modeltest/modeltest.cpp
Expand Down Expand Up @@ -554,8 +544,7 @@ SET(QGIS_CORE_MOC_HDRS
qgsactionscoperegistry.h
qgsanimatedicon.h
qgsbrowsermodel.h
qgscontexthelp.h
qgscoordinatereferencesystem.h
qgscoordinatereferencesystem.h
qgscredentials.h
qgsdataitem.h
qgsdataprovider.h
Expand Down Expand Up @@ -770,8 +759,7 @@ SET(QGIS_CORE_HDRS
qgscolorscheme.h
qgscolorschemeregistry.h
qgsconnectionpool.h
qgscontexthelp.h
qgsconditionalstyle.h
qgsconditionalstyle.h
qgscoordinatetransform.h
qgscoordinateutils.h
qgscrscache.h
Expand Down

0 comments on commit 3a103b7

Please sign in to comment.