diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2013-10-28 16:14:23 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-30 13:50:28 +0100 |
commit | a3e4a69a17a68e1b6bf3a9254164cac0eb2e71b5 (patch) | |
tree | 5359197b90432c3dc643870ecafa4e0518681a42 /src/imports | |
parent | 9f58f8cbf859b2bc7225ee8e0c841200c72e47b4 (diff) | |
download | qtlocation-a3e4a69a17a68e1b6bf3a9254164cac0eb2e71b5.tar.gz |
Add QGeoPositionInfoSource::NoPositioningMethods enum value
This simplifies various position backend implementations
as they don't have to cast 0 to QGeoPositionInfoSource::PositioningMethods
At the same time we synchronize the same QML enum and its value name.
Change-Id: Ic0b258161a6319da238b265ad5d9926349f461f1
Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/positioning/plugins.qmltypes | 12 | ||||
-rw-r--r-- | src/imports/positioning/qdeclarativepositionsource.cpp | 26 | ||||
-rw-r--r-- | src/imports/positioning/qdeclarativepositionsource_p.h | 6 |
3 files changed, 23 insertions, 21 deletions
diff --git a/src/imports/positioning/plugins.qmltypes b/src/imports/positioning/plugins.qmltypes index 7e7f6a13..55cfac45 100644 --- a/src/imports/positioning/plugins.qmltypes +++ b/src/imports/positioning/plugins.qmltypes @@ -134,18 +134,18 @@ Module { Enum { name: "PositioningMethod" values: { - "NoPositioningMethod": 0, - "SatellitePositioningMethod": 255, - "NonSatellitePositioningMethod": -256, + "NoPositioningMethods": 0, + "SatellitePositioningMethods": 255, + "NonSatellitePositioningMethods": -256, "AllPositioningMethods": -1 } } Enum { name: "PositioningMethods" values: { - "NoPositioningMethod": 0, - "SatellitePositioningMethod": 255, - "NonSatellitePositioningMethod": -256, + "NoPositioningMethods": 0, + "SatellitePositioningMethods": 255, + "NonSatellitePositioningMethods": -256, "AllPositioningMethods": -1 } } diff --git a/src/imports/positioning/qdeclarativepositionsource.cpp b/src/imports/positioning/qdeclarativepositionsource.cpp index 2cceae0f..eff548d2 100644 --- a/src/imports/positioning/qdeclarativepositionsource.cpp +++ b/src/imports/positioning/qdeclarativepositionsource.cpp @@ -116,7 +116,7 @@ QT_BEGIN_NAMESPACE */ QDeclarativePositionSource::QDeclarativePositionSource() -: m_positionSource(0), m_preferredPositioningMethods(NoPositioningMethod), m_nmeaFile(0), +: m_positionSource(0), m_preferredPositioningMethods(NoPositioningMethods), m_nmeaFile(0), m_nmeaSocket(0), m_active(false), m_singleUpdate(false), m_updateInterval(0), m_sourceError(NoError) { @@ -453,9 +453,9 @@ int QDeclarativePositionSource::updateInterval() const current source. \list - \li PositionSource.NoPositioningMethod - No positioning methods supported (no source). - \li PositionSource.SatellitePositioningMethod - Satellite-based positioning methods such as GPS are supported. - \li PositionSource.NonSatellitePositioningMethod - Non-satellite-based methods are supported. + \li PositionSource.NoPositioningMethods - No positioning methods supported (no source). + \li PositionSource.SatellitePositioningMethods - Satellite-based positioning methods such as GPS are supported. + \li PositionSource.NonSatellitePositioningMethods - Non-satellite-based methods are supported. \li PositionSource.AllPositioningMethods - Both satellite-based and non-satellite positioning methods are supported. \endlist @@ -468,12 +468,12 @@ QDeclarativePositionSource::PositioningMethods QDeclarativePositionSource::suppo if ( (methods & QGeoPositionInfoSource::AllPositioningMethods) == methods ) { return QDeclarativePositionSource::AllPositioningMethods; } else if (methods & QGeoPositionInfoSource::SatellitePositioningMethods) { - return QDeclarativePositionSource::SatellitePositioningMethod; + return QDeclarativePositionSource::SatellitePositioningMethods; } else if (methods & QGeoPositionInfoSource::NonSatellitePositioningMethods) { - return QDeclarativePositionSource::NonSatellitePositioningMethod; + return QDeclarativePositionSource::NonSatellitePositioningMethods; } } - return QDeclarativePositionSource::NoPositioningMethod; + return QDeclarativePositionSource::NoPositioningMethods; } /*! @@ -483,8 +483,9 @@ QDeclarativePositionSource::PositioningMethods QDeclarativePositionSource::suppo current source. \list - \li PositionSource.SatellitePositioningMethod - Satellite-based positioning methods such as GPS should be preferred. - \li PositionSource.NonSatellitePositioningMethod - Non-satellite-based methods should be preferred. + \li PositionSource.NoPositioningMethods - No positioning method is preferred. + \li PositionSource.SatellitePositioningMethods - Satellite-based positioning methods such as GPS should be preferred. + \li PositionSource.NonSatellitePositioningMethods - Non-satellite-based methods should be preferred. \li PositionSource.AllPositioningMethods - Any positioning methods are acceptable. \endlist @@ -519,10 +520,11 @@ QDeclarativePositionSource::PositioningMethods QDeclarativePositionSource::prefe if ( (methods & QGeoPositionInfoSource::AllPositioningMethods) == methods) { return QDeclarativePositionSource::AllPositioningMethods; } else if (methods & QGeoPositionInfoSource::SatellitePositioningMethods) { - return QDeclarativePositionSource::SatellitePositioningMethod; + return QDeclarativePositionSource::SatellitePositioningMethods; } else if (methods & QGeoPositionInfoSource::NonSatellitePositioningMethods) { - return QDeclarativePositionSource::NonSatellitePositioningMethod; - } + return QDeclarativePositionSource::NonSatellitePositioningMethods; + } else if (methods == QGeoPositionInfoSource::NoPositioningMethods) + return QDeclarativePositionSource::NoPositioningMethods; } return m_preferredPositioningMethods; } diff --git a/src/imports/positioning/qdeclarativepositionsource_p.h b/src/imports/positioning/qdeclarativepositionsource_p.h index 63e54587..b44ba4bb 100644 --- a/src/imports/positioning/qdeclarativepositionsource_p.h +++ b/src/imports/positioning/qdeclarativepositionsource_p.h @@ -73,9 +73,9 @@ class QDeclarativePositionSource : public QObject, public QQmlParserStatus public: enum PositioningMethod { - NoPositioningMethod = 0, - SatellitePositioningMethod = QGeoPositionInfoSource::SatellitePositioningMethods, - NonSatellitePositioningMethod = QGeoPositionInfoSource::NonSatellitePositioningMethods, + NoPositioningMethods = QGeoPositionInfoSource::NoPositioningMethods, + SatellitePositioningMethods = QGeoPositionInfoSource::SatellitePositioningMethods, + NonSatellitePositioningMethods = QGeoPositionInfoSource::NonSatellitePositioningMethods, AllPositioningMethods = QGeoPositionInfoSource::AllPositioningMethods }; |