Skip to content

Commit

Permalink
Addendum to r9288. Header adjustments for Linux and removal of const …
Browse files Browse the repository at this point in the history
…for GRASS 6.2 compatibility.

git-svn-id: http://svn.osgeo.org/qgis/trunk@9291 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
telwertowski committed Sep 10, 2008
1 parent 98c3309 commit 2624cde
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/plugins/grass/qgsgrassattributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include <QHeaderView>
#include <QKeyEvent>
#include <QMessagebox>
#include <QMessageBox>
#include <QSettings>
#include <QTableWidget>

Expand Down
6 changes: 3 additions & 3 deletions src/plugins/grass/qgsgrassnewmapset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1256,13 +1256,13 @@ void QgsGrassNewMapset::createMapset()
// database path
QgsGrass::activeMode(); // because it calls private gsGrass::init()
#if defined(WIN32)
G__setenv( "GISDBASE", getShortPath( mDatabaseLineEdit->text() ).toAscii() );
G__setenv( "GISDBASE", getShortPath( mDatabaseLineEdit->text() ).toAscii().data() );
#else
G__setenv( "GISDBASE", mDatabaseLineEdit->text().toAscii() );
G__setenv( "GISDBASE", mDatabaseLineEdit->text().toAscii().data() );
#endif

QgsGrass::resetError();
int ret = G_make_location( location.toAscii(), &mCellHead,
int ret = G_make_location( location.toAscii().data(), &mCellHead,
mProjInfo, mProjUnits, stdout );

if ( ret != 0 )
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/grass/qgsgrassplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ void QgsGrassPlugin::displayRegion()
QgsGrass::setLocation( gisdbase, location );

struct Cell_head window;
char *err = G__get_window( &window, "", "WIND", mapset.toLatin1().constData() );
char *err = G__get_window( &window, "", "WIND", mapset.toLatin1().data() );

if ( err )
{
Expand Down
1 change: 1 addition & 0 deletions src/plugins/grass/qgsgrassplugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class QgsRubberBand;

class QAction;
class QIcon;
class QPainter;
class QToolBar;

/**
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/grass/qgsgrassregion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ QgsGrassRegion::QgsGrassRegion( QgsGrassPlugin *plugin, QgisInterface *iface,
}

QgsGrass::setLocation( gisdbase, location );
char *err = G__get_window( &mWindow, "", "WIND", mapset.toLatin1() );
char *err = G__get_window( &mWindow, "", "WIND", mapset.toLatin1().data() );

if ( err )
{
Expand Down Expand Up @@ -426,7 +426,7 @@ void QgsGrassRegion::accept()
}

QgsGrass::setLocation( QgsGrass::getDefaultGisdbase(), QgsGrass::getDefaultLocation() );
G__setenv( "MAPSET", QgsGrass::getDefaultMapset().toLatin1() );
G__setenv( "MAPSET", QgsGrass::getDefaultMapset().toLatin1().data() );

if ( G_put_window( &mWindow ) == -1 )
{
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/grass/qgsgrassselect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "qgslogger.h"

#include <QFileDialog>
#include <QMessagebox>
#include <QMessageBox>
#include <QSettings>

extern "C"
Expand Down
34 changes: 17 additions & 17 deletions src/providers/grass/qgsgrass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,11 @@ void QgsGrass::setLocation( QString gisdbase, QString location )

// Set principal GRASS variables (in memory)
#if defined(WIN32)
G__setenv( "GISDBASE", getShortPath( gisdbase ).toAscii().constData() );
G__setenv( "GISDBASE", getShortPath( gisdbase ).toAscii().data() );
#else
G__setenv( "GISDBASE", gisdbase.toAscii().constData() );
G__setenv( "GISDBASE", gisdbase.toAscii().data() );
#endif
G__setenv( "LOCATION_NAME", location.toAscii().constData() );
G__setenv( "LOCATION_NAME", location.toAscii().data() );
G__setenv( "MAPSET", "PERMANENT" ); // PERMANENT must always exist

// Add all available mapsets to search path
Expand All @@ -333,12 +333,12 @@ void QgsGrass::setMapset( QString gisdbase, QString location, QString mapset )

// Set principal GRASS variables (in memory)
#if defined(WIN32)
G__setenv( "GISDBASE", getShortPath( gisdbase ).toAscii().constData() );
G__setenv( "GISDBASE", getShortPath( gisdbase ).toAscii().data() );
#else
G__setenv( "GISDBASE", gisdbase.toAscii().constData() );
G__setenv( "GISDBASE", gisdbase.toAscii().data() );
#endif
G__setenv( "LOCATION_NAME", location.toAscii().constData() );
G__setenv( "MAPSET", mapset.toAscii().constData() );
G__setenv( "LOCATION_NAME", location.toAscii().data() );
G__setenv( "MAPSET", mapset.toAscii().data() );

// Add all available mapsets to search path
char **ms = G_available_mapsets();
Expand Down Expand Up @@ -557,14 +557,14 @@ QString GRASS_EXPORT QgsGrass::openMapset( QString gisdbase, QString location, Q
putenv( gisrcEnvChar );

// Reinitialize GRASS
G__setenv( "GISRC", gisrcEnv.toAscii().constData() );
G__setenv( "GISRC", gisrcEnv.toAscii().data() );
#if defined(WIN32)
G__setenv( "GISDBASE", getShortPath( gisdbase ).toAscii().constData() );
G__setenv( "GISDBASE", getShortPath( gisdbase ).toAscii().data() );
#else
G__setenv( "GISDBASE", gisdbase.toAscii().constData() );
G__setenv( "GISDBASE", gisdbase.toAscii().data() );
#endif
G__setenv( "LOCATION_NAME", location.toAscii().constData() );
G__setenv( "MAPSET", mapset.toAscii().constData() );
G__setenv( "LOCATION_NAME", location.toAscii().data() );
G__setenv( "MAPSET", mapset.toAscii().data() );
defaultGisdbase = gisdbase;
defaultLocation = location;
defaultMapset = mapset;
Expand Down Expand Up @@ -876,7 +876,7 @@ bool GRASS_EXPORT QgsGrass::region( QString gisbase,
{
QgsGrass::setLocation( gisbase, location );

if ( G__get_window( window, "", "WIND", mapset.toLocal8Bit().constData() ) )
if ( G__get_window( window, "", "WIND", mapset.toLocal8Bit().data() ) )
{
return false;
}
Expand Down Expand Up @@ -957,8 +957,8 @@ bool GRASS_EXPORT QgsGrass::mapRegion( int type, QString gisbase,
if ( type == Raster )
{

if ( G_get_cellhd( map.toLocal8Bit().constData(),
mapset.toLocal8Bit().constData(), window ) < 0 )
if ( G_get_cellhd( map.toLocal8Bit().data(),
mapset.toLocal8Bit().data(), window ) < 0 )
{
QMessageBox::warning( 0, QObject::tr( "Warning" ),
QObject::tr( "Cannot read raster map region" ) );
Expand Down Expand Up @@ -1010,8 +1010,8 @@ bool GRASS_EXPORT QgsGrass::mapRegion( int type, QString gisbase,
else if ( type == Region )
{
if ( G__get_window( window, "windows",
map.toLocal8Bit().constData(),
mapset.toLocal8Bit().constData() ) != NULL )
map.toLocal8Bit().data(),
mapset.toLocal8Bit().data() ) != NULL )
{
QMessageBox::warning( 0, QObject::tr( "Warning" ),
QObject::tr( "Cannot read region" ) );
Expand Down
10 changes: 5 additions & 5 deletions src/providers/grass/qgsgrassprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ int QgsGrassProvider::openMap( QString gisdbase, QString location, QString mapse
QgsDebugMsg( QString( "Setting gisdbase, location: %1, %2" ).arg( gisdbase ).arg( location ) );

// Find the vector
char *ms = G_find_vector2( mapName.toAscii().constData(), mapset.toAscii().constData() ) ;
char *ms = G_find_vector2( mapName.toAscii().data(), mapset.toAscii().data() ) ;

if ( ms == NULL )
{
Expand Down Expand Up @@ -1074,7 +1074,7 @@ void QgsGrassProvider::updateMap( int mapId )

// TODO: Should be done better / in other place ?
// TODO: Is it necessary for close ?
G__setenv( "MAPSET", map->mapset.toAscii().constData() );
G__setenv( "MAPSET", map->mapset.toAscii().data() );

if ( closeMap ) Vect_close( map->map );

Expand Down Expand Up @@ -1345,7 +1345,7 @@ bool QgsGrassProvider::isGrassEditable( void )
return false;

/* Check if current user is owner of mapset */
if ( G__mapset_permissions2( mGisdbase.toAscii().constData(), mLocation.toAscii().constData(), mMapset.toAscii().constData() ) != 1 )
if ( G__mapset_permissions2( mGisdbase.toAscii().data(), mLocation.toAscii().data(), mMapset.toAscii().data() ) != 1 )
return false;

// TODO: check format? (cannot edit OGR layers)
Expand Down Expand Up @@ -1423,7 +1423,7 @@ bool QgsGrassProvider::startEdit( void )

// Set current mapset (mapset was previously checked by isGrassEditable() )
// TODO: Should be done better / in other place ?
G__setenv( "MAPSET", map->mapset.toAscii().constData() );
G__setenv( "MAPSET", map->mapset.toAscii().data() );

Vect_close( map->map );

Expand Down Expand Up @@ -1499,7 +1499,7 @@ bool QgsGrassProvider::closeEdit( bool newMap )
// Set current mapset (mapset was previously checked by isGrassEditable() )
// TODO: Should be done better / in other place ?
// TODO: Is it necessary for build/close ?
G__setenv( "MAPSET", map->mapset.toAscii().constData() );
G__setenv( "MAPSET", map->mapset.toAscii().data() );

Vect_build_partial( map->map, GV_BUILD_NONE, NULL );
Vect_build( map->map, stderr );
Expand Down

0 comments on commit 2624cde

Please sign in to comment.