Skip to content

Commit

Permalink
Merge pull request #5124 from boundlessgeo/providers_gui_config
Browse files Browse the repository at this point in the history
Providers gui config
  • Loading branch information
elpaso committed Sep 5, 2017
2 parents 1d0de60 + 59aaa27 commit 5f5be25
Show file tree
Hide file tree
Showing 35 changed files with 1,198 additions and 115 deletions.
2 changes: 2 additions & 0 deletions python/gui/gui_auto.sip
Expand Up @@ -21,6 +21,8 @@
%Include qgsvertexmarker.sip
%Include qgsfiledownloader.sip
%Include qgsabstractdatasourcewidget.sip
%Include qgssourceselectprovider.sip
%Include qgssourceselectproviderregistry.sip
%Include attributetable/qgsfeaturemodel.sip
%Include auth/qgsauthauthoritieseditor.sip
%Include auth/qgsauthcertificateinfo.sip
Expand Down
10 changes: 10 additions & 0 deletions python/gui/qgsabstractdatasourcewidget.sip
Expand Up @@ -90,6 +90,16 @@ Emitted when a vector layer has been selected for addition
\param dataSourceType string (can be "file" or "database")
%End

void replaceVectorLayer( const QString &oldId, const QString &source, const QString &name, const QString &provider );
%Docstring
Emitted when a layer needs to be replaced
\param oldId old layer ID
\param source URI of the layer
\param name of the layer
\param provider key
%End


void progress( int, int );
%Docstring
Emitted when a progress dialog is shown by the provider dialog
Expand Down
6 changes: 6 additions & 0 deletions python/gui/qgsgui.sip
Expand Up @@ -38,6 +38,12 @@ class QgsGui
:rtype: QgsEditorWidgetRegistry
%End

static QgsSourceSelectProviderRegistry *sourceSelectProviderRegistry();
%Docstring
Returns the global source select provider registry, used for managing all known source select widget factories.
:rtype: QgsSourceSelectProviderRegistry
%End

static QgsShortcutsManager *shortcutsManager();
%Docstring
Returns the global shortcuts manager, used for managing a QAction and QShortcut sequences.
Expand Down
85 changes: 85 additions & 0 deletions python/gui/qgssourceselectprovider.sip
@@ -0,0 +1,85 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgssourceselectprovider.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsSourceSelectProvider
{
%Docstring
This is the interface for those who want to add entries to the QgsDataSourceManagerDialog

.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgssourceselectprovider.h"
%End
public:
virtual ~QgsSourceSelectProvider();

virtual QString providerKey() const = 0;
%Docstring
Data Provider key
:rtype: str
%End

virtual QString name() const;
%Docstring
Source select provider name, this is useful to retrieve
a particular source select in case the provider has more
than one, it should be unique among all providers.

The default implementation returns the providerKey()
:rtype: str
%End

virtual QString text() const = 0;
%Docstring
Text for the menu item entry, it will be visible to the user so make sure it's translatable
:rtype: str
%End

virtual QString toolTip() const;
%Docstring
Text for the tooltip menu item entry, it will be visible to the user so make sure it's translatable

The default implementation returns an empty string.
:rtype: str
%End

virtual QIcon icon() const = 0;
%Docstring
Creates a new instance of an QIcon for the menu item entry
:rtype: QIcon
%End

virtual int ordering( ) const;
%Docstring
Ordering: the source select provider registry will be able to sort
the source selects (ascending) using this integer value
:rtype: int
%End

virtual QgsAbstractDataSourceWidget *createDataSourceWidget( QWidget *parent = 0, Qt::WindowFlags fl = Qt::Widget, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::Embedded ) const = 0 /Factory/;
%Docstring
Create a new instance of QgsAbstractDataSourceWidget (or null).
Caller takes responsibility of deleting created.
:rtype: QgsAbstractDataSourceWidget
%End

};


/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgssourceselectprovider.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
78 changes: 78 additions & 0 deletions python/gui/qgssourceselectproviderregistry.sip
@@ -0,0 +1,78 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgssourceselectproviderregistry.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/



class QgsSourceSelectProviderRegistry
{
%Docstring
This class keeps a list of source select providers that may add items to the QgsDataSourceManagerDialog
When created, it automatically adds providers from data provider plugins (e.g. PostGIS, WMS, ...)

QgsSourceSelectProviderRegistry is not usually directly created, but rather accessed through
QgsGui.sourceSelectProviderRegistry().

.. note::

This class access to QgsProviderRegistry instance to initialize, but QgsProviderRegistry is
typically initialized after QgsGui is constructed, for this reason a delayed initialization has been
implemented in the class.

.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgssourceselectproviderregistry.h"
%End
public:
QgsSourceSelectProviderRegistry();

~QgsSourceSelectProviderRegistry();


QList< QgsSourceSelectProvider *> providers();
%Docstring
Get list of available providers
:rtype: list of QgsSourceSelectProvider
%End

void addProvider( QgsSourceSelectProvider *provider /Transfer/ );
%Docstring
Add a ``provider`` implementation. Takes ownership of the object.
%End

bool removeProvider( QgsSourceSelectProvider *provider /Transfer/ );
%Docstring
:return: true if the provider was actually removed and deleted
:rtype: bool
%End

QgsSourceSelectProvider *providerByName( const QString &name );
%Docstring
Return a provider by ``name`` or None if not found
:rtype: QgsSourceSelectProvider
%End

QList<QgsSourceSelectProvider *> providersByKey( const QString &providerKey );
%Docstring
Return a (possibly empty) list of providers by data ``providerkey``
:rtype: list of QgsSourceSelectProvider
%End


private:
QgsSourceSelectProviderRegistry( const QgsSourceSelectProviderRegistry &rh );
};

/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/qgssourceselectproviderregistry.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
4 changes: 4 additions & 0 deletions src/gui/CMakeLists.txt
Expand Up @@ -349,6 +349,8 @@ SET(QGIS_GUI_SRCS
qgsfiledownloader.cpp
qgsdatasourcemanagerdialog.cpp
qgsabstractdatasourcewidget.cpp
qgssourceselectprovider.cpp
qgssourceselectproviderregistry.cpp
)

SET(QGIS_GUI_MOC_HDRS
Expand Down Expand Up @@ -711,6 +713,8 @@ SET(QGIS_GUI_HDRS
qgsfiledownloader.h
qgsdatasourcemanagerdialog.h
qgsabstractdatasourcewidget.h
qgssourceselectprovider.h
qgssourceselectproviderregistry.h

ogr/qgsogrhelperfunctions.h
ogr/qgsnewogrconnection.h
Expand Down
9 changes: 9 additions & 0 deletions src/gui/qgsabstractdatasourcewidget.h
Expand Up @@ -93,6 +93,15 @@ class GUI_EXPORT QgsAbstractDataSourceWidget : public QDialog
*/
void addVectorLayers( const QStringList &layerList, const QString &encoding, const QString &dataSourceType );

/** Emitted when a layer needs to be replaced
* \param oldId old layer ID
* \param source URI of the layer
* \param name of the layer
* \param provider key
*/
void replaceVectorLayer( const QString &oldId, const QString &source, const QString &name, const QString &provider );


//! Emitted when a progress dialog is shown by the provider dialog
void progress( int, int );

Expand Down

0 comments on commit 5f5be25

Please sign in to comment.