Salome HOME
Merge remote branch 'origin/V7_dev'
[modules/gui.git] / src / SalomeApp / SalomeApp_Tools.cxx
index eeb12e91ff4f7fa1d04d871af3ccbffb61388ef9..f66e7f9f246aafa8f94ade158851bcb6863faaad 100644 (file)
@@ -1,24 +1,25 @@
-//  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
 //
+
 #include "SalomeApp_Tools.h"
 
 #include <SUIT_Session.h>
 */
 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;
 }
 
 /*!
@@ -48,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 ) );
 }
 
 /*!
@@ -63,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;
@@ -112,7 +113,7 @@ 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;
@@ -120,9 +121,9 @@ void SalomeApp_Tools::QtCatchCorbaException( const SALOME::SALOME_Exception& S_e
 
   if ( error )
     SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(),
-                              title, message );
+                               title, message );
   else
     SUIT_MessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(),
-                             title, message );
+                              title, message );
 
 }