Skip to content

Commit

Permalink
[addlayerbutton] New signals for new interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Jun 2, 2017
1 parent dcab8ca commit b31f05c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
19 changes: 8 additions & 11 deletions src/app/qgsdatasourcemanagerdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,12 @@ QgsDataSourceManagerDialog::QgsDataSourceManagerDialog( QgsMapCanvas *mapCanvas,
// Bind list index to the stacked dialogs
connect( ui->mList, SIGNAL( currentRowChanged( int ) ), this, SLOT( setCurrentPage( int ) ) );

/////////////////////////////////////////////////////////////////////////////
// BROWSER Add the browser widget to the first stacked widget page

mBrowserWidget = new QgsBrowserDockWidget( QStringLiteral( "Browser" ), this );
mBrowserWidget->setFeatures( QDockWidget::NoDockWidgetFeatures );
ui->mStackedWidget->addWidget( mBrowserWidget );

/////////////////////////////////////////////////////////////////////////////
// VECTOR Layers (completely different interface: it's not a provider)

QgsOpenVectorLayerDialog *ovl = new QgsOpenVectorLayerDialog( this, Qt::Widget, true );
ui->mStackedWidget->addWidget( ovl );
QListWidgetItem *ogrItem = new QListWidgetItem( tr( "Vector files" ), ui->mList );
Expand All @@ -65,7 +61,6 @@ QgsDataSourceManagerDialog::QgsDataSourceManagerDialog( QgsMapCanvas *mapCanvas,
// Add data provider dialogs
QDialog *dlg;


#ifdef HAVE_POSTGRESQL
addDbProviderDialog( QStringLiteral( "postgres" ), tr( "PostgreSQL" ), QStringLiteral( "/mActionAddPostgisLayer.svg" ) );
#endif
Expand All @@ -83,13 +78,15 @@ QgsDataSourceManagerDialog::QgsDataSourceManagerDialog( QgsMapCanvas *mapCanvas,
addRasterProviderDialog( QStringLiteral( "wcs" ), tr( "WCS" ), QStringLiteral( "/mActionAddWcsLayer.svg" ) );

dlg = providerDialog( QStringLiteral( "WFS" ), tr( "WFS" ), QStringLiteral( "/mActionAddWfsLayer.svg" ) );

if ( dlg )
{
// Forward (if only a common interface for the signals had been used in the providers ...)
connect( dlg, SIGNAL( addFsLayer( QString, QString ) ), this, SIGNAL( addFsLayer( QString, QString ) ) );
connect( this, &QgsDataSourceManagerDialog::addFsLayer,
this, [ = ]( const QString & vectorLayerPath, const QString & baseName )
{ this->vectorLayerAdded( vectorLayerPath, baseName, QStringLiteral( "WFS" ) ); } );
connect( dlg, SIGNAL( addWfsLayer( QString, QString ) ), this, SIGNAL( addWfsLayer( QString, QString ) ) );
connect( this, &QgsDataSourceManagerDialog::addWfsLayer, this, [ = ]( const QString & vectorLayerPath, const QString & baseName )
{
this->vectorLayerAdded( vectorLayerPath, baseName, QStringLiteral( "WFS" ) );
} );
}

QgsSourceSelectDialog *afss = dynamic_cast<QgsSourceSelectDialog *>( providerDialog( QStringLiteral( "arcgisfeatureserver" ),
Expand All @@ -99,8 +96,8 @@ QgsDataSourceManagerDialog::QgsDataSourceManagerDialog( QgsMapCanvas *mapCanvas,
{
afss->setCurrentExtentAndCrs( mMapCanvas->extent(), mMapCanvas->mapSettings().destinationCrs() );
// Forward (if only a common interface for the signals had been used in the providers ...)
connect( afss, SIGNAL( addLayer( QString, QString ) ), this, SIGNAL( addFsLayer( QString, QString ) ) );
connect( this, &QgsDataSourceManagerDialog::addFsLayer,
connect( afss, SIGNAL( addLayer( QString, QString ) ), this, SIGNAL( addAfsLayer( QString, QString ) ) );
connect( this, &QgsDataSourceManagerDialog::addAfsLayer,
this, [ = ]( const QString & vectorLayerPath, const QString & baseName )
{ this->vectorLayerAdded( vectorLayerPath, baseName, QStringLiteral( "arcgisfeatureserver" ) ); } );
}
Expand Down
3 changes: 2 additions & 1 deletion src/app/qgsdatasourcemanagerdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ class QgsDataSourceManagerDialog : public QDialog
//! For signal forwarding to QgisApp
void addRasterLayer( QString const &uri, QString const &baseName, QString const &providerKey );
void addVectorLayer( const QString &vectorLayerPath, const QString &baseName, const QString &providerKey );
void addFsLayer( const QString &uri, const QString &typeName );
void addWfsLayer( const QString &uri, const QString &typeName );
void addAfsLayer( const QString &uri, const QString &typeName );
void addVectorLayers( const QStringList &layerQStringList, const QString &enc, const QString &dataSourceType );
void showProgress( int progress, int totalSteps );
void showStatusMessage( const QString &message );
Expand Down

0 comments on commit b31f05c

Please sign in to comment.