X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHOMARDGUI%2FMonPursueIteration.cxx;h=3aea37113b90b63d040fa1cf53627d55f28ddd56;hb=d99ab7669d0fd72f475b275e1185f63142a8bbbc;hp=357f93bfaa5d626cf699a1ca5a3f6bd9f59d76d5;hpb=76a5f649c23c08c9cbdc0bfaafa5cf6ef792713a;p=modules%2Fhomard.git diff --git a/src/HOMARDGUI/MonPursueIteration.cxx b/src/HOMARDGUI/MonPursueIteration.cxx index 357f93bf..3aea3711 100644 --- a/src/HOMARDGUI/MonPursueIteration.cxx +++ b/src/HOMARDGUI/MonPursueIteration.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2011-2012 CEA/DEN, EDF R&D +// Copyright (C) 2011-2022 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,9 +17,8 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -using namespace std; - #include "MonPursueIteration.h" +#include "HOMARD.hxx" #include #include @@ -29,19 +28,24 @@ using namespace std; #include "HomardQtCommun.h" #include +#ifdef WIN32 +#include +#endif + +using namespace std; // ----------------------------------------------------------------------------------------- /* Constructs a MonPursueIteration * Sets attributes to default values */ // ----------------------------------------------------------------------------------------- -MonPursueIteration::MonPursueIteration (QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen) +MonPursueIteration::MonPursueIteration ( bool modal, HOMARD::HOMARD_Gen_var myHomardGen0 ) : Ui_PursueIteration(), _aCaseName(""), _aDirName(""), _aDirNameStart("") { MESSAGE("Debut du constructeur de MonPursueIteration"); - myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen); + myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0); setupUi(this); setModal(modal); @@ -50,7 +54,7 @@ MonPursueIteration::MonPursueIteration (QWidget* parent, bool modal, HOMARD::HOM SetNewCaseName() ; _Type = 1 ; GBIterationintoCase->setVisible(0); - spinBoxNumber->setVisible(0); + SpinBoxNumber->setVisible(0); adjustSize(); MESSAGE("Fin du constructeur de MonPursueIteration"); @@ -66,7 +70,6 @@ MonPursueIteration::~MonPursueIteration() void MonPursueIteration::InitConnect() // ------------------------------------------------------------------------ { - connect( LECaseName, SIGNAL(textChanged(QString)), this, SLOT(CaseNameChanged())); connect( PushDir, SIGNAL(pressed()), this, SLOT(SetDirName())); connect( RBIteration, SIGNAL(clicked()), this, SLOT(FromIteration())); @@ -86,7 +89,7 @@ bool MonPursueIteration::PushOnApply() // -------------------------------- { MESSAGE("PushOnApply"); - +// 1. Enregistrement du repertoire du cas QString aDirName=LEDirName->text().trimmed(); if (aDirName == QString("")) { @@ -94,26 +97,48 @@ bool MonPursueIteration::PushOnApply() QObject::tr("HOM_CASE_DIRECTORY_1") ); return false; } - if ((aDirName != _aDirName) and (myHomardGen->VerifieDir( aDirName.toStdString().c_str()) == 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) { QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), - QObject::tr("HOM_CASE_DIRECTORY_2") ); + QObject::tr("HOM_CASE_DIRECTORY_3") ); return false; } - if (chdir(aDirName.toStdString().c_str()) != 0) +// 2. Enregistrement du repertoire de depart + QString aDirNameStart=LEDirNameStart->text().trimmed(); + if (aDirNameStart == QString("")) { QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), - QObject::tr("HOM_CASE_DIRECTORY_3") ); + QObject::tr("HOM_START_DIRECTORY_1") ); + return false; + } + if (CHDIR(aDirNameStart.toStdString().c_str()) != 0) + { + QMessageBox::critical( 0, QObject::tr("HOM_ERROR"), + QObject::tr("HOM_START_DIRECTORY_3") ); return false; } -// Enregistrement du numero d'iteration +// 3. Enregistrement du numero d'iteration int Number ; - if ( _Type == 3 ) { Number = spinBoxNumber->value() ; } + if ( _Type == 3 ) { Number = SpinBoxNumber->value() ; } -// Creation du cas +// 4. Creation du cas QString _aCaseName=LECaseName->text().trimmed(); + _aDirNameStart=aDirNameStart; + MESSAGE("_aCaseName = "<<_aCaseName.toStdString().c_str()); + MESSAGE("_aDirNameStart = "<<_aDirNameStart.toStdString().c_str()); MESSAGE("_Type = "<<_Type); switch (_Type) { @@ -171,6 +196,9 @@ bool MonPursueIteration::PushOnApply() } } + aCase->SetDirName(aDirName.toStdString().c_str()); + _aDirName=aDirName; + HOMARD_UTILS::updateObjBrowser(); return true; @@ -186,8 +214,8 @@ void MonPursueIteration::PushOnOK() void MonPursueIteration::PushOnHelp() //------------------------------- { - char* LanguageShort = myHomardGen->GetLanguageShort(); - HOMARD_UTILS::PushOnHelp(QString("gui_create_case.html"), QString(""), QString(LanguageShort)); + std::string LanguageShort = myHomardGen->GetLanguageShort(); + HOMARD_UTILS::PushOnHelp(QString("gui_create_case.html"), QString(""), QString(LanguageShort.c_str())); } // --------------------------------- void MonPursueIteration::SetNewCaseName() @@ -203,9 +231,9 @@ void MonPursueIteration::SetNewCaseName() { if ( aCaseName == QString((MyCases)[i])) { - num += 1; - aCaseName = ""; - break; + num ++ ; + aCaseName = "" ; + break ; } } } @@ -231,7 +259,7 @@ void MonPursueIteration::FromIteration() // ------------------------------------------------------------------------ { GBIterationintoCase->setVisible(0); - spinBoxNumber->setVisible(0); + SpinBoxNumber->setVisible(0); _Type = 1 ; adjustSize(); } @@ -246,7 +274,7 @@ void MonPursueIteration::FromCase() void MonPursueIteration::CaseLastIteration() // ------------------------------------------------------------------------ { - spinBoxNumber->setVisible(0); + SpinBoxNumber->setVisible(0); _Type = 2 ; adjustSize(); } @@ -254,7 +282,7 @@ void MonPursueIteration::CaseLastIteration() void MonPursueIteration::CaseNIteration() // ------------------------------------------------------------------------ { - spinBoxNumber->setVisible(1); + SpinBoxNumber->setVisible(1); _Type = 3 ; adjustSize(); }