#include <SUIT_Desktop.h>
#include <SUIT_ResourceMgr.h>
+#include <QtxSplash.h>
#ifdef SUIT_ENABLE_PYTHON
#include <Python.h>
#include <qfile.h>
#include <qstring.h>
#include <qstringlist.h>
+#include <qregexp.h>
#include <stdlib.h>
SUITApp_Session( bool theIniFormat ) : SUIT_Session(), myIniFormat ( theIniFormat ) {}
virtual ~SUITApp_Session() {}
-protected:
virtual SUIT_ResourceMgr* createResourceMgr( const QString& appName ) const
{
SUIT_ResourceMgr* resMgr = 0;
QStringList argList;
bool noExceptHandling = false;
- bool iniFormat = false;
+ bool iniFormat = false;
+ bool noSplash = false;
for ( int i = 1; i < args /*&& !noExceptHandling*/; i++ )
{
- if ( !strcmp( argv[i], "/noexcepthandling" ) )
+ if ( !strcmp( argv[i], "--noexcepthandling" ) )
noExceptHandling = true;
else if ( !strcmp( argv[i], "--format=ini") )
iniFormat = true;
+ else if ( !strcmp( argv[i], "--nosplash") )
+ noSplash = true;
else
argList.append( QString( argv[i] ) );
}
if ( !argList.isEmpty() )
{
SUITApp_Session* aSession = new SUITApp_Session( iniFormat );
+ QtxSplash* splash = 0;
+ if ( !noSplash ) {
+ SUIT_ResourceMgr* resMgr = aSession->createResourceMgr( argList.first() );
+ if ( resMgr ) {
+ resMgr->loadLanguage();
+ QString splashIcon, splashInfo, splashTextColors;
+ resMgr->value( "about", "splash", splashIcon );
+ resMgr->value( "about", "splash_info", splashInfo, false );
+ resMgr->value( "about", "splash_text_colors", splashTextColors );
+ 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 );
+#endif
+ QFont f = splash->font();
+ f.setBold( true );
+ splash->setFont( f );
+ if ( !splashInfo.isEmpty() ) {
+ splashInfo.replace( QRegExp( "%A" ), QObject::tr( "APP_NAME" ) );
+ splashInfo.replace( QRegExp( "%V" ), QObject::tr( "ABOUT_VERSION" ).arg( salomeVersion() ) );
+ 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();
+ }
+ }
+ }
SUIT_Application* theApp = aSession->startApplication( argList.first() );
if ( theApp )
{
// if ( !app.mainWidget() )
// app.setMainWidget( theApp->desktop() );
+ if ( splash )
+ splash->finish( theApp->desktop() );
result = app.exec();
+ if ( splash )
+ delete splash;
}
delete aSession;
}