Salome HOME
b1b09802df08feb0eeeaac241e2fb6854b91481c
[modules/jobmanager.git] / src / genericgui / BL_JobsManager_QT.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_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
29 #include <string>
30
31 namespace BL{
32
33   class JobManagerEvent : public QEvent
34   {
35     public:
36       JobManagerEvent(const std::string & action_i, 
37                       const std::string & event_name_i, 
38                       const std::string & job_name_i, 
39                       const std::string & data_i);
40       virtual ~JobManagerEvent();
41
42     public:
43       std::string action;
44       std::string event_name;
45       std::string job_name;
46       std::string data;
47   };
48
49   class JobsManager_QT: virtual public QDockWidget,
50                         virtual public BL::JobsManager,
51                         virtual public BL::Observer
52   {
53     Q_OBJECT
54
55     public:
56       JobsManager_QT(QWidget * parent, BL::SALOMEServices * salome_services);
57       virtual ~JobsManager_QT();
58
59       void delete_job(QString job_name);
60       void create_job_wizard();
61
62       virtual void sendEvent(const std::string & action, 
63                              const std::string & event_name, 
64                              const std::string & job_name, 
65                              const std::string & data);
66       bool event(QEvent * e);
67
68       void write_normal_text(const QString & text);
69       void write_error_text(const QString & text);
70
71     public slots:
72       void RefreshJobs();
73       void no_auto_refresh();
74       void ten_seconds_refresh();
75       void thirty_seconds_refresh();
76       void one_minute_refresh();
77       void five_minutes_refresh();
78       void thirty_minutes_refresh();
79       void one_hour_refresh();
80
81     signals:
82       void new_job_added(const QString & name);
83       void job_state_changed(const QString & name);
84
85     private:
86       QPushButton * _load_jobs;
87       QPushButton * _save_jobs;
88       QPushButton * _auto_refresh_jobs;
89       QTimer * _timer;
90       QTextEdit * _log;
91   };
92
93 }
94
95 #endif
96
97