Skip to content

Commit

Permalink
Revert "Allowing storing GPGK raster layer styles to DB"
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Oct 6, 2023
1 parent 3642c9c commit f98f4b1
Show file tree
Hide file tree
Showing 51 changed files with 1,426 additions and 1,486 deletions.
9 changes: 0 additions & 9 deletions python/core/auto_additions/qgis.py
Expand Up @@ -3660,15 +3660,6 @@
Qgis.DatabaseProviderConnectionCapabilities2.baseClass = Qgis
DatabaseProviderConnectionCapabilities2 = Qgis # dirty hack since SIP seems to introduce the flags in module
# monkey patching scoped based enum
Qgis.ProviderStyleStorageCapability.SaveToDatabase.__doc__ = ""
Qgis.ProviderStyleStorageCapability.LoadFromDatabase.__doc__ = ""
Qgis.ProviderStyleStorageCapability.DeleteFromDatabase.__doc__ = ""
Qgis.ProviderStyleStorageCapability.__doc__ = "The StorageCapability enum represents the style storage operations supported by the provider.\n\n.. versionadded:: 3.34\n\n" + '* ``SaveToDatabase``: ' + Qgis.ProviderStyleStorageCapability.SaveToDatabase.__doc__ + '\n' + '* ``LoadFromDatabase``: ' + Qgis.ProviderStyleStorageCapability.LoadFromDatabase.__doc__ + '\n' + '* ``DeleteFromDatabase``: ' + Qgis.ProviderStyleStorageCapability.DeleteFromDatabase.__doc__
# --
Qgis.ProviderStyleStorageCapability.baseClass = Qgis
Qgis.ProviderStyleStorageCapabilities.baseClass = Qgis
ProviderStyleStorageCapabilities = Qgis # dirty hack since SIP seems to introduce the flags in module
# monkey patching scoped based enum
Qgis.UserProfileSelectionPolicy.LastProfile.__doc__ = "Open the last closed profile (only mode supported prior to QGIS 3.32)"
Qgis.UserProfileSelectionPolicy.DefaultProfile.__doc__ = "Open a specific profile"
Qgis.UserProfileSelectionPolicy.AskUser.__doc__ = "Let the user choose which profile to open"
Expand Down
7 changes: 0 additions & 7 deletions python/core/auto_generated/providers/qgsdataprovider.sip.in
Expand Up @@ -467,13 +467,6 @@ String sequence used for separating components of sublayers strings.
.. seealso:: :py:func:`subLayers`

.. versionadded:: 3.12
%End

virtual Qgis::ProviderStyleStorageCapabilities styleStorageCapabilities() const;
%Docstring
Returns the style storage capabilities.

.. versionadded:: 3.34
%End

signals:
Expand Down
9 changes: 0 additions & 9 deletions python/core/auto_generated/qgis.sip.in
Expand Up @@ -2121,15 +2121,6 @@ The development version
typedef QFlags<Qgis::DatabaseProviderConnectionCapability2> DatabaseProviderConnectionCapabilities2;


enum class ProviderStyleStorageCapability
{
SaveToDatabase,
LoadFromDatabase,
DeleteFromDatabase
};
typedef QFlags<Qgis::ProviderStyleStorageCapability> ProviderStyleStorageCapabilities;


enum class UserProfileSelectionPolicy
{
LastProfile,
Expand Down
68 changes: 0 additions & 68 deletions python/core/auto_generated/qgsmaplayer.sip.in
Expand Up @@ -728,74 +728,6 @@ Read all custom properties from layer. Properties are stored in a map and saved
.. versionadded:: 3.14
%End

virtual int listStylesInDatabase( QStringList &ids /Out/, QStringList &names /Out/,
QStringList &descriptions /Out/, QString &msgError /Out/ );
%Docstring
Lists all the style in db split into related to the layer and not related to

:param ids: the list in which will be stored the style db ids
:param names: the list in which will be stored the style names

:return: - the number of styles related to current layer (-1 on not implemented)
- descriptions: the list in which will be stored the style descriptions
- msgError: will be set to a descriptive error message if any occurs

.. note::

Since QGIS 3.2 Styles related to the layer are ordered with the default style first then by update time for Postgres, MySQL and Spatialite.
%End

virtual QString getStyleFromDatabase( const QString &styleId, QString &msgError /Out/ );
%Docstring
Returns the named style corresponding to style id provided
%End

virtual bool deleteStyleFromDatabase( const QString &styleId, QString &msgError /Out/ );
%Docstring
Deletes a style from the database

:param styleId: the provider's layer_styles table id of the style to delete

:return: - ``True`` in case of success
- msgError: will be set to a descriptive error message if any occurs

.. versionadded:: 3.0
%End

virtual void saveStyleToDatabase( const QString &name, const QString &description,
bool useAsDefault, const QString &uiFileContent,
QString &msgError /Out/,
QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories );
%Docstring
Saves named and sld style of the layer to the style table in the db.

:param name: Style name
:param description: A description of the style
:param useAsDefault: Set to ``True`` if style should be used as the default style for the layer
:param uiFileContent:
:param msgError: will be set to a descriptive error message if any occurs
:param categories: the style categories to be saved.

.. note::

Prior to QGIS 3.24, this method would show a message box warning when a
style with the same ``styleName`` already existed to confirm replacing the style with the user.
Since 3.24, calling this method will ALWAYS overwrite any existing style with the same name.
Use :py:func:`QgsProviderRegistry.styleExists()` to test in advance if a style already exists and handle this appropriately
in your client code.
%End

virtual QString loadNamedStyle( const QString &theURI, bool &resultFlag /Out/, bool loadFromLocalDb,
QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories );
%Docstring
Loads a named style from file/local db/datasource db

:param theURI: the URI of the style or the URI of the layer
:param resultFlag: will be set to ``True`` if a named style is correctly loaded
:param loadFromLocalDb: if ``True`` forces to load from local db instead of datasource one
:param categories: the style categories to be loaded.
%End



void removeCustomProperty( const QString &key );
Expand Down
12 changes: 12 additions & 0 deletions python/core/auto_generated/vector/qgsvectordataprovider.sip.in
Expand Up @@ -541,6 +541,18 @@ Clear recorded errors
QStringList errors() const;
%Docstring
Gets recorded errors
%End

virtual bool isSaveAndLoadStyleToDatabaseSupported() const;
%Docstring
It returns ``False`` by default.
Must be implemented by providers that support saving and loading styles to db returning ``True``
%End

virtual bool isDeleteStyleFromDatabaseSupported() const;
%Docstring
It returns ``False`` by default.
Must be implemented by providers that support delete styles from db returning ``True``
%End

virtual QgsFeatureRenderer *createRenderer( const QVariantMap &configuration = QVariantMap() ) const /Factory/;
Expand Down
75 changes: 75 additions & 0 deletions python/core/auto_generated/vector/qgsvectorlayer.sip.in
Expand Up @@ -939,6 +939,81 @@ Writes vector layer specific state to project file Dom node.
Resolves references to other layers (kept as layer IDs after reading XML) into layer objects.

.. versionadded:: 3.0
%End

virtual void saveStyleToDatabase( const QString &name, const QString &description,
bool useAsDefault, const QString &uiFileContent,
QString &msgError /Out/,
QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories );
%Docstring
Saves named and sld style of the layer to the style table in the db.

:param name: Style name
:param description: A description of the style
:param useAsDefault: Set to ``True`` if style should be used as the default style for the layer
:param uiFileContent:
:param msgError: will be set to a descriptive error message if any occurs
:param categories: the style categories to be saved.

.. note::

Prior to QGIS 3.24, this method would show a message box warning when a
style with the same ``styleName`` already existed to confirm replacing the style with the user.
Since 3.24, calling this method will ALWAYS overwrite any existing style with the same name.
Use :py:func:`QgsProviderRegistry.styleExists()` to test in advance if a style already exists and handle this appropriately
in your client code.
%End

virtual int listStylesInDatabase( QStringList &ids /Out/, QStringList &names /Out/,
QStringList &descriptions /Out/, QString &msgError /Out/ );
%Docstring
Lists all the style in db split into related to the layer and not related to

:param ids: the list in which will be stored the style db ids
:param names: the list in which will be stored the style names

:return: - the number of styles related to current layer (-1 on not implemented)
- descriptions: the list in which will be stored the style descriptions
- msgError: will be set to a descriptive error message if any occurs

.. note::

Since QGIS 3.2 Styles related to the layer are ordered with the default style first then by update time for Postgres, MySQL and Spatialite.
%End

virtual QString getStyleFromDatabase( const QString &styleId, QString &msgError /Out/ );
%Docstring
Returns the named style corresponding to style id provided
%End

virtual bool deleteStyleFromDatabase( const QString &styleId, QString &msgError /Out/ );
%Docstring
Deletes a style from the database

:param styleId: the provider's layer_styles table id of the style to delete

:return: - ``True`` in case of success
- msgError: will be set to a descriptive error message if any occurs

.. versionadded:: 3.0
%End

virtual QString loadNamedStyle( const QString &theURI, bool &resultFlag /Out/, bool loadFromLocalDb,
QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories );
%Docstring
Loads a named style from file/local db/datasource db

:param theURI: the URI of the style or the URI of the layer
:param resultFlag: will be set to ``True`` if a named style is correctly loaded
:param loadFromLocalDb: if ``True`` forces to load from local db instead of datasource one
:param categories: the style categories to be loaded.
%End

virtual QString loadNamedStyle( const QString &theURI, bool &resultFlag /Out/,
QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) ${SIP_FINAL};
%Docstring
Calls loadNamedStyle( theURI, resultFlag, ``False`` );
Retained for backward compatibility
%End

bool loadAuxiliaryLayer( const QgsAuxiliaryStorage &storage, const QString &key = QString() );
Expand Down
22 changes: 0 additions & 22 deletions python/gui/auto_generated/qgslayerpropertiesdialog.sip.in
Expand Up @@ -27,7 +27,6 @@ Base class for "layer properties" dialogs, containing common utilities for handl
%End
public:


QgsLayerPropertiesDialog( QgsMapLayer *layer, QgsMapCanvas *canvas, const QString &settingsKey, QWidget *parent /TransferThis/ = 0, Qt::WindowFlags fl = Qt::WindowFlags(), QgsSettings *settings = 0 );
%Docstring
Constructor for QgsLayerPropertiesDialog.
Expand All @@ -50,27 +49,6 @@ This must be called in order for the standard metadata loading/saving functional
virtual void addPropertiesPageFactory( const QgsMapLayerConfigWidgetFactory *factory );
%Docstring
Adds properties page from a ``factory``.
%End

void saveDefaultStyle();
%Docstring
Saves the default style when appropriate button is pressed

.. versionadded:: 3.30
%End

void loadStyle();
%Docstring
Triggers a dialog to load a saved style

.. versionadded:: 3.30
%End

void saveStyleAs();
%Docstring
Saves a style when appriate button is pressed

.. versionadded:: 3.30
%End

public slots:
Expand Down
15 changes: 15 additions & 0 deletions python/gui/auto_generated/raster/qgsrasterlayerproperties.sip.in
Expand Up @@ -52,6 +52,21 @@ Saves the default style when appropriate button is pressed
use :py:func:`~QgsRasterLayerProperties.saveStyleAsDefault` instead
%End

void loadStyle() /Deprecated/;
%Docstring
Loads a saved style when appropriate button is pressed

.. deprecated::
use :py:func:`~QgsRasterLayerProperties.loadStyleFromFile` instead.
%End

void saveStyleAs();
%Docstring
Saves a style when appriate button is pressed

.. versionadded:: 3.30
%End

protected slots:
virtual void optionsStackedWidget_CurrentChanged( int index ) ${SIP_FINAL};

Expand Down
28 changes: 28 additions & 0 deletions python/gui/auto_generated/vector/qgsvectorlayerproperties.sip.in
Expand Up @@ -25,6 +25,34 @@ class QgsVectorLayerProperties : QgsLayerPropertiesDialog
virtual bool eventFilter( QObject *obj, QEvent *ev );


void loadDefaultStyle();
%Docstring
Loads the default style when appropriate button is pressed

.. versionadded:: 3.30
%End

void saveDefaultStyle();
%Docstring
Saves the default style when appropriate button is pressed

.. versionadded:: 3.30
%End

void loadStyle();
%Docstring
Loads a saved style when appropriate button is pressed

.. versionadded:: 3.30
%End

void saveStyleAs();
%Docstring
Saves a style when appriate button is pressed

.. versionadded:: 3.30
%End

protected slots:
void optionsStackedWidget_CurrentChanged( int index ) final;
virtual void syncToLayer() ${SIP_FINAL};
Expand Down

0 comments on commit f98f4b1

Please sign in to comment.