Skip to content

Commit 4f46379

Browse files
author
Sandro Santilli
committedMay 31, 2013
Further reduction of instance copies
1 parent 16ba01f commit 4f46379

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed
 

‎src/providers/postgres/qgscolumntypethread.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,15 @@ void QgsGeomColumnTypeThread::run()
6565
return;
6666
}
6767

68-
int i = 0;
69-
foreach ( QgsPostgresLayerProperty layerProperty, layerProperties )
68+
int i = 0, n = layerProperties.size();
69+
for ( QVector<QgsPostgresLayerProperty>::iterator it=layerProperties.begin(),
70+
end=layerProperties.end();
71+
it != end; ++it)
7072
{
73+
QgsPostgresLayerProperty& layerProperty = *it;
7174
if ( !mStopped )
7275
{
73-
emit progress( i++, layerProperties.size() );
76+
emit progress( i++, n );
7477
emit progressMessage( tr( "Scanning column %1.%2.%3..." )
7578
.arg( layerProperty.schemaName )
7679
.arg( layerProperty.tableName )

‎src/providers/postgres/qgspgsourceselect.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ void QgsPgSourceSelect::on_mSearchModeComboBox_currentIndexChanged( const QStrin
353353
on_mSearchTableEdit_textChanged( mSearchTableEdit->text() );
354354
}
355355

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

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

448-
connect( mColumnTypeThread, SIGNAL( setLayerType( QgsPostgresLayerProperty ) ),
449-
this, SLOT( setLayerType( QgsPostgresLayerProperty ) ) );
448+
connect( mColumnTypeThread, SIGNAL( setLayerType( const QgsPostgresLayerProperty& ) ),
449+
this, SLOT( setLayerType( const QgsPostgresLayerProperty& ) ) );
450450
connect( mColumnTypeThread, SIGNAL( finished() ),
451451
this, SLOT( columnThreadFinished() ) );
452452
connect( mColumnTypeThread, SIGNAL( progress( int, int ) ),
453453
this, SIGNAL( progress( int, int ) ) );
454-
connect( mColumnTypeThread, SIGNAL( progressMessage( QString ) ),
455-
this, SIGNAL( progressMessage( QString ) ) );
454+
connect( mColumnTypeThread, SIGNAL( progressMessage( const QString& ) ),
455+
this, SIGNAL( progressMessage( const QString& ) ) );
456456

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

532-
QString QgsPgSourceSelect::fullDescription( QString schema, QString table, QString column, QString type )
532+
QString QgsPgSourceSelect::fullDescription( const QString& schema, const QString& table, const QString& column, const QString& type )
533533
{
534534
QString full_desc = "";
535535
if ( !schema.isEmpty() )

‎src/providers/postgres/qgspgsourceselect.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ class QgsPgSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase
7474
signals:
7575
void addDatabaseLayers( QStringList const & layerPathList, QString const & providerKey );
7676
void connectionsChanged();
77-
void addGeometryColumn( QgsPostgresLayerProperty );
77+
void addGeometryColumn( const QgsPostgresLayerProperty& );
7878
void progress( int, int );
79-
void progressMessage( QString );
79+
void progressMessage( const QString& );
8080

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

127127
// queue another query for the thread
128-
void addSearchGeometryColumn( QgsPostgresLayerProperty layerProperty );
128+
void addSearchGeometryColumn( const QgsPostgresLayerProperty& layerProperty );
129129

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

0 commit comments

Comments
 (0)
Please sign in to comment.