Removed settings struct

This commit is contained in:
Damiano 2021-04-15 17:32:59 +02:00
parent 00a7936389
commit 95dfe0f45c
37 changed files with 176 additions and 191 deletions

View File

@ -321,6 +321,7 @@ The contents of the reply will be returned after the request is completed or an
.. versionadded:: 3.6 .. versionadded:: 3.6
%End %End
<<<<<<< HEAD
void requestAuthOpenBrowser( const QUrl &url ) const; void requestAuthOpenBrowser( const QUrl &url ) const;
%Docstring %Docstring
Forwards an external browser login ``url`` opening request to the authentication handler. Forwards an external browser login ``url`` opening request to the authentication handler.
@ -342,6 +343,9 @@ Forwards an external browser login closure request to the authentication handler
.. versionadded:: 3.20 .. versionadded:: 3.20
%End %End
=======
const QgsSettingsEntryInteger settingsNetworkTimeout;
>>>>>>> 2087a7f4f8 (Removed settings struct)
signals: signals:

View File

@ -93,13 +93,10 @@ Returns the authentication configuration for the parser.
Returns the settings key used for a feed with the given ``baseUrl``. Returns the settings key used for a feed with the given ``baseUrl``.
%End %End
struct Settings const QgsSettingsEntryInteger settingsFeedLastFetchTime;
{ const QgsSettingsEntryString settingsFeedLanguage;
const QgsSettingsEntryInteger feedLastFetchTime; const QgsSettingsEntryDouble settingsFeedLatitude;
const QgsSettingsEntryString feedLanguage; const QgsSettingsEntryDouble settingsFeedLongitude;
const QgsSettingsEntryDouble feedLatitude;
const QgsSettingsEntryDouble feedLongitude;
};
public slots: public slots:

View File

@ -53,13 +53,10 @@ Converts a source ``type`` to a string representation.
static const QString TEMPORARY_OUTPUT; static const QString TEMPORARY_OUTPUT;
struct Settings const QgsSettingsEntryBool settingsPreferFilenameAsLayerName;
{ const QgsSettingsEntryString settingsTempPath;
const QgsSettingsEntryBool preferFilenameAsLayerName; const QgsSettingsEntryInteger settingsDefaultOutputVectorLayerExt;
const QgsSettingsEntryString tempPath; const QgsSettingsEntryInteger settingsDefaultOutputRasterLayerExt;
const QgsSettingsEntryInteger defaultOutputVectorLayerExt;
const QgsSettingsEntryInteger defaultOutputRasterLayerExt;
};
}; };
/************************************************************************ /************************************************************************

View File

@ -1003,14 +1003,11 @@ Emits the signal to collect all the strings of .qgs to be included in ts file
.. versionadded:: 3.4 .. versionadded:: 3.4
%End %End
struct Settings const QgsSettingsEntryString settingsLocaleUserLocale;
{ const QgsSettingsEntryBool settingsLocaleOverrideFlag;
const QgsSettingsEntryString localeUserLocale; const QgsSettingsEntryString settingsLocaleGlobalLocale;
const QgsSettingsEntryBool localeOverrideFlag; const QgsSettingsEntryBool settingsLocaleShowGroupSeparator;
const QgsSettingsEntryString localeGlobalLocale; const QgsSettingsEntryStringList settingsSearchPathsForSVG;
const QgsSettingsEntryBool localeShowGroupSeparator;
const QgsSettingsEntryStringList searchPathsForSVG;
};
%If (ANDROID) %If (ANDROID)
//dummy method to workaround sip generation issue //dummy method to workaround sip generation issue

View File

@ -118,10 +118,7 @@ Read the geometry options from ``node``.
.. versionadded:: 3.4 .. versionadded:: 3.4
%End %End
struct Settings const QgsSettingsEntryString settingsGeometryValidationDefaultChecks;
{
const QgsSettingsEntryString geometryValidationDefaultChecks;
};
signals: signals:

View File

@ -60,10 +60,7 @@ Since the paths are stored by order of preference, lower positions in the list t
Unregisters a localized path Unregisters a localized path
%End %End
struct Settings const QgsSettingsEntryStringList settingsLocalizedDataPaths;
{
const QgsSettingsEntryStringList localizedDataPaths;
};
private: private:
QgsLocalizedDataPathRegistry( const QgsLocalizedDataPathRegistry &other ); QgsLocalizedDataPathRegistry( const QgsLocalizedDataPathRegistry &other );

View File

@ -157,11 +157,7 @@ Returns map settings with which this job was started.
const QgsSettingsEntryBool settingsLogCanvasRefreshEvent;
struct Settings
{
const QgsSettingsEntryBool logCanvasRefreshEvent;
};
signals: signals:

View File

@ -84,6 +84,7 @@ Get settings entry key.
The ``dynamicKeyParts`` argument specifies the list of dynamic parts of the settings key. The ``dynamicKeyParts`` argument specifies the list of dynamic parts of the settings key.
%End %End
<<<<<<< HEAD
bool keyIsValid( const QString &key ) const; bool keyIsValid( const QString &key ) const;
%Docstring %Docstring
Returns ``True`` if the provided key match the settings entry. Returns ``True`` if the provided key match the settings entry.
@ -95,6 +96,8 @@ defined with the key "NewsFeed/%1/%2/content"
The ``key`` to check The ``key`` to check
%End %End
=======
>>>>>>> 7b8aad6203 (Removed settings struct)
QString definitionKey() const; QString definitionKey() const;
%Docstring %Docstring
Returns settings entry defining key. Returns settings entry defining key.
@ -116,7 +119,11 @@ The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key.
bool exists( const QStringList &dynamicKeyPartList ) const; bool exists( const QStringList &dynamicKeyPartList ) const;
%Docstring %Docstring
<<<<<<< HEAD
Returns ``True`` if the settings is contained in the underlying QSettings. Returns ``True`` if the settings is contained in the underlying QSettings.
=======
Returns true if the settings is contained in the underlying QSettings.
>>>>>>> 7b8aad6203 (Removed settings struct)
The ``dynamicKeyParts`` argument specifies the list of dynamic parts of the settings key. The ``dynamicKeyParts`` argument specifies the list of dynamic parts of the settings key.
%End %End
@ -297,11 +304,19 @@ The ``description`` argument specifies a description for the settings entry.
bool setValue( const QString &value, const QString &dynamicKeyPart = QString() ) const; bool setValue( const QString &value, const QString &dynamicKeyPart = QString() ) const;
%Docstring %Docstring
Set settings value. Set settings value.
<<<<<<< HEAD
The ``value`` to set. The ``value`` to set.
The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key. The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key.
%End %End
=======
The ``value`` to set.
The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key.
%End
>>>>>>> 7b8aad6203 (Removed settings struct)
bool setValue( const QString &value, const QStringList &dynamicKeyPartList ) const; bool setValue( const QString &value, const QStringList &dynamicKeyPartList ) const;
%Docstring %Docstring
Set settings value. Set settings value.
@ -396,11 +411,19 @@ The ``description`` argument specifies a description for the settings entry.
bool setValue( const QStringList &value, const QString &dynamicKeyPart = QString() ) const; bool setValue( const QStringList &value, const QString &dynamicKeyPart = QString() ) const;
%Docstring %Docstring
Set settings value. Set settings value.
<<<<<<< HEAD
The ``value`` to set. The ``value`` to set.
The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key. The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key.
%End %End
=======
The ``value`` to set.
The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key.
%End
>>>>>>> 7b8aad6203 (Removed settings struct)
bool setValue( const QStringList &value, const QStringList &dynamicKeyPartList ) const; bool setValue( const QStringList &value, const QStringList &dynamicKeyPartList ) const;
%Docstring %Docstring
Set settings value. Set settings value.
@ -645,11 +668,19 @@ The ``description`` argument specifies a description for the settings entry.
bool setValue( double value, const QString &dynamicKeyPart = QString() ) const; bool setValue( double value, const QString &dynamicKeyPart = QString() ) const;
%Docstring %Docstring
Set settings value. Set settings value.
<<<<<<< HEAD
The ``value`` to set. The ``value`` to set.
The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key. The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key.
%End %End
=======
The ``value`` to set.
The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key.
%End
>>>>>>> 7b8aad6203 (Removed settings struct)
bool setValue( double value, const QStringList &dynamicKeyPartList ) const; bool setValue( double value, const QStringList &dynamicKeyPartList ) const;
%Docstring %Docstring
Set settings value. Set settings value.

View File

@ -31,6 +31,7 @@ Constructor for QgsSettingsRegistry.
virtual ~QgsSettingsRegistry(); virtual ~QgsSettingsRegistry();
<<<<<<< HEAD
QList<const QgsSettingsEntryBase *> getChildSettingsEntries() const; QList<const QgsSettingsEntryBase *> getChildSettingsEntries() const;
%Docstring %Docstring
Returns the list of registered :py:class:`QgsSettingsEntryBase`. Returns the list of registered :py:class:`QgsSettingsEntryBase`.
@ -55,6 +56,13 @@ Returns the list of registered child QgsSettingsRegistry.
protected: protected:
=======
const QgsSettingsEntryBase *getSettingsEntry( const QString &key );
%Docstring
Returns the :py:class:`QgsSettingsEntry` with the given ``key`` or None if not found.
%End
>>>>>>> 7b8aad6203 (Removed settings struct)
void addSettingsEntry( const QgsSettingsEntryBase *settingsEntry ); void addSettingsEntry( const QgsSettingsEntryBase *settingsEntry );
%Docstring %Docstring
Add ``settingsEntry`` to the register. Add ``settingsEntry`` to the register.

View File

@ -968,16 +968,16 @@ int main( int argc, char *argv[] )
{ {
/* Translation file for QGIS. /* Translation file for QGIS.
*/ */
QString myUserTranslation = QgsApplication::Settings::localeUserLocale.value(); QString myUserTranslation = QgsApplication::settingsLocaleUserLocale.value();
QString myGlobalLocale = QgsApplication::Settings::localeGlobalLocale.value(); QString myGlobalLocale = QgsApplication::settingsLocaleGlobalLocale.value();
bool myShowGroupSeparatorFlag = false; // Default to false bool myShowGroupSeparatorFlag = false; // Default to false
bool myLocaleOverrideFlag = QgsApplication::Settings::localeOverrideFlag.value(); bool myLocaleOverrideFlag = QgsApplication::settingsLocaleOverrideFlag.value();
// Override Show Group Separator if the global override flag is set // Override Show Group Separator if the global override flag is set
if ( myLocaleOverrideFlag ) if ( myLocaleOverrideFlag )
{ {
// Default to false again // Default to false again
myShowGroupSeparatorFlag = QgsApplication::Settings::localeShowGroupSeparator.value(); myShowGroupSeparatorFlag = QgsApplication::settingsLocaleShowGroupSeparator.value();
} }
// //
@ -991,7 +991,7 @@ int main( int argc, char *argv[] )
// //
if ( !translationCode.isNull() && !translationCode.isEmpty() ) if ( !translationCode.isNull() && !translationCode.isEmpty() )
{ {
QgsApplication::Settings::localeUserLocale.setValue( translationCode ); QgsApplication::settingsLocaleUserLocale.setValue( translationCode );
} }
else else
{ {
@ -1000,7 +1000,7 @@ int main( int argc, char *argv[] )
translationCode = QLocale().name(); translationCode = QLocale().name();
//setting the locale/userLocale when the --lang= option is not set will allow third party //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 //plugins to always use the same locale as the QGIS, otherwise they can be out of sync
QgsApplication::Settings::localeUserLocale.setValue( translationCode ); QgsApplication::settingsLocaleUserLocale.setValue( translationCode );
} }
else else
{ {

View File

@ -475,7 +475,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
cmbScanZipInBrowser->setCurrentIndex( index ); cmbScanZipInBrowser->setCurrentIndex( index );
// log rendering events, for userspace debugging // log rendering events, for userspace debugging
mLogCanvasRefreshChkBx->setChecked( QgsMapRendererJob::Settings::logCanvasRefreshEvent.value() ); mLogCanvasRefreshChkBx->setChecked( QgsMapRendererJob::settingsLogCanvasRefreshEvent.value() );
//set the default projection behavior radio buttons //set the default projection behavior radio buttons
const QgsOptions::UnknownLayerCrsBehavior mode = QgsSettings().enumValue( QStringLiteral( "/projections/unknownCrsBehavior" ), QgsOptions::UnknownLayerCrsBehavior::NoAction, QgsSettings::App ); const QgsOptions::UnknownLayerCrsBehavior mode = QgsSettings().enumValue( QStringLiteral( "/projections/unknownCrsBehavior" ), QgsOptions::UnknownLayerCrsBehavior::NoAction, QgsSettings::App );
@ -1015,9 +1015,9 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
// //
QString currentLocale = QLocale().name(); QString currentLocale = QLocale().name();
lblSystemLocale->setText( tr( "Detected active locale on your system: %1" ).arg( currentLocale ) ); lblSystemLocale->setText( tr( "Detected active locale on your system: %1" ).arg( currentLocale ) );
QString userLocale = QgsApplication::Settings::localeUserLocale.value(); QString userLocale = QgsApplication::settingsLocaleUserLocale.value();
bool showGroupSeparator = QgsApplication::Settings::localeShowGroupSeparator.value(); bool showGroupSeparator = QgsApplication::settingsLocaleShowGroupSeparator.value();
QString globalLocale = QgsApplication::Settings::localeGlobalLocale.value(); QString globalLocale = QgsApplication::settingsLocaleGlobalLocale.value();
const QStringList language18nList( i18nList() ); const QStringList language18nList( i18nList() );
for ( const auto &l : language18nList ) for ( const auto &l : language18nList )
{ {
@ -1044,7 +1044,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
cboTranslation->setCurrentIndex( cboTranslation->findData( userLocale ) ); cboTranslation->setCurrentIndex( cboTranslation->findData( userLocale ) );
cboGlobalLocale->setCurrentIndex( cboGlobalLocale->findData( globalLocale ) ); cboGlobalLocale->setCurrentIndex( cboGlobalLocale->findData( globalLocale ) );
grpLocale->setChecked( QgsApplication::Settings::localeOverrideFlag.value() ); grpLocale->setChecked( QgsApplication::settingsLocaleOverrideFlag.value() );
cbShowGroupSeparator->setChecked( showGroupSeparator ); cbShowGroupSeparator->setChecked( showGroupSeparator );
@ -1673,7 +1673,7 @@ void QgsOptions::saveOptions()
mSettings->setValue( QStringLiteral( "/Raster/cumulativeCutUpper" ), mRasterCumulativeCutUpperDoubleSpinBox->value() / 100.0 ); mSettings->setValue( QStringLiteral( "/Raster/cumulativeCutUpper" ), mRasterCumulativeCutUpperDoubleSpinBox->value() / 100.0 );
// log rendering events, for userspace debugging // log rendering events, for userspace debugging
QgsMapRendererJob::Settings::logCanvasRefreshEvent.setValue( mLogCanvasRefreshChkBx->isChecked() ); QgsMapRendererJob::settingsLogCanvasRefreshEvent.setValue( mLogCanvasRefreshChkBx->isChecked() );
//check behavior so default projection when new layer is added with no //check behavior so default projection when new layer is added with no
//projection defined... //projection defined...
@ -1856,12 +1856,12 @@ void QgsOptions::saveOptions()
// //
// Locale settings // Locale settings
// //
QgsApplication::Settings::localeUserLocale.setValue( cboTranslation->currentData().toString() ); QgsApplication::settingsLocaleUserLocale.setValue( cboTranslation->currentData().toString() );
QgsApplication::Settings::localeOverrideFlag.setValue( grpLocale->isChecked() ); QgsApplication::settingsLocaleOverrideFlag.setValue( grpLocale->isChecked() );
QgsApplication::Settings::localeGlobalLocale.setValue( cboGlobalLocale->currentData( ).toString() ); QgsApplication::settingsLocaleGlobalLocale.setValue( cboGlobalLocale->currentData( ).toString() );
// Number settings // Number settings
QgsApplication::Settings::localeShowGroupSeparator.setValue( cbShowGroupSeparator->isChecked( ) ); QgsApplication::settingsLocaleShowGroupSeparator.setValue( cbShowGroupSeparator->isChecked( ) );
QgsLocalDefaultSettings::setBearingFormat( mBearingFormat.get() ); QgsLocalDefaultSettings::setBearingFormat( mBearingFormat.get() );

View File

@ -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->addItem( QIcon( QStringLiteral( ":/images/flags/%1.svg" ).arg( QLatin1String( "en_US" ) ) ), QLocale( QStringLiteral( "en_US" ) ).nativeLanguageName(), QStringLiteral( "en_US" ) );
cbtsLocale->setCurrentIndex( cbtsLocale->findData( QgsApplication::Settings::localeUserLocale.value() ) ); cbtsLocale->setCurrentIndex( cbtsLocale->findData( QgsApplication::settingsLocaleUserLocale.value() ) );
connect( generateTsFileButton, &QPushButton::clicked, this, &QgsProjectProperties::onGenerateTsFileButton ); connect( generateTsFileButton, &QPushButton::clicked, this, &QgsProjectProperties::onGenerateTsFileButton );

View File

@ -674,12 +674,12 @@ void QgsNetworkAccessManager::setupDefaultProxyAndCache( Qt::ConnectionType conn
int QgsNetworkAccessManager::timeout() int QgsNetworkAccessManager::timeout()
{ {
return Settings::networkTimeout.value(); return settingsNetworkTimeout.value();
} }
void QgsNetworkAccessManager::setTimeout( const int time ) void QgsNetworkAccessManager::setTimeout( const int time )
{ {
Settings::networkTimeout.setValue( time ); settingsNetworkTimeout.setValue( time );
} }
QgsNetworkReplyContent QgsNetworkAccessManager::blockingGet( QNetworkRequest &request, const QString &authCfg, bool forceRefresh, QgsFeedback *feedback ) QgsNetworkReplyContent QgsNetworkAccessManager::blockingGet( QNetworkRequest &request, const QString &authCfg, bool forceRefresh, QgsFeedback *feedback )

View File

@ -530,6 +530,10 @@ class CORE_EXPORT QgsNetworkAccessManager : public QNetworkAccessManager
*/ */
void requestAuthCloseBrowser() const; void requestAuthCloseBrowser() const;
//! Settings entry network timeout
static const inline QgsSettingsEntryInteger settingsNetworkTimeout = QgsSettingsEntryInteger( QStringLiteral( "/qgis/networkAndProxy/networkTimeout" ), QgsSettings::NoSection, 60000, QObject::tr( "Network timeout" ) );
signals: signals:
/** /**

View File

@ -40,22 +40,22 @@ QgsNewsFeedParser::QgsNewsFeedParser( const QUrl &feedUrl, const QString &authcf
QUrlQuery query( feedUrl ); QUrlQuery query( feedUrl );
const qint64 after = Settings::feedLastFetchTime.value( mSettingsKey ); const qint64 after = settingsFeedLastFetchTime.value( mSettingsKey );
if ( after > 0 ) if ( after > 0 )
query.addQueryItem( QStringLiteral( "after" ), qgsDoubleToString( after, 0 ) ); query.addQueryItem( QStringLiteral( "after" ), qgsDoubleToString( after, 0 ) );
QString feedLanguage = Settings::feedLanguage.value( mSettingsKey ); QString feedLanguage = settingsFeedLanguage.value( mSettingsKey );
if ( feedLanguage.isEmpty() ) if ( feedLanguage.isEmpty() )
{ {
feedLanguage = QgsSettings().value( QgsApplication::Settings::localeUserLocale.key(), QStringLiteral( "en_US" ) ).toString().left( 2 ); feedLanguage = QgsSettings().value( QgsApplication::settingsLocaleUserLocale.key(), QStringLiteral( "en_US" ) ).toString().left( 2 );
} }
if ( !feedLanguage.isEmpty() && feedLanguage != QLatin1String( "C" ) ) if ( !feedLanguage.isEmpty() && feedLanguage != QLatin1String( "C" ) )
query.addQueryItem( QStringLiteral( "lang" ), feedLanguage ); query.addQueryItem( QStringLiteral( "lang" ), feedLanguage );
if ( Settings::feedLatitude.exists( mSettingsKey ) && Settings::feedLongitude.exists( mSettingsKey ) ) if ( settingsFeedLatitude.exists( mSettingsKey ) && settingsFeedLongitude.exists( mSettingsKey ) )
{ {
const double feedLat = Settings::feedLatitude.value( mSettingsKey ); const double feedLat = settingsFeedLatitude.value( mSettingsKey );
const double feedLong = Settings::feedLongitude.value( mSettingsKey ); const double feedLong = settingsFeedLongitude.value( mSettingsKey );
// hack to allow testing using local files // hack to allow testing using local files
if ( feedUrl.isLocalFile() ) if ( feedUrl.isLocalFile() )
@ -169,7 +169,7 @@ void QgsNewsFeedParser::fetch()
void QgsNewsFeedParser::onFetch( const QString &content ) void QgsNewsFeedParser::onFetch( const QString &content )
{ {
Settings::feedLastFetchTime.setValue( mFetchStartTime, mSettingsKey ); settingsFeedLastFetchTime.setValue( mFetchStartTime, mSettingsKey );
const QVariant json = QgsJsonUtils::parseJson( content ); const QVariant json = QgsJsonUtils::parseJson( content );

View File

@ -111,21 +111,14 @@ class CORE_EXPORT QgsNewsFeedParser : public QObject
*/ */
static QString keyForFeed( const QString &baseUrl ); static QString keyForFeed( const QString &baseUrl );
/** //! Settings entry last fetch time
* Contains QgsNewsFeedParser settings static const inline QgsSettingsEntryInteger settingsFeedLastFetchTime = QgsSettingsEntryInteger( QStringLiteral( "%/lastFetchTime" ), QgsSettings::Core, 0, QObject::tr( "Feed last fetch time" ), 0 );
* \since QGIS 3.20 //! Settings entry feed language
*/ static const inline QgsSettingsEntryString settingsFeedLanguage = QgsSettingsEntryString( QStringLiteral( "%/lang" ), QgsSettings::Core, QString(), QObject::tr( "Feed language" ) );
struct Settings //! Settings entry feed latitude
{ static const inline QgsSettingsEntryDouble settingsFeedLatitude = QgsSettingsEntryDouble( QStringLiteral( "%/latitude" ), QgsSettings::Core, 0.0, QObject::tr( "Feed latitude" ) );
//! Settings entry last fetch time //! Settings entry feed longitude
static const inline QgsSettingsEntryInteger feedLastFetchTime = QgsSettingsEntryInteger( QStringLiteral( "%/lastFetchTime" ), QgsSettings::Core, 0, QObject::tr( "Feed last fetch time" ), 0 ); static const inline QgsSettingsEntryDouble settingsFeedLongitude = QgsSettingsEntryDouble( QStringLiteral( "%/longitude" ), QgsSettings::Core, 0.0, QObject::tr( "Feed longitude" ) );
//! Settings entry feed language
static const inline QgsSettingsEntryString feedLanguage = QgsSettingsEntryString( QStringLiteral( "%/lang" ), QgsSettings::Core, QString(), QObject::tr( "Feed language" ) );
//! Settings entry feed latitude
static const inline QgsSettingsEntryDouble feedLatitude = QgsSettingsEntryDouble( QStringLiteral( "%/latitude" ), QgsSettings::Core, 0.0, QObject::tr( "Feed latitude" ) );
//! Settings entry feed longitude
static const inline QgsSettingsEntryDouble feedLongitude = QgsSettingsEntryDouble( QStringLiteral( "%/longitude" ), QgsSettings::Core, 0.0, QObject::tr( "Feed longitude" ) );
};
public slots: public slots:

View File

@ -99,21 +99,14 @@ class CORE_EXPORT QgsProcessing
*/ */
static const QString TEMPORARY_OUTPUT; static const QString TEMPORARY_OUTPUT;
/** //! Settings entry prefer filename as layer name
* Contains QgsProcessing settings static const inline QgsSettingsEntryBool settingsPreferFilenameAsLayerName = QgsSettingsEntryBool( QStringLiteral( "Processing/Configuration/PREFER_FILENAME_AS_LAYER_NAME" ), QgsSettings::NoSection, true, QObject::tr( "Prefer filename as layer name" ) );
* \since QGIS 3.20 //! Settings entry temp path
*/ static const inline QgsSettingsEntryString settingsTempPath = QgsSettingsEntryString( QStringLiteral( "Processing/Configuration/TEMP_PATH2" ), QgsSettings::NoSection, QString() );
struct Settings //! Settings entry default output vector layer ext
{ static const inline QgsSettingsEntryInteger settingsDefaultOutputVectorLayerExt = QgsSettingsEntryInteger( QStringLiteral( "Processing/Configuration/DefaultOutputVectorLayerExt" ), QgsSettings::NoSection, -1 );
//! Settings entry prefer filename as layer name //! Settings entry default output raster layer ext
static const inline QgsSettingsEntryBool preferFilenameAsLayerName = QgsSettingsEntryBool( QStringLiteral( "Processing/Configuration/PREFER_FILENAME_AS_LAYER_NAME" ), QgsSettings::NoSection, true, QObject::tr( "Prefer filename as layer name" ) ); static const inline QgsSettingsEntryInteger settingsDefaultOutputRasterLayerExt = QgsSettingsEntryInteger( QStringLiteral( "Processing/Configuration/DefaultOutputRasterLayerExt" ), QgsSettings::NoSection, -1 );
//! Settings entry temp path
static const inline QgsSettingsEntryString tempPath = QgsSettingsEntryString( QStringLiteral( "Processing/Configuration/TEMP_PATH2" ), QgsSettings::NoSection, QString() );
//! Settings entry default output vector layer ext
static const inline QgsSettingsEntryInteger defaultOutputVectorLayerExt = QgsSettingsEntryInteger( QStringLiteral( "Processing/Configuration/DefaultOutputVectorLayerExt" ), QgsSettings::NoSection, -1 );
//! Settings entry default output raster layer ext
static const inline QgsSettingsEntryInteger defaultOutputRasterLayerExt = QgsSettingsEntryInteger( QStringLiteral( "Processing/Configuration/DefaultOutputRasterLayerExt" ), QgsSettings::NoSection, -1 );
};
}; };
#endif // QGSPROCESSING_H #endif // QGSPROCESSING_H

View File

@ -197,7 +197,7 @@ void QgsProcessingContext::LayerDetails::setOutputLayerName( QgsMapLayer *layer
if ( !layer ) if ( !layer )
return; return;
const bool preferFilenameAsLayerName = QgsProcessing::Settings::preferFilenameAsLayerName.value(); const bool preferFilenameAsLayerName = QgsProcessing::settingsPreferFilenameAsLayerName.value();
// note - for temporary layers, we don't use the filename, regardless of user setting (it will be meaningless!) // 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() ) if ( ( !forceName && preferFilenameAsLayerName && !layer->isTemporary() ) || name.isEmpty() )

View File

@ -954,7 +954,7 @@ QString QgsProcessingUtils::tempFolder()
static QString sFolder; static QString sFolder;
static QMutex sMutex; static QMutex sMutex;
QMutexLocker locker( &sMutex ); QMutexLocker locker( &sMutex );
const QString basePath = QgsProcessing::Settings::tempPath.value(); const QString basePath = QgsProcessing::settingsTempPath.value();
if ( basePath.isEmpty() ) if ( basePath.isEmpty() )
{ {
// default setting -- automatically create a temp folder // default setting -- automatically create a temp folder
@ -1211,7 +1211,7 @@ QgsFields QgsProcessingUtils::indicesToFields( const QList<int> &indices, const
QString QgsProcessingUtils::defaultVectorExtension() QString QgsProcessingUtils::defaultVectorExtension()
{ {
const int setting = QgsProcessing::Settings::defaultOutputVectorLayerExt.value(); const int setting = QgsProcessing::settingsDefaultOutputVectorLayerExt.value();
if ( setting == -1 ) if ( setting == -1 )
return QStringLiteral( "gpkg" ); return QStringLiteral( "gpkg" );
return QgsVectorFileWriter::supportedFormatExtensions().value( setting, QStringLiteral( "gpkg" ) ); return QgsVectorFileWriter::supportedFormatExtensions().value( setting, QStringLiteral( "gpkg" ) );
@ -1219,7 +1219,7 @@ QString QgsProcessingUtils::defaultVectorExtension()
QString QgsProcessingUtils::defaultRasterExtension() QString QgsProcessingUtils::defaultRasterExtension()
{ {
const int setting = QgsProcessing::Settings::defaultOutputRasterLayerExt.value(); const int setting = QgsProcessing::settingsDefaultOutputRasterLayerExt.value();
if ( setting == -1 ) if ( setting == -1 )
return QStringLiteral( "tif" ); return QStringLiteral( "tif" );
return QgsRasterFileWriter::supportedFormatExtensions().value( setting, QStringLiteral( "tif" ) ); return QgsRasterFileWriter::supportedFormatExtensions().value( setting, QStringLiteral( "tif" ) );

View File

@ -1353,7 +1353,7 @@ bool QgsProject::readProjectFile( const QString &filename, QgsProject::ReadFlags
QgsApplication::profiler()->clear( QStringLiteral( "projectload" ) ); QgsApplication::profiler()->clear( QStringLiteral( "projectload" ) );
QgsScopedRuntimeProfile profile( tr( "Setting up translations" ), QStringLiteral( "projectload" ) ); QgsScopedRuntimeProfile profile( tr( "Setting up translations" ), QStringLiteral( "projectload" ) );
QString localeFileName = QStringLiteral( "%1_%2" ).arg( QFileInfo( projectFile.fileName() ).baseName(), QgsApplication::Settings::localeUserLocale.value() ); QString localeFileName = QStringLiteral( "%1_%2" ).arg( QFileInfo( projectFile.fileName() ).baseName(), QgsApplication::settingsLocaleUserLocale.value() );
if ( QFile( QStringLiteral( "%1/%2.qm" ).arg( QFileInfo( projectFile.fileName() ).absolutePath(), localeFileName ) ).exists() ) if ( QFile( QStringLiteral( "%1/%2.qm" ).arg( QFileInfo( projectFile.fileName() ).absolutePath(), localeFileName ) ).exists() )
{ {

View File

@ -1063,7 +1063,7 @@ QString QgsApplication::srsDatabaseFilePath()
void QgsApplication::setSvgPaths( const QStringList &svgPaths ) void QgsApplication::setSvgPaths( const QStringList &svgPaths )
{ {
Settings::searchPathsForSVG.setValue( svgPaths ); settingsSearchPathsForSVG.setValue( svgPaths );
members()->mSvgPathCacheValid = false; members()->mSvgPathCacheValid = false;
} }
@ -1082,7 +1082,7 @@ QStringList QgsApplication::svgPaths()
locker.changeMode( QgsReadWriteLocker::Write ); locker.changeMode( QgsReadWriteLocker::Write );
//local directories to search when looking for an SVG with a given basename //local directories to search when looking for an SVG with a given basename
//defined by user in options dialog //defined by user in options dialog
const QStringList pathList = Settings::searchPathsForSVG.value(); const QStringList pathList = settingsSearchPathsForSVG.value();
// maintain user set order while stripping duplicates // maintain user set order while stripping duplicates
QStringList paths; QStringList paths;
@ -1224,9 +1224,9 @@ QString QgsApplication::platform()
QString QgsApplication::locale() QString QgsApplication::locale()
{ {
if ( Settings::localeOverrideFlag.value() ) if ( settingsLocaleOverrideFlag.value() )
{ {
QString locale = Settings::localeUserLocale.value(); QString locale = settingsLocaleUserLocale.value();
// don't differentiate en_US and en_GB // don't differentiate en_US and en_GB
if ( locale.startsWith( QLatin1String( "en" ), Qt::CaseInsensitive ) ) if ( locale.startsWith( QLatin1String( "en" ), Qt::CaseInsensitive ) )
{ {

View File

@ -944,23 +944,16 @@ class CORE_EXPORT QgsApplication : public QApplication
*/ */
void collectTranslatableObjects( QgsTranslationContext *translationContext ); void collectTranslatableObjects( QgsTranslationContext *translationContext );
/** //! Settings entry locale user locale
* Contains QgsApplication settings static const inline QgsSettingsEntryString settingsLocaleUserLocale = QgsSettingsEntryString( QStringLiteral( "locale/userLocale" ), QgsSettings::NoSection, QString() );
* \since QGIS 3.20 //! Settings entry locale override flag
*/ static const inline QgsSettingsEntryBool settingsLocaleOverrideFlag = QgsSettingsEntryBool( QStringLiteral( "locale/overrideFlag" ), QgsSettings::NoSection, false );
struct Settings //! Settings entry locale global locale
{ static const inline QgsSettingsEntryString settingsLocaleGlobalLocale = QgsSettingsEntryString( QStringLiteral( "locale/globalLocale" ), QgsSettings::NoSection, QString() );
//! Settings entry locale user locale //! Settings entry locale show group separator
static const inline QgsSettingsEntryString localeUserLocale = QgsSettingsEntryString( QStringLiteral( "locale/userLocale" ), QgsSettings::NoSection, QString() ); static const inline QgsSettingsEntryBool settingsLocaleShowGroupSeparator = QgsSettingsEntryBool( QStringLiteral( "locale/showGroupSeparator" ), QgsSettings::NoSection, false );
//! Settings entry locale override flag //! Settings entry search path for SVG
static const inline QgsSettingsEntryBool localeOverrideFlag = QgsSettingsEntryBool( QStringLiteral( "locale/overrideFlag" ), QgsSettings::NoSection, false ); static const inline QgsSettingsEntryStringList settingsSearchPathsForSVG = QgsSettingsEntryStringList( QStringLiteral( "svg/searchPathsForSVG" ), QgsSettings::NoSection, QStringList() );
//! Settings entry locale global locale
static const inline QgsSettingsEntryString localeGlobalLocale = QgsSettingsEntryString( QStringLiteral( "locale/globalLocale" ), QgsSettings::NoSection, QString() );
//! Settings entry locale show group separator
static const inline QgsSettingsEntryBool localeShowGroupSeparator = QgsSettingsEntryBool( QStringLiteral( "locale/showGroupSeparator" ), QgsSettings::NoSection, false );
//! Settings entry search path for SVG
static const inline QgsSettingsEntryStringList searchPathsForSVG = QgsSettingsEntryStringList( QStringLiteral( "svg/searchPathsForSVG" ), QgsSettings::NoSection, QStringList() );
};
#ifdef SIP_RUN #ifdef SIP_RUN
SIP_IF_FEATURE( ANDROID ) SIP_IF_FEATURE( ANDROID )

View File

@ -23,7 +23,7 @@
QgsGeometryOptions::QgsGeometryOptions() QgsGeometryOptions::QgsGeometryOptions()
{ {
mGeometryChecks = Settings::geometryValidationDefaultChecks.value().split( ',' ) ; mGeometryChecks = settingsGeometryValidationDefaultChecks.value().split( ',' ) ;
} }
bool QgsGeometryOptions::removeDuplicateNodes() const bool QgsGeometryOptions::removeDuplicateNodes() const

View File

@ -132,15 +132,8 @@ class CORE_EXPORT QgsGeometryOptions : public QObject
*/ */
void readXml( const QDomNode &node ); void readXml( const QDomNode &node );
/** //! Settings entry search path for templates
* Contains QgsGeometryOptions settings static const inline QgsSettingsEntryString settingsGeometryValidationDefaultChecks = QgsSettingsEntryString( QStringLiteral( "geometry_validation/default_checks" ), QgsSettings::NoSection, QString() );
* \since QGIS 3.20
*/
struct Settings
{
//! Settings entry search path for templates
static const inline QgsSettingsEntryString geometryValidationDefaultChecks = QgsSettingsEntryString( QStringLiteral( "geometry_validation/default_checks" ), QgsSettings::NoSection, QString() );
};
signals: signals:

View File

@ -105,10 +105,10 @@ void QgsLocalizedDataPathRegistry::unregisterPath( const QString &path )
void QgsLocalizedDataPathRegistry::readFromSettings() void QgsLocalizedDataPathRegistry::readFromSettings()
{ {
setPaths( Settings::localizedDataPaths.value() ); setPaths( settingsLocalizedDataPaths.value() );
} }
void QgsLocalizedDataPathRegistry::writeToSettings() void QgsLocalizedDataPathRegistry::writeToSettings()
{ {
Settings::localizedDataPaths.setValue( paths() ); settingsLocalizedDataPaths.setValue( paths() );
} }

View File

@ -66,15 +66,8 @@ class CORE_EXPORT QgsLocalizedDataPathRegistry
//! Unregisters a localized path //! Unregisters a localized path
void unregisterPath( const QString &path ); void unregisterPath( const QString &path );
/** //! Settings entry localized data paths
* Contains QgsLocalizedDataPathRegistry settings static const inline QgsSettingsEntryStringList settingsLocalizedDataPaths = QgsSettingsEntryStringList( QStringLiteral( "/qgis/localized_data_paths" ), QgsSettings::NoSection, QStringList() );
* \since QGIS 3.20
*/
struct Settings
{
//! Settings entry localized data paths
static const inline QgsSettingsEntryStringList localizedDataPaths = QgsSettingsEntryStringList( QStringLiteral( "/qgis/localized_data_paths" ), QgsSettings::NoSection, QStringList() );
};
private: private:
#ifdef SIP_RUN #ifdef SIP_RUN

View File

@ -977,7 +977,7 @@ void QgsMapRendererJob::composeSecondPass( LayerRenderJobs &secondPassJobs, Labe
void QgsMapRendererJob::logRenderingTime( const LayerRenderJobs &jobs, const LayerRenderJobs &secondPassJobs, const LabelRenderJob &labelJob ) void QgsMapRendererJob::logRenderingTime( const LayerRenderJobs &jobs, const LayerRenderJobs &secondPassJobs, const LabelRenderJob &labelJob )
{ {
if ( !Settings::logCanvasRefreshEvent.value() ) if ( !settingsLogCanvasRefreshEvent.value() )
return; return;
QMultiMap<int, QString> elapsed; QMultiMap<int, QString> elapsed;

View File

@ -344,16 +344,8 @@ class CORE_EXPORT QgsMapRendererJob : public QObject
*/ */
static const QString LABEL_PREVIEW_CACHE_ID SIP_SKIP; static const QString LABEL_PREVIEW_CACHE_ID SIP_SKIP;
//! Settings entry log canvas refresh event
/** static const inline QgsSettingsEntryBool settingsLogCanvasRefreshEvent = QgsSettingsEntryBool( QStringLiteral( "Map/logCanvasRefreshEvent" ), QgsSettings::NoSection, false );
* Contains QgsMapRendererJob settings
* \since QGIS 3.20
*/
struct Settings
{
//! Settings entry log canvas refresh event
static const inline QgsSettingsEntryBool logCanvasRefreshEvent = QgsSettingsEntryBool( QStringLiteral( "Map/logCanvasRefreshEvent" ), QgsSettings::NoSection, false );
};
signals: signals:

View File

@ -34,29 +34,29 @@ QgsSettingsRegistryCore::QgsSettingsRegistryCore()
addSettingsEntry( &QgsLocator::settingsLocatorFilterDefault ); addSettingsEntry( &QgsLocator::settingsLocatorFilterDefault );
addSettingsEntry( &QgsLocator::settingsLocatorFilterPrefix ); addSettingsEntry( &QgsLocator::settingsLocatorFilterPrefix );
addSettingsEntry( &QgsNetworkAccessManager::Settings::networkTimeout ); addSettingsEntry( &QgsNetworkAccessManager::settingsNetworkTimeout );
addSettingsEntry( &QgsNewsFeedParser::Settings::feedLastFetchTime ); addSettingsEntry( &QgsNewsFeedParser::settingsFeedLastFetchTime );
addSettingsEntry( &QgsNewsFeedParser::Settings::feedLanguage ); addSettingsEntry( &QgsNewsFeedParser::settingsFeedLanguage );
addSettingsEntry( &QgsNewsFeedParser::Settings::feedLatitude ); addSettingsEntry( &QgsNewsFeedParser::settingsFeedLatitude );
addSettingsEntry( &QgsNewsFeedParser::Settings::feedLongitude ); addSettingsEntry( &QgsNewsFeedParser::settingsFeedLongitude );
addSettingsEntry( &QgsProcessing::Settings::preferFilenameAsLayerName ); addSettingsEntry( &QgsProcessing::settingsPreferFilenameAsLayerName );
addSettingsEntry( &QgsProcessing::Settings::tempPath ); addSettingsEntry( &QgsProcessing::settingsTempPath );
addSettingsEntry( &QgsProcessing::Settings::defaultOutputVectorLayerExt ); addSettingsEntry( &QgsProcessing::settingsDefaultOutputVectorLayerExt );
addSettingsEntry( &QgsProcessing::Settings::defaultOutputRasterLayerExt ); addSettingsEntry( &QgsProcessing::settingsDefaultOutputRasterLayerExt );
addSettingsEntry( &QgsApplication::Settings::localeUserLocale ); addSettingsEntry( &QgsApplication::settingsLocaleUserLocale );
addSettingsEntry( &QgsApplication::Settings::localeOverrideFlag ); addSettingsEntry( &QgsApplication::settingsLocaleOverrideFlag );
addSettingsEntry( &QgsApplication::Settings::localeGlobalLocale ); addSettingsEntry( &QgsApplication::settingsLocaleGlobalLocale );
addSettingsEntry( &QgsApplication::Settings::localeShowGroupSeparator ); addSettingsEntry( &QgsApplication::settingsLocaleShowGroupSeparator );
addSettingsEntry( &QgsApplication::Settings::searchPathsForSVG ); addSettingsEntry( &QgsApplication::settingsSearchPathsForSVG );
addSettingsEntry( &QgsGeometryOptions::Settings::geometryValidationDefaultChecks ); addSettingsEntry( &QgsGeometryOptions::settingsGeometryValidationDefaultChecks );
addSettingsEntry( &QgsLocalizedDataPathRegistry::Settings::localizedDataPaths ); addSettingsEntry( &QgsLocalizedDataPathRegistry::settingsLocalizedDataPaths );
addSettingsEntry( &QgsMapRendererJob::Settings::logCanvasRefreshEvent ); addSettingsEntry( &QgsMapRendererJob::settingsLogCanvasRefreshEvent );
} }
QgsSettingsRegistryCore::~QgsSettingsRegistryCore() QgsSettingsRegistryCore::~QgsSettingsRegistryCore()

View File

@ -136,7 +136,7 @@ void QgsConfigureShortcutsDialog::saveShortcuts()
QDomDocument doc( QStringLiteral( "shortcuts" ) ); QDomDocument doc( QStringLiteral( "shortcuts" ) );
QDomElement root = doc.createElement( QStringLiteral( "qgsshortcuts" ) ); QDomElement root = doc.createElement( QStringLiteral( "qgsshortcuts" ) );
root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) ); root.setAttribute( QStringLiteral( "version" ), QStringLiteral( "1.0" ) );
root.setAttribute( QStringLiteral( "locale" ), settings.value( QgsApplication::Settings::localeUserLocale.key(), "en_US" ).toString() ); root.setAttribute( QStringLiteral( "locale" ), settings.value( QgsApplication::settingsLocaleUserLocale.key(), "en_US" ).toString() );
doc.appendChild( root ); doc.appendChild( root );
settings.beginGroup( mManager->settingsPath() ); settings.beginGroup( mManager->settingsPath() );
@ -205,10 +205,10 @@ void QgsConfigureShortcutsDialog::loadShortcuts()
QString currentLocale; QString currentLocale;
bool localeOverrideFlag = QgsApplication::Settings::localeOverrideFlag.value(); bool localeOverrideFlag = QgsApplication::settingsLocaleOverrideFlag.value();
if ( localeOverrideFlag ) if ( localeOverrideFlag )
{ {
currentLocale = QgsSettings().value( QgsApplication::Settings::localeUserLocale.key(), "en_US" ).toString(); currentLocale = QgsApplication::settingsLocaleUserLocale.value( QString(), true, "en_US" );
} }
else // use QGIS locale else // use QGIS locale
{ {

View File

@ -174,7 +174,7 @@ void QgsGui::setWindowManager( QgsWindowManagerInterface *manager )
QgsGui::HigFlags QgsGui::higFlags() QgsGui::HigFlags QgsGui::higFlags()
{ {
if ( QgsApplication::Settings::localeUserLocale.value().startsWith( QLatin1String( "en" ) ) ) if ( QgsApplication::settingsLocaleUserLocale.value().startsWith( QLatin1String( "en" ) ) )
{ {
return HigMenuTextIsTitleCase | HigDialogTitleIsTitleCase; return HigMenuTextIsTitleCase | HigDialogTitleIsTitleCase;
} }

View File

@ -706,7 +706,7 @@ void QgsMapCanvas::rendererJobFinished()
QPainter p( &img ); QPainter p( &img );
emit renderComplete( &p ); emit renderComplete( &p );
if ( QgsMapRendererJob::Settings::logCanvasRefreshEvent.value() ) if ( QgsMapRendererJob::settingsLogCanvasRefreshEvent.value() )
{ {
QString logMsg = tr( "Canvas refresh: %1 ms" ).arg( mJob->renderingTime() ); QString logMsg = tr( "Canvas refresh: %1 ms" ).arg( mJob->renderingTime() );
QgsMessageLog::logMessage( logMsg, tr( "Rendering" ) ); QgsMessageLog::logMessage( logMsg, tr( "Rendering" ) );

View File

@ -2303,11 +2303,11 @@ void TestQgsProcessing::parameters()
context2.layersToLoadOnCompletion().values().at( 0 ).setOutputLayerName( rl.get() ); context2.layersToLoadOnCompletion().values().at( 0 ).setOutputLayerName( rl.get() );
QCOMPARE( rl->name(), QStringLiteral( "landsat" ) ); QCOMPARE( rl->name(), QStringLiteral( "landsat" ) );
// unless setting prohibits it... // unless setting prohibits it...
QgsProcessing::Settings::preferFilenameAsLayerName.setValue( false ); QgsProcessing::settingsPreferFilenameAsLayerName.setValue( false );
context2.layersToLoadOnCompletion().values().at( 0 ).setOutputLayerName( rl.get() ); context2.layersToLoadOnCompletion().values().at( 0 ).setOutputLayerName( rl.get() );
QCOMPARE( rl->name(), QStringLiteral( "my_dest" ) ); QCOMPARE( rl->name(), QStringLiteral( "my_dest" ) );
// if layer has a layername, we should use that instead of the base file name... // if layer has a layername, we should use that instead of the base file name...
QgsProcessing::Settings::preferFilenameAsLayerName.setValue( true ); QgsProcessing::settingsPreferFilenameAsLayerName.setValue( true );
vl = std::make_unique< QgsVectorLayer >( QStringLiteral( TEST_DATA_DIR ) + "/points_gpkg.gpkg|layername=points_small", QString() ); vl = std::make_unique< QgsVectorLayer >( QStringLiteral( TEST_DATA_DIR ) + "/points_gpkg.gpkg|layername=points_small", QString() );
context2.layersToLoadOnCompletion().values().at( 0 ).setOutputLayerName( vl.get() ); context2.layersToLoadOnCompletion().values().at( 0 ).setOutputLayerName( vl.get() );
QCOMPARE( vl->name(), QStringLiteral( "points_small" ) ); QCOMPARE( vl->name(), QStringLiteral( "points_small" ) );
@ -11042,7 +11042,7 @@ void TestQgsProcessing::tempUtils()
QgsSettings settings; QgsSettings settings;
QString alternative_tempFolder1 = tempDirPath + QStringLiteral( "/alternative_temp_test_one" ); QString alternative_tempFolder1 = tempDirPath + QStringLiteral( "/alternative_temp_test_one" );
QgsProcessing::Settings::tempPath.setValue( alternative_tempFolder1 ); QgsProcessing::settingsTempPath.setValue( alternative_tempFolder1 );
// check folder and if it's constant with alternative temp folder 1 // check folder and if it's constant with alternative temp folder 1
tempFolder = QgsProcessingUtils::tempFolder(); tempFolder = QgsProcessingUtils::tempFolder();
QCOMPARE( tempFolder.left( alternative_tempFolder1.length() ), alternative_tempFolder1 ); QCOMPARE( tempFolder.left( alternative_tempFolder1.length() ), alternative_tempFolder1 );
@ -11054,7 +11054,7 @@ void TestQgsProcessing::tempUtils()
QVERIFY( alternativeTempFile1.startsWith( alternative_tempFolder1 ) ); QVERIFY( alternativeTempFile1.startsWith( alternative_tempFolder1 ) );
// change temp folder in the settings again // change temp folder in the settings again
QString alternative_tempFolder2 = tempDirPath + QStringLiteral( "/alternative_temp_test_two" ); QString alternative_tempFolder2 = tempDirPath + QStringLiteral( "/alternative_temp_test_two" );
QgsProcessing::Settings::tempPath.setValue( alternative_tempFolder2 ); QgsProcessing::settingsTempPath.setValue( alternative_tempFolder2 );
// check folder and if it's constant constant with alternative temp folder 2 // check folder and if it's constant constant with alternative temp folder 2
tempFolder = QgsProcessingUtils::tempFolder(); tempFolder = QgsProcessingUtils::tempFolder();
QCOMPARE( tempFolder.left( alternative_tempFolder2.length() ), alternative_tempFolder2 ); QCOMPARE( tempFolder.left( alternative_tempFolder2.length() ), alternative_tempFolder2 );
@ -11064,7 +11064,7 @@ void TestQgsProcessing::tempUtils()
QVERIFY( alternativeTempFile2.endsWith( "alternative_temptest.txt" ) ); QVERIFY( alternativeTempFile2.endsWith( "alternative_temptest.txt" ) );
QVERIFY( alternativeTempFile2.startsWith( tempFolder ) ); QVERIFY( alternativeTempFile2.startsWith( tempFolder ) );
QVERIFY( alternativeTempFile2.startsWith( alternative_tempFolder2 ) ); QVERIFY( alternativeTempFile2.startsWith( alternative_tempFolder2 ) );
QgsProcessing::Settings::tempPath.setValue( QString() ); QgsProcessing::settingsTempPath.setValue( QString() );
} }
@ -11529,8 +11529,8 @@ void TestQgsProcessing::defaultExtensionsForProvider()
QCOMPARE( context.preferredRasterFormat(), QStringLiteral( "tif" ) ); QCOMPARE( context.preferredRasterFormat(), QStringLiteral( "tif" ) );
// unless the user has set a default format, which IS supported by that provider // unless the user has set a default format, which IS supported by that provider
QgsProcessing::Settings::defaultOutputVectorLayerExt.setValue( QgsVectorFileWriter::supportedFormatExtensions().indexOf( QLatin1String( "tab" ) ) ); QgsProcessing::settingsDefaultOutputVectorLayerExt.setValue( QgsVectorFileWriter::supportedFormatExtensions().indexOf( QLatin1String( "tab" ) ) );
QgsProcessing::Settings::defaultOutputRasterLayerExt.setValue( QgsVectorFileWriter::supportedFormatExtensions().indexOf( QLatin1String( "sdat" ) ) ); QgsProcessing::settingsDefaultOutputRasterLayerExt.setValue( QgsVectorFileWriter::supportedFormatExtensions().indexOf( QLatin1String( "sdat" ) ) );
QCOMPARE( provider.defaultVectorFileExtension( true ), QStringLiteral( "tab" ) ); QCOMPARE( provider.defaultVectorFileExtension( true ), QStringLiteral( "tab" ) );
QCOMPARE( provider.defaultRasterFileExtension(), QStringLiteral( "sdat" ) ); QCOMPARE( provider.defaultRasterFileExtension(), QStringLiteral( "sdat" ) );
@ -11541,8 +11541,8 @@ void TestQgsProcessing::defaultExtensionsForProvider()
QCOMPARE( context2.preferredRasterFormat(), QStringLiteral( "sdat" ) ); QCOMPARE( context2.preferredRasterFormat(), QStringLiteral( "sdat" ) );
// but if default is not supported by provider, we use a supported format // but if default is not supported by provider, we use a supported format
QgsProcessing::Settings::defaultOutputVectorLayerExt.setValue( QgsVectorFileWriter::supportedFormatExtensions().indexOf( QLatin1String( "gpkg" ) ) ); QgsProcessing::settingsDefaultOutputVectorLayerExt.setValue( QgsVectorFileWriter::supportedFormatExtensions().indexOf( QLatin1String( "gpkg" ) ) );
QgsProcessing::Settings::defaultOutputRasterLayerExt.setValue( QgsVectorFileWriter::supportedFormatExtensions().indexOf( QLatin1String( "ecw" ) ) ); QgsProcessing::settingsDefaultOutputRasterLayerExt.setValue( QgsVectorFileWriter::supportedFormatExtensions().indexOf( QLatin1String( "ecw" ) ) );
QCOMPARE( provider.defaultVectorFileExtension( true ), QStringLiteral( "mif" ) ); QCOMPARE( provider.defaultVectorFileExtension( true ), QStringLiteral( "mif" ) );
QCOMPARE( provider.defaultRasterFileExtension(), QStringLiteral( "mig" ) ); QCOMPARE( provider.defaultRasterFileExtension(), QStringLiteral( "mig" ) );
} }

View File

@ -163,7 +163,7 @@ void TestQgsCompositionConverter::initTestCase()
QgsApplication::init(); QgsApplication::init();
QgsApplication::initQgis(); QgsApplication::initQgis();
mReport = QStringLiteral( "<h1>Layout Tests</h1>\n" ); mReport = QStringLiteral( "<h1>Layout Tests</h1>\n" );
QgsApplication::Settings::searchPathsForSVG.setValue( QStringLiteral( TEST_DATA_DIR ) ); QgsApplication::settingsSearchPathsForSVG.setValue( QStringList() << QStringLiteral( TEST_DATA_DIR ) );
} }
void TestQgsCompositionConverter::cleanupTestCase() void TestQgsCompositionConverter::cleanupTestCase()

View File

@ -175,7 +175,7 @@ void TestQgsNetworkAccessManager::initTestCase()
QgsApplication::init(); QgsApplication::init();
QgsApplication::initQgis(); QgsApplication::initQgis();
QgsNetworkAccessManager::Settings::networkTimeout.setValue( 5000 ); QgsNetworkAccessManager::settingsNetworkTimeout.setValue( 5000 );
mHttpBinHost = QStringLiteral( "httpbin.org" ); mHttpBinHost = QStringLiteral( "httpbin.org" );
QString overrideHost = qgetenv( "QGIS_HTTPBIN_HOST" ); QString overrideHost = qgetenv( "QGIS_HTTPBIN_HOST" );

View File

@ -111,12 +111,12 @@ void TestQgsNewsFeedParser::testFetch()
entries.clear(); entries.clear();
// after a fetch, the current timestamp should be saved to avoid refetching these // after a fetch, the current timestamp should be saved to avoid refetching these
uint after = QgsNewsFeedParser::Settings::feedLastFetchTime.value( feedKey ); uint after = QgsNewsFeedParser::settingsFeedLastFetchTime.value( feedKey );
QVERIFY( after >= beforeTime ); QVERIFY( after >= beforeTime );
// reset to a standard known last time // reset to a standard known last time
QgsSettings().remove( feedKey, QgsSettings::Core ); QgsSettings().remove( feedKey, QgsSettings::Core );
QgsNewsFeedParser::Settings::feedLastFetchTime.setValue( 1457360008, feedKey ); QgsNewsFeedParser::settingsFeedLastFetchTime.setValue( 1457360008, feedKey );
// refetch, only new items should be fetched // refetch, only new items should be fetched
QgsNewsFeedParser parser2( url ); QgsNewsFeedParser parser2( url );
@ -230,7 +230,7 @@ void TestQgsNewsFeedParser::testLang()
const QString feedKey = QgsNewsFeedParser::keyForFeed( url.toString() ); const QString feedKey = QgsNewsFeedParser::keyForFeed( url.toString() );
QgsSettings().remove( feedKey, QgsSettings::Core ); QgsSettings().remove( feedKey, QgsSettings::Core );
// force to Spanish language // force to Spanish language
QgsNewsFeedParser::Settings::feedLanguage.setValue( QStringLiteral( "es" ), feedKey ); QgsNewsFeedParser::settingsFeedLanguage.setValue( QStringLiteral( "es" ), feedKey );
QgsNewsFeedParser parser( url ); QgsNewsFeedParser parser( url );
QSignalSpy spy( &parser, &QgsNewsFeedParser::entryAdded ); QSignalSpy spy( &parser, &QgsNewsFeedParser::entryAdded );
@ -256,8 +256,8 @@ void TestQgsNewsFeedParser::testGeoFencing()
const QUrl url( QUrl::fromLocalFile( QStringLiteral( TEST_DATA_DIR ) + "/newsfeed/feed" ) ); const QUrl url( QUrl::fromLocalFile( QStringLiteral( TEST_DATA_DIR ) + "/newsfeed/feed" ) );
const QString feedKey = QgsNewsFeedParser::keyForFeed( url.toString() ); const QString feedKey = QgsNewsFeedParser::keyForFeed( url.toString() );
QgsSettings().remove( feedKey, QgsSettings::Core ); QgsSettings().remove( feedKey, QgsSettings::Core );
QgsNewsFeedParser::Settings::feedLatitude.setValue( 37.2343, feedKey ); QgsNewsFeedParser::settingsFeedLatitude.setValue( 37.2343, feedKey );
QgsNewsFeedParser::Settings::feedLongitude.setValue( -115.8067, feedKey ); QgsNewsFeedParser::settingsFeedLongitude.setValue( -115.8067, feedKey );
QgsNewsFeedParser parser( url ); QgsNewsFeedParser parser( url );
QSignalSpy spy( &parser, &QgsNewsFeedParser::entryAdded ); QSignalSpy spy( &parser, &QgsNewsFeedParser::entryAdded );

View File

@ -57,12 +57,12 @@ void TestQgsTranslateProject::initTestCase()
QgsApplication::init(); QgsApplication::init();
QgsApplication::initQgis(); QgsApplication::initQgis();
original_locale = QgsApplication::Settings::localeUserLocale.value(); original_locale = QgsApplication::settingsLocaleUserLocale.value();
} }
void TestQgsTranslateProject::cleanupTestCase() void TestQgsTranslateProject::cleanupTestCase()
{ {
QgsApplication::Settings::localeUserLocale.setValue( original_locale ); QgsApplication::settingsLocaleUserLocale.setValue( original_locale );
QgsApplication::exitQgis(); QgsApplication::exitQgis();
//delete translated project file //delete translated project file
@ -91,7 +91,7 @@ void TestQgsTranslateProject::cleanup()
void TestQgsTranslateProject::createTsFile() void TestQgsTranslateProject::createTsFile()
{ {
//open project in english //open project in english
QgsApplication::Settings::localeUserLocale.setValue( "en" ); QgsApplication::settingsLocaleUserLocale.setValue( "en" );
QString projectFileName( TEST_DATA_DIR ); QString projectFileName( TEST_DATA_DIR );
projectFileName = projectFileName + "/project_translation/points_translation.qgs"; projectFileName = projectFileName + "/project_translation/points_translation.qgs";
QgsProject::instance()->read( projectFileName ); QgsProject::instance()->read( projectFileName );
@ -163,7 +163,7 @@ void TestQgsTranslateProject::createTsFile()
void TestQgsTranslateProject::translateProject() void TestQgsTranslateProject::translateProject()
{ {
//open project in german //open project in german
QgsApplication::Settings::localeUserLocale.setValue( "de" ); QgsApplication::settingsLocaleUserLocale.setValue( "de" );
QString projectFileName( TEST_DATA_DIR ); QString projectFileName( TEST_DATA_DIR );
projectFileName = projectFileName + "/project_translation/points_translation.qgs"; projectFileName = projectFileName + "/project_translation/points_translation.qgs";
QgsProject::instance()->read( projectFileName ); QgsProject::instance()->read( projectFileName );