diff --git a/src/app/qgsoptions.cpp b/src/app/qgsoptions.cpp index 791301bf1c5..9e634416eeb 100644 --- a/src/app/qgsoptions.cpp +++ b/src/app/qgsoptions.cpp @@ -85,15 +85,6 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) : } } - //local directories to search when looking for an PROJ.4 file with a given basename - foreach( QString path, settings.value( "projSearchPaths" ).toStringList() ) - { - QListWidgetItem* newItem = new QListWidgetItem( mListProjPaths ); - newItem->setText( path ); - newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable ); - mListProjPaths->addItem( newItem ); - } - //Network timeout mNetworkTimeoutSpinBox->setValue( settings.value( "/qgis/networkAndProxy/networkTimeout", "60000" ).toInt() ); @@ -473,13 +464,6 @@ void QgsOptions::saveOptions() } settings.setValue( "svg/searchPathsForSVG", myPaths ); - QStringList paths; - for ( int i = 0; i < mListProjPaths->count(); ++i ) - { - paths << mListProjPaths->item( i )->text(); - } - settings.setValue( "projSearchPaths", paths ); - //Network timeout settings.setValue( "/qgis/networkAndProxy/networkTimeout", mNetworkTimeoutSpinBox->value() ); @@ -888,33 +872,6 @@ void QgsOptions::on_mBtnRemoveSVGPath_clicked() delete itemToRemove; } -void QgsOptions::on_mBtnAddProjPath_clicked() -{ - QString myDir = QFileDialog::getExistingDirectory( - this, - tr( "Choose a directory" ), - QDir::toNativeSeparators( QDir::homePath() ), - QFileDialog::ShowDirsOnly - ); - - if ( ! myDir.isEmpty() ) - { - QListWidgetItem* newItem = new QListWidgetItem( mListProjPaths ); - newItem->setText( myDir ); - newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable ); - mListProjPaths->addItem( newItem ); - mListProjPaths->setCurrentItem( newItem ); - } -} - -void QgsOptions::on_mBtnRemoveProjPath_clicked() -{ - int currentRow = mListProjPaths->currentRow(); - QListWidgetItem* itemToRemove = mListProjPaths->takeItem( currentRow ); - delete itemToRemove; -} - - void QgsOptions::on_mAddUrlPushButton_clicked() { QListWidgetItem* newItem = new QListWidgetItem( mExcludeUrlListWidget ); diff --git a/src/app/qgsoptions.h b/src/app/qgsoptions.h index 04876c45b4e..be7241e8036 100644 --- a/src/app/qgsoptions.h +++ b/src/app/qgsoptions.h @@ -101,12 +101,6 @@ class QgsOptions : public QDialog, private Ui::QgsOptionsBase */ void on_mBtnRemoveSVGPath_clicked(); - /* Let the user add a path to the list of search paths used for finding PROJ.4 files. */ - void on_mBtnAddProjPath_clicked(); - - /* Let the user remove a path to the list of search paths for finding PROJ.4 files. */ - void on_mBtnRemoveProjPath_clicked(); - void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); } void on_mBrowseCacheDirectory_clicked(); diff --git a/src/core/qgscoordinatetransform.cpp b/src/core/qgscoordinatetransform.cpp index a5bcff3e584..1a6e4816b77 100644 --- a/src/core/qgscoordinatetransform.cpp +++ b/src/core/qgscoordinatetransform.cpp @@ -23,10 +23,7 @@ #include #include #include -#include -#include -#include -#include +#include "qgslogger.h" extern "C" { @@ -548,51 +545,28 @@ bool QgsCoordinateTransform::writeXML( QDomNode & theNode, QDomDocument & theDoc return true; } +const char *finder( const char *name ) +{ + QString proj; +#ifdef WIN32 + proj = QApplication::applicationDirPath() + + "/share/proj/" + QString( name ); +#endif + return proj.toUtf8(); +} + void QgsCoordinateTransform::setFinder() { - pj_set_finder( finder ); -} - -const char *QgsCoordinateTransform::finder( const char *name ) -{ - QSettings settings; - QStringList paths = settings.value( "projSearchPaths" ).toStringList(); - - if ( getenv( "PROJ_LIB" ) ) - { - paths << getenv( "PROJ_LIB" ); - } - #ifdef WIN32 - paths << QApplication::applicationDirPath() + "/share/proj"; + // Attention! It should be possible to set PROJ_LIB + // but it can happen that it was previously set by installer + // (version 0.7) and the old installation was deleted + + // Another problem: PROJ checks if pj_finder was set before + // PROJ_LIB environment variable. pj_finder is probably set in + // GRASS gproj library when plugin is loaded, consequently + // PROJ_LIB is ignored + + pj_set_finder( finder ); #endif - - foreach( QString path, paths ) - { - QFileInfo fi( QString( "%1/%2" ).arg( path ).arg( name ) ); - if ( fi.exists() ) - return fi.canonicalFilePath().toUtf8(); - } - - if ( QString( name ).endsWith( ".gsb", Qt::CaseInsensitive ) ) - { - static QSet missing; - - if ( !missing.contains( name ) ) - { - QgsMessageOutput *output = QgsMessageOutput::createMessageOutput(); - output->setTitle( "Grid transformation missing" ); - output->setMessage( tr( "PROJ.4 file %1 not found in any of these directories:\n\n" - "%2\n\n" - "Note: This message won't reappear for this file in this session." ) - .arg( name ) - .arg( paths.join( "\n" ) ), - QgsMessageOutput::MessageText ); - output->showMessage(); - } - - missing << name; - } - - return name; } diff --git a/src/core/qgscoordinatetransform.h b/src/core/qgscoordinatetransform.h index b1179278867..8b35c72f03d 100644 --- a/src/core/qgscoordinatetransform.h +++ b/src/core/qgscoordinatetransform.h @@ -255,15 +255,10 @@ class CORE_EXPORT QgsCoordinateTransform: public QObject */ projPJ mDestinationProjection; - /*! - * Set finder for PROJ grid files. - */ - void setFinder(); - /*! * Finder for PROJ grid files. */ - static const char *finder( const char *name ); + void setFinder(); }; //! Output stream operator diff --git a/src/ui/qgsoptionsbase.ui b/src/ui/qgsoptionsbase.ui index adfcc41c4e7..fd5a4f3234c 100644 --- a/src/ui/qgsoptionsbase.ui +++ b/src/ui/qgsoptionsbase.ui @@ -212,16 +212,6 @@ - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok - - - @@ -634,52 +624,6 @@ - - - - PROJ.4 search paths - - - - - - - - - Qt::Horizontal - - - - 31 - 20 - - - - - - - - Add - - - - - - - Remove - - - - - - - Path(s) to search for PROJ.4 files - - - - - - @@ -1655,6 +1599,16 @@ + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok + + +