Skip to content
Permalink
Browse files

move QGIS_PREFIX_PATH support to QgsApplication

  • Loading branch information
jef-n committed Jun 18, 2012
1 parent a1cb7fd commit 56ea83f582c53aa3762d403bb7d07f5780a2f615
@@ -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 %*
@@ -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/" ^
@@ -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 %*
@@ -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() ) );
@@ -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() )
@@ -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 );

0 comments on commit 56ea83f

Please sign in to comment.
You can’t perform that action at this time.