Salome HOME
6d2571dd69596e8419e472655d945d7f31ae4368
[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 #include "MonEditYACS.h"
21
22 #include "SalomeApp_Tools.h"
23 #include "HOMARDGUI_Utils.h"
24 #include "HomardQtCommun.h"
25 #include <utilities.h>
26
27 using namespace std;
28
29 // -------------------------------------------------------------
30 /* Constructs a MonEditYACS
31     herite de MonCreateYACS
32 */
33 // -------------------------------------------------------------
34 MonEditYACS::MonEditYACS ( bool modal,
35                            HOMARD::HOMARD_Gen_var myHomardGen,
36                            QString Name ):
37    MonCreateYACS(myHomardGen, Name)
38 {
39     MESSAGE("Debut de MonEditYACS" << Name.toStdString().c_str());
40     setWindowTitle(QObject::tr("HOM_YACS_EDIT_WINDOW_TITLE"));
41     _Name = Name;
42     aYACS = myHomardGen->GetYACS(_Name.toStdString().c_str());
43     InitValEdit();
44 }
45 // ------------------------------
46 MonEditYACS::~MonEditYACS()
47 // ------------------------------
48 {
49 }
50 // ------------------------------
51 void MonEditYACS::InitValEdit()
52 // ------------------------------
53 {
54   MESSAGE("InitValEdit");
55   LEName->setText(_Name);
56   LEName->setReadOnly(true);
57
58   QString _aCaseName = aYACS->GetCaseName();
59   LECaseName->setText(_aCaseName);
60   LECaseName->setReadOnly(true);
61   PBCaseName->setVisible(0);
62
63   QString aScriptFile = aYACS->GetScriptFile();
64   LEScriptFile->setText(aScriptFile);
65
66   QString aDirName = aYACS->GetDirName();
67   LEDirName->setText(aDirName);
68
69   QString aMeshFile = aYACS->GetMeshFile();
70   LEMeshFile->setText(aMeshFile);
71
72   int Type=aYACS->GetType();
73   if(Type==1) { RBConstant->setChecked(true); }
74   else        { RBVariable->setChecked(true); };
75   RBConstant->setEnabled(false);
76   RBVariable->setEnabled(false);
77 //
78 }
79
80 // ---------------------------------------------------
81 bool MonEditYACS:: CreateOrUpdate()
82 //----------------------------------------------------
83 //  Modification du schema
84 {
85   MESSAGE("CreateOrUpdate");
86
87   // Les donnees
88   QString aScriptFile=LEScriptFile->text().trimmed();
89   if ( aScriptFile != _aScriptFile )
90   {
91     _aScriptFile = aScriptFile ;
92     aYACS->SetScriptFile(CORBA::string_dup(_aScriptFile.toStdString().c_str())) ;
93   }
94   QString aDirName=LEDirName->text().trimmed();
95   if ( aDirName != _aDirName )
96   {
97     _aDirName = aDirName ;
98     aYACS->SetDirName(CORBA::string_dup(_aDirName.toStdString().c_str())) ;
99   }
100   QString aMeshFile=LEMeshFile->text().trimmed();
101   if ( aMeshFile != _aMeshFile )
102   {
103     _aMeshFile = aMeshFile ;
104     aYACS->SetMeshFile(CORBA::string_dup(_aMeshFile.toStdString().c_str())) ;
105   }
106
107   return true ;
108 }