Skip to content
Permalink
Browse files

Removed settings struct

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

<<<<<<< HEAD
void requestAuthOpenBrowser( const QUrl &url ) const;
%Docstring
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
%End
=======
const QgsSettingsEntryInteger settingsNetworkTimeout;
>>>>>>> 2087a7f4f8 (Removed settings struct)

signals:

@@ -93,13 +93,10 @@ Returns the authentication configuration for the parser.
Returns the settings key used for a feed with the given ``baseUrl``.
%End

struct Settings
{
const QgsSettingsEntryInteger feedLastFetchTime;
const QgsSettingsEntryString feedLanguage;
const QgsSettingsEntryDouble feedLatitude;
const QgsSettingsEntryDouble feedLongitude;
};
const QgsSettingsEntryInteger settingsFeedLastFetchTime;
const QgsSettingsEntryString settingsFeedLanguage;
const QgsSettingsEntryDouble settingsFeedLatitude;
const QgsSettingsEntryDouble settingsFeedLongitude;

public slots:

@@ -53,13 +53,10 @@ Converts a source ``type`` to a string representation.

static const QString TEMPORARY_OUTPUT;

struct Settings
{
const QgsSettingsEntryBool preferFilenameAsLayerName;
const QgsSettingsEntryString tempPath;
const QgsSettingsEntryInteger defaultOutputVectorLayerExt;
const QgsSettingsEntryInteger defaultOutputRasterLayerExt;
};
const QgsSettingsEntryBool settingsPreferFilenameAsLayerName;
const QgsSettingsEntryString settingsTempPath;
const QgsSettingsEntryInteger settingsDefaultOutputVectorLayerExt;
const QgsSettingsEntryInteger settingsDefaultOutputRasterLayerExt;
};

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

struct Settings
{
const QgsSettingsEntryString localeUserLocale;
const QgsSettingsEntryBool localeOverrideFlag;
const QgsSettingsEntryString localeGlobalLocale;
const QgsSettingsEntryBool localeShowGroupSeparator;
const QgsSettingsEntryStringList searchPathsForSVG;
};
const QgsSettingsEntryString settingsLocaleUserLocale;
const QgsSettingsEntryBool settingsLocaleOverrideFlag;
const QgsSettingsEntryString settingsLocaleGlobalLocale;
const QgsSettingsEntryBool settingsLocaleShowGroupSeparator;
const QgsSettingsEntryStringList settingsSearchPathsForSVG;

%If (ANDROID)
//dummy method to workaround sip generation issue
@@ -118,10 +118,7 @@ Read the geometry options from ``node``.
.. versionadded:: 3.4
%End

struct Settings
{
const QgsSettingsEntryString geometryValidationDefaultChecks;
};
const QgsSettingsEntryString settingsGeometryValidationDefaultChecks;

signals:

@@ -60,10 +60,7 @@ Since the paths are stored by order of preference, lower positions in the list t
Unregisters a localized path
%End

struct Settings
{
const QgsSettingsEntryStringList localizedDataPaths;
};
const QgsSettingsEntryStringList settingsLocalizedDataPaths;

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




struct Settings
{
const QgsSettingsEntryBool logCanvasRefreshEvent;
};
const QgsSettingsEntryBool settingsLogCanvasRefreshEvent;

signals:

@@ -84,6 +84,7 @@ Get settings entry key.
The ``dynamicKeyParts`` argument specifies the list of dynamic parts of the settings key.
%End

<<<<<<< HEAD
bool keyIsValid( const QString &key ) const;
%Docstring
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
%End

=======
>>>>>>> 7b8aad6203 (Removed settings struct)
QString definitionKey() const;
%Docstring
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;
%Docstring
<<<<<<< HEAD
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.
%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;
%Docstring
Set settings value.
<<<<<<< HEAD

The ``value`` to set.
The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key.
%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;
%Docstring
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;
%Docstring
Set settings value.
<<<<<<< HEAD

The ``value`` to set.
The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key.
%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;
%Docstring
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;
%Docstring
Set settings value.
<<<<<<< HEAD

The ``value`` to set.
The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key.
%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;
%Docstring
Set settings value.
@@ -31,6 +31,7 @@ Constructor for QgsSettingsRegistry.

virtual ~QgsSettingsRegistry();

<<<<<<< HEAD
QList<const QgsSettingsEntryBase *> getChildSettingsEntries() const;
%Docstring
Returns the list of registered :py:class:`QgsSettingsEntryBase`.
@@ -55,6 +56,13 @@ Returns the list of registered child QgsSettingsRegistry.

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 );
%Docstring
Add ``settingsEntry`` to the register.
@@ -968,16 +968,16 @@ int main( int argc, char *argv[] )
{
/* Translation file for QGIS.
*/
QString myUserTranslation = QgsApplication::Settings::localeUserLocale.value();
QString myGlobalLocale = QgsApplication::Settings::localeGlobalLocale.value();
QString myUserTranslation = QgsApplication::settingsLocaleUserLocale.value();
QString myGlobalLocale = QgsApplication::settingsLocaleGlobalLocale.value();
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
if ( myLocaleOverrideFlag )
{
// 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() )
{
QgsApplication::Settings::localeUserLocale.setValue( translationCode );
QgsApplication::settingsLocaleUserLocale.setValue( translationCode );
}
else
{
@@ -1000,7 +1000,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::Settings::localeUserLocale.setValue( translationCode );
QgsApplication::settingsLocaleUserLocale.setValue( translationCode );
}
else
{
@@ -475,7 +475,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
cmbScanZipInBrowser->setCurrentIndex( index );

// log rendering events, for userspace debugging
mLogCanvasRefreshChkBx->setChecked( QgsMapRendererJob::Settings::logCanvasRefreshEvent.value() );
mLogCanvasRefreshChkBx->setChecked( QgsMapRendererJob::settingsLogCanvasRefreshEvent.value() );

//set the default projection behavior radio buttons
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();
lblSystemLocale->setText( tr( "Detected active locale on your system: %1" ).arg( currentLocale ) );
QString userLocale = QgsApplication::Settings::localeUserLocale.value();
bool showGroupSeparator = QgsApplication::Settings::localeShowGroupSeparator.value();
QString globalLocale = QgsApplication::Settings::localeGlobalLocale.value();
QString userLocale = QgsApplication::settingsLocaleUserLocale.value();
bool showGroupSeparator = QgsApplication::settingsLocaleShowGroupSeparator.value();
QString globalLocale = QgsApplication::settingsLocaleGlobalLocale.value();
const QStringList language18nList( i18nList() );
for ( const auto &l : language18nList )
{
@@ -1044,7 +1044,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti

cboTranslation->setCurrentIndex( cboTranslation->findData( userLocale ) );
cboGlobalLocale->setCurrentIndex( cboGlobalLocale->findData( globalLocale ) );
grpLocale->setChecked( QgsApplication::Settings::localeOverrideFlag.value() );
grpLocale->setChecked( QgsApplication::settingsLocaleOverrideFlag.value() );
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::Settings::logCanvasRefreshEvent.setValue( mLogCanvasRefreshChkBx->isChecked() );
QgsMapRendererJob::settingsLogCanvasRefreshEvent.setValue( 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::Settings::localeUserLocale.setValue( cboTranslation->currentData().toString() );
QgsApplication::Settings::localeOverrideFlag.setValue( grpLocale->isChecked() );
QgsApplication::Settings::localeGlobalLocale.setValue( cboGlobalLocale->currentData( ).toString() );
QgsApplication::settingsLocaleUserLocale.setValue( cboTranslation->currentData().toString() );
QgsApplication::settingsLocaleOverrideFlag.setValue( grpLocale->isChecked() );
QgsApplication::settingsLocaleGlobalLocale.setValue( cboGlobalLocale->currentData( ).toString() );

// Number settings
QgsApplication::Settings::localeShowGroupSeparator.setValue( cbShowGroupSeparator->isChecked( ) );
QgsApplication::settingsLocaleShowGroupSeparator.setValue( 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::Settings::localeUserLocale.value() ) );
cbtsLocale->setCurrentIndex( cbtsLocale->findData( QgsApplication::settingsLocaleUserLocale.value() ) );

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

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

int QgsNetworkAccessManager::timeout()
{
return Settings::networkTimeout.value();
return settingsNetworkTimeout.value();
}

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 )
@@ -530,6 +530,10 @@ class CORE_EXPORT QgsNetworkAccessManager : public QNetworkAccessManager
*/
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:

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

QUrlQuery query( feedUrl );

const qint64 after = Settings::feedLastFetchTime.value( mSettingsKey );
const qint64 after = settingsFeedLastFetchTime.value( mSettingsKey );
if ( after > 0 )
query.addQueryItem( QStringLiteral( "after" ), qgsDoubleToString( after, 0 ) );

QString feedLanguage = Settings::feedLanguage.value( mSettingsKey );
QString feedLanguage = settingsFeedLanguage.value( mSettingsKey );
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" ) )
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 feedLong = Settings::feedLongitude.value( mSettingsKey );
const double feedLat = settingsFeedLatitude.value( mSettingsKey );
const double feedLong = settingsFeedLongitude.value( mSettingsKey );

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

void QgsNewsFeedParser::onFetch( const QString &content )
{
Settings::feedLastFetchTime.setValue( mFetchStartTime, mSettingsKey );
settingsFeedLastFetchTime.setValue( mFetchStartTime, mSettingsKey );

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

0 comments on commit 95dfe0f

Please sign in to comment.