Skip to content
Permalink
Browse files

add (unemitted) signals to provider source selectors to silence data

source manager connection warnings
  • Loading branch information
jef-n committed Jul 17, 2017
1 parent 205b705 commit 9bae83275368d09b14a4b25951724b1a30b363b7
@@ -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,
@@ -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)
@@ -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();
@@ -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;
@@ -21,6 +21,7 @@
#include <QList>
#include <QMap>
#include <QObject>
#include <QPointer>

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

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

private:

/**
@@ -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;
@@ -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 )
@@ -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
@@ -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,
@@ -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,
@@ -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
@@ -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
@@ -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

0 comments on commit 9bae832

Please sign in to comment.
You can’t perform that action at this time.