Skip to content

Commit

Permalink
Reintroduction of centering to GPS when starting to record new feature (
Browse files Browse the repository at this point in the history
  • Loading branch information
VitorVieiraZ authored Jun 19, 2024
1 parent 55b8aef commit eb2b626
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 31 deletions.
17 changes: 17 additions & 0 deletions app/appsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ AppSettings::AppSettings( QObject *parent ): QObject( parent )
bool autosync = settings.value( QStringLiteral( "autosyncAllowed" ), false ).toBool();
double gpsHeight = settings.value( "gpsHeight", 0 ).toDouble();
QString ignoreMigrateVersion = settings.value( QStringLiteral( "ignoreMigrateVersion" ) ).toString();
bool autolockPosition = settings.value( QStringLiteral( "autolockPosition" ), true ).toBool();

settings.endGroup();

Expand All @@ -46,6 +47,7 @@ AppSettings::AppSettings( QObject *parent ): QObject( parent )
setAutosyncAllowed( autosync );
setGpsAntennaHeight( gpsHeight );
setIgnoreMigrateVersion( ignoreMigrateVersion );
setAutolockPosition( autolockPosition );
}

QString AppSettings::defaultLayer() const
Expand Down Expand Up @@ -279,6 +281,21 @@ void AppSettings::setAutosyncAllowed( bool newAutosyncAllowed )
emit autosyncAllowedChanged( mAutosyncAllowed );
}

bool AppSettings::autolockPosition() const
{
return mAutolockPosition;
}

void AppSettings::setAutolockPosition( bool autolockPosition )
{
if ( mAutolockPosition == autolockPosition )
return;

mAutolockPosition = autolockPosition;
setValue( QStringLiteral( "autolockPosition" ), autolockPosition );
emit autolockPositionChanged( mAutolockPosition );
}

double AppSettings::gpsAntennaHeight() const
{
return mGpsAntennaHeight;
Expand Down
6 changes: 6 additions & 0 deletions app/appsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class AppSettings: public QObject
Q_PROPERTY( bool autosyncAllowed READ autosyncAllowed WRITE setAutosyncAllowed NOTIFY autosyncAllowedChanged )
Q_PROPERTY( double gpsAntennaHeight READ gpsAntennaHeight WRITE setGpsAntennaHeight NOTIFY gpsAntennaHeightChanged )
Q_PROPERTY( QString ignoreMigrateVersion READ ignoreMigrateVersion WRITE setIgnoreMigrateVersion NOTIFY ignoreMigrateVersionChanged )
Q_PROPERTY( bool autolockPosition READ autolockPosition WRITE setAutolockPosition NOTIFY autolockPositionChanged )

public:
explicit AppSettings( QObject *parent = nullptr );
Expand Down Expand Up @@ -82,6 +83,9 @@ class AppSettings: public QObject

static const QString POSITION_PROVIDERS_GROUP;

bool autolockPosition() const;
void setAutolockPosition( bool autolockPosition );

public slots:
void setReuseLastEnteredValues( bool reuseLastEnteredValues );

Expand All @@ -99,6 +103,7 @@ class AppSettings: public QObject
void activePositionProviderIdChanged( const QString & );

void autosyncAllowedChanged( bool autosyncAllowed );
void autolockPositionChanged( bool autolockPosition );

void ignoreMigrateVersionChanged();

Expand Down Expand Up @@ -132,6 +137,7 @@ class AppSettings: public QObject
QVariant value( const QString &key, const QVariant &defaultValue = QVariant() );
QString mActivePositionProviderId;
bool mAutosyncAllowed = false;
bool mAutolockPosition = true;
double mGpsAntennaHeight = 0;
QString mIgnoreMigrateVersion;
};
Expand Down
71 changes: 40 additions & 31 deletions app/qml/map/MMMapController.qml
Original file line number Diff line number Diff line change
Expand Up @@ -97,44 +97,53 @@ Item {
updatePosition()

switch ( state ) {
case "record": {
if ( __appSettings.autolockPosition ) { // center to GPS
if ( gpsStateGroup.state === "unavailable" ) {
__notificationModel.addError( "GPS currently unavailable." )
}
else {
root.centeredToGPS = true
updatePosition()
}
}

case "record": {
root.recordingStarted()
break
}
root.recordingStarted()
break
}

case "recordInLayer": {
root.recordInLayerFeatureStarted()
root.hideHighlight()
break
}
case "recordInLayer": {
root.recordInLayerFeatureStarted()
root.hideHighlight()
break
}

case "edit": {
root.editingGeometryStarted()
root.hideHighlight()
break
}
case "edit": {
root.editingGeometryStarted()
root.hideHighlight()
break
}

case "split": {
root.showInfoTextMessage( qsTr( "Create line to split the selected feature" ) )
root.splittingStarted()
break
}
case "split": {
root.showInfoTextMessage( qsTr( "Create line to split the selected feature" ) )
root.splittingStarted()
break
}

case "view": {
root.hideHighlight()
break
}
case "view": {
root.hideHighlight()
break
}

case "stakeout": {
root.hideHighlight()
root.stakeoutStarted( internal.stakeoutTarget )
break
}
case "stakeout": {
root.hideHighlight()
root.stakeoutStarted( internal.stakeoutTarget )
break
}

case "inactive": {
break
}
case "inactive": {
break
}
}
}

Expand Down
11 changes: 11 additions & 0 deletions app/qml/settings/MMSettingsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,17 @@ MMPage {
onClicked: __appSettings.autosyncAllowed = !checked
}

MMLine {}

MMSettingsComponents.MMSettingsSwitch {
width: parent.width
title: qsTr("Auto-lock position")
description: qsTr("Each time you start recording, the app centers to GPS")
checked: __appSettings.autolockPosition

onClicked: __appSettings.autolockPosition = !checked
}

Item { width: 1; height: 1 }

Text {
Expand Down

1 comment on commit eb2b626

@inputapp-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS - version 24.6.635411 just submitted!

Please sign in to comment.