diff --git a/python/plugins/fTools/tools/doMergeShapes.py b/python/plugins/fTools/tools/doMergeShapes.py index 2506729c07b..db4cf25acd3 100644 --- a/python/plugins/fTools/tools/doMergeShapes.py +++ b/python/plugins/fTools/tools/doMergeShapes.py @@ -139,6 +139,10 @@ class Dialog( QDialog, Ui_Dialog ): baseDir = self.leInputDir.text() # look for shapes with specified geometry type self.inputFiles = ftools_utils.getShapesByGeometryType( baseDir, self.inputFiles, self.cmbGeometry.currentIndex() ) + if self.inputFiles is None: + QMessageBox.warning( self, self.tr( "No shapefiles found" ), + self.tr( "There are no shapefiles with the given geometry type. Please select an available geometry type." ) ) + return self.progressFiles.setRange( 0, self.inputFiles.count() ) outFile = QFile( self.outFileName ) diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index 3ed3f2cceee..86aed12bebd 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -344,12 +344,12 @@ static QgsMessageOutput *messageOutputViewer_() return new QgsMessageOutputConsole(); } -static void customSrsValidation_( QgsCoordinateReferenceSystem* srs ) +static void customSrsValidation_( QgsCoordinateReferenceSystem &srs ) { QgisApp::instance()->emitCustomSrsValidation( srs ); } -void QgisApp::emitCustomSrsValidation( QgsCoordinateReferenceSystem* srs ) +void QgisApp::emitCustomSrsValidation( QgsCoordinateReferenceSystem &srs ) { emit customSrsValidation( srs ); } @@ -361,7 +361,7 @@ void QgisApp::emitCustomSrsValidation( QgsCoordinateReferenceSystem* srs ) * - use project's CRS * - use predefined global CRS */ -void QgisApp::validateSrs( QgsCoordinateReferenceSystem* srs ) +void QgisApp::validateSrs( QgsCoordinateReferenceSystem &srs ) { static QString authid = QString::null; QSettings mySettings; @@ -372,9 +372,10 @@ void QgisApp::validateSrs( QgsCoordinateReferenceSystem* srs ) //it in the ctor of the layer projection selector QgsGenericProjectionSelector *mySelector = new QgsGenericProjectionSelector(); - mySelector->setMessage( srs->validationHint() ); //shows a generic message, if not specified + mySelector->setMessage( srs.validationHint() ); //shows a generic message, if not specified if ( authid.isNull() ) authid = QgisApp::instance()->mapCanvas()->mapRenderer()->destinationCrs().authid(); + QgsCoordinateReferenceSystem defaultCrs; if ( defaultCrs.createFromOgcWmsCrs( authid ) ) { @@ -389,7 +390,7 @@ void QgisApp::validateSrs( QgsCoordinateReferenceSystem* srs ) { QgsDebugMsg( "Layer srs set from dialog: " + QString::number( mySelector->selectedCrsId() ) ); authid = mySelector->selectedAuthId(); - srs->createFromOgcWmsCrs( mySelector->selectedAuthId() ); + srs.createFromOgcWmsCrs( mySelector->selectedAuthId() ); } //QApplication::restoreOverrideCursor(); @@ -402,12 +403,12 @@ void QgisApp::validateSrs( QgsCoordinateReferenceSystem* srs ) authid = QgisApp::instance()->mapCanvas()->mapRenderer()->destinationCrs().authid(); QgsDebugMsg( "Layer srs set from project: " + authid ); QgisApp::instance()->statusBar()->showMessage( QObject::tr( "CRS undefined - defaulting to project CRS" ) ); - srs->createFromOgcWmsCrs( authid ); + srs.createFromOgcWmsCrs( authid ); } else ///Projections/defaultBehaviour==useGlobal { authid = mySettings.value( "/Projections/layerDefaultCrs", GEO_EPSG_CRS_AUTHID ).toString(); - srs->createFromOgcWmsCrs( authid ); + srs.createFromOgcWmsCrs( authid ); QgisApp::instance()->statusBar()->showMessage( QObject::tr( "CRS undefined - defaulting to default CRS: %1" ).arg( authid ) ); } } @@ -566,8 +567,8 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent, QgsMessageLog::logMessage( tr( "QGIS starting..." ) ); // set QGIS specific srs validation - connect( this, SIGNAL( customSrsValidation( QgsCoordinateReferenceSystem * ) ), - this, SLOT( validateSrs( QgsCoordinateReferenceSystem * ) ) ); + connect( this, SIGNAL( customSrsValidation( QgsCoordinateReferenceSystem& ) ), + this, SLOT( validateSrs( QgsCoordinateReferenceSystem& ) ) ); QgsCoordinateReferenceSystem::setCustomSrsValidation( customSrsValidation_ ); // set graphical message output @@ -7020,6 +7021,7 @@ void QgisApp::markDirty() // notify the project that there was a change QgsProject::instance()->dirty( true ); } + //changed from layerWasAdded to layersWereAdded in 1.8 void QgisApp::layersWereAdded( QList theLayers ) { diff --git a/src/app/qgisapp.h b/src/app/qgisapp.h index 90db198490e..06e721d39e3 100644 --- a/src/app/qgisapp.h +++ b/src/app/qgisapp.h @@ -404,7 +404,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow //! @note added in 1.6 void completeInitialization(); - void emitCustomSrsValidation( QgsCoordinateReferenceSystem *crs ); + void emitCustomSrsValidation( QgsCoordinateReferenceSystem &crs ); QList decorationItems() { return mDecorationItems; } void addDecorationItem( QgsDecorationItem* item ) { mDecorationItems.append( item ); } @@ -533,7 +533,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow private slots: //! validate a SRS - void validateSrs( QgsCoordinateReferenceSystem *crs ); + void validateSrs( QgsCoordinateReferenceSystem &crs ); //! QGis Sponsors void sponsors(); @@ -1008,7 +1008,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow @note added in version 1.6*/ void initializationCompleted(); - void customSrsValidation( QgsCoordinateReferenceSystem *crs ); + void customSrsValidation( QgsCoordinateReferenceSystem &crs ); private: /** This method will open a dialog so the user can select GDAL sublayers to load diff --git a/src/core/qgscoordinatereferencesystem.cpp b/src/core/qgscoordinatereferencesystem.cpp index c9a711e2f8e..9dafec5f2cd 100644 --- a/src/core/qgscoordinatereferencesystem.cpp +++ b/src/core/qgscoordinatereferencesystem.cpp @@ -283,7 +283,7 @@ void QgsCoordinateReferenceSystem::validate() // try to validate using custom validation routines if ( mCustomSrsValidation ) - mCustomSrsValidation( this ); + mCustomSrsValidation( *this ); if ( !mIsValidFlag ) { diff --git a/src/core/qgscoordinatereferencesystem.h b/src/core/qgscoordinatereferencesystem.h index 5bdca175c7b..7faa3d95cb5 100644 --- a/src/core/qgscoordinatereferencesystem.h +++ b/src/core/qgscoordinatereferencesystem.h @@ -42,7 +42,7 @@ typedef void *OGRSpatialReferenceH; #endif class QgsCoordinateReferenceSystem; -typedef void ( *CUSTOM_CRS_VALIDATION )( QgsCoordinateReferenceSystem* ); +typedef void ( *CUSTOM_CRS_VALIDATION )( QgsCoordinateReferenceSystem& ); /** \ingroup core * Class for storing a coordinate reference system (CRS)