Skip to content

Commit

Permalink
use QString in QgsException to fix encoding
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12616 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Dec 24, 2009
1 parent b76cd81 commit e0c98fb
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 18 deletions.
9 changes: 9 additions & 0 deletions src/core/qgsapplication.cpp
Expand Up @@ -17,6 +17,7 @@
#include "qgsapplication.h"
#include "qgsmaplayerregistry.h"
#include "qgsproviderregistry.h"
#include "qgsexception.h"

#include <QDir>
#include <QMessageBox>
Expand Down Expand Up @@ -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;
}

Expand Down
1 change: 0 additions & 1 deletion src/core/qgscsexception.h
Expand Up @@ -25,7 +25,6 @@
class CORE_EXPORT QgsCsException : public QgsException
{
public:
QgsCsException( std::string const &what ) : QgsException( what ) {};
QgsCsException( QString const &what ) : QgsException( what ) {};

};
Expand Down
22 changes: 5 additions & 17 deletions src/core/qgsexception.h
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions src/plugins/diagram_overlay/qgsbardiagramfactory.cpp
Expand Up @@ -19,6 +19,7 @@
#include "qgsrendercontext.h"
#include <limits>
#include <QPainter>
#include <QDomNode>

QgsBarDiagramFactory::QgsBarDiagramFactory(): QgsWKNDiagramFactory(), mBarWidth( 5 )
{
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/diagram_overlay/qgsdiagramfactory.cpp
Expand Up @@ -15,6 +15,8 @@
* *
***************************************************************************/

#include <QDomNode>

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

Expand Down
2 changes: 2 additions & 0 deletions src/plugins/diagram_overlay/qgsdiagramoverlay.cpp
Expand Up @@ -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 )
{
Expand Down
1 change: 1 addition & 0 deletions src/plugins/diagram_overlay/qgssvgdiagramfactory.cpp
Expand Up @@ -19,6 +19,7 @@
#include "qgsrendercontext.h"
#include <QImage>
#include <QPainter>
#include <QDomNode>

QgsSVGDiagramFactory::QgsSVGDiagramFactory(): QgsDiagramFactory()
{
Expand Down

0 comments on commit e0c98fb

Please sign in to comment.