X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FSalomeApp%2FSalomeApp_Tools.cxx;h=a226e95104af9c16d5f58dd2bdade4950c1bc0e7;hb=d26f738c9c427a45409bacf3848fd8c224edf6ed;hp=f6b93b4ca721d8a652dc8ed52353b3a311a11472;hpb=232b55569765049c7d1cceb5096a45f8584c9369;p=modules%2Fgui.git diff --git a/src/SalomeApp/SalomeApp_Tools.cxx b/src/SalomeApp/SalomeApp_Tools.cxx index f6b93b4ca..a226e9510 100644 --- a/src/SalomeApp/SalomeApp_Tools.cxx +++ b/src/SalomeApp/SalomeApp_Tools.cxx @@ -1,21 +1,25 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// +// Copyright (C) 2007-2014 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 +// // 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 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 +// 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. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software +// 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/ +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #include "SalomeApp_Tools.h" #include @@ -24,15 +28,20 @@ #include +#include +#include + +#include + /*! Convert QColor to Quantity_Color, if QColor is valid. */ Quantity_Color SalomeApp_Tools::color( const QColor& c ) { - Quantity_Color aColor; - if ( c.isValid() ) - aColor = Quantity_Color( c.red() / 255., c.green() / 255., c.blue() / 255., Quantity_TOC_RGB ); - return aColor; + Quantity_Color aColor; + if ( c.isValid() ) + aColor = Quantity_Color( c.red() / 255., c.green() / 255., c.blue() / 255., Quantity_TOC_RGB ); + return aColor; } /*! @@ -40,7 +49,7 @@ Quantity_Color SalomeApp_Tools::color( const QColor& c ) */ QColor SalomeApp_Tools::color( const Quantity_Color& c ) { - return QColor( (int)( c.Red() * 255 ), (int)( c.Green() * 255 ), (int)( c.Blue() * 255 ) ); + return QColor( (int)( c.Red() * 255 ), (int)( c.Green() * 255 ), (int)( c.Blue() * 255 ) ); } /*! @@ -55,32 +64,32 @@ QString SalomeApp_Tools::ExceptionToString( const SALOME::SALOME_Exception& S_ex case SALOME::COMM: case SALOME::INTERNAL_ERROR: { - message = QString( S_ex.details.text ); - QString source( S_ex.details.sourceFile ); - QString line; - line.setNum( S_ex.details.lineNumber ); - message = message + " \n" + source + " : " + line; + message = QString( S_ex.details.text ); + QString source( S_ex.details.sourceFile ); + QString line; + line.setNum( S_ex.details.lineNumber ); + message = message + " \n" + source + " : " + line; break; } case SALOME::BAD_PARAM: { - message = QString( S_ex.details.text ); + message = QString( S_ex.details.text ); #ifdef _DEBUG_ - QString source( S_ex.details.sourceFile ); - QString line; - line.setNum( S_ex.details.lineNumber ); - message = message + " \n" + source + " : " + line; + QString source( S_ex.details.sourceFile ); + QString line; + line.setNum( S_ex.details.lineNumber ); + message = message + " \n" + source + " : " + line; #endif - break; + break; } default: { - message = QString( "SALOME CORBA Exception Type invalid" ); - QString source( S_ex.details.sourceFile ); - QString line; - line.setNum( S_ex.details.lineNumber ); - message = message + " \n" + source + " : " + line; - break; + message = QString( "SALOME CORBA Exception Type invalid" ); + QString source( S_ex.details.sourceFile ); + QString line; + line.setNum( S_ex.details.lineNumber ); + message = message + " \n" + source + " : " + line; + break; } } return message; @@ -104,17 +113,17 @@ void SalomeApp_Tools::QtCatchCorbaException( const SALOME::SALOME_Exception& S_e case SALOME::BAD_PARAM: error = false; title = QObject::tr( "Engine Warning" ); - break; + break; default: title = QObject::tr( "Internal SALOME Error" ); break; } if ( error ) - SUIT_MessageBox::error1( SUIT_Session::session()->activeApplication()->desktop(), - title, message, QObject::tr( "OK" ) ); + SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(), + title, message ); else - SUIT_MessageBox::warn1( SUIT_Session::session()->activeApplication()->desktop(), - title, message, QObject::tr( "OK" ) ); + SUIT_MessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), + title, message ); }