Salome HOME
Integrate developments from N. Toukourou at INRIA (OAR and CooRM support)
[modules/jobmanager.git] / src / genericgui / BL_CreateJobWizard.hxx
1 // Copyright (C) 2009-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 #ifndef _BL_CREATEJOBWIZARD_HXX_
21 #define _BL_CREATEJOBWIZARD_HXX_
22
23 #include <QtGui>
24
25 #include "BL_Traces.hxx"
26 #include "BL_SALOMEServices.hxx"
27 #include "JM_ResourceCatalog.hxx"
28
29 #include <string>
30 #include <list>
31
32 namespace BL{
33
34   class JobsManager_QT;
35   class JobNamePage;
36   class CreateJobWizard: public QWizard
37   {
38     Q_OBJECT
39
40     public:
41       CreateJobWizard(BL::JobsManager_QT * jobs_manager, BL::SALOMEServices * salome_services);
42       virtual ~CreateJobWizard();
43
44       void setFilesList(QListWidget * input_files_list, QListWidget * output_files_list);
45
46       void clone(const std::string & name);
47
48     public slots:
49       void end(int result);
50
51     private:
52       //Page Name
53       QLineEdit * _nameLineEdit;
54       BL::JobsManager_QT * _jobs_manager;
55       QListWidget * _input_files_list;
56       QListWidget * _output_files_list;
57
58       BL::JobNamePage * _job_name_page;
59       BL::SALOMEServices * _salome_services;
60
61     public:
62       // Results
63       std::string job_name;
64
65       std::string yacs_file;
66       std::string command;
67       std::string python_salome_file;
68
69       std::string env_file;
70
71       std::string batch_directory;
72
73           // For COORM
74           std::string coorm_batch_directory;
75
76           std::string maximum_duration;
77       std::string expected_memory;
78       int nb_proc;
79
80           // Parameters for COORM
81           std::string launcher_file;
82           std::string launcher_args;
83
84       std::string result_directory;
85       std::list<std::string> input_files_list;
86       std::list<std::string> output_files_list;
87
88       std::string resource_choosed;
89       std::string batch_queue;
90
91       bool start_job;
92       int dump_yacs_state;
93       std::string ll_jobtype;
94
95     public:
96       enum {Page_JobName,
97             Page_YACSSchema,
98             Page_Command_Main_Definitions,
99             Page_PythonSalome_Main_Definitions,
100             Page_BatchParameters,
101                         Page_COORM_BatchParameters,
102             Page_Files,
103             Page_Resource,
104             Page_Conclusion};
105   };
106
107   class JobNamePage: public QWizardPage
108   {
109     Q_OBJECT
110
111     public:
112       JobNamePage(QWidget * parent, BL::JobsManager_QT * jobs_manager);
113       virtual ~JobNamePage();
114
115       virtual bool validatePage();
116       virtual int nextId() const ;
117       virtual void cleanupPage() {}
118
119     public slots:
120       void yacs_schema_button(bool checked);
121       void command_button(bool checked);
122       void python_salome_button(bool checked);
123
124     private:
125       BL::JobsManager_QT * _jobs_manager;
126       QLabel * _explanation;
127
128     public:
129       QRadioButton * _yacs_schema_button;
130       QRadioButton * _command_button;
131       QRadioButton * _python_salome_button;
132       bool _check_name;
133   };
134
135   class ConclusionPage: public QWizardPage
136   {
137     public:
138       ConclusionPage(QWidget * parent);
139       virtual ~ConclusionPage();
140
141       virtual bool validatePage();
142       virtual int nextId() const ;
143       virtual void cleanupPage() {}
144   };
145
146   class BatchParametersPage: public QWizardPage
147   {
148     Q_OBJECT
149
150     public:
151       BatchParametersPage(QWidget * parent, BL::SALOMEServices * salome_services);
152       virtual ~BatchParametersPage();
153
154       virtual bool validatePage();
155       virtual int nextId() const;
156       virtual void cleanupPage();
157       virtual void initializePage();
158
159     private:
160       BL::SALOMEServices * _salome_services;
161       QString resource_choosed;
162   };
163
164   // For COORM
165   class COORM_BatchParametersPage: public QWizardPage
166   {
167     Q_OBJECT
168
169     public:
170       COORM_BatchParametersPage(QWidget * parent, BL::SALOMEServices * salome_services);
171       virtual ~COORM_BatchParametersPage();
172
173       virtual bool validatePage();
174       virtual int nextId() const;
175       virtual void cleanupPage();
176       virtual void initializePage();
177
178     public slots:
179       void choose_launcher_file();
180
181     private:
182       BL::SALOMEServices * _salome_services;
183       QLineEdit * _launcher_file_text;
184       QString resource_choosed;
185   };
186
187   class FilesPage: public QWizardPage
188   {
189     Q_OBJECT
190
191     public:
192       FilesPage(BL::CreateJobWizard * parent);
193       virtual ~FilesPage();
194
195       virtual int nextId() const;
196       virtual bool validatePage();
197       virtual void cleanupPage() {}
198
199     public slots:
200       void choose_input_files();
201       void remove_input_files();
202       void input_itemSelectionChanged();
203       void choose_local_directory();
204
205       void add_output_file();
206       void remove_output_files();
207       void output_itemSelectionChanged();
208
209     private:
210       QPushButton * _input_files_button;
211       QPushButton * _remove_input_files_button;
212       QListWidget * _input_files_list;
213       QLineEdit * _result_directory;
214
215       QPushButton * _output_files_button;
216       QPushButton * _remove_output_files_button;
217       QListWidget * _output_files_list;
218   };
219
220   class ResourcePage: public QWizardPage
221   {
222     Q_OBJECT
223
224     public:
225       ResourcePage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services);
226       virtual ~ResourcePage();
227
228       virtual int nextId() const;
229       virtual bool validatePage();
230       virtual void initializePage();
231       virtual void cleanupPage() {}
232
233     public slots:
234       void itemSelected(QListWidgetItem * item);
235
236     private:
237       JM::ResourceCatalog * _resource_list;
238       QLineEdit * _resource_choosed;
239       BL::SALOMEServices * _salome_services;
240
241       QLabel * _ll_label;
242       QLineEdit * _ll_value;
243       QGridLayout * _main_layout;
244   };
245
246   class YACSSchemaPage: public QWizardPage
247   {
248     Q_OBJECT
249
250     public:
251       YACSSchemaPage(QWidget * parent);
252       virtual ~YACSSchemaPage();
253
254       virtual bool validatePage();
255       virtual int nextId() const ;
256       virtual void cleanupPage() {}
257
258     public slots:
259       void choose_file();
260       void choose_env_file();
261
262     private:
263       QLineEdit * _yacs_file_text;
264       QLineEdit * _line_env_file;
265   };
266
267   class CommandMainPage: public QWizardPage
268   {
269     Q_OBJECT
270
271     public:
272       CommandMainPage(QWidget * parent);
273       virtual ~CommandMainPage();
274
275       virtual bool validatePage();
276       virtual int nextId() const ;
277       virtual void cleanupPage() {}
278
279     public slots:
280       void choose_command_file();
281       void choose_env_file();
282
283     private:
284       QLineEdit * _line_command;
285       QLineEdit * _line_env_file;
286   };
287
288   class PythonSalomeMainPage: public QWizardPage
289   {
290     Q_OBJECT
291
292     public:
293       PythonSalomeMainPage(QWidget * parent);
294       virtual ~PythonSalomeMainPage();
295
296       virtual bool validatePage();
297       virtual int nextId() const ;
298       virtual void cleanupPage() {}
299
300     public slots:
301       void choose_PythonSalome_file();
302       void choose_env_file();
303
304     private:
305       QLineEdit * _line_PythonSalome;
306       QLineEdit * _line_env_file;
307   };
308 }
309
310 #endif
311