Salome HOME
Mise à jour de la documentation
[modules/homard.git] / src / HOMARDGUI / MonEditYACS.cxx
1 // Copyright (C) 2011-2013  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 using namespace std;
21
22 #include "MonEditYACS.h"
23
24 #include "SalomeApp_Tools.h"
25 #include "HOMARDGUI_Utils.h"
26 #include "HomardQtCommun.h"
27 #include <utilities.h>
28
29
30 // -------------------------------------------------------------
31 /* Constructs a MonEditYACS
32     herite de MonCreateYACS
33 */
34 // -------------------------------------------------------------
35 MonEditYACS::MonEditYACS ( bool modal,
36                            HOMARD::HOMARD_Gen_var myHomardGen,
37                            QString Name ):
38    MonCreateYACS(myHomardGen, Name)
39 {
40     MESSAGE("Debut de MonEditYACS" << Name.toStdString().c_str());
41     setWindowTitle(QObject::tr("HOM_YACS_EDIT_WINDOW_TITLE"));
42     _Name = Name;
43     aYACS = myHomardGen->GetYACS(_Name.toStdString().c_str());
44     InitValEdit();
45 }
46 // ------------------------------
47 MonEditYACS::~MonEditYACS()
48 // ------------------------------
49 {
50 }
51 // ------------------------------
52 void MonEditYACS::InitValEdit()
53 // ------------------------------
54 {
55   MESSAGE("InitValEdit");
56   LEName->setText(_Name);
57   LEName->setReadOnly(true);
58
59   QString _aCaseName = aYACS->GetCaseName();
60   LECaseName->setText(_aCaseName);
61   LECaseName->setReadOnly(true);
62   PBCaseName->setVisible(0);
63
64   QString aScriptFile = aYACS->GetScriptFile();
65   LEScriptFile->setText(aScriptFile);
66
67   QString aDirName = aYACS->GetDirName();
68   LEDirName->setText(aDirName);
69
70   QString aMeshFile = aYACS->GetMeshFile();
71   LEMeshFile->setText(aMeshFile);
72
73   int Type=aYACS->GetType();
74   if(Type==1) { RBStatic->setChecked(true); }
75   else        { RBTransient->setChecked(true); };
76   RBStatic->setEnabled(false);
77   RBTransient->setEnabled(false);
78 //
79   adjustSize();
80 }
81
82 // ---------------------------------------------------
83 bool MonEditYACS:: CreateOrUpdate()
84 //----------------------------------------------------
85 //  Modification du schema
86 {
87   MESSAGE("CreateOrUpdate");
88
89   // Les donnees
90   QString aScriptFile=LEScriptFile->text().trimmed();
91   if ( aScriptFile != _aScriptFile )
92   {
93     _aScriptFile = aScriptFile ;
94     aYACS->SetScriptFile(CORBA::string_dup(_aScriptFile.toStdString().c_str())) ;
95   }
96   QString aDirName=LEDirName->text().trimmed();
97   if ( aDirName != _aDirName )
98   {
99     _aDirName = aDirName ;
100     aYACS->SetDirName(CORBA::string_dup(_aDirName.toStdString().c_str())) ;
101   }
102   QString aMeshFile=LEMeshFile->text().trimmed();
103   if ( aMeshFile != _aMeshFile )
104   {
105     _aMeshFile = aMeshFile ;
106     aYACS->SetMeshFile(CORBA::string_dup(_aMeshFile.toStdString().c_str())) ;
107   }
108
109   return true ;
110 }