move QGIS_PREFIX_PATH support to QgsApplication

This commit is contained in:
Juergen E. Fischer 2012-06-18 18:26:31 +02:00
parent a1cb7fdcd3
commit 56ea83f582
6 changed files with 21 additions and 71 deletions

View File

@ -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 %*

View File

@ -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/" ^

View File

@ -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 %*

View File

@ -34,14 +34,6 @@ 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
@ -49,54 +41,6 @@ int main( int argc, char ** argv )
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() ) );

View File

@ -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() )

View File

@ -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 );