Skip to content

Commit

Permalink
Moved all digitizing settings except Enums and Flags
Browse files Browse the repository at this point in the history
  • Loading branch information
domi4484 committed Apr 26, 2021
1 parent 4fb0ab2 commit eaf18f6
Show file tree
Hide file tree
Showing 36 changed files with 261 additions and 308 deletions.
13 changes: 0 additions & 13 deletions python/core/auto_generated/settings/qgssettingsregistrycore.sip.in
Expand Up @@ -72,19 +72,6 @@ Add ``settingsEntry`` to the register.

const QgsSettingsEntryBool settingsDigitizingDefaultSnapEnabled;

class QgsSettingsEntryEnumFlag_settingsDigitizingDefaultSnapType
{
%TypeHeaderCode
#include "qgssettingsregistrycore.h"
#include "qgssettingsentry.h"
typedef QgsSettingsEntryEnumFlag<QgsSnappingConfig::SnappingTypes> QgsSettingsEntryEnumFlag_settingsDigitizingDefaultSnapType;
%End
public:
QgsSettingsEntryEnumFlag_settingsDigitizingDefaultSnapType( const QString &key, QgsSettings::Section section, const QgsSnappingConfig::SnappingTypes &defaultValue, const QString &description = QString() );
QString key( const QString &dynamicKeyPart = QString() ) const;
QgsSnappingConfig::SnappingTypes value( const QString &dynamicKeyPart = QString(), bool useDefaultValueOverride = false, const QgsSnappingConfig::SnappingTypes &defaultValueOverride = QgsSnappingConfig::SnappingTypes() ) const;
};
const QgsSettingsEntryEnumFlag_settingsDigitizingDefaultSnapType settingsDigitizingDefaultSnapType;

const QgsSettingsEntryDouble settingsDigitizingDefaultSnappingTolerance;

Expand Down
Expand Up @@ -15,7 +15,7 @@ email : matthias@opengis.ch

#include "qgsgeometryisvalidcheck.h"
#include "qgsfeature.h"
#include "qgssettings.h"
#include "qgssettingsregistrycore.h"
#include "qgsgeos.h"
#include "qgsgeometryvalidator.h"

Expand All @@ -33,7 +33,7 @@ QList<QgsSingleGeometryCheckError *> QgsGeometryIsValidCheck::processGeometry( c
QVector<QgsGeometry::Error> errors;

QgsGeometry::ValidationMethod method = QgsGeometry::ValidatorQgisInternal;
if ( QgsSettings().value( QStringLiteral( "qgis/digitizing/validate_geometries" ), 1 ).toInt() == 2 )
if ( QgsSettingsRegistryCore::settingsDigitizingValidateGeometries.value() == 2 )
method = QgsGeometry::ValidatorGeos;

QgsGeometryValidator validator( geometry, &errors, method );
Expand Down
11 changes: 5 additions & 6 deletions src/app/labeling/qgsmaptoollabel.cpp
Expand Up @@ -24,7 +24,7 @@
#include "qgsvectorlayer.h"
#include "qgsvectorlayerlabeling.h"
#include "qgsdiagramrenderer.h"
#include "qgssettings.h"
#include "qgssettingsregistrycore.h"
#include "qgsvectorlayerjoininfo.h"
#include "qgsvectorlayerjoinbuffer.h"
#include "qgsauxiliarystorage.h"
Expand Down Expand Up @@ -189,11 +189,10 @@ void QgsMapToolLabel::createRubberBands()
// instead, just use the boundary of the polygon for the rubber band
geom = QgsGeometry( geom.constGet()->boundary() );
}
QgsSettings settings;
int r = settings.value( QStringLiteral( "qgis/digitizing/line_color_red" ), 255 ).toInt();
int g = settings.value( QStringLiteral( "qgis/digitizing/line_color_green" ), 0 ).toInt();
int b = settings.value( QStringLiteral( "qgis/digitizing/line_color_blue" ), 0 ).toInt();
int a = settings.value( QStringLiteral( "qgis/digitizing/line_color_alpha" ), 200 ).toInt();
int r = QgsSettingsRegistryCore::settingsDigitizingLineColorRed.value();
int g = QgsSettingsRegistryCore::settingsDigitizingLineColorGreen.value();
int b = QgsSettingsRegistryCore::settingsDigitizingLineColorBlue.value();
int a = QgsSettingsRegistryCore::settingsDigitizingLineColorAlpha.value();
mFeatureRubberBand = new QgsRubberBand( mCanvas, geom.type() );
mFeatureRubberBand->setColor( QColor( r, g, b, a ) );
mFeatureRubberBand->setToGeometry( geom, vlayer );
Expand Down
9 changes: 3 additions & 6 deletions src/app/maptools/qgsappmaptools.cpp
Expand Up @@ -69,6 +69,7 @@
#include "qgsmaptoolpinlabels.h"
#include "qgsmaptooloffsetpointsymbol.h"
#include "qgsspinbox.h"
#include "qgssettingsregistrycore.h"

//
// QgsStreamDigitizingSettingsAction
Expand All @@ -80,25 +81,21 @@ QgsStreamDigitizingSettingsAction::QgsStreamDigitizingSettingsAction( QWidget *p
QGridLayout *gLayout = new QGridLayout();
gLayout->setContentsMargins( 3, 2, 3, 2 );

QgsSettings settings;
int defaultTolerance = settings.value( QStringLiteral( "/qgis/digitizing/stream_tolerance" ), 2 ).toInt();

mStreamToleranceSpinBox = new QgsSpinBox();
mStreamToleranceSpinBox->setSuffix( tr( "px" ) );
mStreamToleranceSpinBox->setKeyboardTracking( false );
mStreamToleranceSpinBox->setRange( 1, 200 );
mStreamToleranceSpinBox->setWrapping( false );
mStreamToleranceSpinBox->setSingleStep( 1 );
mStreamToleranceSpinBox->setClearValue( 2 );
mStreamToleranceSpinBox->setValue( defaultTolerance );
mStreamToleranceSpinBox->setValue( QgsSettingsRegistryCore::settingsDigitizingStreamTolerance.value() );

QLabel *label = new QLabel( tr( "Streaming Tolerance" ) );
gLayout->addWidget( label, 1, 0 );
gLayout->addWidget( mStreamToleranceSpinBox, 1, 1 );
connect( mStreamToleranceSpinBox, qOverload<int>( &QgsSpinBox::valueChanged ), this, [ = ]( int value )
{
QgsSettings settings;
settings.setValue( QStringLiteral( "/qgis/digitizing/stream_tolerance" ), value );
QgsSettingsRegistryCore::settingsDigitizingStreamTolerance.setValue( value );
} );

QWidget *w = new QWidget();
Expand Down

0 comments on commit eaf18f6

Please sign in to comment.