From fdb2475d282e6f49884963ffe02ec31719285e5d Mon Sep 17 00:00:00 2001 From: "Juergen E. Fischer" Date: Thu, 29 Mar 2012 17:16:39 +0200 Subject: [PATCH] fix srs validation from threads --- src/app/qgisapp.cpp | 14 +++++++++++++- src/app/qgisapp.h | 7 +++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index 137523ed9c25..f46e97612d12 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -321,6 +321,16 @@ static QgsMessageOutput *messageOutputViewer_() return new QgsMessageViewer( QgisApp::instance() ); } +static void customSrsValidation_( QgsCoordinateReferenceSystem* srs ) +{ + QgisApp::instance()->emitCustomSrsValidation( srs ); +} + +void QgisApp::emitCustomSrsValidation( QgsCoordinateReferenceSystem* srs ) +{ + emit customSrsValidation( srs ); +} + /** * This function contains forced validation of CRS used in QGIS. * There are 3 options depending on the settings: @@ -328,7 +338,7 @@ static QgsMessageOutput *messageOutputViewer_() * - use project's CRS * - use predefined global CRS */ -static void customSrsValidation_( QgsCoordinateReferenceSystem* srs ) +void QgisApp::validateSrs( QgsCoordinateReferenceSystem* srs ) { static QString authid = QString::null; QSettings mySettings; @@ -514,6 +524,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 * ) ) ); QgsCoordinateReferenceSystem::setCustomSrsValidation( customSrsValidation_ ); // set graphical message output diff --git a/src/app/qgisapp.h b/src/app/qgisapp.h index ff6073f6692f..1a698b8667fa 100644 --- a/src/app/qgisapp.h +++ b/src/app/qgisapp.h @@ -371,6 +371,8 @@ class QgisApp : public QMainWindow, private Ui::MainWindow //! @note added in 1.6 void completeInitialization(); + void emitCustomSrsValidation( QgsCoordinateReferenceSystem *crs ); + public slots: //! Zoom to full extent void zoomFull(); @@ -487,6 +489,9 @@ class QgisApp : public QMainWindow, private Ui::MainWindow #endif private slots: + //! validate a SRS + void validateSrs( QgsCoordinateReferenceSystem *crs ); + //! QGis Sponsors void sponsors(); //! About QGis @@ -858,6 +863,8 @@ class QgisApp : public QMainWindow, private Ui::MainWindow @note added in version 1.6*/ void initializationCompleted(); + void customSrsValidation( QgsCoordinateReferenceSystem *crs ); + private: /** This method will open a dialog so the user can select the sublayers to load */