//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#if defined WNT
+#if defined WIN32
#undef SUIT_ENABLE_PYTHON
//#else
#include "SUITApp_Application.h"
#include <SUIT_Session.h>
-#include <SUIT_Desktop.h>
+//#include <SUIT_Desktop.h>
#include <SUIT_ResourceMgr.h>
-#include <QtxSplash.h>
+// TODO
+//#include <QtxSplash.h>
#ifdef SUIT_ENABLE_PYTHON
#include <Python.h>
#endif
-#include <qdir.h>
-#include <qfile.h>
-#include <qstring.h>
-#include <qstringlist.h>
-#include <qregexp.h>
+#include <QDir>
+#include <QFile>
+//#include <QRegExp>
+#include <QString>
+#include <QStringList>
#include <stdlib.h>
path += QString( "bin/salome/VERSION" );
QFile vf( path );
- if ( !vf.open( IO_ReadOnly ) )
+ if ( !vf.open( QFile::ReadOnly ) )
return QString::null;
- QString line;
- vf.readLine( line, 1024 );
+ QString line = vf.readLine( 1024 );
vf.close();
if ( line.isEmpty() )
line.remove( line.length() - 1, 1 );
QString ver;
- int idx = line.findRev( ":" );
+ int idx = line.lastIndexOf( ":" );
if ( idx != -1 )
- ver = line.mid( idx + 1 ).stripWhiteSpace();
+ ver = line.mid( idx + 1 ).trimmed();
return ver;
}
SUIT_ResourceMgr* resMgr = 0;
if ( myIniFormat )
{
- resMgr = new SUIT_ResourceMgr( appName );
+ resMgr = new SUIT_ResourceMgr( appName, QString( "%1Config" ) );
resMgr->setCurrentFormat( "ini" );
}
else
if ( !argList.isEmpty() )
{
SUITApp_Session* aSession = new SUITApp_Session( iniFormat );
+ // TODO
+/*
QtxSplash* splash = 0;
- if ( !noSplash ) {
+ if ( !noSplash )
+ {
SUIT_ResourceMgr* resMgr = aSession->createResourceMgr( argList.first() );
- if ( resMgr ) {
- resMgr->loadLanguage();
- QString splashIcon, splashInfo, splashTextColors;
- resMgr->value( "splash", "image", splashIcon );
- resMgr->value( "splash", "info", splashInfo, false );
- resMgr->value( "splash", "text_colors", splashTextColors );
- QString appName = QObject::tr( "APP_NAME" ).stripWhiteSpace();
- QString appVersion = QObject::tr( "APP_VERSION" ).stripWhiteSpace();
- if ( appVersion == "APP_VERSION" ) {
- if ( appName == "APP_NAME" || appName.lower() == "salome" )
- appVersion = salomeVersion();
- else
- appVersion = "";
- }
- QPixmap px( splashIcon );
- if ( !px.isNull() ) {
- splash = QtxSplash::splash( px );
- if ( !splashTextColors.isEmpty() ) {
- QStringList colors = QStringList::split( "|", splashTextColors );
- QColor c1, c2;
- if ( colors.count() > 0 ) c1 = QColor( colors[0] );
- if ( colors.count() > 1 ) c2 = QColor( colors[1] );
- splash->setTextColors( c1, c2 );
- }
- else {
- splash->setTextColors( Qt::white, Qt::black );
- }
+ if ( resMgr )
+ {
+ resMgr->loadLanguage();
+ QString splashIcon, splashInfo, splashTextColors;
+ resMgr->value( "splash", "image", splashIcon );
+ resMgr->value( "splash", "info", splashInfo, false );
+ resMgr->value( "splash", "text_colors", splashTextColors );
+ QString appName = QObject::tr( "APP_NAME" ).stripWhiteSpace();
+ QString appVersion = QObject::tr( "APP_VERSION" ).stripWhiteSpace();
+ if ( appVersion == "APP_VERSION" )
+ {
+ if ( appName == "APP_NAME" || appName.toLower() == "salome" )
+ appVersion = salomeVersion();
+ else
+ appVersion = "";
+ }
+ QPixmap px( splashIcon );
+ if ( !px.isNull() )
+ {
+ splash = QtxSplash::splash( px );
+ if ( !splashTextColors.isEmpty() )
+ {
+ QStringList colors = QStringList::split( "|", splashTextColors );
+ QColor c1, c2;
+ if ( colors.count() > 0 )
+ c1 = QColor( colors[0] );
+ if ( colors.count() > 1 )
+ c2 = QColor( colors[1] );
+ splash->setTextColors( c1, c2 );
+ }
+ else
+ {
+ splash->setTextColors( Qt::white, Qt::black );
+ }
#ifdef _DEBUG_
- splash->setHideOnClick( true );
+ splash->setHideOnClick( true );
#endif
- QFont f = splash->font();
- f.setBold( true );
- splash->setFont( f );
- if ( !splashInfo.isEmpty() ) {
- splashInfo.replace( QRegExp( "%A" ), appName );
- splashInfo.replace( QRegExp( "%V" ), QObject::tr( "ABOUT_VERSION" ).arg( appVersion ) );
- splashInfo.replace( QRegExp( "%L" ), QObject::tr( "ABOUT_LICENSE" ) );
- splashInfo.replace( QRegExp( "%C" ), QObject::tr( "ABOUT_COPYRIGHT" ) );
- splashInfo.replace( QRegExp( "\\\\n" ), "\n" );
- splash->message( splashInfo );
- }
- splash->show();
- qApp->processEvents();
- }
+ QFont f = splash->font();
+ f.setBold( true );
+ splash->setFont( f );
+ if ( !splashInfo.isEmpty() )
+ {
+ splashInfo.replace( QRegExp( "%A" ), appName );
+ splashInfo.replace( QRegExp( "%V" ), QObject::tr( "ABOUT_VERSION" ).arg( appVersion ) );
+ splashInfo.replace( QRegExp( "%L" ), QObject::tr( "ABOUT_LICENSE" ) );
+ splashInfo.replace( QRegExp( "%C" ), QObject::tr( "ABOUT_COPYRIGHT" ) );
+ splashInfo.replace( QRegExp( "\\\\n" ), "\n" );
+ splash->message( splashInfo );
+ }
+ splash->show();
+ QApplication::instance()->processEvents();
+ }
}
}
+*/
SUIT_Application* theApp = aSession->startApplication( argList.first() );
if ( theApp )
{
if ( !noExceptHandling )
app.setHandler( aSession->handler() );
-// if ( !app.mainWidget() )
-// app.setMainWidget( theApp->desktop() );
- if ( splash )
- splash->finish( theApp->desktop() );
+// TODO
+// if ( splash )
+// splash->finish( theApp->desktop() );
result = app.exec();
- if ( splash )
- delete splash;
+// TODO
+// delete splash;
}
delete aSession;
}
//
#include "SUITApp_Application.h"
-#include "SUIT_Session.h"
-#include "SUIT_MessageBox.h"
-#include "SUIT_ExceptionHandler.h"
+#include <SUIT_Tools.h>
+#include <SUIT_ExceptionHandler.h>
-#include <qdir.h>
-#include <qfileinfo.h>
+#include <QDir>
+#include <QTranslator>
#ifdef WIN32
#include <windows.h>
: QApplication( argc, argv ),
myExceptHandler( hand )
{
- QString path = QFileInfo( argv[0] ).dirPath() + QDir::separator() + "../../resources";
+ QString path = SUIT_Tools::dir( argv[0] ) + QDir::separator() + "../../resources";
path = QDir::convertSeparators( QDir( path ).canonicalPath() );
QTranslator* strTbl = new QTranslator( 0 );
*/
bool SUITApp_Application::notify( QObject* receiver, QEvent* e )
{
-#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) < 0x060101
- // Disable GUI user actions while python command is executed
- if (SUIT_Session::IsPythonExecuted()) {
- // Disable mouse and keyboard events
- QEvent::Type aType = e->type();
- if (aType == QEvent::MouseButtonPress || aType == QEvent::MouseButtonRelease ||
- aType == QEvent::MouseButtonDblClick || aType == QEvent::MouseMove ||
- aType == QEvent::Wheel || aType == QEvent::ContextMenu ||
- aType == QEvent::KeyPress || aType == QEvent::KeyRelease ||
- aType == QEvent::Accel || aType == QEvent::AccelOverride)
- return false;
- }
-#endif
-
return myExceptHandler ? myExceptHandler->handle( receiver, e ) :
QApplication::notify( receiver, e );
}