-#if defined WNT
-#undef SUIT_ENABLE_PYTHON
-//#else
-//#include "SUITconfig.h"
-#endif
-
-#include <qapplication.h>
-
-#include "SUIT_Session.h"
-#include "SUITApp_Application.h"
-
-#ifdef SUIT_ENABLE_PYTHON
-#include <Python.h>
-#endif
-
-#include <qstringlist.h>
-
-int main( int args, char* argv[] )
-{
-#ifdef SUIT_ENABLE_PYTHON
- Py_Initialize();
- PySys_SetArgv( args, argv );
-#endif
-
- QStringList argList;
- bool noExceptHandling = false;
- for ( int i = 1; i < args && !noExceptHandling; i++ )
- {
- if ( !strcmp( argv[i], "/noexcepthandling" ) )
- noExceptHandling = true;
- else
- argList.append( QString( argv[i] ) );
- }
-
- SUITApp_Application app( args, argv );
-
- int result = -1;
- if ( !argList.isEmpty() )
- {
- SUIT_Session* aSession = new SUIT_Session();
- if ( aSession->startApplication( argList.first() ) )
- {
- if ( !noExceptHandling )
- app.setHandler( aSession->handler() );
-
- result = app.exec();
- }
- delete aSession;
- }
-
- return result;
-}
+#if defined WNT\r
+#undef SUIT_ENABLE_PYTHON\r
+//#else\r
+//#include "SUITconfig.h"\r
+#endif\r
+\r
+#include <qapplication.h>\r
+\r
+#include "SUIT_Session.h"\r
+#include "SUIT_ResourceMgr.h"\r
+#include "SUITApp_Application.h"\r
+\r
+#ifdef SUIT_ENABLE_PYTHON\r
+#include <Python.h>\r
+#endif\r
+\r
+#include <stdlib.h>\r
+\r
+#include <qstringlist.h>\r
+#include <qfile.h>\r
+#include <qdir.h>\r
+#include <qstring.h>\r
+\r
+QString salomeVersion()\r
+{\r
+ QString path( ::getenv( "GUI_ROOT_DIR" ) );\r
+ if ( !path.isEmpty() )\r
+ path += QDir::separator();\r
+ path += QString( "bin/salome/VERSION" );\r
+\r
+ QFile vf( path );\r
+ if ( !vf.open( IO_ReadOnly ) )\r
+ return QString::null;\r
+\r
+ QString line;\r
+ vf.readLine( line, 1024 );\r
+ vf.close();\r
+\r
+ if ( line.isEmpty() )\r
+ return QString::null;\r
+\r
+ while ( !line.isEmpty() && line.at( line.length() - 1 ) == QChar( '\n' ) )\r
+ line.remove( line.length() - 1, 1 );\r
+\r
+ QString ver;\r
+ int idx = line.findRev( ":" );\r
+ if ( idx != -1 )\r
+ ver = line.mid( idx + 1 ).stripWhiteSpace();\r
+\r
+ return ver;\r
+}\r
+\r
+/* XPM */\r
+static const char* pixmap_not_found_xpm[] = {\r
+"16 16 3 1",\r
+" c None",\r
+". c #000000",\r
+"+ c #A80000",\r
+" ",\r
+" ",\r
+" . . ",\r
+" .+. .+. ",\r
+" .+++. .+++. ",\r
+" .+++.+++. ",\r
+" .+++++. ",\r
+" .+++. ",\r
+" .+++++. ",\r
+" .+++.+++. ",\r
+" .+++. .+++. ",\r
+" .+. .+. ",\r
+" . . ",\r
+" ",\r
+" ",\r
+" "};\r
+\r
+class SUITApp_Session: public SUIT_Session\r
+{\r
+public:\r
+ SUITApp_Session( bool theIniFormat ) : SUIT_Session(), myIniFormat ( theIniFormat ) {}\r
+ virtual ~SUITApp_Session() {}\r
+\r
+protected:\r
+ virtual SUIT_ResourceMgr* createResourceMgr( const QString& appName ) const\r
+ {\r
+ SUIT_ResourceMgr* resMgr;\r
+ if ( myIniFormat )\r
+ resMgr = new SUIT_ResourceMgr( appName );\r
+ else {\r
+ resMgr = new SUIT_ResourceMgr( appName, QString( "%1Config" ) );\r
+ resMgr->setVersion( salomeVersion() );\r
+ resMgr->setCurrentFormat( "xml" );\r
+ resMgr->setOption( "translators", QString( "%P_msg_%L.qm|%P_icons.qm|%P_images.qm" ) );\r
+ static QPixmap defaultPixmap( pixmap_not_found_xpm );\r
+ resMgr->setDefaultPixmap( defaultPixmap );\r
+ }\r
+ return resMgr;\r
+ }\r
+private:\r
+ bool myIniFormat;\r
+};\r
+\r
+\r
+int main( int args, char* argv[] )\r
+{\r
+#ifdef SUIT_ENABLE_PYTHON\r
+ Py_Initialize();\r
+ PySys_SetArgv( args, argv );\r
+#endif\r
+ \r
+ QStringList argList;\r
+ bool noExceptHandling = false;\r
+ bool iniFormat = false;\r
+ for ( int i = 1; i < args /*&& !noExceptHandling*/; i++ )\r
+ {\r
+ if ( !strcmp( argv[i], "/noexcepthandling" ) )\r
+ noExceptHandling = true;\r
+ else if ( !strcmp( argv[i], "--format=ini") )\r
+ iniFormat = true;\r
+ else\r
+ argList.append( QString( argv[i] ) );\r
+ }\r
+\r
+\r
+ SUITApp_Application app( args, argv );\r
+\r
+ int result = -1;\r
+ if ( !argList.isEmpty() )\r
+ {\r
+ SUITApp_Session* aSession = new SUITApp_Session( iniFormat );\r
+ if ( aSession->startApplication( argList.first() ) )\r
+ {\r
+ if ( !noExceptHandling )\r
+ app.setHandler( aSession->handler() );\r
+\r
+ result = app.exec();\r
+ }\r
+ delete aSession;\r
+ }\r
+\r
+ return result;\r
+}\r