X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHOMARDGUI%2FMonCreateYACS.cxx;h=fc7e15923131827bb0d47e8380ec78044abc55e3;hb=refs%2Ftags%2FV9_13_0b1;hp=bff7b2b8424b4d70adc91719ce8eafb21b98fa41;hpb=12b85cd9ba544095fc7c78d848cd3715f7317966;p=modules%2Fhomard.git diff --git a/src/HOMARDGUI/MonCreateYACS.cxx b/src/HOMARDGUI/MonCreateYACS.cxx index bff7b2b8..fc7e1592 100644 --- a/src/HOMARDGUI/MonCreateYACS.cxx +++ b/src/HOMARDGUI/MonCreateYACS.cxx @@ -1,9 +1,9 @@ -// 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 @@ -17,9 +17,8 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -using namespace std; - #include "MonCreateYACS.h" +#include "HOMARD.hxx" #include #include @@ -29,6 +28,10 @@ using namespace std; #include "HomardQtCommun.h" #include +#ifdef WIN32 +#include +#endif +using namespace std; // ---------------------------------------------------------------------- MonCreateYACS::MonCreateYACS (bool modal, HOMARD::HOMARD_Gen_var myHomardGen0, QString CaseName ): @@ -43,25 +46,32 @@ MonCreateYACS::MonCreateYACS (bool modal, HOMARD::HOMARD_Gen_var myHomardGen0, Q _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"); } // ---------------------------------------------------------------------- @@ -70,17 +80,18 @@ MonCreateYACS::MonCreateYACS(HOMARD::HOMARD_Gen_var myHomardGen0, // ---------------------------------------------------------------------- // 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() // ------------------------------------------------------------------------ @@ -127,13 +138,18 @@ bool MonCreateYACS::PushOnApply() QObject::tr("HOM_CASE_DIRECTORY_4") ); return false; } - if ((aDirName != _aDirName) and (myHomardGen->VerifieDir( aDirName.toStdString().c_str()) == false)) - { - QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), - QObject::tr("HOM_CASE_DIRECTORY_2") ); - return false; + if ( aDirName != _aDirName) + { QString CaseNameDir = myHomardGen->VerifieDir( aDirName.toStdString().c_str()) ; + if ( CaseNameDir != "" ) + { + QString texte ; + texte = QObject::tr("HOM_CASE_DIRECTORY_2") + CaseNameDir ; + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + texte ); + 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") ); @@ -170,14 +186,15 @@ bool MonCreateYACS:: CreateOrUpdate() 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 ) { @@ -197,7 +214,7 @@ bool MonCreateYACS:: CreateOrUpdate() Chgt = true ; } - // Creation de l'objet CORBA + // 2. Creation de l'objet CORBA try { _Name=LEName->text().trimmed(); @@ -210,11 +227,25 @@ bool MonCreateYACS:: CreateOrUpdate() 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() ; @@ -234,8 +265,8 @@ void MonCreateYACS::PushOnOK() 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() @@ -252,9 +283,9 @@ void MonCreateYACS::SetNewName() { if ( aName == QString(MyObjects[i])) { - num=num+1; - aName=""; - break; + num ++ ; + aName = "" ; + break ; } } } @@ -284,7 +315,7 @@ void MonCreateYACS::SetScriptFile() // ------------------------------------------------------------------------ { 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); } @@ -293,7 +324,7 @@ void MonCreateYACS::SetMeshFile() // ------------------------------------------------------------------------ { 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); }