From: vsr Date: Tue, 29 Jan 2008 08:55:45 +0000 (+0000) Subject: Improve splash screen: add margin attribute X-Git-Tag: for_M2008_07022008~11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=163cf8373fb295d98e95bc43d602649d866e355b;p=modules%2Fgui.git Improve splash screen: add margin attribute --- diff --git a/src/LightApp/resources/LightApp.xml b/src/LightApp/resources/LightApp.xml index 0d47f5dbb..0c2f9ee0c 100644 --- a/src/LightApp/resources/LightApp.xml +++ b/src/LightApp/resources/LightApp.xml @@ -18,6 +18,7 @@ +
diff --git a/src/SUITApp/SUITApp.cxx b/src/SUITApp/SUITApp.cxx index f343c435e..db686afad 100644 --- a/src/SUITApp/SUITApp.cxx +++ b/src/SUITApp/SUITApp.cxx @@ -165,10 +165,6 @@ int main( int args, char* argv[] ) 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" ) { @@ -177,10 +173,17 @@ int main( int args, char* argv[] ) else appVersion = ""; } + QString splashIcon; + resMgr->value( "splash", "image", splashIcon ); QPixmap px( splashIcon ); if ( !px.isNull() ) { splash = QtxSplash::splash( px ); - if ( !splashTextColors.isEmpty() ) { + int splashMargin; + if ( resMgr->value( "splash", "margin", splashMargin ) && splashMargin > 0 ) { + splash->setMargin( splashMargin ); + } + QString splashTextColors; + if ( resMgr->value( "splash", "text_colors", splashTextColors ) && !splashTextColors.isEmpty() ) { QStringList colors = QStringList::split( "|", splashTextColors ); QColor c1, c2; if ( colors.count() > 0 ) c1 = QColor( colors[0] ); @@ -196,7 +199,8 @@ int main( int args, char* argv[] ) QFont f = splash->font(); f.setBold( true ); splash->setFont( f ); - if ( !splashInfo.isEmpty() ) { + QString splashInfo; + if ( resMgr->value( "splash", "info", splashInfo, false ) && !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" ) ); diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index e6b7b6474..b1cde1c20 100755 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -433,19 +433,22 @@ int main( int argc, char **argv ) resMgr.setCurrentFormat( "xml" ); resMgr.loadLanguage( "LightApp", "en" ); // ...get splash preferences - QString splashIcon, splashInfo, splashTextColors, splashProgressColors; - resMgr.value( "splash", "image", splashIcon ); - resMgr.value( "splash", "info", splashInfo, false ); - resMgr.value( "splash", "text_colors", splashTextColors ); - resMgr.value( "splash", "progress_colors", splashProgressColors ); + QString splashIcon; + resMgr.value( "splash", "image", splashIcon ); QPixmap px( splashIcon ); if ( px.isNull() ) // try to get splash pixmap from resources px = resMgr.loadPixmap( "LightApp", QObject::tr( "ABOUT_SPLASH" ) ); if ( !px.isNull() ) { // ...set splash pixmap splash = QtxSplash::splash( px ); + // ... set margin + int splashMargin; + if ( resMgr.value( "splash", "margin", splashMargin ) && splashMargin > 0 ) { + splash->setMargin( splashMargin ); + } // ...set splash text colors - if ( !splashTextColors.isEmpty() ) { + QString splashTextColors; + if ( resMgr.value( "splash", "text_colors", splashTextColors ) && !splashTextColors.isEmpty() ) { QStringList colors = QStringList::split( "|", splashTextColors ); QColor c1, c2; if ( colors.count() > 0 ) c1 = QColor( colors[0] ); @@ -456,7 +459,8 @@ int main( int argc, char **argv ) splash->setTextColors( Qt::white, Qt::black ); } // ...set splash progress colors - if ( !splashProgressColors.isEmpty() ) { + QString splashProgressColors; + if ( resMgr.value( "splash", "progress_colors", splashProgressColors ) && !splashProgressColors.isEmpty() ) { QStringList colors = QStringList::split( "|", splashProgressColors ); QColor c1, c2; int gradType = QtxSplash::Vertical; @@ -470,7 +474,8 @@ int main( int argc, char **argv ) f.setBold( true ); splash->setFont( f ); // ...show splash initial status - if ( !splashInfo.isEmpty() ) { + QString splashInfo; + if ( resMgr.value( "splash", "info", splashInfo, false ) && !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" ) );