Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
address review comments (docstring, typo, …)
  • Loading branch information
3nids committed Jan 16, 2023
1 parent b36d32e commit ac8170e
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion python/core/auto_additions/qgssettingstreeelement.py
Expand Up @@ -7,7 +7,7 @@
# --
QgsSettingsTreeElement.Type.baseClass = QgsSettingsTreeElement
# monkey patching scoped based enum
QgsSettingsTreeElement.Option.NamedListSelectedItemSetting.__doc__ = ""
QgsSettingsTreeElement.Option.NamedListSelectedItemSetting.__doc__ = "Creates a setting to store which is the current item"
QgsSettingsTreeElement.Option.__doc__ = 'Options for named list elements\n\n' + '* ``NamedListSelectedItemSetting``: ' + QgsSettingsTreeElement.Option.NamedListSelectedItemSetting.__doc__
# --
QgsSettingsTreeElement.Option.baseClass = QgsSettingsTreeElement
Expand Down
Expand Up @@ -337,7 +337,7 @@ Returns the current value (or default) if there is no former value.

bool copyValueFromKey( const QString &key, const QStringList &dynamicKeyPartList = QStringList(), bool deleteOldKey = false ) const;
%Docstring
Checks if the settings does not exist and try to set it from a given ``oldKey``.
Checks if the settings does not exist and tries to set it from a given ``oldKey``.
\arg dynamicKeyPartList is the optional dynamic key part to determine the key. It must be the same for origin and destination keys.
If ``deleteOldKey``, the setting with the old key will be removed

Expand Down
Expand Up @@ -69,7 +69,7 @@ Creates a normal tree element
QgsSettingsTreeNamedListElement *createNamedListElement( const QString &key, const QgsSettingsTreeElement::Options &options = QgsSettingsTreeElement::Options() ) throw( QgsSettingsException ) /KeepReference/;
%Docstring
Creates a named list tree element.
This is useful to register group of settings for several named items (for instance credentials for several named services)
This is useful to register groups of settings for several named items (for instance credentials for several named services)
%End


Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsowsconnection.h
Expand Up @@ -38,7 +38,7 @@
class CORE_EXPORT QgsXyzConnectionSettings SIP_SKIP
{
public:
static inline QgsSettingsTreeNamedListElement *sTreeXyzConnections = QgsSettings::sTtreeConnections->createNamedListElement( QStringLiteral( "xyz" ), QgsSettingsTreeElement::Option::NamedListSelectedItemSetting );
static inline QgsSettingsTreeNamedListElement *sTreeXyzConnections = QgsSettings::sTreeConnections->createNamedListElement( QStringLiteral( "xyz" ), QgsSettingsTreeElement::Option::NamedListSelectedItemSetting );

static inline QgsSettingsEntryString *settingsUrl = new QgsSettingsEntryString( QStringLiteral( "url" ), sTreeXyzConnections, QString() ) ;
static inline QgsSettingsEntryVariantMap *settingsHeaders = new QgsSettingsEntryVariantMap( QStringLiteral( "http-header" ), sTreeXyzConnections ) ;
Expand All @@ -65,7 +65,7 @@ class CORE_EXPORT QgsOwsConnection : public QObject
public:

#ifndef SIP_RUN
static inline QgsSettingsTreeNamedListElement *sTtreeOwsServices = QgsSettings::sTtreeConnections->createNamedListElement( QStringLiteral( "ows" ) );
static inline QgsSettingsTreeNamedListElement *sTtreeOwsServices = QgsSettings::sTreeConnections->createNamedListElement( QStringLiteral( "ows" ) );
static inline QgsSettingsTreeNamedListElement *sTreeOwsConnections = sTtreeOwsServices->createNamedListElement( QStringLiteral( "connections" ) );

static inline QgsSettingsEntryString *settingsUrl = new QgsSettingsEntryString( QStringLiteral( "url" ), sTreeOwsConnections, QString() ) ;
Expand Down
4 changes: 2 additions & 2 deletions src/core/settings/qgssettings.h
Expand Up @@ -88,8 +88,8 @@ class CORE_EXPORT QgsSettings : public QObject
*/
static QgsSettingsTreeElement *treeRoot();

static inline QgsSettingsTreeElement *sTtreeApp = treeRoot()->createChildElement( QStringLiteral( "app" ) );
static inline QgsSettingsTreeElement *sTtreeConnections = treeRoot()->createChildElement( QStringLiteral( "connections" ) );
static inline QgsSettingsTreeElement *sTreeApp = treeRoot()->createChildElement( QStringLiteral( "app" ) );
static inline QgsSettingsTreeElement *sTreeConnections = treeRoot()->createChildElement( QStringLiteral( "connections" ) );
static inline QgsSettingsTreeElement *sTreeLocale = treeRoot()->createChildElement( QStringLiteral( "locale" ) );
static inline QgsSettingsTreeElement *sTreeGps = treeRoot()->createChildElement( QStringLiteral( "gps" ) );
static inline QgsSettingsTreeElement *sTreeQgis = treeRoot()->createChildElement( QStringLiteral( "qgis" ) );
Expand Down
2 changes: 1 addition & 1 deletion src/core/settings/qgssettingsentry.h
Expand Up @@ -343,7 +343,7 @@ class CORE_EXPORT QgsSettingsEntryBase
QVariant formerValueAsVariant( const QStringList &dynamicKeyPartList ) const;

/**
* Checks if the settings does not exist and try to set it from a given \a oldKey.
* Checks if the settings does not exist and tries to set it from a given \a oldKey.
* \arg dynamicKeyPartList is the optional dynamic key part to determine the key. It must be the same for origin and destination keys.
* If \a deleteOldKey, the setting with the old key will be removed
* \returns TRUE if the key exists and the setting value could be copied
Expand Down
3 changes: 2 additions & 1 deletion src/core/settings/qgssettingsregistrycore.cpp
Expand Up @@ -139,7 +139,7 @@ QgsSettingsRegistryCore::~QgsSettingsRegistryCore()

void QgsSettingsRegistryCore::migrateOldSettings()
{
// the logic is to copy value from old key to new keys and delete the old ones
// copy values from old keys to new keys and delete the old ones
// for backward compatibility, old keys are recreated when the registry gets deleted

// connections settings - added in 3.30
Expand Down Expand Up @@ -248,6 +248,7 @@ void QgsSettingsRegistryCore::migrateOldSettings()
}
}

// TODO QGIS 4.0: Remove
void QgsSettingsRegistryCore::backwardCompatibility()
{
// OWS connections settings - added in 3.30
Expand Down
8 changes: 4 additions & 4 deletions src/core/settings/qgssettingstreeelement.cpp
Expand Up @@ -69,8 +69,8 @@ QgsSettingsTreeNamedListElement *QgsSettingsTreeElement::createNamedListElement(

QgsSettingsTreeElement *QgsSettingsTreeElement::childElement( const QString &key )
{
QList<QgsSettingsTreeElement *>::iterator it = mChildrenElements.begin();
for ( ; it != mChildrenElements.end(); ++it )
QList<QgsSettingsTreeElement *>::const_iterator it = mChildrenElements.constBegin();
for ( ; it != mChildrenElements.constEnd(); ++it )
{
if ( ( *it )->key() == key )
return *it;
Expand All @@ -81,8 +81,8 @@ QgsSettingsTreeElement *QgsSettingsTreeElement::childElement( const QString &key
QgsSettingsEntryBase *QgsSettingsTreeElement::childSetting( const QString &key )
{
const QString testCompleteKey = QStringLiteral( "%1%2" ).arg( mCompleteKey, key );
QList<QgsSettingsEntryBase *>::iterator it = mChildrenSettings.begin();
for ( ; it != mChildrenSettings.end(); ++it )
QList<QgsSettingsEntryBase *>::const_iterator it = mChildrenSettings.constBegin();
for ( ; it != mChildrenSettings.constEnd(); ++it )
{
if ( ( *it )->definitionKey() == testCompleteKey )
return *it;
Expand Down
4 changes: 2 additions & 2 deletions src/core/settings/qgssettingstreeelement.h
Expand Up @@ -71,7 +71,7 @@ class CORE_EXPORT QgsSettingsTreeElement
//! Options for named list elements
enum class Option
{
NamedListSelectedItemSetting,
NamedListSelectedItemSetting, //!< Creates a setting to store which is the current item
};

Q_ENUM( Option )
Expand All @@ -91,7 +91,7 @@ class CORE_EXPORT QgsSettingsTreeElement

/**
* Creates a named list tree element.
* This is useful to register group of settings for several named items (for instance credentials for several named services)
* This is useful to register groups of settings for several named items (for instance credentials for several named services)
*/
QgsSettingsTreeNamedListElement *createNamedListElement( const QString &key, const QgsSettingsTreeElement::Options &options = QgsSettingsTreeElement::Options() ) SIP_THROW( QgsSettingsException ) SIP_KEEPREFERENCE;

Expand Down
2 changes: 1 addition & 1 deletion src/core/vectortile/qgsvectortileconnection.h
Expand Up @@ -33,7 +33,7 @@ class CORE_EXPORT QgsVectorTileProviderConnection : public QgsAbstractProviderCo

#ifndef SIP_RUN

static inline QgsSettingsTreeNamedListElement *sTreeConnectionVectorTile = QgsSettings::sTtreeConnections->createNamedListElement( QStringLiteral( "vector-tile" ), QgsSettingsTreeNamedListElement::Option::NamedListSelectedItemSetting );
static inline QgsSettingsTreeNamedListElement *sTreeConnectionVectorTile = QgsSettings::sTreeConnections->createNamedListElement( QStringLiteral( "vector-tile" ), QgsSettingsTreeNamedListElement::Option::NamedListSelectedItemSetting );

static inline QgsSettingsEntryString *settingsUrl = new QgsSettingsEntryString( QStringLiteral( "url" ), sTreeConnectionVectorTile );
static inline QgsSettingsEntryInteger *settingsZmin = new QgsSettingsEntryInteger( QStringLiteral( "zmin" ), sTreeConnectionVectorTile, -1 );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/symbology/qgsstylemanagerdialog.h
Expand Up @@ -74,7 +74,7 @@ class GUI_EXPORT QgsStyleManagerDialog : public QDialog, private Ui::QgsStyleMan
public:
#ifndef SIP_RUN

static inline QgsSettingsTreeElement *sTtreeStyleManager = QgsSettings::sTtreeApp->createChildElement( QStringLiteral( "style-manager" ) );
static inline QgsSettingsTreeElement *sTtreeStyleManager = QgsSettings::sTreeApp->createChildElement( QStringLiteral( "style-manager" ) );

/**
* Last used folder for generic style database actions.
Expand Down

0 comments on commit ac8170e

Please sign in to comment.