Skip to content

Commit

Permalink
add (unemitted) signals to provider source selectors to silence data
Browse files Browse the repository at this point in the history
source manager connection warnings
  • Loading branch information
jef-n committed Jul 17, 2017
1 parent 205b705 commit 9bae832
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 23 deletions.
2 changes: 0 additions & 2 deletions python/gui/qgsowssourceselect.sip
Expand Up @@ -106,8 +106,6 @@ Stores the selected datasource whenerver it is changed
Add some default wms servers to the list
%End

void on_mDialogButtonBox_helpRequested();

signals:
void addRasterLayer( const QString &rasterLayerPath,
const QString &baseName,
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisapp.h
Expand Up @@ -805,7 +805,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
*/
bool addVectorLayers( const QStringList &layerQStringList, const QString &enc, const QString &dataSourceType );

/** Overloaded vesion of the private addRasterLayer()
/** Overloaded version of the private addRasterLayer()
Method that takes a list of file names instead of prompting
user with a dialog.
\returns true if successfully added layer(s)
Expand Down
10 changes: 0 additions & 10 deletions src/app/qgsclipboard.cpp
Expand Up @@ -61,10 +61,7 @@ void QgsClipboard::replaceWithCopyOf( QgsVectorLayer *src )
mFeatureFields = src->fields();
mFeatureClipboard = src->selectedFeatures();
mCRS = src->crs();
layerDestroyed();
mSrcLayer = src;
connect( mSrcLayer, &QObject::destroyed, this, &QgsClipboard::layerDestroyed );

QgsDebugMsg( "replaced QGis clipboard." );

setSystemClipboard();
Expand All @@ -78,19 +75,12 @@ void QgsClipboard::replaceWithCopyOf( QgsFeatureStore &featureStore )
mFeatureFields = featureStore.fields();
mFeatureClipboard = featureStore.features();
mCRS = featureStore.crs();
disconnect( mSrcLayer, &QObject::destroyed, this, &QgsClipboard::layerDestroyed );
mSrcLayer = nullptr;
setSystemClipboard();
mUseSystemClipboard = false;
emit changed();
}

void QgsClipboard::layerDestroyed()
{
disconnect( mSrcLayer, &QObject::destroyed, this, &QgsClipboard::layerDestroyed );
mSrcLayer = nullptr;
}

QString QgsClipboard::generateClipboardText() const
{
QgsSettings settings;
Expand Down
7 changes: 2 additions & 5 deletions src/app/qgsclipboard.h
Expand Up @@ -21,6 +21,7 @@
#include <QList>
#include <QMap>
#include <QObject>
#include <QPointer>

#include "qgsfields.h"
#include "qgsfeature.h"
Expand Down Expand Up @@ -148,10 +149,6 @@ class APP_EXPORT QgsClipboard : public QObject
//! Emitted when content changed
void changed();

private slots:
//! source layer destroyed
void layerDestroyed();

private:

/**
Expand Down Expand Up @@ -184,7 +181,7 @@ class APP_EXPORT QgsClipboard : public QObject
QgsFeatureList mFeatureClipboard;
QgsFields mFeatureFields;
QgsCoordinateReferenceSystem mCRS;
QgsVectorLayer *mSrcLayer = nullptr;
QPointer<QgsVectorLayer> mSrcLayer;

//! True when the data from the system clipboard should be read
bool mUseSystemClipboard;
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsdatasourcemanagerdialog.cpp
Expand Up @@ -168,12 +168,12 @@ void QgsDataSourceManagerDialog::setPreviousPage()

void QgsDataSourceManagerDialog::rasterLayerAdded( const QString &uri, const QString &baseName, const QString &providerKey )
{
emit( addRasterLayer( uri, baseName, providerKey ) );
emit addRasterLayer( uri, baseName, providerKey );
}

void QgsDataSourceManagerDialog::vectorLayerAdded( const QString &vectorLayerPath, const QString &baseName, const QString &providerKey )
{
emit( addVectorLayer( vectorLayerPath, baseName, providerKey ) );
emit addVectorLayer( vectorLayerPath, baseName, providerKey );
}

void QgsDataSourceManagerDialog::vectorLayersAdded( const QStringList &layerQStringList, const QString &enc, const QString &dataSourceType )
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsdatasourcemanagerdialog.h
Expand Up @@ -79,7 +79,7 @@ class GUI_EXPORT QgsDataSourceManagerDialog : public QgsOptionsDialogBase, priva
//! Emitted when a raster layer was selected for addition: for signal forwarding to QgisApp
void addRasterLayer( QString const &uri, QString const &baseName, QString const &providerKey );
//! Emitted when the user wants to select a raster layer: for signal forwarding to QgisApp
void addRasterLayer( );
void addRasterLayer();
//! Emitted when a vector layer was selected for addition: for signal forwarding to QgisApp
void addVectorLayer( const QString &vectorLayerPath, const QString &baseName, const QString &providerKey );
//! Replace the selected layer by a vector layer defined by uri, layer name, data source uri
Expand Down
2 changes: 0 additions & 2 deletions src/gui/qgsowssourceselect.h
Expand Up @@ -106,8 +106,6 @@ class GUI_EXPORT QgsOWSSourceSelect : public QDialog, protected Ui::QgsOWSSource
//! Add some default wms servers to the list
void on_mAddDefaultButton_clicked();

void on_mDialogButtonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }

signals:
void addRasterLayer( const QString &rasterLayerPath,
const QString &baseName,
Expand Down
5 changes: 5 additions & 0 deletions src/providers/arcgisrest/qgsamssourceselect.h
Expand Up @@ -30,6 +30,11 @@ class QgsAmsSourceSelect: public QgsSourceSelectDialog
public:
QgsAmsSourceSelect( QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::None );

signals:
void addRasterLayer( QString const &rasterLayerPath,
QString const &baseName,
QString const &providerKey );

protected:
bool connectToService( const QgsOwsConnection &connection ) override;
QString getLayerURI( const QgsOwsConnection &connection,
Expand Down
2 changes: 2 additions & 0 deletions src/providers/db2/qgsdb2sourceselect.h
Expand Up @@ -111,6 +111,8 @@ class QgsDb2SourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase
void addDatabaseLayers( QStringList const &layerPathList, QString const &providerKey );
void connectionsChanged();
void addGeometryColumn( QgsDb2LayerProperty );
void progress( int, int );
void progressMessage( QString );

public slots:
//! Determines the tables the user selected and closes the dialog
Expand Down
2 changes: 2 additions & 0 deletions src/providers/mssql/qgsmssqlsourceselect.h
Expand Up @@ -81,6 +81,8 @@ class QgsMssqlSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase
void addDatabaseLayers( QStringList const &layerPathList, QString const &providerKey );
void connectionsChanged();
void addGeometryColumn( const QgsMssqlLayerProperty & );
void progress( int, int );
void progressMessage( QString );

public slots:
//! Determines the tables the user selected and closes the dialog
Expand Down
2 changes: 2 additions & 0 deletions src/providers/spatialite/qgsspatialitesourceselect.h
Expand Up @@ -97,6 +97,8 @@ class QgsSpatiaLiteSourceSelect: public QDialog, private Ui::QgsDbSourceSelectBa
signals:
void connectionsChanged();
void addDatabaseLayers( QStringList const &paths, QString const &providerKey );
void progress( int, int );
void progressMessage( QString );

private:
enum Columns
Expand Down

0 comments on commit 9bae832

Please sign in to comment.