Skip to content
Permalink
Browse files

Further reduction of instance copies

  • Loading branch information
Sandro Santilli
Sandro Santilli committed May 31, 2013
1 parent 16ba01f commit 4f4637913df0cbdaf526d3cccf64f30b9adc4ef3
@@ -65,12 +65,15 @@ void QgsGeomColumnTypeThread::run()
return;
}

int i = 0;
foreach ( QgsPostgresLayerProperty layerProperty, layerProperties )
int i = 0, n = layerProperties.size();
for ( QVector<QgsPostgresLayerProperty>::iterator it=layerProperties.begin(),
end=layerProperties.end();
it != end; ++it)
{
QgsPostgresLayerProperty& layerProperty = *it;
if ( !mStopped )
{
emit progress( i++, layerProperties.size() );
emit progress( i++, n );
emit progressMessage( tr( "Scanning column %1.%2.%3..." )
.arg( layerProperty.schemaName )
.arg( layerProperty.tableName )
@@ -353,7 +353,7 @@ void QgsPgSourceSelect::on_mSearchModeComboBox_currentIndexChanged( const QStrin
on_mSearchTableEdit_textChanged( mSearchTableEdit->text() );
}

void QgsPgSourceSelect::setLayerType( QgsPostgresLayerProperty layerProperty )
void QgsPgSourceSelect::setLayerType( const QgsPostgresLayerProperty& layerProperty )
{
QgsDebugMsg( "entering." );
mTableModel.addTableEntry( layerProperty );
@@ -445,14 +445,14 @@ void QgsPgSourceSelect::on_btnConnect_clicked()

mColumnTypeThread = new QgsGeomColumnTypeThread( cmbConnections->currentText(), mUseEstimatedMetadata, cbxAllowGeometrylessTables->isChecked() );

connect( mColumnTypeThread, SIGNAL( setLayerType( QgsPostgresLayerProperty ) ),
this, SLOT( setLayerType( QgsPostgresLayerProperty ) ) );
connect( mColumnTypeThread, SIGNAL( setLayerType( const QgsPostgresLayerProperty& ) ),
this, SLOT( setLayerType( const QgsPostgresLayerProperty& ) ) );
connect( mColumnTypeThread, SIGNAL( finished() ),
this, SLOT( columnThreadFinished() ) );
connect( mColumnTypeThread, SIGNAL( progress( int, int ) ),
this, SIGNAL( progress( int, int ) ) );
connect( mColumnTypeThread, SIGNAL( progressMessage( QString ) ),
this, SIGNAL( progressMessage( QString ) ) );
connect( mColumnTypeThread, SIGNAL( progressMessage( const QString& ) ),
this, SIGNAL( progressMessage( const QString& ) ) );

btnConnect->setText( tr( "Stop" ) );
mColumnTypeThread->start();
@@ -529,7 +529,7 @@ void QgsPgSourceSelect::setSql( const QModelIndex &index )
delete vlayer;
}

QString QgsPgSourceSelect::fullDescription( QString schema, QString table, QString column, QString type )
QString QgsPgSourceSelect::fullDescription( const QString& schema, const QString& table, const QString& column, const QString& type )
{
QString full_desc = "";
if ( !schema.isEmpty() )
@@ -74,9 +74,9 @@ class QgsPgSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase
signals:
void addDatabaseLayers( QStringList const & layerPathList, QString const & providerKey );
void connectionsChanged();
void addGeometryColumn( QgsPostgresLayerProperty );
void addGeometryColumn( const QgsPostgresLayerProperty& );
void progress( int, int );
void progressMessage( QString );
void progressMessage( const QString& );

public slots:
//! Determines the tables the user selected and closes the dialog
@@ -104,7 +104,7 @@ class QgsPgSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase
void on_cmbConnections_currentIndexChanged( const QString &text );
void setSql( const QModelIndex& index );
//! Store the selected database
void setLayerType( QgsPostgresLayerProperty layerProperty );
void setLayerType( const QgsPostgresLayerProperty& layerProperty );
void on_mTablesTreeView_clicked( const QModelIndex &index );
void on_mTablesTreeView_doubleClicked( const QModelIndex &index );
//!Sets a new regular expression to the model
@@ -125,14 +125,14 @@ class QgsPgSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase
bool mEmbeddedMode;

// queue another query for the thread
void addSearchGeometryColumn( QgsPostgresLayerProperty layerProperty );
void addSearchGeometryColumn( const QgsPostgresLayerProperty& layerProperty );

// Set the position of the database connection list to the last
// used one.
void setConnectionListPosition();
// Combine the schema, table and column data into a single string
// useful for display to the user
QString fullDescription( QString schema, QString table, QString column, QString type );
QString fullDescription( const QString& schema, const QString& table, const QString& column, const QString& type );
// The column labels
QStringList mColumnLabels;
// Our thread for doing long running queries

0 comments on commit 4f46379

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