mirror of
https://github.com/qgis/QGIS.git
synced 2025-11-22 00:14:55 -05:00
make all QgsHelp methods static
This commit is contained in:
parent
1882aea159
commit
212406cd65
@ -437,13 +437,6 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
|
||||
*/
|
||||
static QgsMessageLog* messageLog();
|
||||
|
||||
/**
|
||||
* Returns the application's help viewer, used for displaying
|
||||
* help topic for the given key
|
||||
* @note added in QGIS 3.0
|
||||
*/
|
||||
static QgsHelp* helpViewer();
|
||||
|
||||
%If(ANDROID)
|
||||
//dummy method to workaround sip generation issue issue
|
||||
bool x11EventFilter ( XEvent * event );
|
||||
|
||||
@ -14,12 +14,9 @@
|
||||
* If no help found, default error page with information how to setup
|
||||
* help system will be shown.
|
||||
*
|
||||
* This class can be created directly, or accessed via
|
||||
* QgsApplication::helpViewer().
|
||||
*
|
||||
* @note added in QGIS 3.0
|
||||
*/
|
||||
class QgsHelp : QObject
|
||||
class QgsHelp
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <qgshelp.h>
|
||||
@ -27,24 +24,17 @@ class QgsHelp : QObject
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor for QgsHelp.
|
||||
* @param parent parent QObject
|
||||
*/
|
||||
QgsHelp( QObject* parent = nullptr );
|
||||
|
||||
virtual ~QgsHelp();
|
||||
|
||||
/** Opens help topic for the given help key using default system
|
||||
* web browser. If help topic not found, builtin error page shown.
|
||||
* @param key key which identified help topic
|
||||
* @note added in QGIS 3.0
|
||||
*/
|
||||
void openHelp( const QString& key ) const;
|
||||
static void openHelp( const QString& key );
|
||||
|
||||
/** Returns URI of the help topic for the given key. If help topic
|
||||
* not found, URI of the builtin error page returned.
|
||||
* @param key key which identified help topic
|
||||
* @note added in QGIS 3.0
|
||||
*/
|
||||
QUrl helpUrl( const QString& key ) const;
|
||||
static QUrl helpUrl( const QString& key );
|
||||
};
|
||||
|
||||
@ -482,7 +482,6 @@ SET(QGIS_CORE_MOC_HDRS
|
||||
qgsgeometryvalidator.h
|
||||
qgsgml.h
|
||||
qgsgmlschema.h
|
||||
qgshelp.h
|
||||
qgsmaplayer.h
|
||||
qgsmaplayerlegend.h
|
||||
qgsmaplayermodel.h
|
||||
@ -675,6 +674,7 @@ SET(QGIS_CORE_HDRS
|
||||
qgsfields.h
|
||||
qgsfontutils.h
|
||||
qgsgeometrycache.h
|
||||
qgshelp.h
|
||||
qgshistogram.h
|
||||
qgsindexedfeature.h
|
||||
qgsinterval.h
|
||||
|
||||
@ -36,7 +36,6 @@
|
||||
#include "gps/qgsgpsconnectionregistry.h"
|
||||
#include "qgspluginlayerregistry.h"
|
||||
#include "qgsmessagelog.h"
|
||||
#include "qgshelp.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
@ -147,7 +146,6 @@ QgsApplication::QgsApplication( int & argc, char ** argv, bool GUIenabled, const
|
||||
mRasterRendererRegistry = new QgsRasterRendererRegistry();
|
||||
mGpsConnectionRegistry = new QgsGPSConnectionRegistry();
|
||||
mPluginLayerRegistry = new QgsPluginLayerRegistry();
|
||||
mHelpViewer = new QgsHelp();
|
||||
|
||||
init( customConfigPath ); // init can also be called directly by e.g. unit tests that don't inherit QApplication.
|
||||
}
|
||||
@ -293,7 +291,6 @@ QgsApplication::~QgsApplication()
|
||||
delete mDataItemProviderRegistry;
|
||||
delete mProfiler;
|
||||
delete mMessageLog;
|
||||
delete mHelpViewer;
|
||||
}
|
||||
|
||||
QgsApplication* QgsApplication::instance()
|
||||
@ -1600,8 +1597,3 @@ QgsFieldFormatterRegistry* QgsApplication::fieldFormatterRegistry()
|
||||
{
|
||||
return instance()->mFieldFormatterRegistry;
|
||||
}
|
||||
|
||||
QgsHelp* QgsApplication::helpViewer()
|
||||
{
|
||||
return instance()->mHelpViewer;
|
||||
}
|
||||
|
||||
@ -37,7 +37,6 @@ class QgsGPSConnectionRegistry;
|
||||
class QgsDataItemProviderRegistry;
|
||||
class QgsPluginLayerRegistry;
|
||||
class QgsMessageLog;
|
||||
class QgsHelp;
|
||||
|
||||
/** \ingroup core
|
||||
* Extends QApplication to provide access to QGIS specific resources such
|
||||
@ -450,15 +449,6 @@ class CORE_EXPORT QgsApplication : public QApplication
|
||||
*/
|
||||
static QgsMessageLog* messageLog();
|
||||
|
||||
/**
|
||||
* Returns the application's help viewer, used for displaying
|
||||
* help topic for the given key
|
||||
* @note added in QGIS 3.0
|
||||
*/
|
||||
static QgsHelp* helpViewer();
|
||||
|
||||
|
||||
|
||||
#ifdef ANDROID
|
||||
//dummy method to workaround sip generation issue issue
|
||||
bool x11EventFilter( XEvent * event )
|
||||
@ -592,7 +582,6 @@ class CORE_EXPORT QgsApplication : public QApplication
|
||||
QgsActionScopeRegistry* mActionScopeRegistry;
|
||||
QgsRuntimeProfiler* mProfiler;
|
||||
QgsTaskManager* mTaskManager;
|
||||
QgsHelp* mHelpViewer;
|
||||
QgsFieldFormatterRegistry* mFieldFormatterRegistry;
|
||||
QgsColorSchemeRegistry* mColorSchemeRegistry;
|
||||
QgsPaintEffectRegistry* mPaintEffectRegistry;
|
||||
|
||||
@ -25,21 +25,12 @@
|
||||
#include "qgis.h"
|
||||
#include "qgsapplication.h"
|
||||
|
||||
QgsHelp::QgsHelp( QObject* parent )
|
||||
: QObject( parent )
|
||||
void QgsHelp::openHelp( const QString& key )
|
||||
{
|
||||
QDesktopServices::openUrl( QgsHelp::helpUrl( key ) );
|
||||
}
|
||||
|
||||
QgsHelp::~QgsHelp()
|
||||
{
|
||||
}
|
||||
|
||||
void QgsHelp::openHelp( const QString& key ) const
|
||||
{
|
||||
QDesktopServices::openUrl( helpUrl( key ) );
|
||||
}
|
||||
|
||||
QUrl QgsHelp::helpUrl( const QString& key ) const
|
||||
QUrl QgsHelp::helpUrl( const QString& key )
|
||||
{
|
||||
QUrl helpNotFound = QUrl::fromLocalFile( QgsApplication::pkgDataPath() + "/doc/nohelp.html" );
|
||||
|
||||
@ -84,7 +75,7 @@ QUrl QgsHelp::helpUrl( const QString& key ) const
|
||||
|
||||
if ( path.startsWith( QStringLiteral( "http://" ) ) )
|
||||
{
|
||||
if ( !urlExists( helpPath ) )
|
||||
if ( !QgsHelp::urlExists( helpPath ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -108,7 +99,7 @@ QUrl QgsHelp::helpUrl( const QString& key ) const
|
||||
return helpFound ? helpUrl : helpNotFound;
|
||||
}
|
||||
|
||||
bool QgsHelp::urlExists( const QString& url ) const
|
||||
bool QgsHelp::urlExists( const QString& url )
|
||||
{
|
||||
QUrl helpUrl( url );
|
||||
QTcpSocket socket;
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
#ifndef QGSHELP_H
|
||||
#define QGSHELP_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QtCore>
|
||||
|
||||
/** \ingroup core
|
||||
* \class QgsHelp
|
||||
@ -34,37 +34,25 @@
|
||||
* If no help found, default error page with information how to setup
|
||||
* help system will be shown.
|
||||
*
|
||||
* This class can be created directly, or accessed via
|
||||
* QgsApplication::helpViewer().
|
||||
*
|
||||
* @note added in QGIS 3.0
|
||||
*/
|
||||
class CORE_EXPORT QgsHelp : public QObject
|
||||
class CORE_EXPORT QgsHelp
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor for QgsHelp.
|
||||
* @param parent parent QObject
|
||||
*/
|
||||
QgsHelp( QObject* parent = nullptr );
|
||||
|
||||
virtual ~QgsHelp();
|
||||
|
||||
/** Opens help topic for the given help key using default system
|
||||
* web browser. If help topic not found, builtin error page shown.
|
||||
* @param key key which identified help topic
|
||||
* @note added in QGIS 3.0
|
||||
*/
|
||||
void openHelp( const QString& key ) const;
|
||||
static void openHelp( const QString& key );
|
||||
|
||||
/** Returns URI of the help topic for the given key. If help topic
|
||||
* not found, URI of the builtin error page returned.
|
||||
* @param key key which identified help topic
|
||||
* @note added in QGIS 3.0
|
||||
*/
|
||||
QUrl helpUrl( const QString& key ) const;
|
||||
static QUrl helpUrl( const QString& key );
|
||||
|
||||
private:
|
||||
|
||||
@ -73,7 +61,7 @@ class CORE_EXPORT QgsHelp : public QObject
|
||||
* @param url URL to check
|
||||
* @note added in QGIS 3.0
|
||||
*/
|
||||
bool urlExists( const QString& url ) const;
|
||||
static bool urlExists( const QString& url );
|
||||
};
|
||||
|
||||
#endif // QGSHELP_H
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user