Skip to content

Commit

Permalink
move QGIS_PREFIX_PATH support to QgsApplication
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jun 18, 2012
1 parent a1cb7fd commit 56ea83f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 71 deletions.
3 changes: 2 additions & 1 deletion ms-windows/osgeo4w/browser.bat.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ call "%OSGEO4W_ROOT%"\bin\o4w_env.bat
call "%OSGEO4W_ROOT%"\apps\grass\grass-@grassversion@\etc\env.bat
@echo off
path %PATH%;%OSGEO4W_ROOT%\apps\@package@\bin;%OSGEO4W_ROOT%\apps\grass\grass-@grassversion@\lib
start "Quantum GIS Browser" /B "%OSGEO4W_ROOT%"\apps\@package@\bin\qbrowser.exe %*
set QGIS_PREFIX_PATH=@osgeo4w_msys@/apps/@package@
start "Quantum GIS Browser" /B "%OSGEO4W_ROOT%"\@package@-browser.exe %*
6 changes: 4 additions & 2 deletions ms-windows/osgeo4w/package.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,13 @@ tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-server-%VERSION%-%PACKAGE%.tar.bz2 ^
>>%LOG% 2>&1
if errorlevel 1 goto error

move apps\%PACKAGENAME%\bin\qgis.exe bin\%PACKAGENAME%.exe
move apps\%PACKAGENAME%\bin\qbrowser.exe bin\%PACKAGENAME%-browser.exe
tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2 ^
--exclude-from exclude ^
--exclude "*.pyc" ^
"apps/%PACKAGENAME%/bin/qbrowser.exe" ^
"apps/%PACKAGENAME%/bin/qgis.exe" ^
"bin/%PACKAGENAME%-browser.exe" ^
"bin/%PACKAGENAME%.exe" ^
"apps/%PACKAGENAME%/bin/qgis.reg.tmpl" ^
"apps/%PACKAGENAME%/i18n/" ^
"apps/%PACKAGENAME%/icons/" ^
Expand Down
3 changes: 2 additions & 1 deletion ms-windows/osgeo4w/qgis.bat.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ call "%OSGEO4W_ROOT%"\bin\o4w_env.bat
call "%OSGEO4W_ROOT%"\apps\grass\grass-@grassversion@\etc\env.bat
@echo off
path %PATH%;%OSGEO4W_ROOT%\apps\@package@\bin;%OSGEO4W_ROOT%\apps\grass\grass-@grassversion@\lib
start "Quantum GIS" /B "%OSGEO4W_ROOT%"\apps\@package@\bin\qgis.exe %*
set QGIS_PREFIX_PATH=@osgeo4w_msys@/apps/@package@
start "Quantum GIS" /B "%OSGEO4W_ROOT%"\bin\@package@.exe %*
56 changes: 0 additions & 56 deletions src/browser/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,69 +34,13 @@ int main( int argc, char ** argv )

QgsApplication a( argc, argv, true );
a.setThemeName( settings.value( "/Themes", "default" ).toString() );

// load providers
#if defined(Q_WS_WIN)
QString prefixPath = QApplication::applicationDirPath();
#else
QString prefixPath = QApplication::applicationDirPath() + "/..";
#endif
a.setPrefixPath( prefixPath, true );
a.initQgis();

// Set up the QSettings environment must be done after qapp is created
QCoreApplication::setOrganizationName( "QuantumGIS" );
QCoreApplication::setOrganizationDomain( "qgis.org" );
QCoreApplication::setApplicationName( "QGIS" );

#if 0
QString myTranslationCode = "";

// This is mostly copy from Help viewer - not sure if important
#if defined(Q_WS_MACX)
// If we're on Mac, we have the resource library way above us...
a.setPkgDataPath( QgsApplication::prefixPath() + "/../../../../" + QString( QGIS_DATA_SUBDIR ) );
#elif defined(Q_WS_WIN)
a.setPkgDataPath( QgsApplication::prefixPath() + "/" QGIS_DATA_SUBDIR );
#else
a.setPkgDataPath( QgsApplication::prefixPath() + "/../" QGIS_DATA_SUBDIR );
#endif

QString i18nPath = QgsApplication::i18nPath();
if ( myTranslationCode.isEmpty() )
{
myTranslationCode = QLocale::system().name();

QSettings settings;
if ( settings.value( "locale/overrideFlag", false ).toBool() )
{
myTranslationCode = settings.value( "locale/userLocale", "en_US" ).toString();
}
}
QgsDebugMsg( QString( "Setting translation to %1/qgis_%2" ).arg( i18nPath ).arg( myTranslationCode ) );

/* Translation file for Qt.
* The strings from the QMenuBar context section are used by Qt/Mac to shift
* the About, Preferences and Quit items to the Mac Application menu.
* These items must be translated identically in both qt_ and qgis_ files.
*/

QTranslator qttor( 0 );
if ( qttor.load( QString( "qt_" ) + myTranslationCode, i18nPath ) )
{
a.installTranslator( &qttor );
}

/* Translation file for QGIS.
*/

QTranslator qgistor( 0 );
if ( qgistor.load( QString( "qgis_" ) + myTranslationCode, i18nPath ) )
{
a.installTranslator( &qgistor );
}
#endif

QgsBrowser w;

a.connect( &a, SIGNAL( aboutToQuit() ), &w, SLOT( saveWindowState() ) );
Expand Down
18 changes: 13 additions & 5 deletions src/core/qgsapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,22 @@ void QgsApplication::init( QString customConfigPath )
}
else
{
char *prefixPath = getenv( "QGIS_PREFIX_PATH" );
if ( !prefixPath )
{
#if defined(Q_WS_MACX) || defined(Q_WS_WIN32) || defined(WIN32)
setPrefixPath( applicationDirPath(), true );
setPrefixPath( applicationDirPath(), true );
#else
QDir myDir( applicationDirPath() );
myDir.cdUp();
QString myPrefix = myDir.absolutePath();
setPrefixPath( myPrefix, true );
QDir myDir( applicationDirPath() );
myDir.cdUp();
QString myPrefix = myDir.absolutePath();
setPrefixPath( myPrefix, true );
#endif
}
else
{
setPrefixPath( prefixPath, true );
}
}

if ( !customConfigPath.isEmpty() )
Expand Down
6 changes: 0 additions & 6 deletions src/crssync/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ int main( int argc, char ** argv )
{
QgsApplication a( argc, argv, false );

if ( !QgsApplication::isRunningFromBuildDir() )
{
char *prefixPath = getenv( "QGIS_PREFIX_PATH" );
a.setPrefixPath( prefixPath ? prefixPath : CMAKE_INSTALL_PREFIX, true );
}

std::cout << "Synchronizing CRS database with PROJ definitions." << std::endl;

CPLPushErrorHandler( showError );
Expand Down

0 comments on commit 56ea83f

Please sign in to comment.