]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
*** empty log message ***
authorvsr <vsr@opencascade.com>
Fri, 10 Aug 2007 14:03:58 +0000 (14:03 +0000)
committervsr <vsr@opencascade.com>
Fri, 10 Aug 2007 14:03:58 +0000 (14:03 +0000)
src/LightApp/resources/LightApp.xml
src/Qtx/Qtx.cxx
src/Qtx/QtxSplash.cxx
src/SUITApp/SUITApp.cxx
src/SalomeApp/resources/SalomeApp.xml

index 5b2cab2f17c978a2dcf8c61ec723e85f9e390a8f..c87bc8f18d2bde3ad3a0677ea02e86876309b731 100644 (file)
   </section>
   <section name="splash" >
     <!-- Splash screen settings -->
-    <parameter name="image"       value="${GUI_ROOT_DIR}/share/salome/resources/gui/icon_about.png" />
-    <parameter name="info"        value="%A : %V" />
-    <parameter name="text_colors" value="#543AA9|#FFFFFF" />
+    <parameter name="image"             value="${GUI_ROOT_DIR}/share/salome/resources/gui/icon_about.png" />
+    <parameter name="constant_info"     value="%A [ %V ]" />
+    <parameter name="text_colors"       value="#5A81BF|#20408F" />
+    <parameter name="hide_on_click"     value="no" />
+    <parameter name="margin"            value="10" />
+    <parameter name="progress_width"    value="20" />
+    <parameter name="progress_flags"    value="bottom,left_to_right" />
+    <parameter name="opacity"           value="0.70" />
+    <parameter name="font"              value="Helvetica,12,bold" />
+    <parameter name="alignment"         value="top,left" />
+    <parameter name="progress_gradient" value="linear|0.3|0.0|1.0|1.0|reflect|0.0|red|0.2|blue|0.5|yellow|0.6|black|1.0|white" />
+    <parameter name="progress_colors"   value="#20408F|#5A81BF|vertical" />
   </section>
   <section name="resources">
     <!-- Resource directories (resource manager)-->
index a5b3ea2e2e2478259102c9d5d38d89db453d0387..38f85882e8bad9daa1d977d67fe1d8b9e07c23e9 100755 (executable)
@@ -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
index db4d6afa19e094fc33f0e9ad5334028af799256a..d57c843a18d4bbf5aeca598a82f0a1e09e566290 100644 (file)
@@ -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 );
   }
index bb0b155f7f705e22f3c43d03088673c974c03214..5779af2f1ec40facec0e2e93eafff9c792639a26 100644 (file)
 #include "SUITApp_Application.h"
 
 #include <SUIT_Session.h>
-//#include <SUIT_Desktop.h>
+#include <SUIT_Desktop.h>
 #include <SUIT_ResourceMgr.h>
 #include <Style_Salome.h>
 #include <Style_Model.h>
-
-// TODO
-//#include <QtxSplash.h>
+#include <QtxSplash.h>
 
 #ifdef SUIT_ENABLE_PYTHON
 #include <Python.h>
@@ -40,7 +38,7 @@
 
 #include <QDir>
 #include <QFile>
-//#include <QRegExp>
+#include <QRegExp>
 #include <QString>
 #include <QStringList>
 
@@ -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;
   }
index db53d8e3ccbd28697a7cf275e86da60683dd7920..afeac2e91f02726a8854bcc7ab9ea205824c92d1 100644 (file)
   </section>
   <section name="splash" >
     <!-- Splash screen settings -->
-    <parameter name="image"           value="${GUI_ROOT_DIR}/share/salome/resources/gui/icon_about.png" />
-    <parameter name="info"            value="%V" />
-    <parameter name="text_colors"     value="#543AA9|#FFFFFF" />
-    <parameter name="progress_colors" value="#0A4E5F|#B2EFED|1" />
+    <parameter name="image"             value="${GUI_ROOT_DIR}/share/salome/resources/gui/icon_about.png" />
+    <parameter name="constant_info"     value="%A [ %V ]" />
+    <parameter name="text_colors"       value="#5A81BF|#20408F" />
+    <parameter name="hide_on_click"     value="no" />
+    <parameter name="margin"            value="10" />
+    <parameter name="progress_width"    value="20" />
+    <parameter name="progress_flags"    value="bottom,left_to_right" />
+    <parameter name="opacity"           value="0.70" />
+    <parameter name="font"              value="Helvetica,12,bold" />
+    <parameter name="alignment"         value="top,left" />
+    <parameter name="progress_gradient" value="linear|0.3|0.0|1.0|1.0|reflect|0.0|red|0.2|blue|0.5|yellow|0.6|black|1.0|white" />
+    <parameter name="progress_colors"   value="#20408F|#5A81BF|vertical" />
   </section>
   <section name="resources">
     <!-- Resource directories (resource manager)-->