From: vsr Date: Wed, 26 Apr 2006 09:13:05 +0000 (+0000) Subject: Improvement: display splash screen for light configuration X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f57b68cd4619c91775c337fb3b8dc90f8b4bdbf3;p=modules%2Fgui.git Improvement: display splash screen for light configuration --- diff --git a/src/SUITApp/SUITApp.cxx b/src/SUITApp/SUITApp.cxx index 497906700..2b51d4d20 100644 --- a/src/SUITApp/SUITApp.cxx +++ b/src/SUITApp/SUITApp.cxx @@ -29,6 +29,7 @@ #include #include +#include #ifdef SUIT_ENABLE_PYTHON #include @@ -38,6 +39,7 @@ #include #include #include +#include #include @@ -101,7 +103,6 @@ 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; @@ -139,13 +140,16 @@ int main( int args, char* argv[] ) 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] ) ); } @@ -156,6 +160,47 @@ int main( int args, char* argv[] ) 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 ) { @@ -164,8 +209,12 @@ int main( int args, char* argv[] ) // if ( !app.mainWidget() ) // app.setMainWidget( theApp->desktop() ); + if ( splash ) + splash->finish( theApp->desktop() ); result = app.exec(); + if ( splash ) + delete splash; } delete aSession; }