Skip to content

Commit

Permalink
partly revert r14399 (all except srs updates):
Browse files Browse the repository at this point in the history
- 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@14439 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Oct 27, 2010
1 parent 5c00425 commit eeda546
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 155 deletions.
43 changes: 0 additions & 43 deletions src/app/qgsoptions.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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 //Network timeout
mNetworkTimeoutSpinBox->setValue( settings.value( "/qgis/networkAndProxy/networkTimeout", "60000" ).toInt() ); mNetworkTimeoutSpinBox->setValue( settings.value( "/qgis/networkAndProxy/networkTimeout", "60000" ).toInt() );


Expand Down Expand Up @@ -473,13 +464,6 @@ void QgsOptions::saveOptions()
} }
settings.setValue( "svg/searchPathsForSVG", myPaths ); 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 //Network timeout
settings.setValue( "/qgis/networkAndProxy/networkTimeout", mNetworkTimeoutSpinBox->value() ); settings.setValue( "/qgis/networkAndProxy/networkTimeout", mNetworkTimeoutSpinBox->value() );


Expand Down Expand Up @@ -888,33 +872,6 @@ void QgsOptions::on_mBtnRemoveSVGPath_clicked()
delete itemToRemove; 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() void QgsOptions::on_mAddUrlPushButton_clicked()
{ {
QListWidgetItem* newItem = new QListWidgetItem( mExcludeUrlListWidget ); QListWidgetItem* newItem = new QListWidgetItem( mExcludeUrlListWidget );
Expand Down
6 changes: 0 additions & 6 deletions src/app/qgsoptions.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -101,12 +101,6 @@ class QgsOptions : public QDialog, private Ui::QgsOptionsBase
*/ */
void on_mBtnRemoveSVGPath_clicked(); 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_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }


void on_mBrowseCacheDirectory_clicked(); void on_mBrowseCacheDirectory_clicked();
Expand Down
62 changes: 18 additions & 44 deletions src/core/qgscoordinatetransform.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
#include <QDomNode> #include <QDomNode>
#include <QDomElement> #include <QDomElement>
#include <QApplication> #include <QApplication>
#include <QSettings> #include "qgslogger.h"
#include <QStringList>
#include <QFileInfo>
#include <QSet>


extern "C" extern "C"
{ {
Expand Down Expand Up @@ -548,51 +545,28 @@ bool QgsCoordinateTransform::writeXML( QDomNode & theNode, QDomDocument & theDoc
return true; return true;
} }


void QgsCoordinateTransform::setFinder() const char *finder( const char *name )
{ {
pj_set_finder( finder ); QString proj;
#ifdef WIN32
proj = QApplication::applicationDirPath()
+ "/share/proj/" + QString( name );
#endif
return proj.toUtf8();
} }


const char *QgsCoordinateTransform::finder( const char *name ) void QgsCoordinateTransform::setFinder()
{ {
QSettings settings;
QStringList paths = settings.value( "projSearchPaths" ).toStringList();

if ( getenv( "PROJ_LIB" ) )
{
paths << getenv( "PROJ_LIB" );
}

#ifdef WIN32 #ifdef WIN32
paths << QApplication::applicationDirPath() + "/share/proj"; // Attention! It should be possible to set PROJ_LIB
#endif // but it can happen that it was previously set by installer
// (version 0.7) and the old installation was deleted


foreach( QString path, paths ) // Another problem: PROJ checks if pj_finder was set before
{ // PROJ_LIB environment variable. pj_finder is probably set in
QFileInfo fi( QString( "%1/%2" ).arg( path ).arg( name ) ); // GRASS gproj library when plugin is loaded, consequently
if ( fi.exists() ) // PROJ_LIB is ignored
return fi.canonicalFilePath().toUtf8();
}

if ( QString( name ).endsWith( ".gsb", Qt::CaseInsensitive ) )
{
static QSet<QString> missing;


if ( !missing.contains( name ) ) pj_set_finder( finder );
{ #endif
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;
} }
7 changes: 1 addition & 6 deletions src/core/qgscoordinatetransform.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -255,15 +255,10 @@ class CORE_EXPORT QgsCoordinateTransform: public QObject
*/ */
projPJ mDestinationProjection; projPJ mDestinationProjection;


/*!
* Set finder for PROJ grid files.
*/
void setFinder();

/*! /*!
* Finder for PROJ grid files. * Finder for PROJ grid files.
*/ */
static const char *finder( const char *name ); void setFinder();
}; };


//! Output stream operator //! Output stream operator
Expand Down
66 changes: 10 additions & 56 deletions src/ui/qgsoptionsbase.ui
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -212,16 +212,6 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QStackedWidget" name="stackedWidget"> <widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex"> <property name="currentIndex">
Expand Down Expand Up @@ -634,52 +624,6 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>PROJ.4 search paths</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="4" column="0" colspan="4">
<widget class="QListWidget" name="mListProjPaths"/>
</item>
<item row="3" column="1">
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>31</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="mBtnAddProjPath">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QPushButton" name="mBtnRemoveProjPath">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="mProjLabel">
<property name="text">
<string>Path(s) to search for PROJ.4 files</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="stackedWidgetPage3"> <widget class="QWidget" name="stackedWidgetPage3">
Expand Down Expand Up @@ -1655,6 +1599,16 @@
</widget> </widget>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
Expand Down

0 comments on commit eeda546

Please sign in to comment.