Skip to content

Commit

Permalink
Removed move of settings for a separate pr
Browse files Browse the repository at this point in the history
  • Loading branch information
domi4484 committed Apr 19, 2021
1 parent 598f6c7 commit fc55866
Show file tree
Hide file tree
Showing 37 changed files with 83 additions and 174 deletions.
Expand Up @@ -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/;
Expand Down
5 changes: 0 additions & 5 deletions python/core/auto_generated/network/qgsnewsfeedparser.sip.in
Expand Up @@ -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();
Expand Down
5 changes: 0 additions & 5 deletions python/core/auto_generated/processing/qgsprocessing.sip.in
Expand Up @@ -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;
};

/************************************************************************
Expand Down
6 changes: 0 additions & 6 deletions python/core/auto_generated/qgsapplication.sip.in
Expand Up @@ -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 );
Expand Down
2 changes: 0 additions & 2 deletions python/core/auto_generated/qgsgeometryoptions.sip.in
Expand Up @@ -118,8 +118,6 @@ Read the geometry options from ``node``.
.. versionadded:: 3.4
%End

const QgsSettingsEntryString settingsGeometryValidationDefaultChecks;

signals:

void checkConfigurationChanged();
Expand Down
Expand Up @@ -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 );
};
Expand Down
2 changes: 0 additions & 2 deletions python/core/auto_generated/qgsmaprendererjob.sip.in
Expand Up @@ -157,8 +157,6 @@ Returns map settings with which this job was started.



const QgsSettingsEntryBool settingsLogCanvasRefreshEvent;

signals:

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




class QgsSettingsRegistryCore : QgsSettingsRegistry
{
%Docstring(signature="appended")
Expand Down
14 changes: 8 additions & 6 deletions src/app/main.cpp
Expand Up @@ -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();
}

//
Expand All @@ -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
{
Expand All @@ -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
{
Expand Down
22 changes: 11 additions & 11 deletions src/app/options/qgsoptions.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 )
{
Expand All @@ -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 );


Expand Down Expand Up @@ -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...
Expand Down Expand Up @@ -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() );

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsprojectproperties.cpp
Expand Up @@ -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 );

Expand Down
4 changes: 2 additions & 2 deletions src/core/network/qgsnetworkaccessmanager.cpp
Expand Up @@ -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 )
Expand Down
4 changes: 0 additions & 4 deletions src/core/network/qgsnetworkaccessmanager.h
Expand Up @@ -31,7 +31,6 @@

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

class QgsFeedback;

Expand Down Expand Up @@ -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:

/**
Expand Down
17 changes: 9 additions & 8 deletions src/core/network/qgsnewsfeedparser.cpp
Expand Up @@ -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() )
{
Expand Down Expand Up @@ -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 );

Expand Down
10 changes: 0 additions & 10 deletions src/core/network/qgsnewsfeedparser.h
Expand Up @@ -17,7 +17,6 @@

#include "qgis_core.h"
#include "qgis_sip.h"
#include "qgssettingsentry.h"
#include <QObject>
#include <QUrl>
#include <QPixmap>
Expand Down Expand Up @@ -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:

/**
Expand Down
10 changes: 0 additions & 10 deletions src/core/processing/qgsprocessing.h
Expand Up @@ -19,7 +19,6 @@
#define QGSPROCESSING_H

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

//
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/core/processing/qgsprocessingcontext.cpp
Expand Up @@ -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() )
Expand Down
8 changes: 5 additions & 3 deletions src/core/processing/qgsprocessingutils.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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" ) );
Expand Down
2 changes: 1 addition & 1 deletion src/core/project/qgsproject.cpp
Expand Up @@ -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() )
{
Expand Down

0 comments on commit fc55866

Please sign in to comment.