This commit is contained in:
Denis Rouzaud 2022-04-25 10:33:03 +02:00 committed by Nyall Dawson
parent 4790f92444
commit 6dd66759cd
7 changed files with 167 additions and 48 deletions

View File

@ -0,0 +1,10 @@
# The following has been generated automatically from src/core/qgsowsconnection.h
# monkey patching scoped based enum
QgsOwsConnection.DpiMode.All.__doc__ = ""
QgsOwsConnection.DpiMode.Off.__doc__ = ""
QgsOwsConnection.DpiMode.QGIS.__doc__ = ""
QgsOwsConnection.DpiMode.UMN.__doc__ = ""
QgsOwsConnection.DpiMode.GeoServer.__doc__ = ""
QgsOwsConnection.DpiMode.__doc__ = 'DpiMode enum\n\n.. versionadded:: 3.26\n\n' + '* ``All``: ' + QgsOwsConnection.DpiMode.All.__doc__ + '\n' + '* ``Off``: ' + QgsOwsConnection.DpiMode.Off.__doc__ + '\n' + '* ``QGIS``: ' + QgsOwsConnection.DpiMode.QGIS.__doc__ + '\n' + '* ``UMN``: ' + QgsOwsConnection.DpiMode.UMN.__doc__ + '\n' + '* ``GeoServer``: ' + QgsOwsConnection.DpiMode.GeoServer.__doc__
# --
QgsOwsConnection.DpiMode.baseClass = QgsOwsConnection

View File

@ -8,6 +8,46 @@
class QgsGeoNodeConnectionUtils
{
%Docstring(signature="appended")
Contains various utilities for managing the known collection of
GeoNode servers associated with a QGIS install.
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgsgeonodeconnection.h"
%End
public:
static QStringList connectionList();
%Docstring
Returns a list of all known GeoNode connection names.
%End
static void deleteConnection( const QString &name );
%Docstring
Deletes the GeoNode connection with matching ``name``.
%End
static QString pathGeoNodeConnection();
%Docstring
Returns the base path for settings related to GeoNode connections.
%End
static QString pathGeoNodeConnectionDetails() /Deprecated/;
%Docstring
Returns the base path for settings related to GeoNode connection details.
.. deprecated:: QGIS 3.26
use :py:func:`~QgsGeoNodeConnectionUtils.pathGeonNodeConnection` instead
%End
static const QString sGeoNodeConnection;
};
class QgsGeoNodeConnection class QgsGeoNodeConnection
{ {
%Docstring(signature="appended") %Docstring(signature="appended")
@ -80,41 +120,6 @@ Adds uri parameters relating to the settings for a WCS layer on the connection t
}; };
class QgsGeoNodeConnectionUtils
{
%Docstring(signature="appended")
Contains various utilities for managing the known collection of
GeoNode servers associated with a QGIS install.
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgsgeonodeconnection.h"
%End
public:
static QStringList connectionList();
%Docstring
Returns a list of all known GeoNode connection names.
%End
static void deleteConnection( const QString &name );
%Docstring
Deletes the GeoNode connection with matching ``name``.
%End
static QString pathGeoNodeConnection();
%Docstring
Returns the base path for settings related to GeoNode connections.
%End
static QString pathGeoNodeConnectionDetails();
%Docstring
Returns the base path for settings related to GeoNode connection details.
%End
};
/************************************************************************ /************************************************************************

View File

@ -21,6 +21,21 @@ Connections management
%End %End
public: public:
enum class DpiMode
{
All,
Off,
QGIS,
UMN,
GeoServer,
};
const QgsSettingsEntryGroup settingsServiceConnectionDetailsGroup;
const QgsSettingsEntryGroup settingsServiceConnectionCredentialsGroup;
QgsOwsConnection( const QString &service, const QString &connName ); QgsOwsConnection( const QString &service, const QString &connName );
%Docstring %Docstring
Constructor Constructor
@ -55,20 +70,42 @@ Returns a string representing the service type, e.g. "WMS".
Returns the connection uri. Returns the connection uri.
%End %End
static QgsDataSourceUri &addWmsWcsConnectionSettings( QgsDataSourceUri &uri, const QString &settingsKey ); static QgsDataSourceUri &addWmsWcsConnectionSettings( QgsDataSourceUri &uri, const QString &settingsKey ) /Deprecated/;
%Docstring %Docstring
Adds uri parameters relating to the settings for a WMS or WCS connection to a :py:class:`QgsDataSourceUri` ``uri``. Adds uri parameters relating to the settings for a WMS or WCS connection to a :py:class:`QgsDataSourceUri` ``uri``.
Connection settings are taken from the specified QSettings ``settingsKey``. Connection settings are taken from the specified QSettings ``settingsKey``.
.. versionadded:: 3.0 .. versionadded:: 3.0
.. deprecated:: QGIS 3.26
use addWmsWcsConnectionSettings with service and connection name parameters
%End %End
static QgsDataSourceUri &addWfsConnectionSettings( QgsDataSourceUri &uri, const QString &settingsKey ); static QgsDataSourceUri &addWmsWcsConnectionSettings( QgsDataSourceUri &uri, const QString &service, const QString &connName );
%Docstring
Adds uri parameters relating to the settings for a WMS or WCS connection to a :py:class:`QgsDataSourceUri` ``uri``.
Connection settings are taken from the specified ``servcie`` and ``connName``
.. versionadded:: 3.26
%End
static QgsDataSourceUri &addWfsConnectionSettings( QgsDataSourceUri &uri, const QString &settingsKey ) /Deprecated/;
%Docstring %Docstring
Adds uri parameters relating to the settings for a WFS connection to a :py:class:`QgsDataSourceUri` ``uri``. Adds uri parameters relating to the settings for a WFS connection to a :py:class:`QgsDataSourceUri` ``uri``.
Connection settings are taken from the specified QSettings ``settingsKey``. Connection settings are taken from the specified QSettings ``settingsKey``.
.. versionadded:: 3.0 .. versionadded:: 3.0
.. deprecated:: QGIS 3.26
use addWfsConnectionSettings with service and connection name parameters
%End
static QgsDataSourceUri &addWfsConnectionSettings( QgsDataSourceUri &uri, const QString &service, const QString &connName );
%Docstring
Adds uri parameters relating to the settings for a WFS connection to a :py:class:`QgsDataSourceUri` ``uri``.
Connection settings are taken from the specified ``servcie`` and ``connName``
.. versionadded:: 3.26
%End %End
static QStringList connectionList( const QString &service ); static QStringList connectionList( const QString &service );

View File

@ -9,6 +9,67 @@
class QgsSettingsEntryGroup
{
%Docstring(signature="appended")
Creates a group of setting which have a common definition of base key
.. versionadded:: 3.26
%End
%TypeHeaderCode
#include "qgssettingsentry.h"
%End
public:
QgsSettingsEntryGroup( const QList<const QgsSettingsEntryBase *> settings );
%Docstring
Constructor
%End
%MethodCode
sipCpp = new QgsSettingsEntryGroup( *a0, false );
sipIsErr = sipCpp->isValid() ? 0 : 1;
if ( sipIsErr )
PyErr_SetString( PyExc_ValueError, QStringLiteral( "Settings do not share the same base definition key for this group. This will lead to unpredictable results." ).toUtf8().constData() );
%End
bool isValid() const;
%Docstring
Returns if the group is valid (if settings share the same base key)
%End
QString baseKey( const QStringList &dynamicKeyPartList = QStringList() ) const;
%Docstring
Returns the base key for the given ``dynamicKeyPartList``
%End
const QList<const QgsSettingsEntryBase *> settings() const;
%Docstring
Returns all the settings
%End
void removeAllSettingsAtBaseKey( const QStringList &dynamicKeyPartList = QStringList() ) const;
%Docstring
Removes all the settings at the base key for the given ``dynamicKeyPartList``
This means it might remove more settings than the ones registered in the group, use with caution
%End
void removeAllChildrenSettings( const QString &dynamicKeyPart = QString() ) const;
%Docstring
Removes all the settings from this group
The ``dynamicKeyPart`` argument specifies the dynamic part of the settings key.
%End
void removeAllChildrenSettings( const QStringList &dynamicKeyPartList ) const;
%Docstring
Removes all the settings from this group
The ``dynamicKeyPartList`` argument specifies the dynamic part of the settings key.
%End
};
class QgsSettingsEntryBase class QgsSettingsEntryBase
{ {
%Docstring(signature="appended") %Docstring(signature="appended")
@ -43,6 +104,13 @@ to validate set values and provide more accurate settings description for the gu
%End %End
public: public:
static QStringList dynamicKeyPartToList( const QString &dynamicKeyPart );
%Docstring
Transforms a dynamic key part string to list
.. versionadded:: 3.26
%End
QgsSettingsEntryBase( const QString &key, QgsSettingsEntryBase( const QString &key,
const QString &section, const QString &section,
@ -245,13 +313,6 @@ Returns the current value (or default) if there is no former value.
Sets the settings value with a variant value. Sets the settings value with a variant value.
This should be called from any implementation as it takes care of actually calling QSettings This should be called from any implementation as it takes care of actually calling QSettings
.. versionadded:: 3.26
%End
QStringList dynamicKeyPartToList( const QString &dynamicKeyPart ) const;
%Docstring
Transforms a dynamic key part string to list
.. versionadded:: 3.26 .. versionadded:: 3.26
%End %End

View File

@ -73,7 +73,6 @@ The ``options`` arguments specifies the options for the settings entry.
}; };
typedef QgsSettingsEntryByReference<QString> QgsSettingsEntryByReferenceQStringBase; typedef QgsSettingsEntryByReference<QString> QgsSettingsEntryByReferenceQStringBase;
class QgsSettingsEntryString : QgsSettingsEntryByReferenceQStringBase class QgsSettingsEntryString : QgsSettingsEntryByReferenceQStringBase

View File

@ -60,9 +60,16 @@ Returns the list of registered child QgsSettingsRegistry.
protected: protected:
void addSettingsEntry( const QgsSettingsEntryBase *settingsEntry ); bool addSettingsEntry( const QgsSettingsEntryBase *settingsEntry );
%Docstring %Docstring
Add ``settingsEntry`` to the register. Adds ``settingsEntry`` to the registry.
%End
void addSettingsEntryGroup( const QgsSettingsEntryGroup *settingsGroup );
%Docstring
Adds a group of setting to the registry
.. versionadded:: 3.26
%End %End
}; };

View File

@ -43,7 +43,7 @@ information for an HTTP Server for WMS, etc.
QgsNewHttpConnection( QWidget *parent /TransferThis/ = 0, QgsNewHttpConnection( QWidget *parent /TransferThis/ = 0,
QgsNewHttpConnection::ConnectionTypes types = ConnectionWms, QgsNewHttpConnection::ConnectionTypes types = ConnectionWms,
const QString &baseKey = "qgis/connections-wms/", const QString &serviceName = "WMS",
const QString &connectionName = QString(), const QString &connectionName = QString(),
QgsNewHttpConnection::Flags flags = QgsNewHttpConnection::Flags(), QgsNewHttpConnection::Flags flags = QgsNewHttpConnection::Flags(),
Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags ); Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags );