Skip to content

Commit

Permalink
migrate setting distanceThreshold to class (Double, core)
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Jan 25, 2023
1 parent c5e9157 commit 9514613
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app/options/qgsgpsoptions.cpp
Expand Up @@ -210,7 +210,7 @@ QgsGpsOptionsWidget::QgsGpsOptionsWidget( QWidget *parent )
gpsdDevice = settings.value( QStringLiteral( "gpsdDevice" ), QVariant(), QgsSettings::Gps ).toString();

acquisitionInterval = settings.value( QStringLiteral( "acquisitionInterval" ), 0, QgsSettings::Gps ).toInt();
distanceThreshold = settings.value( QStringLiteral( "distanceThreshold" ), 0, QgsSettings::Gps ).toDouble();
distanceThreshold = QgsGpsLogger::settingsDistanceThreshold->value();

bearingFromTravelDirection = settings.value( QStringLiteral( "calculateBearingFromTravel" ), "false", QgsSettings::Gps ).toBool();

Expand Down
6 changes: 5 additions & 1 deletion src/core/gps/qgsgpslogger.cpp
Expand Up @@ -23,6 +23,10 @@
#include <QTimer>
#include <QTimeZone>

#include "qgssettingsentryimpl.h"
const QgsSettingsEntryDouble *QgsGpsLogger::settingsDistanceThreshold = new QgsSettingsEntryDouble( QStringLiteral( "distanceThreshold" ), QgsSettings::sTreeGps, 0 );


const QgsSettingsEntryEnumFlag<Qgis::GpsInformationComponent> *QgsGpsLogger::settingsGpsMValueComponent = new QgsSettingsEntryEnumFlag<Qgis::GpsInformationComponent>( QStringLiteral( "m-value-attribute" ), QgsSettings::sTreeGps, Qgis::GpsInformationComponent::Timestamp, QStringLiteral( "Which GPS attribute should be stored in geometry m values" ) ) SIP_SKIP;

const QgsSettingsEntryBool *QgsGpsLogger::settingsGpsStoreAttributeInMValues = new QgsSettingsEntryBool( QStringLiteral( "store-attribute-in-m-values" ), QgsSettings::sTreeGps, false, QStringLiteral( "Whether GPS attributes should be stored in geometry m values" ) ) SIP_SKIP;
Expand Down Expand Up @@ -226,7 +230,7 @@ void QgsGpsLogger::updateGpsSettings()
QgsSettings settings;

acquisitionInterval = settings.value( QStringLiteral( "acquisitionInterval" ), 0, QgsSettings::Gps ).toInt();
mDistanceThreshold = settings.value( QStringLiteral( "distanceThreshold" ), 0, QgsSettings::Gps ).toDouble();
mDistanceThreshold = QgsGpsLogger::settingsDistanceThreshold->value();
mApplyLeapSettings = settings.value( QStringLiteral( "applyLeapSeconds" ), true, QgsSettings::Gps ).toBool();
mLeapSeconds = settings.value( QStringLiteral( "leapSecondsCorrection" ), 18, QgsSettings::Gps ).toInt();

Expand Down
4 changes: 4 additions & 0 deletions src/core/gps/qgsgpslogger.h
Expand Up @@ -31,6 +31,8 @@
#include <QDateTime>
#include "info.h"

class QgsSettingsEntryDouble;

class QgsGpsConnection;
class QTimer;
class QgsGpsInformation;
Expand All @@ -52,6 +54,8 @@ class CORE_EXPORT QgsGpsLogger : public QObject

public:

static const QgsSettingsEntryDouble *settingsDistanceThreshold SIP_SKIP;

#ifndef SIP_RUN
//! Settings entry for whether storing GPS attributes as geometry M values should be enabled
static const QgsSettingsEntryBool *settingsGpsStoreAttributeInMValues;
Expand Down
1 change: 1 addition & 0 deletions src/core/settings/qgssettingsregistrycore.cpp
Expand Up @@ -25,6 +25,7 @@
#include "qgsowsconnection.h"
#include "qgsprocessing.h"
#include "qgsvectortileconnection.h"
#include "qgsgpslogger.h"
#include "qgsgpsdetector.h"


Expand Down

0 comments on commit 9514613

Please sign in to comment.