diff --git a/cmake/FindPyQt.py b/cmake/FindPyQt.py index 5d2f9514d87..090fba51b2a 100644 --- a/cmake/FindPyQt.py +++ b/cmake/FindPyQt.py @@ -6,6 +6,7 @@ import PyQt4.pyqtconfig pyqtcfg = PyQt4.pyqtconfig.Configuration() print("pyqt_version:%06.0x" % pyqtcfg.pyqt_version) +print("pyqt_version_num:%d" % pyqtcfg.pyqt_version) print("pyqt_version_str:%s" % pyqtcfg.pyqt_version_str) pyqt_version_tag = "" diff --git a/cmake/FindPyQt4.cmake b/cmake/FindPyQt4.cmake index 37f645ea6c2..12ac7103f66 100644 --- a/cmake/FindPyQt4.cmake +++ b/cmake/FindPyQt4.cmake @@ -34,6 +34,7 @@ ELSE(EXISTS PYQT4_VERSION) STRING(REGEX REPLACE "^pyqt_version:([^\n]+).*$" "\\1" PYQT4_VERSION ${pyqt_config}) STRING(REGEX REPLACE ".*\npyqt_version_str:([^\n]+).*$" "\\1" PYQT4_VERSION_STR ${pyqt_config}) STRING(REGEX REPLACE ".*\npyqt_version_tag:([^\n]+).*$" "\\1" PYQT4_VERSION_TAG ${pyqt_config}) + STRING(REGEX REPLACE ".*\npyqt_version_num:([^\n]+).*$" "\\1" PYQT4_VERSION_NUM ${pyqt_config}) STRING(REGEX REPLACE ".*\npyqt_sip_dir:([^\n]+).*$" "\\1" PYQT4_SIP_DIR ${pyqt_config}) STRING(REGEX REPLACE ".*\npyqt_sip_flags:([^\n]+).*$" "\\1" PYQT4_SIP_FLAGS ${pyqt_config}) @@ -51,3 +52,5 @@ ELSE(EXISTS PYQT4_VERSION) ENDIF(PYQT4_FOUND) ENDIF(EXISTS PYQT4_VERSION) + + diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 2dbe4a154f5..c29dc78a198 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -35,9 +35,9 @@ IF(MSVC) ADD_DEFINITIONS(-DNOMINMAX) ENDIF(MSVC) -IF(PYQT4_VERSION_TAG LESS 263680) # 0x040600 +IF(PYQT4_VERSION_NUM LESS 263680) # 0x040600 SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} PROXY_FACTORY) -ENDIF(PYQT4_VERSION_TAG LESS 263680) +ENDIF(PYQT4_VERSION_NUM LESS 263680) # core module FILE(GLOB sip_files_core core/*.sip) diff --git a/src/providers/grass/qgis.g.info.c b/src/providers/grass/qgis.g.info.c index fb02bd15385..0aaa97a8fc8 100644 --- a/src/providers/grass/qgis.g.info.c +++ b/src/providers/grass/qgis.g.info.c @@ -108,7 +108,12 @@ int main( int argc, char **argv ) void *ptr; double val; +#if defined(GRASS_VERSION_MAJOR) && defined(GRASS_VERSION_MINOR) && \ + ( ( GRASS_VERSION_MAJOR == 6 && GRASS_VERSION_MINOR > 2 ) || GRASS_VERSION_MAJOR > 6 ) rast_type = G_get_raster_map_type( fd ); +#else + rast_type = G_raster_map_type( rast_opt->answer, "" ); +#endif cell = G_allocate_c_raster_buf(); dcell = G_allocate_d_raster_buf(); @@ -120,7 +125,7 @@ int main( int argc, char **argv ) rast_opt->answer, row ); } val = cell[col]; - ptr = &(cell[col]); + ptr = &( cell[col] ); } else { @@ -130,7 +135,7 @@ int main( int argc, char **argv ) rast_opt->answer, row ); } val = dcell[col]; - ptr = &(dcell[col]); + ptr = &( dcell[col] ); } if ( G_is_null_value( ptr, rast_type ) ) { diff --git a/src/providers/grass/qgsgrass.cpp b/src/providers/grass/qgsgrass.cpp index 072b505182c..e8574d9574d 100644 --- a/src/providers/grass/qgsgrass.cpp +++ b/src/providers/grass/qgsgrass.cpp @@ -40,6 +40,13 @@ extern "C" #include } +#if !defined(GRASS_VERSION_MAJOR) || \ + !defined(GRASS_VERSION_MINOR) || \ + GRASS_VERSION_MAJOR<6 || \ + (GRASS_VERSION_MAJOR == 6 && GRASS_VERSION_MINOR <= 2) +#define G__setenv(name,value) G__setenv( ( char * ) (name), (char *) (value) ) +#endif + #if defined(WIN32) #include QString GRASS_EXPORT QgsGrass::shortPath( const QString &path ) @@ -333,14 +340,14 @@ void QgsGrass::setLocation( QString gisdbase, QString location ) // Set principal GRASS variables (in memory) #if defined(WIN32) - G__setenv(( char * ) "GISDBASE", shortPath( gisdbase ).toLocal8Bit().data() ); + G__setenv( "GISDBASE", shortPath( gisdbase ).toLocal8Bit().data() ); #else - // This does not work for GISBAS with non ascii chars on Windows XP, + // This does not work for GISBASE with non ascii chars on Windows XP, // gives error 'LOCATION ... not available': - G__setenv(( char * ) "GISDBASE", gisdbase.toUtf8().constData() ); + G__setenv( "GISDBASE", gisdbase.toUtf8().constData() ); #endif - G__setenv(( char * ) "LOCATION_NAME", location.toUtf8().constData() ); - G__setenv(( char * ) "MAPSET", ( char * ) "PERMANENT" ); // PERMANENT must always exist + G__setenv( "LOCATION_NAME", location.toUtf8().constData() ); + G__setenv( "MAPSET", "PERMANENT" ); // PERMANENT must always exist // Add all available mapsets to search path char **ms = G_available_mapsets(); @@ -354,12 +361,12 @@ void QgsGrass::setMapset( QString gisdbase, QString location, QString mapset ) // Set principal GRASS variables (in memory) #if defined(WIN32) - G__setenv(( char * ) "GISDBASE", shortPath( gisdbase ).toUtf8().data() ); + G__setenv( "GISDBASE", shortPath( gisdbase ).toUtf8().data() ); #else - G__setenv(( char * ) "GISDBASE", gisdbase.toUtf8().data() ); + G__setenv( "GISDBASE", gisdbase.toUtf8().data() ); #endif - G__setenv(( char * ) "LOCATION_NAME", location.toUtf8().data() ); - G__setenv(( char * ) "MAPSET", mapset.toUtf8().data() ); + G__setenv( "LOCATION_NAME", location.toUtf8().data() ); + G__setenv( "MAPSET", mapset.toUtf8().data() ); // Add all available mapsets to search path char **ms = G_available_mapsets(); @@ -560,14 +567,14 @@ QString GRASS_EXPORT QgsGrass::openMapset( QString gisdbase, QString location, Q putEnv( "GISRC", mGisrc ); // Reinitialize GRASS - G__setenv(( char * ) "GISRC", mGisrc.toUtf8().data() ); + G__setenv( "GISRC", mGisrc.toUtf8().data() ); #if defined(WIN32) - G__setenv(( char * ) "GISDBASE", shortPath( gisdbase ).toLocal8Bit().data() ); + G__setenv( "GISDBASE", shortPath( gisdbase ).toLocal8Bit().data() ); #else - G__setenv(( char * ) "GISDBASE", gisdbase.toUtf8().data() ); + G__setenv( "GISDBASE", gisdbase.toUtf8().data() ); #endif - G__setenv(( char * ) "LOCATION_NAME", location.toLocal8Bit().data() ); - G__setenv(( char * ) "MAPSET", mapset.toLocal8Bit().data() ); + G__setenv( "LOCATION_NAME", location.toLocal8Bit().data() ); + G__setenv( "MAPSET", mapset.toLocal8Bit().data() ); defaultGisdbase = gisdbase; defaultLocation = location; defaultMapset = mapset; @@ -602,15 +609,15 @@ QString QgsGrass::closeMapset( ) putenv(( char * ) "GISRC" ); // Reinitialize GRASS - G__setenv(( char * ) "GISRC", ( char * ) "" ); + G__setenv( "GISRC", ( char * ) "" ); // Temporarily commented because of // http://trac.osgeo.org/qgis/ticket/1900 // http://trac.osgeo.org/gdal/ticket/3313 // it can be uncommented once GDAL with patch gets deployed (probably GDAL 1.8) - //G__setenv(( char * ) "GISDBASE", ( char * ) "" ); - //G__setenv(( char * ) "LOCATION_NAME", ( char * ) "" ); - //G__setenv(( char * ) "MAPSET", ( char * ) "" ); + //G__setenv( "GISDBASE", ( char * ) "" ); + //G__setenv( "LOCATION_NAME", ( char * ) "" ); + //G__setenv( "MAPSET", ( char * ) "" ); defaultGisdbase = ""; defaultLocation = "";