1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/
19 #include "SUITApp_Application.h"
21 #include "SUIT_MessageBox.h"
22 #include "SUIT_ExceptionHandler.h"
25 #include <qfileinfo.h>
34 SUITApp_Application::SUITApp_Application( int& argc, char** argv, SUIT_ExceptionHandler* hand )
35 : QApplication( argc, argv ),
36 myExceptHandler( hand )
38 QString path = QFileInfo( argv[0] ).dirPath() + QDir::separator() + "../../resources";
39 path = QDir::convertSeparators( QDir( path ).canonicalPath() );
41 QTranslator* strTbl = new QTranslator( 0 );
42 if ( strTbl->load( "SUITApp_msg_en.po", path ) )
43 installTranslator( strTbl );
48 SUITApp_Application::SUITApp_Application( int& argc, char** argv, Type type, SUIT_ExceptionHandler* hand )
49 : QApplication( argc, argv, type ),
50 myExceptHandler( hand )
52 QTranslator* strTbl = new QTranslator( 0 );
53 strTbl->load( "resources\\SUITApp_msg_en.po" );
54 installTranslator( strTbl );
57 bool SUITApp_Application::notify( QObject* receiver, QEvent* e )
59 return myExceptHandler ? myExceptHandler->handle( receiver, e ) :
60 QApplication::notify( receiver, e );
63 void SUITApp_Application::setHandler( SUIT_ExceptionHandler* hand )
65 myExceptHandler = hand;
68 SUIT_ExceptionHandler* SUITApp_Application::handler() const
70 return myExceptHandler;