X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FQtx%2FQtxSplash.cxx;h=f532b1b039abe76a0a0d588a0f74735e36825111;hb=0f9dfaa83b994c9d7fdd893f418395fad145f388;hp=e32a29aae24d7fae4a6032102565bb78e251ddbb;hpb=1c889394b028b786898a995d38c07c8f3d564837;p=modules%2Fgui.git diff --git a/src/Qtx/QtxSplash.cxx b/src/Qtx/QtxSplash.cxx index e32a29aae..f532b1b03 100644 --- a/src/Qtx/QtxSplash.cxx +++ b/src/Qtx/QtxSplash.cxx @@ -1,29 +1,31 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : QtxSplash.cxx // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) // #include "QtxSplash.h" #include "QtxResourceMgr.h" +#include #include #include @@ -265,9 +267,9 @@ void QtxSplash::setError( const QString& error, const QString& title, const int if ( mySplash ) { mySplash->setError( code ); QMessageBox::critical( mySplash, - title.isEmpty() ? tr( "Error" ) : title, - error, - tr( "&OK" ) ); + title.isEmpty() ? tr( "Error" ) : title, + error, + tr( "&OK" ) ); } else { printf( "QtxSplash::error: %s\n",error.toLatin1().constData() ); @@ -551,7 +553,7 @@ int QtxSplash::progressFlags() const \sa progressColors() */ void QtxSplash::setProgressColors( const QColor& startColor, - const QColor& endColor, + const QColor& endColor, const Qt::Orientation orientation ) { if ( !startColor.isValid() ) @@ -906,19 +908,19 @@ void QtxSplash::readSettings( QtxResourceMgr* resMgr, const QString& section ) 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; + 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 ); @@ -945,23 +947,23 @@ void QtxSplash::readSettings( QtxResourceMgr* resMgr, const QString& section ) 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; + 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 ); @@ -977,17 +979,17 @@ void QtxSplash::readSettings( QtxResourceMgr* resMgr, const QString& section ) setProgressColors( lgrad ); } else if ( resMgr->value( resSection, "progress_color", rgrad ) || - resMgr->value( resSection, "progress_colors", rgrad ) ) { + resMgr->value( resSection, "progress_colors", rgrad ) ) { // radial gradient-colored progress bar setProgressColors( rgrad ); } else if ( resMgr->value( resSection, "progress_color", cgrad ) || - resMgr->value( resSection, "progress_colors", cgrad ) ) { + resMgr->value( resSection, "progress_colors", cgrad ) ) { // conical gradient-colored progress bar setProgressColors( cgrad ); } else if ( resMgr->value( resSection, "progress_color", pc ) || - resMgr->value( resSection, "progress_colors", pc ) ) { + resMgr->value( resSection, "progress_colors", pc ) ) { // one/two-colored progress bar QStringList colors = pc.split( "|", QString::SkipEmptyParts ); QColor c1, c2; @@ -999,12 +1001,12 @@ void QtxSplash::readSettings( QtxResourceMgr* resMgr, const QString& section ) bool bOk; gt = colors[2].toInt( &bOk ); if ( bOk ) { - if ( gt == 0 ) - o = Qt::Horizontal; + if ( gt == 0 ) + o = Qt::Horizontal; } else { - if ( colors[2].toLower().startsWith( "h" ) ) - o = Qt::Horizontal; + if ( colors[2].toLower().startsWith( "h" ) ) + o = Qt::Horizontal; } } setProgressColors( c1, c2, o ); @@ -1045,8 +1047,8 @@ void QtxSplash::readSettings( QtxResourceMgr* resMgr, const QString& section ) \sa message(), constantInfo(), setConstantInfo() */ void QtxSplash::setMessage( const QString& msg, - int alignment, - const QColor& color ) + int alignment, + const QColor& color ) { myMessage = msg; myAlignment = alignment; @@ -1218,17 +1220,17 @@ void QtxSplash::drawProgressBar( QPainter* p ) QLinearGradient lg; const QLinearGradient* other = static_cast( progressColors() ); if ( checkGradient( other ) ) { - // gradient is defined in relative coordinates [0.0 - 1.0] - lg.setStart( r.left() + r.width() * other->start().x(), - r.top() + r.height() * other->start().y() ); - lg.setFinalStop( r.left() + r.width() * other->finalStop().x(), - r.top() + r.height() * other->finalStop().y() ); + // gradient is defined in relative coordinates [0.0 - 1.0] + lg.setStart( r.left() + r.width() * other->start().x(), + r.top() + r.height() * other->start().y() ); + lg.setFinalStop( r.left() + r.width() * other->finalStop().x(), + r.top() + r.height() * other->finalStop().y() ); } else { - // gradient is defined in absolute coordinates - // according to its dimensions - lg.setStart( r.topLeft() + other->start() ); - lg.setFinalStop( r.topLeft() + other->finalStop() ); + // gradient is defined in absolute coordinates + // according to its dimensions + lg.setStart( r.topLeft() + other->start() ); + lg.setFinalStop( r.topLeft() + other->finalStop() ); } lg.setStops( other->stops() ); @@ -1243,17 +1245,17 @@ void QtxSplash::drawProgressBar( QPainter* p ) QRadialGradient rg; const QRadialGradient* other = static_cast( progressColors() ); if ( checkGradient( other ) ) { - // gradient is defined in relative coordinates [0.0 - 1.0] - rg.setCenter( r.left() + r.width() * other->center().x(), - r.top() + r.height() * other->center().y() ); - rg.setFocalPoint( r.left() + r.width() * other->focalPoint().x(), - r.top() + r.height() * other->focalPoint().y() ); + // gradient is defined in relative coordinates [0.0 - 1.0] + rg.setCenter( r.left() + r.width() * other->center().x(), + r.top() + r.height() * other->center().y() ); + rg.setFocalPoint( r.left() + r.width() * other->focalPoint().x(), + r.top() + r.height() * other->focalPoint().y() ); } else { - // gradient is defined in absolute coordinates - // according to its dimensions - rg.setCenter( r.topLeft() + other->center() ); - rg.setFocalPoint( r.topLeft() + other->focalPoint() ); + // gradient is defined in absolute coordinates + // according to its dimensions + rg.setCenter( r.topLeft() + other->center() ); + rg.setFocalPoint( r.topLeft() + other->focalPoint() ); } // only width is taken into account for the radius in relative mode @@ -1271,14 +1273,14 @@ void QtxSplash::drawProgressBar( QPainter* p ) QConicalGradient cg; const QConicalGradient* other = static_cast( progressColors() ); if ( checkGradient( other ) ) { - // gradient is defined in relative coordinates [0.0 - 1.0] - cg.setCenter( r.left() + r.width() * other->center().x(), - r.top() + r.height() * other->center().y() ); + // gradient is defined in relative coordinates [0.0 - 1.0] + cg.setCenter( r.left() + r.width() * other->center().x(), + r.top() + r.height() * other->center().y() ); } else { - // gradient is defined in absolute coordinates - // according to its dimensions - cg.setCenter( r.topLeft() + other->center() ); + // gradient is defined in absolute coordinates + // according to its dimensions + cg.setCenter( r.topLeft() + other->center() ); } cg.setAngle( other->angle() );