Skip to content

Commit

Permalink
Further reduction of instance copies
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandro Santilli committed May 31, 2013
1 parent 16ba01f commit 4f46379
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
9 changes: 6 additions & 3 deletions src/providers/postgres/qgscolumntypethread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
12 changes: 6 additions & 6 deletions src/providers/postgres/qgspgsourceselect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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() )
Expand Down
10 changes: 5 additions & 5 deletions src/providers/postgres/qgspgsourceselect.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 4f46379

Please sign in to comment.