Salome HOME
b1f5c67d581d79376d0faca0da696f469d074a9a
[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 Ui {
33   class ResourceRequirementsWizardPage;
34   class FilesWizardPage;
35 }
36
37 namespace BL{
38
39   class JobsManager_QT;
40   class JobNamePage;
41   class CreateJobWizard: public QWizard
42   {
43     Q_OBJECT
44
45     public:
46       CreateJobWizard(BL::JobsManager_QT * jobs_manager, BL::SALOMEServices * salome_services);
47       virtual ~CreateJobWizard();
48
49       void setFilesList(QListWidget * input_files_list, QListWidget * output_files_list);
50
51       void clone(const std::string & name);
52
53     public slots:
54       void end(int result);
55
56     private:
57       //Page Name
58       QLineEdit * _nameLineEdit;
59       BL::JobsManager_QT * _jobs_manager;
60       QListWidget * _input_files_list;
61       QListWidget * _output_files_list;
62
63       BL::JobNamePage * _job_name_page;
64       BL::SALOMEServices * _salome_services;
65
66     public:
67       // Results
68       std::string job_name;
69
70       std::string yacs_file;
71       std::string command;
72       std::string python_salome_file;
73
74       std::string env_file;
75
76       std::string batch_directory;
77
78           // For COORM
79           std::string coorm_batch_directory;
80
81           std::string maximum_duration;
82       std::string expected_memory;
83       int nb_proc;
84       bool exclusive;
85
86           // Parameters for COORM
87           std::string launcher_file;
88           std::string launcher_args;
89
90       std::string result_directory;
91       std::list<std::string> input_files_list;
92       std::list<std::string> output_files_list;
93
94       std::string resource_choosed;
95       std::string batch_queue;
96
97       bool start_job;
98       int dump_yacs_state;
99       std::string ll_jobtype;
100
101     public:
102       enum {Page_JobName,
103             Page_YACSSchema,
104             Page_Command_Main_Definitions,
105             Page_PythonSalome_Main_Definitions,
106             Page_BatchParameters,
107                         Page_COORM_BatchParameters,
108             Page_Files,
109             Page_Resource,
110             Page_Conclusion};
111   };
112
113   class JobNamePage: public QWizardPage
114   {
115     Q_OBJECT
116
117     public:
118       JobNamePage(QWidget * parent, BL::JobsManager_QT * jobs_manager);
119       virtual ~JobNamePage();
120
121       virtual bool validatePage();
122       virtual int nextId() const ;
123       virtual void cleanupPage() {}
124
125     public slots:
126       void yacs_schema_button(bool checked);
127       void command_button(bool checked);
128       void python_salome_button(bool checked);
129
130     private:
131       BL::JobsManager_QT * _jobs_manager;
132       QLabel * _explanation;
133
134     public:
135       QRadioButton * _yacs_schema_button;
136       QRadioButton * _command_button;
137       QRadioButton * _python_salome_button;
138       bool _check_name;
139   };
140
141   class ConclusionPage: public QWizardPage
142   {
143     public:
144       ConclusionPage(QWidget * parent);
145       virtual ~ConclusionPage();
146
147       virtual bool validatePage();
148       virtual int nextId() const ;
149       virtual void cleanupPage() {}
150   };
151
152   class BatchParametersPage: public QWizardPage
153   {
154     Q_OBJECT
155
156     public:
157       BatchParametersPage(QWidget * parent);
158       virtual ~BatchParametersPage();
159
160       virtual bool validatePage();
161       virtual int nextId() const;
162       virtual void cleanupPage();
163
164     private:
165       Ui::ResourceRequirementsWizardPage * ui;
166   };
167
168   // For COORM
169   class COORM_BatchParametersPage: public QWizardPage
170   {
171     Q_OBJECT
172
173     public:
174       COORM_BatchParametersPage(QWidget * parent, BL::SALOMEServices * salome_services);
175       virtual ~COORM_BatchParametersPage();
176
177       virtual bool validatePage();
178       virtual int nextId() const;
179       virtual void cleanupPage();
180       virtual void initializePage();
181
182     public slots:
183       void choose_launcher_file();
184
185     private:
186       BL::SALOMEServices * _salome_services;
187       QLineEdit * _launcher_file_text;
188       QString resource_choosed;
189   };
190
191   class FilesPage: public QWizardPage
192   {
193     Q_OBJECT
194
195     public:
196       FilesPage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services);
197       virtual ~FilesPage();
198
199       virtual void initializePage();
200       virtual int nextId() const;
201       virtual bool validatePage();
202       virtual void cleanupPage() {}
203
204     public slots:
205       void choose_input_files();
206       void remove_input_files();
207       void input_itemSelectionChanged();
208       void choose_local_directory();
209
210       void add_output_file();
211       void remove_output_files();
212       void output_itemSelectionChanged();
213
214     private:
215       Ui::FilesWizardPage * ui;
216       BL::SALOMEServices * _salome_services;
217       QString resource_choosed;
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