Skip to content

Commit 56ea83f

Browse files
committedJun 18, 2012
move QGIS_PREFIX_PATH support to QgsApplication
1 parent a1cb7fd commit 56ea83f

File tree

6 files changed

+21
-71
lines changed

6 files changed

+21
-71
lines changed
 

‎ms-windows/osgeo4w/browser.bat.tmpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ call "%OSGEO4W_ROOT%"\bin\o4w_env.bat
55
call "%OSGEO4W_ROOT%"\apps\grass\grass-@grassversion@\etc\env.bat
66
@echo off
77
path %PATH%;%OSGEO4W_ROOT%\apps\@package@\bin;%OSGEO4W_ROOT%\apps\grass\grass-@grassversion@\lib
8-
start "Quantum GIS Browser" /B "%OSGEO4W_ROOT%"\apps\@package@\bin\qbrowser.exe %*
8+
set QGIS_PREFIX_PATH=@osgeo4w_msys@/apps/@package@
9+
start "Quantum GIS Browser" /B "%OSGEO4W_ROOT%"\@package@-browser.exe %*

‎ms-windows/osgeo4w/package.cmd

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,13 @@ tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-server-%VERSION%-%PACKAGE%.tar.bz2 ^
206206
>>%LOG% 2>&1
207207
if errorlevel 1 goto error
208208

209+
move apps\%PACKAGENAME%\bin\qgis.exe bin\%PACKAGENAME%.exe
210+
move apps\%PACKAGENAME%\bin\qbrowser.exe bin\%PACKAGENAME%-browser.exe
209211
tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2 ^
210212
--exclude-from exclude ^
211213
--exclude "*.pyc" ^
212-
"apps/%PACKAGENAME%/bin/qbrowser.exe" ^
213-
"apps/%PACKAGENAME%/bin/qgis.exe" ^
214+
"bin/%PACKAGENAME%-browser.exe" ^
215+
"bin/%PACKAGENAME%.exe" ^
214216
"apps/%PACKAGENAME%/bin/qgis.reg.tmpl" ^
215217
"apps/%PACKAGENAME%/i18n/" ^
216218
"apps/%PACKAGENAME%/icons/" ^

‎ms-windows/osgeo4w/qgis.bat.tmpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ call "%OSGEO4W_ROOT%"\bin\o4w_env.bat
55
call "%OSGEO4W_ROOT%"\apps\grass\grass-@grassversion@\etc\env.bat
66
@echo off
77
path %PATH%;%OSGEO4W_ROOT%\apps\@package@\bin;%OSGEO4W_ROOT%\apps\grass\grass-@grassversion@\lib
8-
start "Quantum GIS" /B "%OSGEO4W_ROOT%"\apps\@package@\bin\qgis.exe %*
8+
set QGIS_PREFIX_PATH=@osgeo4w_msys@/apps/@package@
9+
start "Quantum GIS" /B "%OSGEO4W_ROOT%"\bin\@package@.exe %*

‎src/browser/main.cpp

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -34,69 +34,13 @@ int main( int argc, char ** argv )
3434

3535
QgsApplication a( argc, argv, true );
3636
a.setThemeName( settings.value( "/Themes", "default" ).toString() );
37-
38-
// load providers
39-
#if defined(Q_WS_WIN)
40-
QString prefixPath = QApplication::applicationDirPath();
41-
#else
42-
QString prefixPath = QApplication::applicationDirPath() + "/..";
43-
#endif
44-
a.setPrefixPath( prefixPath, true );
4537
a.initQgis();
4638

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

52-
#if 0
53-
QString myTranslationCode = "";
54-
55-
// This is mostly copy from Help viewer - not sure if important
56-
#if defined(Q_WS_MACX)
57-
// If we're on Mac, we have the resource library way above us...
58-
a.setPkgDataPath( QgsApplication::prefixPath() + "/../../../../" + QString( QGIS_DATA_SUBDIR ) );
59-
#elif defined(Q_WS_WIN)
60-
a.setPkgDataPath( QgsApplication::prefixPath() + "/" QGIS_DATA_SUBDIR );
61-
#else
62-
a.setPkgDataPath( QgsApplication::prefixPath() + "/../" QGIS_DATA_SUBDIR );
63-
#endif
64-
65-
QString i18nPath = QgsApplication::i18nPath();
66-
if ( myTranslationCode.isEmpty() )
67-
{
68-
myTranslationCode = QLocale::system().name();
69-
70-
QSettings settings;
71-
if ( settings.value( "locale/overrideFlag", false ).toBool() )
72-
{
73-
myTranslationCode = settings.value( "locale/userLocale", "en_US" ).toString();
74-
}
75-
}
76-
QgsDebugMsg( QString( "Setting translation to %1/qgis_%2" ).arg( i18nPath ).arg( myTranslationCode ) );
77-
78-
/* Translation file for Qt.
79-
* The strings from the QMenuBar context section are used by Qt/Mac to shift
80-
* the About, Preferences and Quit items to the Mac Application menu.
81-
* These items must be translated identically in both qt_ and qgis_ files.
82-
*/
83-
84-
QTranslator qttor( 0 );
85-
if ( qttor.load( QString( "qt_" ) + myTranslationCode, i18nPath ) )
86-
{
87-
a.installTranslator( &qttor );
88-
}
89-
90-
/* Translation file for QGIS.
91-
*/
92-
93-
QTranslator qgistor( 0 );
94-
if ( qgistor.load( QString( "qgis_" ) + myTranslationCode, i18nPath ) )
95-
{
96-
a.installTranslator( &qgistor );
97-
}
98-
#endif
99-
10044
QgsBrowser w;
10145

10246
a.connect( &a, SIGNAL( aboutToQuit() ), &w, SLOT( saveWindowState() ) );

‎src/core/qgsapplication.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,22 @@ void QgsApplication::init( QString customConfigPath )
127127
}
128128
else
129129
{
130+
char *prefixPath = getenv( "QGIS_PREFIX_PATH" );
131+
if ( !prefixPath )
132+
{
130133
#if defined(Q_WS_MACX) || defined(Q_WS_WIN32) || defined(WIN32)
131-
setPrefixPath( applicationDirPath(), true );
134+
setPrefixPath( applicationDirPath(), true );
132135
#else
133-
QDir myDir( applicationDirPath() );
134-
myDir.cdUp();
135-
QString myPrefix = myDir.absolutePath();
136-
setPrefixPath( myPrefix, true );
136+
QDir myDir( applicationDirPath() );
137+
myDir.cdUp();
138+
QString myPrefix = myDir.absolutePath();
139+
setPrefixPath( myPrefix, true );
137140
#endif
141+
}
142+
else
143+
{
144+
setPrefixPath( prefixPath, true );
145+
}
138146
}
139147

140148
if ( !customConfigPath.isEmpty() )

‎src/crssync/main.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ int main( int argc, char ** argv )
4040
{
4141
QgsApplication a( argc, argv, false );
4242

43-
if ( !QgsApplication::isRunningFromBuildDir() )
44-
{
45-
char *prefixPath = getenv( "QGIS_PREFIX_PATH" );
46-
a.setPrefixPath( prefixPath ? prefixPath : CMAKE_INSTALL_PREFIX, true );
47-
}
48-
4943
std::cout << "Synchronizing CRS database with PROJ definitions." << std::endl;
5044

5145
CPLPushErrorHandler( showError );

0 commit comments

Comments
 (0)
Please sign in to comment.