Salome HOME
Synchronize adm files
[modules/jobmanager.git] / src / genericgui / BL_JobsManager_QT.hxx
1 // Copyright (C) 2009-2014  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, or (at your option) any later version.
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_JOBSMANAGER_QT_HXX_
21 #define _BL_JOBSMANAGER_QT_HXX_
22
23 #include <QObject>
24
25 #include "BL_Traces.hxx"
26 #include "BL_JobsManager.hxx"
27 #include "BL_CreateJobWizard.hxx"
28 #include "BL_JobsManager.hxx"
29 #include "BL_QModelManager.hxx"
30
31 #include <string>
32
33 namespace BL{
34
35   class JobManagerEvent : public QEvent
36   {
37     public:
38       JobManagerEvent(const std::string & action_i, 
39                       const std::string & event_name_i, 
40                       const std::string & job_name_i, 
41                       const std::string & data_i);
42       virtual ~JobManagerEvent();
43
44     public:
45       std::string action;
46       std::string event_name;
47       std::string job_name;
48       std::string data;
49   };
50
51   class GenericGui;
52   class JobsManager_QT: public QDockWidget,
53                         public BL::JobsManager,
54                         public BL::Observer
55   {
56     Q_OBJECT
57
58     public:
59       JobsManager_QT(QWidget * parent, BL::GenericGui * main_gui, BL::SALOMEServices * salome_services);
60       virtual ~JobsManager_QT();
61
62       void delete_job(QString job_name);
63
64       void create_job();
65       void edit_clone_job(const std::string & name);
66       void restart_job(const std::string & name);
67
68       virtual void sendEvent(const std::string & action, 
69                              const std::string & event_name, 
70                              const std::string & job_name, 
71                              const std::string & data);
72       bool event(QEvent * e);
73
74       void write_normal_text(const QString & text);
75       void write_error_text(const QString & text);
76
77       void set_model_manager(BL::QModelManager * model_manager);
78
79     protected:
80       void create_job_with_wizard(BL::CreateJobWizard & wizard);
81
82     public slots:
83       void RefreshJobs();
84       void no_auto_refresh();
85       void ten_seconds_refresh();
86       void thirty_seconds_refresh();
87       void one_minute_refresh();
88       void five_minutes_refresh();
89       void thirty_minutes_refresh();
90       void one_hour_refresh();
91       void load_jobs_button();
92       void save_jobs_button();
93
94     signals:
95       void new_job_added(const QString & name);
96       void job_state_changed(const QString & name);
97
98     private:
99       QPushButton * _load_jobs;
100       QPushButton * _save_jobs;
101       QPushButton * _auto_refresh_jobs;
102       QTimer * _timer;
103       QTextEdit * _log;
104       BL::GenericGui * _main_gui;
105       BL::QModelManager * _model_manager;
106   };
107
108 }
109
110 #endif
111
112