From af946fceba5bc12f7ddbe62f65c7aac281f87fb8 Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 10 Aug 2007 14:03:58 +0000 Subject: [PATCH] *** empty log message *** --- src/LightApp/resources/LightApp.xml | 15 +++- src/Qtx/Qtx.cxx | 21 +++--- src/Qtx/QtxSplash.cxx | 68 +++++++++++++++-- src/SUITApp/SUITApp.cxx | 101 +++++++++----------------- src/SalomeApp/resources/SalomeApp.xml | 16 +++- 5 files changed, 132 insertions(+), 89 deletions(-) diff --git a/src/LightApp/resources/LightApp.xml b/src/LightApp/resources/LightApp.xml index 5b2cab2f1..c87bc8f18 100644 --- a/src/LightApp/resources/LightApp.xml +++ b/src/LightApp/resources/LightApp.xml @@ -15,9 +15,18 @@
- - - + + + + + + + + + + + +
diff --git a/src/Qtx/Qtx.cxx b/src/Qtx/Qtx.cxx index a5b3ea2e2..38f85882e 100755 --- a/src/Qtx/Qtx.cxx +++ b/src/Qtx/Qtx.cxx @@ -1126,11 +1126,12 @@ bool Qtx::stringToLinearGradient( const QString& str, QLinearGradient& gradient // spread type if ( vals.count() > 5 ) { - if ( vals[ 5 ] == "pad" || vals[ 5 ] == "0" ) + QString spread = vals[ 5 ].trimmed().toLower(); + if ( spread == "pad" || spread == "0" ) gradient.setSpread( QGradient::PadSpread ); - else if ( vals[ 5 ] == "repeat" || vals[ 5 ] == "2" ) + else if ( spread == "repeat" || spread == "2" ) gradient.setSpread( QGradient::RepeatSpread ); - else if ( vals[ 5 ] == "reflect" || vals[ 5 ] == "1" ) + else if ( spread == "reflect" || spread == "1" ) gradient.setSpread( QGradient::ReflectSpread ); } // stop points @@ -1179,11 +1180,12 @@ bool Qtx::stringToRadialGradient( const QString& str, QRadialGradient& gradient // spread type if ( vals.count() > 6 ) { - if ( vals[ 6 ] == "pad" || vals[ 6 ] == "0" ) + QString spread = vals[ 6 ].trimmed().toLower(); + if ( spread == "pad" || spread == "0" ) gradient.setSpread( QGradient::PadSpread ); - else if ( vals[ 6 ] == "repeat" || vals[ 6 ] == "2" ) + else if ( spread == "repeat" || spread == "2" ) gradient.setSpread( QGradient::RepeatSpread ); - else if ( vals[ 6 ] == "reflect" || vals[ 6 ] == "1" ) + else if ( spread == "reflect" || spread == "1" ) gradient.setSpread( QGradient::ReflectSpread ); } // stop points @@ -1230,11 +1232,12 @@ bool Qtx::stringToConicalGradient( const QString& str, QConicalGradient& gradien // spread type if ( vals.count() > 4 ) { - if ( vals[ 4 ] == "pad" || vals[ 4 ] == "0" ) + QString spread = vals[ 4 ].trimmed().toLower(); + if ( spread == "pad" || spread == "0" ) gradient.setSpread( QGradient::PadSpread ); - else if ( vals[ 4 ] == "repeat" || vals[ 4 ] == "2" ) + else if ( spread == "repeat" || spread == "2" ) gradient.setSpread( QGradient::RepeatSpread ); - else if ( vals[ 4 ] == "reflect" || vals[ 4 ] == "1" ) + else if ( spread == "reflect" || spread == "1" ) gradient.setSpread( QGradient::ReflectSpread ); } // stop points diff --git a/src/Qtx/QtxSplash.cxx b/src/Qtx/QtxSplash.cxx index db4d6afa1..d57c843a1 100644 --- a/src/Qtx/QtxSplash.cxx +++ b/src/Qtx/QtxSplash.cxx @@ -782,9 +782,30 @@ void QtxSplash::readSettings( QtxResourceMgr* resMgr, const QString& section ) } // progress bar position and direction - int pf; + QString pf; if ( resMgr->value( resSection, "progress_flags", pf ) ) { - setProgressFlags( pf ); + bool bOk; + int fl = pf.toInt( &bOk ); + if ( !bOk ) { + fl = 0; + QStringList opts = pf.split( QRegExp( "," ), QString::SkipEmptyParts ); + for ( int i = 0; i < opts.count(); i++ ) { + QString opt = opts[i].trimmed().toLower(); + if ( opt == "left" ) + fl = fl | LeftSide; + else if ( opt == "right" ) + fl = fl | RightSide; + else if ( opt == "top" ) + fl = fl | TopSide; + else if ( opt == "bottom" ) + fl = fl | BottomSide; + else if ( opt == "left_to_right" ) + fl = fl | LeftToRight; + else if ( opt == "right_to_left" ) + fl = fl | RightToLeft; + } + } + setProgressFlags( fl ); } // opacity @@ -800,9 +821,34 @@ void QtxSplash::readSettings( QtxResourceMgr* resMgr, const QString& section ) } // text alignment - int al; + QString al; if ( resMgr->value( resSection, "alignment", al ) ) { - setTextAlignment( al ); + bool bOk; + int fl = al.toInt( &bOk ); + if ( !bOk ) { + fl = 0; + QStringList opts = al.split( QRegExp( "," ), QString::SkipEmptyParts ); + for ( int i = 0; i < opts.count(); i++ ) { + QString opt = opts[i].trimmed().toLower(); + if ( opt == "left" ) + fl = fl | Qt::AlignLeft; + else if ( opt == "right" ) + fl = fl | Qt::AlignRight; + else if ( opt == "top" ) + fl = fl | Qt::AlignTop; + else if ( opt == "bottom" ) + fl = fl | Qt::AlignBottom; + else if ( opt == "hcenter" ) + fl = fl | Qt::AlignHCenter; + else if ( opt == "vcenter" ) + fl = fl | Qt::AlignVCenter; + else if ( opt == "justify" ) + fl = fl | Qt::AlignJustify; + else if ( opt == "center" ) + fl = fl | Qt::AlignCenter; + } + } + setTextAlignment( fl ); } // progress color(s) @@ -821,11 +867,19 @@ void QtxSplash::readSettings( QtxResourceMgr* resMgr, const QString& section ) if ( colors.count() > 0 ) c1 = QColor( colors[0] ); if ( colors.count() > 1 ) c2 = QColor( colors[1] ); int gt; - bool bOk; if ( colors.count() > 2 ) { + bool bOk; gt = colors[2].toInt( &bOk ); - if ( bOk && gt >= QtxSplash::Horizontal && gt <= QtxSplash::Vertical ) - gradType = (QtxSplash::GradientType)gt; + if ( bOk ) { + if ( gt >= QtxSplash::Horizontal && gt <= QtxSplash::Vertical ) + gradType = (QtxSplash::GradientType)gt; + } + else { + if ( colors[2].toLower() == "horizontal" ) + gradType = QtxSplash::Horizontal; + else if ( colors[2].toLower() == "vertical" ) + gradType = QtxSplash::Vertical; + } } setProgressColors( c1, c2, gradType ); } diff --git a/src/SUITApp/SUITApp.cxx b/src/SUITApp/SUITApp.cxx index bb0b155f7..5779af2f1 100644 --- a/src/SUITApp/SUITApp.cxx +++ b/src/SUITApp/SUITApp.cxx @@ -26,13 +26,11 @@ #include "SUITApp_Application.h" #include -//#include +#include #include #include #include - -// TODO -//#include +#include #ifdef SUIT_ENABLE_PYTHON #include @@ -40,7 +38,7 @@ #include #include -//#include +#include #include #include @@ -56,13 +54,13 @@ QString salomeVersion() QFile vf( path ); if ( !vf.open( QFile::ReadOnly ) ) - return QString::null; + return QString(); QString line = vf.readLine( 1024 ); vf.close(); if ( line.isEmpty() ) - return QString::null; + return QString(); while ( !line.isEmpty() && line.at( line.length() - 1 ) == QChar( '\n' ) ) line.remove( line.length() - 1, 1 ); @@ -162,67 +160,40 @@ int main( int args, char* argv[] ) 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.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 ); -#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(); - QApplication::instance()->processEvents(); - } + resMgr->loadLanguage(); + + splash = QtxSplash::splash( QPixmap() ); + splash->readSettings( resMgr ); + if ( splash->pixmap().isNull() ) { + delete splash; + splash = 0; + } + else { + QString appName = QObject::tr( "APP_NAME" ).trimmed(); + QString appVersion = QObject::tr( "APP_VERSION" ).trimmed(); + if ( appVersion == "APP_VERSION" ) + { + if ( appName == "APP_NAME" || appName.toLower() == "salome" ) + appVersion = salomeVersion(); + else + appVersion = ""; + } + splash->setOption( "%A", appName ); + splash->setOption( "%V", QObject::tr( "ABOUT_VERSION" ).arg( appVersion ) ); + splash->setOption( "%L", QObject::tr( "ABOUT_LICENSE" ) ); + splash->setOption( "%C", QObject::tr( "ABOUT_COPYRIGHT" ) ); + splash->show(); + QApplication::instance()->processEvents(); + } } } -*/ + SUIT_Application* theApp = aSession->startApplication( argList.first() ); if ( theApp ) { @@ -233,13 +204,11 @@ int main( int args, char* argv[] ) if ( !noExceptHandling ) app.setHandler( aSession->handler() ); -// TODO -// if ( splash ) -// splash->finish( theApp->desktop() ); + if ( splash ) + splash->finish( theApp->desktop() ); result = app.exec(); -// TODO -// delete splash; + delete splash; } delete aSession; } diff --git a/src/SalomeApp/resources/SalomeApp.xml b/src/SalomeApp/resources/SalomeApp.xml index db53d8e3c..afeac2e91 100644 --- a/src/SalomeApp/resources/SalomeApp.xml +++ b/src/SalomeApp/resources/SalomeApp.xml @@ -23,10 +23,18 @@
- - - - + + + + + + + + + + + +
-- 2.39.2