Salome HOME
Suppression de la fonction SetAdapRefinUnRef et création de la fonction SetUnifRefinU...
[modules/homard.git] / src / HOMARDGUI / MonCreateHypothesis.cxx
index a29acebfbcde357ef099219ab6b5db1b0f4a2a5d..8b63d9ab557ed6439bbab2f9ece2a5b9ffd8d4a9 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2011-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2011-2014  CEA/DEN, EDF R&D
 //
 // 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.
+// 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
@@ -17,8 +17,6 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-using namespace std;
-
 #include "MonCreateHypothesis.h"
 #include "MonCreateListGroup.h"
 #include "MonCreateIteration.h"
@@ -33,15 +31,17 @@ using namespace std;
 #include "HomardQtCommun.h"
 #include <utilities.h>
 
+using namespace std;
+
 // -------------------------------------------------------------------------------
 MonCreateHypothesis::MonCreateHypothesis(MonCreateIteration* parent, bool modal,
-                                         HOMARD::HOMARD_Gen_var myHomardGen,
+                                         HOMARD::HOMARD_Gen_var myHomardGen0,
                                          QString Name,
                                          QString caseName, QString aFieldFile)
 // ---------------------------------------------------------------------------------
 /* Constructs a MonCreateHypothesis */
     :
-    QDialog(0), Ui_CreateHypothesis(),
+    QScrollArea(0), Ui_CreateHypothesis(),
     _parent(parent), _Name(Name),
     _aCaseName(caseName), _aFieldFile(aFieldFile),
     _aFieldName(""),
@@ -56,9 +56,11 @@ MonCreateHypothesis::MonCreateHypothesis(MonCreateIteration* parent, bool modal,
 
 {
       MESSAGE("Constructeur") ;
-      myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen);
+      myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0);
       setupUi(this);
-      setModal(modal);
+      if ( modal ) { setWindowModality(Qt::WindowModal); }
+      else         { setWindowModality(Qt::NonModal); }
+      setWindowFlags( Qt::WindowStaysOnTopHint ) ;
       InitConnect();
 
       SetNewName();
@@ -73,6 +75,8 @@ MonCreateHypothesis::MonCreateHypothesis(MonCreateIteration* parent, bool modal,
       SetFieldNo();
       GBAdvancedOptions->setVisible(0);
       CBLevelOutput->setChecked(false);
+//
+      adjustSize();
 }
 
 // ------------------------------------------------------------------------
@@ -161,7 +165,13 @@ bool MonCreateHypothesis::PushOnApply()
   }
 
 // Mise en place des attributs
-  aHypothesis->SetAdapRefinUnRef(_aTypeAdap,_aTypeRaff,_aTypeDera);
+  if ( _aTypeAdap == -1 )
+  {
+    int TypeRaffDera ;
+    if ( _aTypeRaff == 1 ) { TypeRaffDera = 1 ; }
+    else                   { TypeRaffDera = -1 ; }
+    aHypothesis->SetUnifRefinUnRef(TypeRaffDera);
+  }
   aHypothesis->SetTypeFieldInterp(_TypeFieldInterp);
   aHypothesis->SetCaseCreation(_aCaseName.toStdString().c_str());
 
@@ -174,7 +184,7 @@ bool MonCreateHypothesis::PushOnApply()
   if (CBAdvanced->isChecked())
   {
 // Enregistrement du niveau maximal
-    _NivMax = spinBoxNivMax->value() ;
+    _NivMax = SpinBoxNivMax->value() ;
     aHypothesis->SetNivMax(_NivMax);
 // Enregistrement du diametre minimal
     _DiamMin = doubleSpinBoxDiamMin->value() ;
@@ -203,7 +213,8 @@ void MonCreateHypothesis::PushOnOK()
 void MonCreateHypothesis::PushOnHelp()
 // ------------------------------------------------------------------------
 {
-  HOMARD_UTILS::PushOnHelp(QString("gui_create_hypothese.html"), QString(""));
+  std::string LanguageShort = myHomardGen->GetLanguageShort();
+  HOMARD_UTILS::PushOnHelp(QString("gui_create_hypothese.html"), QString(""), QString(LanguageShort.c_str()));
 }
 // -------------------------------------------------
 void MonCreateHypothesis::SetNewName()
@@ -221,9 +232,9 @@ void MonCreateHypothesis::SetNewName()
     {
       if ( aName ==  QString(MyObjects[i]))
       {
-          num=num+1;
-          aName="";
-          break;
+        num ++ ;
+        aName = "" ;
+        break ;
       }
     }
   }
@@ -240,8 +251,10 @@ void MonCreateHypothesis::SetUniforme()
   else                         { GBFieldFile->setVisible(1); }
   GBAreaManagement->setVisible(0);
   GBUniform->setVisible(1);
-  adjustSize();
+
   _aTypeAdap = -1 ;
+//
+  adjustSize();
 }
 // ------------------------------------------------------------------------
 void MonCreateHypothesis::SetChamp()
@@ -267,9 +280,10 @@ void MonCreateHypothesis::SetChamp()
   GBAreaManagement->adjustSize();
   GBFieldManagement->adjustSize();
   GBFieldFile->adjustSize();
-  adjustSize();
 
   _aTypeAdap = 1 ;
+//
+  adjustSize();
 }
 // ------------------------------------------------------------------------
 void MonCreateHypothesis::SetZone()
@@ -281,10 +295,12 @@ void MonCreateHypothesis::SetZone()
   if ( _TypeFieldInterp == 0 ) { GBFieldFile->setVisible(0); }
   else                         { GBFieldFile->setVisible(1); }
   GBAreaManagement->setVisible(1);
-  adjustSize();
+
   _aTypeRaff = 1 ;
   _aTypeDera = 0 ;
   _aTypeAdap = 0 ;
+//
+  adjustSize();
 }
 
 // ------------------------------------------------------------------------
@@ -303,7 +319,7 @@ void MonCreateHypothesis::PushZoneEdit()
   MESSAGE("Debut de MonCreateHypothesis::PushZoneEdit")
   int colonne = TWZone->currentColumn();
   QTableWidgetItem * monItem = TWZone->currentItem();
-  if (colonne !=2  or monItem == NULL)
+  if (colonne !=2  || monItem == NULL)
   {
     QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
                               QObject::tr("HOM_HYPO_ZONE_1") );
@@ -399,7 +415,7 @@ QStringList MonCreateHypothesis::GetZonesChecked()
   int Pbm = 0 ;
   for ( int row=0; row< TWZone->rowCount(); row++)
   {
-    if ( ( TWZone->item( row, 0 )->checkState() == Qt::Checked ) and ( TWZone->item( row, 1 )->checkState() == Qt::Checked ) )
+    if ( ( TWZone->item( row, 0 )->checkState() == Qt::Checked ) && ( TWZone->item( row, 1 )->checkState() == Qt::Checked ) )
     {
       QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
                                 QObject::tr("HOM_HYPO_ZONE_3") );
@@ -459,8 +475,12 @@ void MonCreateHypothesis::AssocieFieldInterp()
 {
   if ( _TypeFieldInterp != 2 ) return;
   for ( int row=0; row< TWField->rowCount(); row++)
-      if ( TWField->item( row, 0 )->checkState() == Qt::Checked )
-      { aHypothesis->AddFieldInterp(TWField->item(row, 1)->text().toStdString().c_str()); }
+  {
+    if ( TWField->item( row, 0 )->checkState() == Qt::Checked )
+    {
+      aHypothesis->AddFieldInterp(TWField->item(row, 1)->text().toStdString().c_str());
+    }
+  }
 }
 // ------------------------------------------------------------------------
 void MonCreateHypothesis::SetUniRaff()
@@ -497,7 +517,7 @@ void MonCreateHypothesis::SetFieldName()
 {
   MESSAGE("Debut de SetFieldName");
   _aFieldName=CBFieldName->currentText();
-  if (QString(_aFieldFile) == QString("") or QString(_aFieldName) == QString("") ) { return; }
+  if (QString(_aFieldFile) == QString("") || QString(_aFieldName) == QString("") ) { return; }
 
   int nbrow= TWCMP->rowCount() ;
   for ( int row=0; row < nbrow ; row++)
@@ -792,8 +812,9 @@ void MonCreateHypothesis::SetFieldNo()
   else                   { GBFieldFile->setVisible(0); }
   TWField->setVisible(0);
 //
-   adjustSize();
   _TypeFieldInterp = 0 ;
+//
+  adjustSize();
 }
 // ------------------------------------------------------------------------
 void MonCreateHypothesis::SetFieldAll()
@@ -814,7 +835,8 @@ void MonCreateHypothesis::SetFieldAll()
   TWField->setVisible(0);
 //
   _TypeFieldInterp = 1 ;
-   adjustSize();
+//
+  adjustSize();
 }
 // ------------------------------------------------------------------------
 void MonCreateHypothesis::SetFieldChosen()
@@ -861,7 +883,8 @@ void MonCreateHypothesis::SetFieldChosen()
   TWField->setVisible(1);
 
   _TypeFieldInterp = 2 ;
-   adjustSize();
+//
+  adjustSize();
 }
 // ------------------------------------------------------------------------
 void MonCreateHypothesis::SetAdvanced()
@@ -885,6 +908,7 @@ void MonCreateHypothesis::SetAdvanced()
     CBLevelOutput->setChecked(false);
     _LevelOutput = 0 ;
   }
+//
   adjustSize();
 }
 // ------------------------------------------------------------------------