Skip to content
Permalink
Browse files

use QString in QgsException to fix encoding

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12616 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Dec 24, 2009
1 parent b76cd81 commit e0c98fb54c99aeb47cd386166d10b8d9b97a5107
@@ -17,6 +17,7 @@
#include "qgsapplication.h"
#include "qgsmaplayerregistry.h"
#include "qgsproviderregistry.h"
#include "qgsexception.h"

#include <QDir>
#include <QMessageBox>
@@ -87,10 +88,18 @@ bool QgsApplication::notify( QObject * receiver, QEvent * event )
{
done = QApplication::notify( receiver, event );
}
catch ( QgsException & e )
{
QMessageBox::critical( activeWindow(), tr( "Exception" ), e.what() );
}
catch ( std::exception & e )
{
QMessageBox::critical( activeWindow(), tr( "Exception" ), e.what() );
}
catch ( ... )
{
QMessageBox::critical( activeWindow(), tr( "Exception" ), "unknown exception" );
}
return done;
}

@@ -25,7 +25,6 @@
class CORE_EXPORT QgsCsException : public QgsException
{
public:
QgsCsException( std::string const &what ) : QgsException( what ) {};
QgsCsException( QString const &what ) : QgsException( what ) {};

};
@@ -18,40 +18,28 @@
#ifndef QGSEXCEPTION_H
#define QGSEXCEPTION_H

#include <exception>
#include <string>
#include <list>

#include <QDomNode>
#include <QDomDocument>

/** \ingroup core
* Defines a qgis exception class.
*/
class CORE_EXPORT QgsException : public std::exception
class CORE_EXPORT QgsException
{
public:

QgsException( std::string const & what )
: what_( what )
{}

QgsException( QString const & what )
: what_(( const char * )what.toLocal8Bit().data() )
: what_( what )
{}

virtual ~QgsException() throw()
{}

const char* what() const throw()
QString what() const throw()
{
return what_.c_str();
return what_;
}

private:

/// description of exception
std::string what_;
QString what_;

}; // class QgsException

@@ -19,6 +19,7 @@
#include "qgsrendercontext.h"
#include <limits>
#include <QPainter>
#include <QDomNode>

QgsBarDiagramFactory::QgsBarDiagramFactory(): QgsWKNDiagramFactory(), mBarWidth( 5 )
{
@@ -15,6 +15,8 @@
* *
***************************************************************************/

#include <QDomNode>

#include "qgsdiagramfactory.h"
#include "qgsrendercontext.h"

@@ -32,7 +32,9 @@
#include "qgssymbologyutils.h"
#include "qgsvectordataprovider.h"
#include "qgslogger.h"

#include <QPainter>
#include <QDomNode>

QgsDiagramOverlay::QgsDiagramOverlay( QgsVectorLayer* vl ): QgsVectorOverlay( vl ), mDiagramRenderer( 0 )
{
@@ -19,6 +19,7 @@
#include "qgsrendercontext.h"
#include <QImage>
#include <QPainter>
#include <QDomNode>

QgsSVGDiagramFactory::QgsSVGDiagramFactory(): QgsDiagramFactory()
{

0 comments on commit e0c98fb

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