Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[addlayerbutton] Connect and forward all signals from browser to app
  • Loading branch information
elpaso committed Jun 2, 2017
1 parent c188911 commit 7a2ce49
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/app/qgisapp.cpp
Expand Up @@ -1604,6 +1604,10 @@ void QgisApp::dataSourceManager( QString pageName )
connect( mDataSourceManagerDialog, &QgsDataSourceManagerDialog::addDatabaseLayers, this, &QgisApp::addDatabaseLayers );
connect( mDataSourceManagerDialog, &QgsDataSourceManagerDialog::replaceSelectedVectorLayer, this, &QgisApp::replaceSelectedVectorLayer );
connect( mDataSourceManagerDialog, static_cast<void ( QgsDataSourceManagerDialog::* )()>( &QgsDataSourceManagerDialog::addRasterLayer ), this, static_cast<void ( QgisApp::* )()>( &QgisApp::addRasterLayer ) );
connect( mDataSourceManagerDialog, &QgsDataSourceManagerDialog::handleDropUriList, this, &QgisApp::handleDropUriList );
connect( this, &QgisApp::newProject, mDataSourceManagerDialog, &QgsDataSourceManagerDialog::updateProjectHome );
connect( mDataSourceManagerDialog, &QgsDataSourceManagerDialog::openFile, this, &QgisApp::openFile );

}
// Try to open the dialog on a particular page
if ( ! pageName.isEmpty( ) )
Expand Down
6 changes: 2 additions & 4 deletions src/app/qgisapp.h
Expand Up @@ -594,14 +594,12 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
//! Unregister a previously registered custom drop handler.
void unregisterCustomDropHandler( QgsCustomDropHandler *handler );

public slots:
//! Process the list of URIs that have been dropped in QGIS
void handleDropUriList( const QgsMimeDataUtils::UriList &lst );

//! Returns the active map layer.
QgsMapLayer *activeLayer();

public slots:
//! Process the list of URIs that have been dropped in QGIS
void handleDropUriList( const QgsMimeDataUtils::UriList &lst );
//! Convenience function to open either a project or a layer file.
void openFile( const QString &fileName );
void layerTreeViewDoubleClicked( const QModelIndex &index );
Expand Down
4 changes: 4 additions & 0 deletions src/app/qgsdatasourcemanagerdialog.cpp
Expand Up @@ -48,6 +48,10 @@ QgsDataSourceManagerDialog::QgsDataSourceManagerDialog( QgsMapCanvas *mapCanvas,
mBrowserWidget->setFeatures( QDockWidget::NoDockWidgetFeatures );
ui->mOptionsStackedWidget->addWidget( mBrowserWidget );
mPageNames.append( QStringLiteral( "browser" ) );
// Forward all browser signals
connect( mBrowserWidget, &QgsBrowserDockWidget::handleDropUriList, this, &QgsDataSourceManagerDialog::handleDropUriList );
connect( mBrowserWidget, &QgsBrowserDockWidget::openFile, this, &QgsDataSourceManagerDialog::openFile );
connect( this, &QgsDataSourceManagerDialog::updateProjectHome, mBrowserWidget, &QgsBrowserDockWidget::updateProjectHome );

// VECTOR Layers (completely different interface: it's not a provider)
QgsOpenVectorLayerDialog *ovl = new QgsOpenVectorLayerDialog( this, Qt::Widget, QgsProviderRegistry::WidgetMode::Embedded );
Expand Down
7 changes: 7 additions & 0 deletions src/app/qgsdatasourcemanagerdialog.h
Expand Up @@ -21,6 +21,7 @@
#include <QDialog>
#include "qgsoptionsdialogbase.h"
#include "qgsguiutils.h"
#include "qgsmimedatautils.h"
#include "qgshelp.h"

class QgsBrowserDockWidget;
Expand Down Expand Up @@ -72,6 +73,12 @@ class QgsDataSourceManagerDialog : public QgsOptionsDialogBase
void showProgress( int progress, int totalSteps );
void showStatusMessage( const QString &message );
void addDatabaseLayers( QStringList const &layerPathList, QString const &providerKey );
//! Emitted when a file needs to be opened
void openFile( const QString & );
//! Emitted when drop uri list needs to be handled from the browser
void handleDropUriList( const QgsMimeDataUtils::UriList & );
//! Update project home directory
void updateProjectHome();

private:
//! Return the dialog from the provider
Expand Down

0 comments on commit 7a2ce49

Please sign in to comment.