-// Copyright (C) 2011-2012 CEA/DEN, EDF R&D
+// Copyright (C) 2011-2013 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
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-using namespace std;
-
#include "MonCreateCase.h"
#include "MonCreateBoundaryAn.h"
#include "MonEditBoundaryAn.h"
#include "HomardQtCommun.h"
#include <utilities.h>
+#ifdef WIN32
+#include <direct.h>
+#endif
+
+using namespace std;
-// -----------------------------------------------------------------------------------------
-MonCreateCase::MonCreateCase(QWidget* parent, bool modal, HOMARD::HOMARD_Gen_var myHomardGen)
// -----------------------------------------------------------------------------------------
/* Constructs a MonCreateCase
* Inherits from CasHomard
* Sets attributes to default values
*/
+// -----------------------------------------------------------------------------------------
+MonCreateCase::MonCreateCase( bool modal, HOMARD::HOMARD_Gen_var myHomardGen0)
:
Ui_CreateCase(),
_aCaseName(""),_aDirName(""),
_ConfType(1),
_Pyram(0)
{
- _myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen);
- setupUi(this);
- setModal(modal);
- InitConnect();
+ MESSAGE("Debut du constructeur de MonCreateCase");
+ myHomardGen=HOMARD::HOMARD_Gen::_duplicate(myHomardGen0);
+ setupUi(this);
+ setModal(modal);
+ InitConnect();
- SetNewCaseName() ;
- GBBoundaryA->setVisible(0);
- GBBoundaryD->setVisible(0);
- GBTypeNoConf->setVisible(0);
- adjustSize();
- GBAdvancedOptions->setVisible(0);
- CBPyramid->setChecked(false);
-}
+ SetNewName() ;
+ GBBoundaryA->setVisible(0);
+ GBBoundaryD->setVisible(0);
+ GBTypeNoConf->setVisible(0);
+ GBAdvancedOptions->setVisible(0);
+ Comment->setVisible(0);
+ CBPyramid->setChecked(false);
+ adjustSize();
+ MESSAGE("Fin du constructeur de MonCreateCase");
+}
// ------------------------------------------------------------------------
MonCreateCase::~MonCreateCase()
// ------------------------------------------------------------------------
void MonCreateCase::InitConnect()
// ------------------------------------------------------------------------
{
+ connect( LEName, SIGNAL(textChanged(QString)), this, SLOT(CaseNameChanged()));
connect( PushDir, SIGNAL(pressed()), this, SLOT(SetDirName()));
connect( PushFichier, SIGNAL(pressed()), this, SLOT(SetFileName()));
connect( buttonApply, SIGNAL(pressed()), this, SLOT(PushOnApply()));
connect( buttonCancel, SIGNAL(pressed()), this, SLOT(close()));
connect( buttonHelp, SIGNAL(pressed()), this, SLOT(PushOnHelp()));
- connect( LECaseName, SIGNAL(textChanged(QString)), this, SLOT(CaseNameChanged()));
}
// ------------------------------------------------------------------------
void MonCreateCase::InitBoundarys()
// Pour les frontieres discretes : la liste a saisir
// Pour les frontieres analytiques : les colonnes de chaque frontiere
HOMARD::HOMARD_Boundary_var myBoundary ;
- HOMARD::listeBoundarys_var mesBoundarys = _myHomardGen->GetAllBoundarysName();
+ HOMARD::listeBoundarys_var mesBoundarys = myHomardGen->GetAllBoundarysName();
// MESSAGE("Nombre de frontieres enregistrees : "<<mesBoundarys->length());
for (int i=0; i<mesBoundarys->length(); i++)
{
- myBoundary = _myHomardGen->GetBoundary(mesBoundarys[i]);
+ myBoundary = myHomardGen->GetBoundary(mesBoundarys[i]);
int type_obj = myBoundary->GetType() ;
if ( type_obj==0 ) { CBBoundaryDi->addItem(QString(mesBoundarys[i])); }
else { AddBoundaryAn(QString(mesBoundarys[i])); }
// --------------------------------
{
MESSAGE("PushOnApply");
- QString aCaseName=LECaseName->text().trimmed();
+ QString aCaseName=LEName->text().trimmed();
if ( aCaseName == "" )
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_CASE_DIRECTORY_1") );
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;
+ }
}
+#ifndef WIN32
if (chdir(aDirName.toStdString().c_str()) != 0)
+#else
+ if (_chdir(aDirName.toStdString().c_str()) != 0)
+#endif
{
QMessageBox::critical( 0, QObject::tr("HOM_ERROR"),
QObject::tr("HOM_CASE_DIRECTORY_3") );
_aCaseName = aCaseName;
try
{
- aCase = _myHomardGen->CreateCase( \
+ aCase = myHomardGen->CreateCase( \
CORBA::string_dup(_aCaseName.toStdString().c_str()), \
CORBA::string_dup(aMeshName.toStdString().c_str()), \
CORBA::string_dup(aFileName.toStdString().c_str()) );
QObject::tr(CORBA::string_dup(S_ex.details.text)) );
try
{
- aCase = _myHomardGen->GetCase(_aCaseName.toStdString().c_str());
+ aCase = myHomardGen->GetCase(_aCaseName.toStdString().c_str());
string iter0 = aCase->GetIter0Name();
- HOMARD::HOMARD_Iteration_var aIter = _myHomardGen->GetIteration(iter0.c_str());
+ HOMARD::HOMARD_Iteration_var aIter = myHomardGen->GetIteration(iter0.c_str());
QString aFileName = aIter->GetMeshFile();
LEFileName->setText(aFileName);
LEFileName->setReadOnly(true);
void MonCreateCase::PushOnOK()
// ---------------------------
{
- bool bOK = PushOnApply();
- if ( bOK ) this->close();
+ bool bOK = PushOnApply();
+ if ( bOK ) this->close();
}
//------------------------------
void MonCreateCase::PushOnHelp()
//-------------------------------
{
- HOMARD_UTILS::PushOnHelp(QString("gui_create_case.html"));
+ char* LanguageShort = myHomardGen->GetLanguageShort();
+ HOMARD_UTILS::PushOnHelp(QString("gui_create_case.html"), QString(""), QString(LanguageShort));
}
// ---------------------------------
-void MonCreateCase::SetNewCaseName()
+void MonCreateCase::SetNewName()
// ------------------------------
{
- HOMARD::listeCases_var MyCases = _myHomardGen->GetAllCasesName();
+ HOMARD::listeCases_var MyCases = myHomardGen->GetAllCasesName();
int num = 0; QString aCaseName="";
while (aCaseName=="" )
{
}
}
}
- LECaseName->clear() ;
- LECaseName->insert(aCaseName);
+ LEName->clear() ;
+ LEName->insert(aCaseName);
}
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
{
MonCreateBoundaryDi *BoundaryDlg = new MonCreateBoundaryDi(this, true,
- HOMARD::HOMARD_Gen::_duplicate(_myHomardGen), _aCaseName, "") ;
+ HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, "") ;
BoundaryDlg->show();
}
// ------------------------------------------------------------------------
{
if (CBBoundaryDi->currentText() == QString("")) return;
MonEditBoundaryDi *BoundaryDlg = new MonEditBoundaryDi(this, true,
- HOMARD::HOMARD_Gen::_duplicate(_myHomardGen), _aCaseName, CBBoundaryDi->currentText() ) ;
+ HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, CBBoundaryDi->currentText() ) ;
BoundaryDlg->show();
}
// ------------------------------------------------------------------------
void MonCreateCase::PushBoundaryDiHelp()
// ------------------------------------------------------------------------
{
- HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html#frontiere-discrete") ) ;
+ char* LanguageShort = myHomardGen->GetLanguageShort();
+ HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("frontiere-discrete"), QString(LanguageShort));
}
// ------------------------------------------------------------------------
void MonCreateCase::SetBoundaryA()
// ------------------------------------------------------------------------
{
MonCreateBoundaryAn *BoundaryDlg = new MonCreateBoundaryAn(this, true,
- HOMARD::HOMARD_Gen::_duplicate(_myHomardGen), _aCaseName) ;
+ HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName) ;
BoundaryDlg->show();
}
// ------------------------------------------------------------------------
MESSAGE("nom "<<nom.toStdString().c_str());
if (nom != QString(""))
{ MonEditBoundaryAn *BoundaryDlg = new MonEditBoundaryAn(this, true,
- HOMARD::HOMARD_Gen::_duplicate(_myHomardGen), _aCaseName, nom ) ;
+ HOMARD::HOMARD_Gen::_duplicate(myHomardGen), _aCaseName, nom ) ;
BoundaryDlg->show(); }
}
}
void MonCreateCase::PushBoundaryAnHelp()
// ------------------------------------------------------------------------
{
- HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html#frontiere-analytique") ) ;
+ char* LanguageShort = myHomardGen->GetLanguageShort();
+ HOMARD_UTILS::PushOnHelp(QString("gui_create_boundary.html"), QString("frontiere-analytique"), QString(LanguageShort));
}
// ------------------------------------------------------------------------
void MonCreateCase::CaseNameChanged()
// ------------------------------------------------------------------------
{
- if (_aCaseName != LECaseName->text().trimmed())
+ if (_aCaseName != LEName->text().trimmed())
{
LEFileName->setReadOnly(false);
PushFichier->show();