Skip to content

Commit 2534385

Browse files
author
jef
committed
partly revert r14399 (all except srs updates):
- proj.4 user paths mask standard directory - gsb file warning doesn't make sense for optional grids. git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14439 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent c4e283b commit 2534385

File tree

5 files changed

+29
-155
lines changed

5 files changed

+29
-155
lines changed

src/app/qgsoptions.cpp

-43
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,6 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
8585
}
8686
}
8787

88-
//local directories to search when looking for an PROJ.4 file with a given basename
89-
foreach( QString path, settings.value( "projSearchPaths" ).toStringList() )
90-
{
91-
QListWidgetItem* newItem = new QListWidgetItem( mListProjPaths );
92-
newItem->setText( path );
93-
newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
94-
mListProjPaths->addItem( newItem );
95-
}
96-
9788
//Network timeout
9889
mNetworkTimeoutSpinBox->setValue( settings.value( "/qgis/networkAndProxy/networkTimeout", "60000" ).toInt() );
9990

@@ -473,13 +464,6 @@ void QgsOptions::saveOptions()
473464
}
474465
settings.setValue( "svg/searchPathsForSVG", myPaths );
475466

476-
QStringList paths;
477-
for ( int i = 0; i < mListProjPaths->count(); ++i )
478-
{
479-
paths << mListProjPaths->item( i )->text();
480-
}
481-
settings.setValue( "projSearchPaths", paths );
482-
483467
//Network timeout
484468
settings.setValue( "/qgis/networkAndProxy/networkTimeout", mNetworkTimeoutSpinBox->value() );
485469

@@ -888,33 +872,6 @@ void QgsOptions::on_mBtnRemoveSVGPath_clicked()
888872
delete itemToRemove;
889873
}
890874

891-
void QgsOptions::on_mBtnAddProjPath_clicked()
892-
{
893-
QString myDir = QFileDialog::getExistingDirectory(
894-
this,
895-
tr( "Choose a directory" ),
896-
QDir::toNativeSeparators( QDir::homePath() ),
897-
QFileDialog::ShowDirsOnly
898-
);
899-
900-
if ( ! myDir.isEmpty() )
901-
{
902-
QListWidgetItem* newItem = new QListWidgetItem( mListProjPaths );
903-
newItem->setText( myDir );
904-
newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
905-
mListProjPaths->addItem( newItem );
906-
mListProjPaths->setCurrentItem( newItem );
907-
}
908-
}
909-
910-
void QgsOptions::on_mBtnRemoveProjPath_clicked()
911-
{
912-
int currentRow = mListProjPaths->currentRow();
913-
QListWidgetItem* itemToRemove = mListProjPaths->takeItem( currentRow );
914-
delete itemToRemove;
915-
}
916-
917-
918875
void QgsOptions::on_mAddUrlPushButton_clicked()
919876
{
920877
QListWidgetItem* newItem = new QListWidgetItem( mExcludeUrlListWidget );

src/app/qgsoptions.h

-6
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,6 @@ class QgsOptions : public QDialog, private Ui::QgsOptionsBase
101101
*/
102102
void on_mBtnRemoveSVGPath_clicked();
103103

104-
/* Let the user add a path to the list of search paths used for finding PROJ.4 files. */
105-
void on_mBtnAddProjPath_clicked();
106-
107-
/* Let the user remove a path to the list of search paths for finding PROJ.4 files. */
108-
void on_mBtnRemoveProjPath_clicked();
109-
110104
void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
111105

112106
void on_mBrowseCacheDirectory_clicked();

src/core/qgscoordinatetransform.cpp

+18-44
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@
2323
#include <QDomNode>
2424
#include <QDomElement>
2525
#include <QApplication>
26-
#include <QSettings>
27-
#include <QStringList>
28-
#include <QFileInfo>
29-
#include <QSet>
26+
#include "qgslogger.h"
3027

3128
extern "C"
3229
{
@@ -548,51 +545,28 @@ bool QgsCoordinateTransform::writeXML( QDomNode & theNode, QDomDocument & theDoc
548545
return true;
549546
}
550547

551-
void QgsCoordinateTransform::setFinder()
548+
const char *finder( const char *name )
552549
{
553-
pj_set_finder( finder );
550+
QString proj;
551+
#ifdef WIN32
552+
proj = QApplication::applicationDirPath()
553+
+ "/share/proj/" + QString( name );
554+
#endif
555+
return proj.toUtf8();
554556
}
555557

556-
const char *QgsCoordinateTransform::finder( const char *name )
558+
void QgsCoordinateTransform::setFinder()
557559
{
558-
QSettings settings;
559-
QStringList paths = settings.value( "projSearchPaths" ).toStringList();
560-
561-
if ( getenv( "PROJ_LIB" ) )
562-
{
563-
paths << getenv( "PROJ_LIB" );
564-
}
565-
566560
#ifdef WIN32
567-
paths << QApplication::applicationDirPath() + "/share/proj";
568-
#endif
561+
// Attention! It should be possible to set PROJ_LIB
562+
// but it can happen that it was previously set by installer
563+
// (version 0.7) and the old installation was deleted
569564

570-
foreach( QString path, paths )
571-
{
572-
QFileInfo fi( QString( "%1/%2" ).arg( path ).arg( name ) );
573-
if ( fi.exists() )
574-
return fi.canonicalFilePath().toUtf8();
575-
}
576-
577-
if ( QString( name ).endsWith( ".gsb", Qt::CaseInsensitive ) )
578-
{
579-
static QSet<QString> missing;
565+
// Another problem: PROJ checks if pj_finder was set before
566+
// PROJ_LIB environment variable. pj_finder is probably set in
567+
// GRASS gproj library when plugin is loaded, consequently
568+
// PROJ_LIB is ignored
580569

581-
if ( !missing.contains( name ) )
582-
{
583-
QgsMessageOutput *output = QgsMessageOutput::createMessageOutput();
584-
output->setTitle( "Grid transformation missing" );
585-
output->setMessage( tr( "PROJ.4 file %1 not found in any of these directories:\n\n"
586-
"%2\n\n"
587-
"Note: This message won't reappear for this file in this session." )
588-
.arg( name )
589-
.arg( paths.join( "\n" ) ),
590-
QgsMessageOutput::MessageText );
591-
output->showMessage();
592-
}
593-
594-
missing << name;
595-
}
596-
597-
return name;
570+
pj_set_finder( finder );
571+
#endif
598572
}

src/core/qgscoordinatetransform.h

+1-6
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,10 @@ class CORE_EXPORT QgsCoordinateTransform: public QObject
255255
*/
256256
projPJ mDestinationProjection;
257257

258-
/*!
259-
* Set finder for PROJ grid files.
260-
*/
261-
void setFinder();
262-
263258
/*!
264259
* Finder for PROJ grid files.
265260
*/
266-
static const char *finder( const char *name );
261+
void setFinder();
267262
};
268263

269264
//! Output stream operator

src/ui/qgsoptionsbase.ui

+10-56
Original file line numberDiff line numberDiff line change
@@ -212,16 +212,6 @@
212212
</item>
213213
</widget>
214214
</item>
215-
<item row="1" column="0" colspan="2">
216-
<widget class="QDialogButtonBox" name="buttonBox">
217-
<property name="orientation">
218-
<enum>Qt::Horizontal</enum>
219-
</property>
220-
<property name="standardButtons">
221-
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
222-
</property>
223-
</widget>
224-
</item>
225215
<item row="0" column="1">
226216
<widget class="QStackedWidget" name="stackedWidget">
227217
<property name="currentIndex">
@@ -634,52 +624,6 @@
634624
</layout>
635625
</widget>
636626
</item>
637-
<item>
638-
<widget class="QGroupBox" name="groupBox_4">
639-
<property name="title">
640-
<string>PROJ.4 search paths</string>
641-
</property>
642-
<layout class="QGridLayout" name="gridLayout_4">
643-
<item row="4" column="0" colspan="4">
644-
<widget class="QListWidget" name="mListProjPaths"/>
645-
</item>
646-
<item row="3" column="1">
647-
<spacer name="spacer">
648-
<property name="orientation">
649-
<enum>Qt::Horizontal</enum>
650-
</property>
651-
<property name="sizeHint" stdset="0">
652-
<size>
653-
<width>31</width>
654-
<height>20</height>
655-
</size>
656-
</property>
657-
</spacer>
658-
</item>
659-
<item row="3" column="2">
660-
<widget class="QPushButton" name="mBtnAddProjPath">
661-
<property name="text">
662-
<string>Add</string>
663-
</property>
664-
</widget>
665-
</item>
666-
<item row="3" column="3">
667-
<widget class="QPushButton" name="mBtnRemoveProjPath">
668-
<property name="text">
669-
<string>Remove</string>
670-
</property>
671-
</widget>
672-
</item>
673-
<item row="3" column="0">
674-
<widget class="QLabel" name="mProjLabel">
675-
<property name="text">
676-
<string>Path(s) to search for PROJ.4 files</string>
677-
</property>
678-
</widget>
679-
</item>
680-
</layout>
681-
</widget>
682-
</item>
683627
</layout>
684628
</widget>
685629
<widget class="QWidget" name="stackedWidgetPage3">
@@ -1655,6 +1599,16 @@
16551599
</widget>
16561600
</widget>
16571601
</item>
1602+
<item row="1" column="0" colspan="2">
1603+
<widget class="QDialogButtonBox" name="buttonBox">
1604+
<property name="orientation">
1605+
<enum>Qt::Horizontal</enum>
1606+
</property>
1607+
<property name="standardButtons">
1608+
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
1609+
</property>
1610+
</widget>
1611+
</item>
16581612
</layout>
16591613
</widget>
16601614
<layoutdefault spacing="6" margin="11"/>

0 commit comments

Comments
 (0)