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