Salome HOME
ede4b4be6b27966a027982fc8f030d2f1b6a8ebe
[modules/jobmanager.git] / src / genericgui / BL_CreateJobWizard.hxx
1 //  Copyright (C) 2009 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_JobsManager_QT.hxx"
27 #include "BL_SALOMEServices.hxx"
28
29 #include <string>
30 #include <list>
31
32 namespace BL{
33
34   class JobsManager_QT;
35   class CreateJobWizard: virtual public QWizard
36   {
37     Q_OBJECT
38
39     public:
40       CreateJobWizard(BL::JobsManager_QT * jobs_manager, BL::SALOMEServices * salome_services);
41       virtual ~CreateJobWizard();
42
43       void setFilesList(QListWidget * input_files_list, QListWidget * output_files_list);
44
45     public slots:
46       void end(int result);
47
48     private:
49       //Page Name
50       QLineEdit * _nameLineEdit;
51       BL::JobsManager_QT * _jobs_manager;
52       QListWidget * _input_files_list;
53       QListWidget * _output_files_list;
54
55     public:
56       // Results
57       std::string job_name;
58       
59       std::string yacs_file;
60
61       std::string command;
62
63       std::string batch_directory;
64       std::string expected_during_time;
65       std::string expected_memory;
66       int nb_proc;
67
68       std::string result_directory;
69       std::list<std::string> input_files_list;
70       std::list<std::string> output_files_list;
71
72       std::string machine_choosed;
73
74       bool start_job;
75
76     public:
77       enum {Page_JobName, Page_YACSSchema, Page_BatchParameters, Page_Files, 
78         Page_Command_Main_Definitions, Page_Machine, Page_Conclusion};
79
80       class JobNamePage: virtual public QWizardPage
81       {
82         public:
83           JobNamePage(QWidget * parent, BL::JobsManager_QT * jobs_manager);
84           virtual ~JobNamePage();
85
86           virtual bool validatePage();
87           virtual int nextId() const ;
88
89         private:          
90           BL::JobsManager_QT * _jobs_manager;
91           QRadioButton * _yacs_schema_button;
92       };
93
94
95       class CommandMainPage: virtual public QWizardPage
96       {
97         public:
98           CommandMainPage(QWidget * parent);
99           virtual ~CommandMainPage();
100
101           virtual bool validatePage();
102           virtual int nextId() const ;
103       };
104
105       class ConclusionPage: virtual public QWizardPage
106       {
107         public:
108           ConclusionPage(QWidget * parent);
109           virtual ~ConclusionPage();
110
111           virtual bool validatePage();
112           virtual int nextId() const ;
113       };
114   };
115
116   class YACSSchemaPage: virtual public QWizardPage
117   {
118     Q_OBJECT
119
120     public:
121       YACSSchemaPage(QWidget * parent);
122       virtual ~YACSSchemaPage();
123
124       virtual bool validatePage();
125       virtual int nextId() const ;
126
127     public slots:
128       void choose_file();
129
130     private:
131       QPushButton * _yacs_file_button;
132       QLineEdit * _yacs_file_text;
133   };
134
135   class BatchParametersPage: virtual public QWizardPage
136   {
137     Q_OBJECT
138
139     public:
140       BatchParametersPage(QWidget * parent);
141       virtual ~BatchParametersPage();
142
143       virtual bool validatePage();
144       virtual int nextId() const;
145   };
146
147   class FilesPage: virtual public QWizardPage
148   {
149     Q_OBJECT
150
151     public:
152       FilesPage(BL::CreateJobWizard * parent);
153       virtual ~FilesPage();
154
155       virtual int nextId() const;
156       virtual bool validatePage();
157
158     public slots:
159       void choose_input_files();
160       void remove_input_files();
161       void input_itemSelectionChanged();
162
163       void add_output_file();
164       void remove_output_files();
165       void output_itemSelectionChanged();
166
167     private:
168       QPushButton * _input_files_button;
169       QPushButton * _remove_input_files_button;
170       QListWidget * _input_files_list;
171
172       QPushButton * _output_files_button;
173       QPushButton * _remove_output_files_button;
174       QListWidget * _output_files_list;
175   };
176
177   class MachinePage: virtual public QWizardPage
178   {
179     Q_OBJECT
180
181     public:
182       MachinePage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services);
183       virtual ~MachinePage();
184
185       virtual int nextId() const;
186       virtual bool validatePage();
187
188     public slots:
189       void machine_itemSelectionChanged();
190
191     private:
192       QListWidget * _machine_list;
193       QLineEdit * _machine_choosed;
194       BL::SALOMEServices * _salome_services;
195   };
196 }
197
198 #endif
199