Skip to content
Permalink
Browse files
Removed move of settings for a separate pr
  • Loading branch information
domi4484 committed Apr 19, 2021
1 parent 598f6c7 commit fc558661558e62f0d5299d3c573baf103bfe93f4
Showing with 83 additions and 174 deletions.
  1. +0 −2 python/core/auto_generated/network/qgsnetworkaccessmanager.sip.in
  2. +0 −5 python/core/auto_generated/network/qgsnewsfeedparser.sip.in
  3. +0 −5 python/core/auto_generated/processing/qgsprocessing.sip.in
  4. +0 −6 python/core/auto_generated/qgsapplication.sip.in
  5. +0 −2 python/core/auto_generated/qgsgeometryoptions.sip.in
  6. +0 −2 python/core/auto_generated/qgslocalizeddatapathregistry.sip.in
  7. +0 −2 python/core/auto_generated/qgsmaprendererjob.sip.in
  8. +0 −1 python/core/auto_generated/settings/qgssettingsregistrycore.sip.in
  9. +8 −6 src/app/main.cpp
  10. +11 −11 src/app/options/qgsoptions.cpp
  11. +1 −1 src/app/qgsprojectproperties.cpp
  12. +2 −2 src/core/network/qgsnetworkaccessmanager.cpp
  13. +0 −4 src/core/network/qgsnetworkaccessmanager.h
  14. +9 −8 src/core/network/qgsnewsfeedparser.cpp
  15. +0 −10 src/core/network/qgsnewsfeedparser.h
  16. +0 −10 src/core/processing/qgsprocessing.h
  17. +1 −1 src/core/processing/qgsprocessingcontext.cpp
  18. +5 −3 src/core/processing/qgsprocessingutils.cpp
  19. +1 −1 src/core/project/qgsproject.cpp
  20. +7 −4 src/core/qgsapplication.cpp
  21. +0 −12 src/core/qgsapplication.h
  22. +1 −1 src/core/qgsgeometryoptions.cpp
  23. +0 −4 src/core/qgsgeometryoptions.h
  24. +2 −2 src/core/qgslocalizeddatapathregistry.cpp
  25. +0 −4 src/core/qgslocalizeddatapathregistry.h
  26. +2 −1 src/core/qgsmaprendererjob.cpp
  27. +0 −4 src/core/qgsmaprendererjob.h
  28. +1 −31 src/core/settings/qgssettingsregistrycore.cpp
  29. +0 −2 src/core/settings/qgssettingsregistrycore.h
  30. +4 −4 src/gui/qgsconfigureshortcutsdialog.cpp
  31. +2 −1 src/gui/qgsgui.cpp
  32. +2 −2 src/gui/qgsmapcanvas.cpp
  33. +11 −9 tests/src/analysis/testqgsprocessing.cpp
  34. +2 −1 tests/src/core/testqgscompositionconverter.cpp
  35. +1 −1 tests/src/core/testqgsnetworkaccessmanager.cpp
  36. +5 −5 tests/src/core/testqgsnewsfeedparser.cpp
  37. +5 −4 tests/src/core/testqgstranslateproject.cpp
@@ -321,8 +321,6 @@ The contents of the reply will be returned after the request is completed or an
.. versionadded:: 3.6
%End

const QgsSettingsEntryInteger settingsNetworkTimeout;

signals:

void requestAboutToBeCreated( QNetworkAccessManager::Operation, const QNetworkRequest &, QIODevice * ) /Deprecated/;
@@ -93,11 +93,6 @@ Returns the authentication configuration for the parser.
Returns the settings key used for a feed with the given ``baseUrl``.
%End

const QgsSettingsEntryInteger settingsFeedLastFetchTime;
const QgsSettingsEntryString settingsFeedLanguage;
const QgsSettingsEntryDouble settingsFeedLatitude;
const QgsSettingsEntryDouble settingsFeedLongitude;

public slots:

void fetch();
@@ -52,11 +52,6 @@ Converts a source ``type`` to a string representation.
%End

static const QString TEMPORARY_OUTPUT;

const QgsSettingsEntryBool settingsPreferFilenameAsLayerName;
const QgsSettingsEntryString settingsTempPath;
const QgsSettingsEntryInteger settingsDefaultOutputVectorLayerExt;
const QgsSettingsEntryInteger settingsDefaultOutputRasterLayerExt;
};

/************************************************************************
@@ -1004,12 +1004,6 @@ Emits the signal to collect all the strings of .qgs to be included in ts file
.. versionadded:: 3.4
%End

const QgsSettingsEntryString settingsLocaleUserLocale;
const QgsSettingsEntryBool settingsLocaleOverrideFlag;
const QgsSettingsEntryString settingsLocaleGlobalLocale;
const QgsSettingsEntryBool settingsLocaleShowGroupSeparator;
const QgsSettingsEntryStringList settingsSearchPathsForSVG;

%If (ANDROID)
//dummy method to workaround sip generation issue
bool x11EventFilter( XEvent *event );
@@ -118,8 +118,6 @@ Read the geometry options from ``node``.
.. versionadded:: 3.4
%End

const QgsSettingsEntryString settingsGeometryValidationDefaultChecks;

signals:

void checkConfigurationChanged();
@@ -60,8 +60,6 @@ Since the paths are stored by order of preference, lower positions in the list t
Unregisters a localized path
%End

const QgsSettingsEntryStringList settingsLocalizedDataPaths;

private:
QgsLocalizedDataPathRegistry( const QgsLocalizedDataPathRegistry &other );
};
@@ -157,8 +157,6 @@ Returns map settings with which this job was started.



const QgsSettingsEntryBool settingsLogCanvasRefreshEvent;

signals:

void renderingLayersFinished();
@@ -9,7 +9,6 @@




class QgsSettingsRegistryCore : QgsSettingsRegistry
{
%Docstring(signature="appended")
@@ -966,18 +966,20 @@ int main( int argc, char *argv[] )
delete profile;

{
QgsSettings settings;

/* Translation file for QGIS.
*/
QString myUserTranslation = QgsApplication::settingsLocaleUserLocale.value();
QString myGlobalLocale = QgsApplication::settingsLocaleGlobalLocale.value();
QString myUserTranslation = settings.value( QStringLiteral( "locale/userLocale" ), "" ).toString();
QString myGlobalLocale = settings.value( QStringLiteral( "locale/globalLocale" ), "" ).toString();
bool myShowGroupSeparatorFlag = false; // Default to false
bool myLocaleOverrideFlag = QgsApplication::settingsLocaleOverrideFlag.value();
bool myLocaleOverrideFlag = settings.value( QStringLiteral( "locale/overrideFlag" ), false ).toBool();

// Override Show Group Separator if the global override flag is set
if ( myLocaleOverrideFlag )
{
// Default to false again
myShowGroupSeparatorFlag = QgsApplication::settingsLocaleShowGroupSeparator.value();
myShowGroupSeparatorFlag = settings.value( QStringLiteral( "locale/showGroupSeparator" ), false ).toBool();
}

//
@@ -991,7 +993,7 @@ int main( int argc, char *argv[] )
//
if ( !translationCode.isNull() && !translationCode.isEmpty() )
{
QgsApplication::settingsLocaleUserLocale.setValue( translationCode );
settings.setValue( QStringLiteral( "locale/userLocale" ), translationCode );
}
else
{
@@ -1000,7 +1002,7 @@ int main( int argc, char *argv[] )
translationCode = QLocale().name();
//setting the locale/userLocale when the --lang= option is not set will allow third party
//plugins to always use the same locale as the QGIS, otherwise they can be out of sync
QgsApplication::settingsLocaleUserLocale.setValue( translationCode );
settings.setValue( QStringLiteral( "locale/userLocale" ), translationCode );
}
else
{
@@ -24,7 +24,6 @@
#include "qgsgdalutils.h"
#include "qgshighlight.h"
#include "qgsmapcanvas.h"
#include "qgsmaprendererjob.h"
#include "qgsprojectionselectiondialog.h"
#include "qgscoordinatereferencesystem.h"
#include "qgstolerance.h"
@@ -475,7 +474,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
cmbScanZipInBrowser->setCurrentIndex( index );

// log rendering events, for userspace debugging
mLogCanvasRefreshChkBx->setChecked( QgsMapRendererJob::settingsLogCanvasRefreshEvent.value() );
mLogCanvasRefreshChkBx->setChecked( mSettings->value( QStringLiteral( "/Map/logCanvasRefreshEvent" ), false ).toBool() );

//set the default projection behavior radio buttons
const QgsOptions::UnknownLayerCrsBehavior mode = QgsSettings().enumValue( QStringLiteral( "/projections/unknownCrsBehavior" ), QgsOptions::UnknownLayerCrsBehavior::NoAction, QgsSettings::App );
@@ -1015,9 +1014,9 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
//
QString currentLocale = QLocale().name();
lblSystemLocale->setText( tr( "Detected active locale on your system: %1" ).arg( currentLocale ) );
QString userLocale = QgsApplication::settingsLocaleUserLocale.value();
bool showGroupSeparator = QgsApplication::settingsLocaleShowGroupSeparator.value();
QString globalLocale = QgsApplication::settingsLocaleGlobalLocale.value();
QString userLocale = mSettings->value( QStringLiteral( "locale/userLocale" ), QString( ) ).toString();
bool showGroupSeparator = mSettings->value( QStringLiteral( "locale/showGroupSeparator" ), false ).toBool();
QString globalLocale = mSettings->value( QStringLiteral( "locale/globalLocale" ), currentLocale ).toString();
const QStringList language18nList( i18nList() );
for ( const auto &l : language18nList )
{
@@ -1044,7 +1043,8 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti

cboTranslation->setCurrentIndex( cboTranslation->findData( userLocale ) );
cboGlobalLocale->setCurrentIndex( cboGlobalLocale->findData( globalLocale ) );
grpLocale->setChecked( QgsApplication::settingsLocaleOverrideFlag.value() );
bool localeOverrideFlag = mSettings->value( QStringLiteral( "locale/overrideFlag" ), false ).toBool();
grpLocale->setChecked( localeOverrideFlag );
cbShowGroupSeparator->setChecked( showGroupSeparator );


@@ -1673,7 +1673,7 @@ void QgsOptions::saveOptions()
mSettings->setValue( QStringLiteral( "/Raster/cumulativeCutUpper" ), mRasterCumulativeCutUpperDoubleSpinBox->value() / 100.0 );

// log rendering events, for userspace debugging
QgsMapRendererJob::settingsLogCanvasRefreshEvent.setValue( mLogCanvasRefreshChkBx->isChecked() );
mSettings->setValue( QStringLiteral( "/Map/logCanvasRefreshEvent" ), mLogCanvasRefreshChkBx->isChecked() );

//check behavior so default projection when new layer is added with no
//projection defined...
@@ -1856,12 +1856,12 @@ void QgsOptions::saveOptions()
//
// Locale settings
//
QgsApplication::settingsLocaleUserLocale.setValue( cboTranslation->currentData().toString() );
QgsApplication::settingsLocaleOverrideFlag.setValue( grpLocale->isChecked() );
QgsApplication::settingsLocaleGlobalLocale.setValue( cboGlobalLocale->currentData( ).toString() );
mSettings->setValue( QStringLiteral( "locale/userLocale" ), cboTranslation->currentData().toString() );
mSettings->setValue( QStringLiteral( "locale/overrideFlag" ), grpLocale->isChecked() );
mSettings->setValue( QStringLiteral( "locale/globalLocale" ), cboGlobalLocale->currentData( ).toString() );

// Number settings
QgsApplication::settingsLocaleShowGroupSeparator.setValue( cbShowGroupSeparator->isChecked( ) );
mSettings->setValue( QStringLiteral( "locale/showGroupSeparator" ), cbShowGroupSeparator->isChecked( ) );

QgsLocalDefaultSettings::setBearingFormat( mBearingFormat.get() );

@@ -983,7 +983,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
}

cbtsLocale->addItem( QIcon( QStringLiteral( ":/images/flags/%1.svg" ).arg( QLatin1String( "en_US" ) ) ), QLocale( QStringLiteral( "en_US" ) ).nativeLanguageName(), QStringLiteral( "en_US" ) );
cbtsLocale->setCurrentIndex( cbtsLocale->findData( QgsApplication::settingsLocaleUserLocale.value() ) );
cbtsLocale->setCurrentIndex( cbtsLocale->findData( settings.value( QStringLiteral( "locale/userLocale" ), QString() ).toString() ) );

connect( generateTsFileButton, &QPushButton::clicked, this, &QgsProjectProperties::onGenerateTsFileButton );

@@ -654,12 +654,12 @@ void QgsNetworkAccessManager::setupDefaultProxyAndCache( Qt::ConnectionType conn

int QgsNetworkAccessManager::timeout()
{
return settingsNetworkTimeout.value();
return QgsSettings().value( QStringLiteral( "/qgis/networkAndProxy/networkTimeout" ), 60000 ).toInt();
}

void QgsNetworkAccessManager::setTimeout( const int time )
{
settingsNetworkTimeout.setValue( time );
QgsSettings().setValue( QStringLiteral( "/qgis/networkAndProxy/networkTimeout" ), time );
}

QgsNetworkReplyContent QgsNetworkAccessManager::blockingGet( QNetworkRequest &request, const QString &authCfg, bool forceRefresh, QgsFeedback *feedback )
@@ -31,7 +31,6 @@

#include "qgis_core.h"
#include "qgis_sip.h"
#include "qgssettingsentry.h"

class QgsFeedback;

@@ -500,9 +499,6 @@ class CORE_EXPORT QgsNetworkAccessManager : public QNetworkAccessManager
*/
static QgsNetworkReplyContent blockingPost( QNetworkRequest &request, const QByteArray &data, const QString &authCfg = QString(), bool forceRefresh = false, QgsFeedback *feedback = nullptr );

//! Settings entry network timeout
static const inline QgsSettingsEntryInteger settingsNetworkTimeout = QgsSettingsEntryInteger( QStringLiteral( "/qgis/networkAndProxy/networkTimeout" ), QgsSettings::NoSection, 60000, QObject::tr( "Network timeout" ) );

signals:

/**
@@ -40,23 +40,24 @@ QgsNewsFeedParser::QgsNewsFeedParser( const QUrl &feedUrl, const QString &authcf

QUrlQuery query( feedUrl );

const qint64 after = settingsFeedLastFetchTime.value( mSettingsKey );
const qint64 after = QgsSettings().value( QStringLiteral( "%1/lastFetchTime" ).arg( mSettingsKey ), 0, QgsSettings::Core ).toUInt();
if ( after > 0 )
query.addQueryItem( QStringLiteral( "after" ), qgsDoubleToString( after, 0 ) );

QString feedLanguage = settingsFeedLanguage.value( mSettingsKey );
QString feedLanguage = QgsSettings().value( QStringLiteral( "%1/lang" ).arg( mSettingsKey ), QString(), QgsSettings::Core ).toString();
if ( feedLanguage.isEmpty() )
{
feedLanguage = QgsSettings().value( QgsApplication::settingsLocaleUserLocale.key(), QStringLiteral( "en_US" ) ).toString().left( 2 );
feedLanguage = QgsSettings().value( QStringLiteral( "locale/userLocale" ), QStringLiteral( "en_US" ) ).toString().left( 2 );
}
if ( !feedLanguage.isEmpty() && feedLanguage != QLatin1String( "C" ) )
query.addQueryItem( QStringLiteral( "lang" ), feedLanguage );

if ( settingsFeedLatitude.exists( mSettingsKey ) && settingsFeedLongitude.exists( mSettingsKey ) )
bool latOk = false;
bool longOk = false;
const double feedLat = QgsSettings().value( QStringLiteral( "%1/latitude" ).arg( mSettingsKey ), QString(), QgsSettings::Core ).toDouble( &latOk );
const double feedLong = QgsSettings().value( QStringLiteral( "%1/longitude" ).arg( mSettingsKey ), QString(), QgsSettings::Core ).toDouble( &longOk );
if ( latOk && longOk )
{
const double feedLat = settingsFeedLatitude.value( mSettingsKey );
const double feedLong = settingsFeedLongitude.value( mSettingsKey );

// hack to allow testing using local files
if ( feedUrl.isLocalFile() )
{
@@ -169,7 +170,7 @@ void QgsNewsFeedParser::fetch()

void QgsNewsFeedParser::onFetch( const QString &content )
{
settingsFeedLastFetchTime.setValue( mFetchStartTime, mSettingsKey );
QgsSettings().setValue( mSettingsKey + "/lastFetchTime", mFetchStartTime, QgsSettings::Core );

const QVariant json = QgsJsonUtils::parseJson( content );

@@ -17,7 +17,6 @@

#include "qgis_core.h"
#include "qgis_sip.h"
#include "qgssettingsentry.h"
#include <QObject>
#include <QUrl>
#include <QPixmap>
@@ -111,15 +110,6 @@ class CORE_EXPORT QgsNewsFeedParser : public QObject
*/
static QString keyForFeed( const QString &baseUrl );

//! Settings entry last fetch time
static const inline QgsSettingsEntryInteger settingsFeedLastFetchTime = QgsSettingsEntryInteger( QStringLiteral( "%1/lastFetchTime" ), QgsSettings::Core, 0, QObject::tr( "Feed last fetch time" ), 0 );
//! Settings entry feed language
static const inline QgsSettingsEntryString settingsFeedLanguage = QgsSettingsEntryString( QStringLiteral( "%1/lang" ), QgsSettings::Core, QString(), QObject::tr( "Feed language" ) );
//! Settings entry feed latitude
static const inline QgsSettingsEntryDouble settingsFeedLatitude = QgsSettingsEntryDouble( QStringLiteral( "%1/latitude" ), QgsSettings::Core, 0.0, QObject::tr( "Feed latitude" ) );
//! Settings entry feed longitude
static const inline QgsSettingsEntryDouble settingsFeedLongitude = QgsSettingsEntryDouble( QStringLiteral( "%1/longitude" ), QgsSettings::Core, 0.0, QObject::tr( "Feed longitude" ) );

public slots:

/**
@@ -19,7 +19,6 @@
#define QGSPROCESSING_H

#include "qgis_core.h"
#include "qgssettingsentry.h"
#include <QString>

//
@@ -98,15 +97,6 @@ class CORE_EXPORT QgsProcessing
* \since QGIS 3.6
*/
static const QString TEMPORARY_OUTPUT;

//! Settings entry prefer filename as layer name
static const inline QgsSettingsEntryBool settingsPreferFilenameAsLayerName = QgsSettingsEntryBool( QStringLiteral( "Processing/Configuration/PREFER_FILENAME_AS_LAYER_NAME" ), QgsSettings::NoSection, true, QObject::tr( "Prefer filename as layer name" ) );
//! Settings entry temp path
static const inline QgsSettingsEntryString settingsTempPath = QgsSettingsEntryString( QStringLiteral( "Processing/Configuration/TEMP_PATH2" ), QgsSettings::NoSection, QString() );
//! Settings entry default output vector layer ext
static const inline QgsSettingsEntryInteger settingsDefaultOutputVectorLayerExt = QgsSettingsEntryInteger( QStringLiteral( "Processing/Configuration/DefaultOutputVectorLayerExt" ), QgsSettings::NoSection, -1 );
//! Settings entry default output raster layer ext
static const inline QgsSettingsEntryInteger settingsDefaultOutputRasterLayerExt = QgsSettingsEntryInteger( QStringLiteral( "Processing/Configuration/DefaultOutputRasterLayerExt" ), QgsSettings::NoSection, -1 );
};

#endif // QGSPROCESSING_H
@@ -197,7 +197,7 @@ void QgsProcessingContext::LayerDetails::setOutputLayerName( QgsMapLayer *layer
if ( !layer )
return;

const bool preferFilenameAsLayerName = QgsProcessing::settingsPreferFilenameAsLayerName.value();
const bool preferFilenameAsLayerName = QgsSettings().value( QStringLiteral( "Processing/Configuration/PREFER_FILENAME_AS_LAYER_NAME" ), true ).toBool();

// note - for temporary layers, we don't use the filename, regardless of user setting (it will be meaningless!)
if ( ( !forceName && preferFilenameAsLayerName && !layer->isTemporary() ) || name.isEmpty() )
@@ -954,7 +954,7 @@ QString QgsProcessingUtils::tempFolder()
static QString sFolder;
static QMutex sMutex;
QMutexLocker locker( &sMutex );
const QString basePath = QgsProcessing::settingsTempPath.value();
const QString basePath = QgsSettings().value( QStringLiteral( "Processing/Configuration/TEMP_PATH2" ) ).toString();
if ( basePath.isEmpty() )
{
// default setting -- automatically create a temp folder
@@ -1211,15 +1211,17 @@ QgsFields QgsProcessingUtils::indicesToFields( const QList<int> &indices, const

QString QgsProcessingUtils::defaultVectorExtension()
{
const int setting = QgsProcessing::settingsDefaultOutputVectorLayerExt.value();
QgsSettings settings;
const int setting = settings.value( QStringLiteral( "Processing/Configuration/DefaultOutputVectorLayerExt" ), -1 ).toInt();
if ( setting == -1 )
return QStringLiteral( "gpkg" );
return QgsVectorFileWriter::supportedFormatExtensions().value( setting, QStringLiteral( "gpkg" ) );
}

QString QgsProcessingUtils::defaultRasterExtension()
{
const int setting = QgsProcessing::settingsDefaultOutputRasterLayerExt.value();
QgsSettings settings;
const int setting = settings.value( QStringLiteral( "Processing/Configuration/DefaultOutputRasterLayerExt" ), -1 ).toInt();
if ( setting == -1 )
return QStringLiteral( "tif" );
return QgsRasterFileWriter::supportedFormatExtensions().value( setting, QStringLiteral( "tif" ) );
@@ -1356,7 +1356,7 @@ bool QgsProject::readProjectFile( const QString &filename, QgsProject::ReadFlags
QgsApplication::profiler()->clear( QStringLiteral( "projectload" ) );
QgsScopedRuntimeProfile profile( tr( "Setting up translations" ), QStringLiteral( "projectload" ) );

QString localeFileName = QStringLiteral( "%1_%2" ).arg( QFileInfo( projectFile.fileName() ).baseName(), QgsApplication::settingsLocaleUserLocale.value() );
QString localeFileName = QStringLiteral( "%1_%2" ).arg( QFileInfo( projectFile.fileName() ).baseName(), mSettings.value( QStringLiteral( "locale/userLocale" ), QString() ).toString() );

if ( QFile( QStringLiteral( "%1/%2.qm" ).arg( QFileInfo( projectFile.fileName() ).absolutePath(), localeFileName ) ).exists() )
{

0 comments on commit fc55866

Please sign in to comment.