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