Skip to content

Commit 8cc3c65

Browse files
author
jef
committedDec 24, 2009
use QString in QgsException to fix encoding
git-svn-id: http://svn.osgeo.org/qgis/trunk@12616 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent ed0d9da commit 8cc3c65

File tree

7 files changed

+20
-18
lines changed

7 files changed

+20
-18
lines changed
 

‎src/core/qgsapplication.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "qgsapplication.h"
1818
#include "qgsmaplayerregistry.h"
1919
#include "qgsproviderregistry.h"
20+
#include "qgsexception.h"
2021

2122
#include <QDir>
2223
#include <QMessageBox>
@@ -87,10 +88,18 @@ bool QgsApplication::notify( QObject * receiver, QEvent * event )
8788
{
8889
done = QApplication::notify( receiver, event );
8990
}
91+
catch ( QgsException & e )
92+
{
93+
QMessageBox::critical( activeWindow(), tr( "Exception" ), e.what() );
94+
}
9095
catch ( std::exception & e )
9196
{
9297
QMessageBox::critical( activeWindow(), tr( "Exception" ), e.what() );
9398
}
99+
catch ( ... )
100+
{
101+
QMessageBox::critical( activeWindow(), tr( "Exception" ), "unknown exception" );
102+
}
94103
return done;
95104
}
96105

‎src/core/qgscsexception.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
class CORE_EXPORT QgsCsException : public QgsException
2626
{
2727
public:
28-
QgsCsException( std::string const &what ) : QgsException( what ) {};
2928
QgsCsException( QString const &what ) : QgsException( what ) {};
3029

3130
};

‎src/core/qgsexception.h

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,28 @@
1818
#ifndef QGSEXCEPTION_H
1919
#define QGSEXCEPTION_H
2020

21-
#include <exception>
22-
#include <string>
23-
#include <list>
24-
25-
#include <QDomNode>
26-
#include <QDomDocument>
27-
2821
/** \ingroup core
2922
* Defines a qgis exception class.
3023
*/
31-
class CORE_EXPORT QgsException : public std::exception
24+
class CORE_EXPORT QgsException
3225
{
3326
public:
34-
35-
QgsException( std::string const & what )
36-
: what_( what )
37-
{}
38-
3927
QgsException( QString const & what )
40-
: what_(( const char * )what.toLocal8Bit().data() )
28+
: what_( what )
4129
{}
4230

4331
virtual ~QgsException() throw()
4432
{}
4533

46-
const char* what() const throw()
34+
QString what() const throw()
4735
{
48-
return what_.c_str();
36+
return what_;
4937
}
5038

5139
private:
5240

5341
/// description of exception
54-
std::string what_;
42+
QString what_;
5543

5644
}; // class QgsException
5745

‎src/plugins/diagram_overlay/qgsbardiagramfactory.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "qgsrendercontext.h"
2020
#include <limits>
2121
#include <QPainter>
22+
#include <QDomNode>
2223

2324
QgsBarDiagramFactory::QgsBarDiagramFactory(): QgsWKNDiagramFactory(), mBarWidth( 5 )
2425
{

‎src/plugins/diagram_overlay/qgsdiagramfactory.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* *
1616
***************************************************************************/
1717

18+
#include <QDomNode>
19+
1820
#include "qgsdiagramfactory.h"
1921
#include "qgsrendercontext.h"
2022

‎src/plugins/diagram_overlay/qgsdiagramoverlay.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
#include "qgssymbologyutils.h"
3333
#include "qgsvectordataprovider.h"
3434
#include "qgslogger.h"
35+
3536
#include <QPainter>
37+
#include <QDomNode>
3638

3739
QgsDiagramOverlay::QgsDiagramOverlay( QgsVectorLayer* vl ): QgsVectorOverlay( vl ), mDiagramRenderer( 0 )
3840
{

‎src/plugins/diagram_overlay/qgssvgdiagramfactory.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "qgsrendercontext.h"
2020
#include <QImage>
2121
#include <QPainter>
22+
#include <QDomNode>
2223

2324
QgsSVGDiagramFactory::QgsSVGDiagramFactory(): QgsDiagramFactory()
2425
{

0 commit comments

Comments
 (0)
Please sign in to comment.