[QGIS Commit] r12751 - in trunk/qgis/src: core plugins/grass providers/grass

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Jan 12 13:51:47 EST 2010


Author: jef
Date: 2010-01-12 13:51:47 -0500 (Tue, 12 Jan 2010)
New Revision: 12751

Modified:
   trunk/qgis/src/core/qgsexception.h
   trunk/qgis/src/plugins/grass/qgsgrassplugin.cpp
   trunk/qgis/src/providers/grass/qgsgrass.cpp
   trunk/qgis/src/providers/grass/qgsgrass.h
Log:
derive QgsGrass::Exception from QgsException

Modified: trunk/qgis/src/core/qgsexception.h
===================================================================
--- trunk/qgis/src/core/qgsexception.h	2010-01-12 18:18:32 UTC (rev 12750)
+++ trunk/qgis/src/core/qgsexception.h	2010-01-12 18:51:47 UTC (rev 12751)
@@ -18,6 +18,8 @@
 #ifndef QGSEXCEPTION_H
 #define QGSEXCEPTION_H
 
+#include <QString>
+
 /** \ingroup core
   * Defines a qgis exception class.
  */

Modified: trunk/qgis/src/plugins/grass/qgsgrassplugin.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassplugin.cpp	2010-01-12 18:18:32 UTC (rev 12750)
+++ trunk/qgis/src/plugins/grass/qgsgrassplugin.cpp	2010-01-12 18:51:47 UTC (rev 12751)
@@ -337,7 +337,7 @@
     }
     catch ( QgsGrass::Exception &e )
     {
-      QMessageBox::warning( 0, tr( "Warning" ), tr( "Cannot open GRASS vector:\n %1" ).arg( QString::fromUtf8( e.what() ) ) );
+      QMessageBox::warning( 0, tr( "Warning" ), tr( "Cannot open GRASS vector:\n %1" ).arg( e.what() ) );
     }
 
     qGisInterface->addVectorLayer( uri, name, "grass" );
@@ -502,7 +502,7 @@
   catch ( QgsGrass::Exception &e )
   {
     QMessageBox::warning( 0, tr( "Warning" ),
-                          tr( "Cannot create new vector: %1" ).arg( QString::fromUtf8( e.what() ) ) );
+                          tr( "Cannot create new vector: %1" ).arg( e.what() ) );
     return;
   }
 

Modified: trunk/qgis/src/providers/grass/qgsgrass.cpp
===================================================================
--- trunk/qgis/src/providers/grass/qgsgrass.cpp	2010-01-12 18:18:32 UTC (rev 12750)
+++ trunk/qgis/src/providers/grass/qgsgrass.cpp	2010-01-12 18:51:47 UTC (rev 12751)
@@ -90,7 +90,7 @@
   // Init GRASS libraries (required)
   G_no_gisinit();  // Doesn't check write permissions for mapset compare to G_gisinit("libgrass++");
 
-  // I think that mask should not be used in QGIS as it can only confuse people, 
+  // I think that mask should not be used in QGIS as it can only confuses people,
   // anyway, I don't think anybody is using MASK
   G_suppress_masking();
 
@@ -397,8 +397,8 @@
 
   if ( fatal )
   {
-    // we have to do a long jump here, otherwise GRASS >= 6.3 will kill our process
-    throw QgsGrass::Exception( msg );
+    // we have to throw an exception here, otherwise GRASS >= 6.3 will kill our process
+    throw QgsGrass::Exception( QString::fromUtf8( msg ) );
   }
   else
     lastError = WARNING;
@@ -599,10 +599,10 @@
     // Reinitialize GRASS
     G__setenv(( char * ) "GISRC", ( char * ) "" );
 
-    // Temporarily commented because of 
+    // 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 depoyed (probably GDAL 1.8) 
+    // 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 * ) "" );

Modified: trunk/qgis/src/providers/grass/qgsgrass.h
===================================================================
--- trunk/qgis/src/providers/grass/qgsgrass.h	2010-01-12 18:18:32 UTC (rev 12750)
+++ trunk/qgis/src/providers/grass/qgsgrass.h	2010-01-12 18:51:47 UTC (rev 12751)
@@ -23,7 +23,7 @@
 #include <grass/form.h>
 }
 
-#include <stdexcept>
+#include "qgsexception.h"
 #include <QString>
 
 /*!
@@ -32,9 +32,9 @@
 class QgsGrass
 {
   public:
-    struct Exception : public std::runtime_error
+    struct Exception : public QgsException
     {
-      Exception( const std::string &msg ) : std::runtime_error( msg ) {}
+      Exception( const QString &msg ) : QgsException( msg ) {}
     };
 
     //! Get info about the mode



More information about the QGIS-commit mailing list