Skip to content

Commit 9e176fe

Browse files
committed
gps fixes
1 parent e545d44 commit 9e176fe

9 files changed

Lines changed: 73 additions & 23 deletions

File tree

cmake_templates/Doxyfile.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2072,7 +2072,8 @@ EXPAND_AS_DEFINED = "SIP_ABSTRACT" \
20722072
"SIP_SKIP" \
20732073
"SIP_TRANSFER" \
20742074
"SIP_TRANSFERBACK" \
2075-
"SIP_TRANSFERTHIS"
2075+
"SIP_TRANSFERTHIS" \
2076+
"SIP_WHEN_FEATURE"
20762077

20772078
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
20782079
# remove all references to function-like macros that are alone on a line, have

python/core/gps/qgsgpsconnection.sip

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ class QgsGPSConnection : QObject
5151

5252
%TypeHeaderCode
5353
#include "qgsgpsconnection.h"
54+
55+
#include <qgsgpsdconnection.h>
56+
#include <qgsnmeaconnection.h>
57+
%End
58+
59+
%ConvertToSubClassCode
60+
if ( sipCpp->inherits( "QgsGpsdConnection" ) )
61+
sipType = sipType_QgsGpsdConnection;
62+
else if ( sipCpp->inherits( "QgsNMEAConnection" ) )
63+
sipType = sipType_QgsNMEAConnection;
64+
else
65+
sipType = NULL;
5466
%End
5567
public:
5668

python/core/gps/qgsgpsconnectionregistry.sip

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ Unregisters connection. The registry does no longer own the connection
4343
:rtype: list of QgsGPSConnection
4444
%End
4545

46+
private:
47+
QgsGPSConnectionRegistry( const QgsGPSConnectionRegistry &rh );
4648
};
4749

4850
/************************************************************************

python/core/gps/qgsqtlocationconnection.sip

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,8 @@
1111

1212

1313

14-
QTM_USE_NAMESPACE
15-
%Docstring
16-
*************************************************************************
17-
*
18-
This program is free software; you can redistribute it and/or modify *
19-
it under the terms of the GNU General Public License as published by *
20-
the Free Software Foundation; either version 2 of the License, or *
21-
(at your option) any later version. *
22-
*
23-
**************************************************************************
24-
%End
14+
%Feature MOBILITY_LOCATION
15+
%If (MOBILITY_LOCATION)
2516

2617
class QgsQtLocationConnection: QgsGPSConnection
2718
{
@@ -49,18 +40,31 @@ Needed to make QtLocation detected
4940
Parse available data source content
5041
%End
5142

52-
void positionUpdated( const QGeoPositionInfo &info );
43+
44+
%If (!ANDROID)
45+
46+
void satellitesInViewUpdated( const QList<QGeoSatelliteInfo> &satellites );
5347
%Docstring
54-
Called when the position updated.
48+
Called when the number of satellites in view is updated.
5549
.. note::
5650

57-
not available in Python binding
51+
not available in Python bindings on android
5852
%End
5953

54+
void satellitesInUseUpdated( const QList<QGeoSatelliteInfo> &satellites );
55+
%Docstring
56+
Called when the number of satellites in use is updated.
57+
.. note::
58+
59+
not available in Python bindings on android
60+
%End
6061

62+
%End
6163

6264
};
6365

66+
%End // MOBILITY_LOCATION
67+
6468
/************************************************************************
6569
* This file has been generated automatically from *
6670
* *

scripts/sipify.pl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
my $PRIVATE_SECTION_LINE = '';
4545
my $RETURN_TYPE = '';
4646
my $IS_OVERRIDE = 0;
47+
my $IF_FEATURE_CONDITION = '';
4748
my %QFLAG_HASH;
4849

4950
my $LINE_COUNT = @INPUT_LINES;
@@ -75,7 +76,10 @@ sub write_output {
7576
else{
7677
$dbg_code = '';
7778
}
79+
push @OUTPUT, "%If ($IF_FEATURE_CONDITION)\n" if $IF_FEATURE_CONDITION ne '';
7880
push @OUTPUT, $dbg_code.$out;
81+
push @OUTPUT, "%End\n" if $IF_FEATURE_CONDITION ne '';
82+
$IF_FEATURE_CONDITION = '';
7983
}
8084

8185
sub dbg_info {
@@ -275,6 +279,11 @@ sub detect_comment_block{
275279
next;
276280
}
277281

282+
if ( $LINE =~ s/SIP_WHEN_FEATURE\(\s*(.*?)\s*\)// ){
283+
dbg_info('found SIP_WHEN_FEATURE');
284+
$IF_FEATURE_CONDITION = $1;
285+
}
286+
278287
# Skip preprocessor stuff
279288
if ($LINE =~ m/^\s*#/){
280289

@@ -626,9 +635,7 @@ sub detect_comment_block{
626635
}
627636
}
628637

629-
if ( $LINE =~ m/\boverride\b/){
630-
$IS_OVERRIDE = 1;
631-
}
638+
$IS_OVERRIDE = 1 if ( $LINE =~ m/\boverride\b/);
632639

633640
# keyword fixes
634641
do {no warnings 'uninitialized';

src/core/gps/qgsgpsconnection.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,12 @@ struct CORE_EXPORT QgsGPSInformation
6262
/** \ingroup core
6363
* Abstract base class for connection to a GPS device*/
6464
class CORE_EXPORT QgsGPSConnection : public QObject
65+
{
6566
#ifdef SIP_RUN
6667
#include <qgsgpsdconnection.h>
6768
#include <qgsnmeaconnection.h>
6869
#endif
69-
{
70+
7071

7172
#ifdef SIP_RUN
7273
SIP_CONVERT_TO_SUBCLASS_CODE

src/core/gps/qgsgpsconnectionregistry.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ class CORE_EXPORT QgsGPSConnectionRegistry
5151
QList< QgsGPSConnection *> connectionList() const;
5252

5353
private:
54+
#ifdef SIP_RUN
55+
QgsGPSConnectionRegistry( const QgsGPSConnectionRegistry &rh );
56+
#endif
5457

5558
QSet<QgsGPSConnection *> mConnections;
5659
};

src/core/gps/qgsqtlocationconnection.h

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
#include <QtCore/QPointer>
2626

27+
#ifndef SIP_RUN
2728
#if defined(HAVE_QT_MOBILITY_LOCATION )
2829
#include <QtLocation/QGeoPositionInfoSource>
2930
#include <QtLocation/QGeoSatelliteInfo>
@@ -35,6 +36,10 @@ QTM_USE_NAMESPACE
3536
#include <QtPositioning/QGeoSatelliteInfo>
3637
#include <QtPositioning/QGeoSatelliteInfoSource>
3738
#endif
39+
#endif
40+
41+
SIP_FEATURE( MOBILITY_LOCATION )
42+
SIP_IF_FEATURE( MOBILITY_LOCATION )
3843

3944
/**
4045
* \ingroup core
@@ -56,19 +61,27 @@ class CORE_EXPORT QgsQtLocationConnection: public QgsGPSConnection
5661
void parseData();
5762

5863
/** Called when the position updated.
59-
* \note not available in Python binding
64+
* \note not available in Python bindings
6065
*/
61-
void positionUpdated( const QGeoPositionInfo &info );
66+
void positionUpdated( const QGeoPositionInfo &info ) SIP_SKIP;
67+
68+
#ifdef SIP_RUN
69+
SIP_IF_FEATURE( !ANDROID )
70+
#endif
6271

6372
/** Called when the number of satellites in view is updated.
6473
* \note not available in Python bindings on android
6574
*/
66-
void satellitesInViewUpdated( const QList<QGeoSatelliteInfo> &satellites ) SIP_SKIP;
75+
void satellitesInViewUpdated( const QList<QGeoSatelliteInfo> &satellites );
6776

6877
/** Called when the number of satellites in use is updated.
6978
* \note not available in Python bindings on android
7079
*/
71-
void satellitesInUseUpdated( const QList<QGeoSatelliteInfo> &satellites ) SIP_SKIP;
80+
void satellitesInUseUpdated( const QList<QGeoSatelliteInfo> &satellites );
81+
82+
#ifdef SIP_RUN
83+
SIP_END
84+
#endif
7285

7386
private:
7487
void startGPS();
@@ -80,4 +93,6 @@ class CORE_EXPORT QgsQtLocationConnection: public QgsGPSConnection
8093

8194
};
8295

96+
SIP_END // MOBILITY_LOCATION
97+
8398
#endif // QGSQTLOCATIONCONNECTION_H

src/core/qgis_sip.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@
142142
*/
143143
#define SIP_IF_FEATURE(feature)
144144

145+
/*
146+
* Will place the current line with an `%If feature` directive in sip file
147+
*/
148+
#define SIP_WHEN_FEATURE(feature)
149+
145150
/*
146151
* Convert to subclass code
147152
*/

0 commit comments

Comments
 (0)