-// Copyright (C) 2011-2012 CEA/DEN, EDF R&D
+// Copyright (C) 2011-2024 CEA, EDF
//
// 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
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-using namespace std;
-
#include "MonCreateYACS.h"
+#include "HOMARD.hxx"
#include <QFileDialog>
#include <QMessageBox>
#include "HomardQtCommun.h"
#include <utilities.h>
+#ifdef WIN32
+#include <direct.h>
+#endif
+using namespace std;
// ----------------------------------------------------------------------
MonCreateYACS::MonCreateYACS (bool modal, HOMARD::HOMARD_Gen_var myHomardGen0, QString CaseName ):
_aDirName(""),
_aMeshFile(""),
_Type(1)
- // La valeur de _Type doit etre la meme que celle dans HOMARD_Gen_i::CreateYACSSchema
- // et doit correspondre aux defauts des boutons
+ // Les valeurs de _Type, _MaxIter, _MaxNode, _MaxElem doivent etre les memes que celles dans HOMARD_Gen_i::CreateYACSSchema
+ // et doivent correspondre aux defauts des boutons
{
// MESSAGE("Debut du constructeur de MonCreateYACS");
myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0);
setupUi(this);
- setModal(modal);
+ if ( modal ) { setWindowModality(Qt::WindowModal); }
+ else { setWindowModality(Qt::NonModal); }
InitConnect();
SetNewName() ;
- if (_aCaseName != QString(""))
- { SetCaseName(); }
- else
- {setModal(false); /* permet selection du cas dans l arbre d etude */}
-
+ if (_aCaseName != QString("")) { SetCaseName(); }
+ else { setWindowModality(Qt::NonModal); /* permet selection du cas dans l arbre d etude */}
+//
+// Les valeurs definies dans les preferences
+ _MaxIter = myHomardGen->GetYACSMaxIter();
+ _MaxNode = myHomardGen->GetYACSMaxNode();
+ _MaxElem = myHomardGen->GetYACSMaxElem();
+ MESSAGE ("Valeur par defaut de MaxIter = " << _MaxIter<<", MaxNode = "<< _MaxNode<<", MaxElem = "<< _MaxElem);
+ SpinBoxMaxIter->setValue(_MaxIter) ;
+ SpinBoxMaxNode->setValue(_MaxNode) ;
+ SpinBoxMaxElem->setValue(_MaxElem) ;
+//
adjustSize();
-// MESSAGE("Fin du constructeur de MonCreateYACS");
}
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// Constructeur appele par MonEditYACS
//
- myHomardGen(myHomardGen0),
- _Name (""),
- Chgt (false)
- {
+myHomardGen(myHomardGen0),
+_Name (""),
+Chgt (false)
+{
// MESSAGE("Debut du constructeur de MonCreateYACS appele par MonEditYACS");
- setupUi(this) ;
-
- setModal(true) ;
- InitConnect() ;
- }
+ setupUi(this) ;
+ setWindowModality(Qt::WindowModal);
+ InitConnect() ;
+//
+ adjustSize();
+}
// ------------------------------------------------------------------------
MonCreateYACS::~MonCreateYACS()
// ------------------------------------------------------------------------
return false;
}
}
- if (chdir(aDirName.toStdString().c_str()) != 0)
+ if (CHDIR(aDirName.toStdString().c_str()) != 0)
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_CASE_DIRECTORY_3") );
MESSAGE("CreateOrUpdate");
bool bOK = true ;
- // Le cas
+ // 1. Verification des donnees
+ // 1.1. Le cas
if ( _aCaseName == QString (""))
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_CASE_NAME") );
return false;
}
- // Les donnees
+ // 1.2. Les donnees
QString aScriptFile=LEScriptFile->text().trimmed();
if ( aScriptFile != _aScriptFile )
{
Chgt = true ;
}
- // Creation de l'objet CORBA
+ // 2. Creation de l'objet CORBA
try
{
_Name=LEName->text().trimmed();
bOK = false;
}
- // Options
+ // 3. Options
if ( bOK )
- { aYACS->SetType(_Type) ; }
+ {
+ // 3.1. Le type du schema
+ aYACS->SetType(_Type) ;
+
+ // 3.2. Les maximums
+ _MaxIter = SpinBoxMaxIter->value() ;
+ aYACS->SetMaxIter(_MaxIter) ;
+
+ _MaxNode = SpinBoxMaxNode->value() ;
+ aYACS->SetMaxNode(_MaxNode) ;
+
+ _MaxElem = SpinBoxMaxElem->value() ;
+ aYACS->SetMaxElem(_MaxElem) ;
+
+ }
- // Ecriture du fichier
+ // 4. Ecriture du fichier
if ( bOK )
{
int codret = aYACS->Write() ;
void MonCreateYACS::PushOnHelp()
//-------------------------------
{
- char* LanguageShort = myHomardGen->GetLanguageShort();
- HOMARD_UTILS::PushOnHelp(QString("yacs.html"), QString(""), QString(LanguageShort));
+ std::string LanguageShort = myHomardGen->GetLanguageShort();
+ HOMARD_UTILS::PushOnHelp(QString("yacs.html"), QString(""), QString(LanguageShort.c_str()));
}
// -------------------------------------------------
void MonCreateYACS::SetNewName()
{
if ( aName == QString(MyObjects[i]))
{
- num=num+1;
- aName="";
- break;
+ num ++ ;
+ aName = "" ;
+ break ;
}
}
}
// ------------------------------------------------------------------------
{
QString fileName0 = LEScriptFile->text().trimmed();
- QString fileName = HOMARD_QT_COMMUN::PushNomFichier(false);
+ QString fileName = HOMARD_QT_COMMUN::PushNomFichier( false, QString("py") ) ;
if (fileName.isEmpty()) fileName = fileName0 ;
LEScriptFile->setText(fileName);
}
// ------------------------------------------------------------------------
{
QString fileName0 = LEMeshFile->text().trimmed();
- QString fileName = HOMARD_QT_COMMUN::PushNomFichier(false);
+ QString fileName = HOMARD_QT_COMMUN::PushNomFichier( false, QString("med") ) ;
if (fileName.isEmpty()) fileName = fileName0 ;
LEMeshFile->setText(fileName);
}