Skip to content

Commit 212406c

Browse files
committedJan 10, 2017
make all QgsHelp methods static
1 parent 1882aea commit 212406c

File tree

7 files changed

+14
-71
lines changed

7 files changed

+14
-71
lines changed
 

‎python/core/qgsapplication.sip

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -437,13 +437,6 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
437437
*/
438438
static QgsMessageLog* messageLog();
439439

440-
/**
441-
* Returns the application's help viewer, used for displaying
442-
* help topic for the given key
443-
* @note added in QGIS 3.0
444-
*/
445-
static QgsHelp* helpViewer();
446-
447440
%If(ANDROID)
448441
//dummy method to workaround sip generation issue issue
449442
bool x11EventFilter ( XEvent * event );

‎python/core/qgshelp.sip

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,27 @@
1414
* If no help found, default error page with information how to setup
1515
* help system will be shown.
1616
*
17-
* This class can be created directly, or accessed via
18-
* QgsApplication::helpViewer().
19-
*
2017
* @note added in QGIS 3.0
2118
*/
22-
class QgsHelp : QObject
19+
class QgsHelp
2320
{
2421
%TypeHeaderCode
2522
#include <qgshelp.h>
2623
%End
2724

2825
public:
2926

30-
/** Constructor for QgsHelp.
31-
* @param parent parent QObject
32-
*/
33-
QgsHelp( QObject* parent = nullptr );
34-
35-
virtual ~QgsHelp();
36-
3727
/** Opens help topic for the given help key using default system
3828
* web browser. If help topic not found, builtin error page shown.
3929
* @param key key which identified help topic
4030
* @note added in QGIS 3.0
4131
*/
42-
void openHelp( const QString& key ) const;
32+
static void openHelp( const QString& key );
4333

4434
/** Returns URI of the help topic for the given key. If help topic
4535
* not found, URI of the builtin error page returned.
4636
* @param key key which identified help topic
4737
* @note added in QGIS 3.0
4838
*/
49-
QUrl helpUrl( const QString& key ) const;
39+
static QUrl helpUrl( const QString& key );
5040
};

‎src/core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,6 @@ SET(QGIS_CORE_MOC_HDRS
482482
qgsgeometryvalidator.h
483483
qgsgml.h
484484
qgsgmlschema.h
485-
qgshelp.h
486485
qgsmaplayer.h
487486
qgsmaplayerlegend.h
488487
qgsmaplayermodel.h
@@ -675,6 +674,7 @@ SET(QGIS_CORE_HDRS
675674
qgsfields.h
676675
qgsfontutils.h
677676
qgsgeometrycache.h
677+
qgshelp.h
678678
qgshistogram.h
679679
qgsindexedfeature.h
680680
qgsinterval.h

‎src/core/qgsapplication.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include "gps/qgsgpsconnectionregistry.h"
3737
#include "qgspluginlayerregistry.h"
3838
#include "qgsmessagelog.h"
39-
#include "qgshelp.h"
4039

4140
#include <QDir>
4241
#include <QFile>
@@ -147,7 +146,6 @@ QgsApplication::QgsApplication( int & argc, char ** argv, bool GUIenabled, const
147146
mRasterRendererRegistry = new QgsRasterRendererRegistry();
148147
mGpsConnectionRegistry = new QgsGPSConnectionRegistry();
149148
mPluginLayerRegistry = new QgsPluginLayerRegistry();
150-
mHelpViewer = new QgsHelp();
151149

152150
init( customConfigPath ); // init can also be called directly by e.g. unit tests that don't inherit QApplication.
153151
}
@@ -293,7 +291,6 @@ QgsApplication::~QgsApplication()
293291
delete mDataItemProviderRegistry;
294292
delete mProfiler;
295293
delete mMessageLog;
296-
delete mHelpViewer;
297294
}
298295

299296
QgsApplication* QgsApplication::instance()
@@ -1600,8 +1597,3 @@ QgsFieldFormatterRegistry* QgsApplication::fieldFormatterRegistry()
16001597
{
16011598
return instance()->mFieldFormatterRegistry;
16021599
}
1603-
1604-
QgsHelp* QgsApplication::helpViewer()
1605-
{
1606-
return instance()->mHelpViewer;
1607-
}

‎src/core/qgsapplication.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ class QgsGPSConnectionRegistry;
3737
class QgsDataItemProviderRegistry;
3838
class QgsPluginLayerRegistry;
3939
class QgsMessageLog;
40-
class QgsHelp;
4140

4241
/** \ingroup core
4342
* Extends QApplication to provide access to QGIS specific resources such
@@ -450,15 +449,6 @@ class CORE_EXPORT QgsApplication : public QApplication
450449
*/
451450
static QgsMessageLog* messageLog();
452451

453-
/**
454-
* Returns the application's help viewer, used for displaying
455-
* help topic for the given key
456-
* @note added in QGIS 3.0
457-
*/
458-
static QgsHelp* helpViewer();
459-
460-
461-
462452
#ifdef ANDROID
463453
//dummy method to workaround sip generation issue issue
464454
bool x11EventFilter( XEvent * event )
@@ -592,7 +582,6 @@ class CORE_EXPORT QgsApplication : public QApplication
592582
QgsActionScopeRegistry* mActionScopeRegistry;
593583
QgsRuntimeProfiler* mProfiler;
594584
QgsTaskManager* mTaskManager;
595-
QgsHelp* mHelpViewer;
596585
QgsFieldFormatterRegistry* mFieldFormatterRegistry;
597586
QgsColorSchemeRegistry* mColorSchemeRegistry;
598587
QgsPaintEffectRegistry* mPaintEffectRegistry;

‎src/core/qgshelp.cpp

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,12 @@
2525
#include "qgis.h"
2626
#include "qgsapplication.h"
2727

28-
QgsHelp::QgsHelp( QObject* parent )
29-
: QObject( parent )
28+
void QgsHelp::openHelp( const QString& key )
3029
{
30+
QDesktopServices::openUrl( QgsHelp::helpUrl( key ) );
3131
}
3232

33-
QgsHelp::~QgsHelp()
34-
{
35-
}
36-
37-
void QgsHelp::openHelp( const QString& key ) const
38-
{
39-
QDesktopServices::openUrl( helpUrl( key ) );
40-
}
41-
42-
QUrl QgsHelp::helpUrl( const QString& key ) const
33+
QUrl QgsHelp::helpUrl( const QString& key )
4334
{
4435
QUrl helpNotFound = QUrl::fromLocalFile( QgsApplication::pkgDataPath() + "/doc/nohelp.html" );
4536

@@ -84,7 +75,7 @@ QUrl QgsHelp::helpUrl( const QString& key ) const
8475

8576
if ( path.startsWith( QStringLiteral( "http://" ) ) )
8677
{
87-
if ( !urlExists( helpPath ) )
78+
if ( !QgsHelp::urlExists( helpPath ) )
8879
{
8980
continue;
9081
}
@@ -108,7 +99,7 @@ QUrl QgsHelp::helpUrl( const QString& key ) const
10899
return helpFound ? helpUrl : helpNotFound;
109100
}
110101

111-
bool QgsHelp::urlExists( const QString& url ) const
102+
bool QgsHelp::urlExists( const QString& url )
112103
{
113104
QUrl helpUrl( url );
114105
QTcpSocket socket;

‎src/core/qgshelp.h

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#ifndef QGSHELP_H
1717
#define QGSHELP_H
1818

19-
#include <QObject>
19+
#include <QtCore>
2020

2121
/** \ingroup core
2222
* \class QgsHelp
@@ -34,37 +34,25 @@
3434
* If no help found, default error page with information how to setup
3535
* help system will be shown.
3636
*
37-
* This class can be created directly, or accessed via
38-
* QgsApplication::helpViewer().
39-
*
4037
* @note added in QGIS 3.0
4138
*/
42-
class CORE_EXPORT QgsHelp : public QObject
39+
class CORE_EXPORT QgsHelp
4340
{
44-
Q_OBJECT
45-
4641
public:
4742

48-
/** Constructor for QgsHelp.
49-
* @param parent parent QObject
50-
*/
51-
QgsHelp( QObject* parent = nullptr );
52-
53-
virtual ~QgsHelp();
54-
5543
/** Opens help topic for the given help key using default system
5644
* web browser. If help topic not found, builtin error page shown.
5745
* @param key key which identified help topic
5846
* @note added in QGIS 3.0
5947
*/
60-
void openHelp( const QString& key ) const;
48+
static void openHelp( const QString& key );
6149

6250
/** Returns URI of the help topic for the given key. If help topic
6351
* not found, URI of the builtin error page returned.
6452
* @param key key which identified help topic
6553
* @note added in QGIS 3.0
6654
*/
67-
QUrl helpUrl( const QString& key ) const;
55+
static QUrl helpUrl( const QString& key );
6856

6957
private:
7058

@@ -73,7 +61,7 @@ class CORE_EXPORT QgsHelp : public QObject
7361
* @param url URL to check
7462
* @note added in QGIS 3.0
7563
*/
76-
bool urlExists( const QString& url ) const;
64+
static bool urlExists( const QString& url );
7765
};
7866

7967
#endif // QGSHELP_H

0 commit comments

Comments
 (0)
Please sign in to comment.