Salome HOME
Ask to save the jobs before exit.
[modules/jobmanager.git] / src / genericgui / BL_GenericGui.hxx
1 // Copyright (C) 2009-2016  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_GENERICGUI_HXX_
21 #define _BL_GENERICGUI_HXX_
22
23 #include "BL_GenericGuiDefines.hxx"
24
25 #include "BL_Traces.hxx"
26
27 #include "BL_SALOMEServices.hxx"
28
29 #include "BL_MainWindows_Wrap.hxx"
30
31 #include "BL_QModelManager.hxx"
32 #include "BL_JobsManager_QT.hxx"
33 #include "BL_JobsTable.hxx"
34 #include "BL_JobTab.hxx"
35 #include "BL_Buttons.hxx"
36 #include "BL_Summary.hxx"
37 #include "JM_ResourceCatalog.hxx"
38
39 #include <QObject>
40
41 class QAction;
42 class QDockWidget;
43 class QMainWindow;
44 class QModelIndex;
45
46 namespace BL 
47 {
48   class BL_GenericGui_EXPORT GenericGui: public QObject
49   {
50     Q_OBJECT
51
52     public:
53       GenericGui(BL::MainWindows_Wrap * wrapper);
54       virtual ~GenericGui();
55
56       void createDockWidgets();
57       void createCentralWidget();
58
59       void showDockWidgets(bool isVisible);
60       void createActions();
61       void createMenus();
62
63       void delete_job_internal();
64
65       void deleteDockWidget();
66       void delete_job_external(const QString & name);
67
68       void reset_job_selection();
69
70       void saveIfNeeded();
71
72     public slots:
73       void create_job();
74       void edit_clone_job();
75       void start_job();
76       void restart_job();
77       void delete_job();
78       void refresh_job();
79       void stop_job();
80       void get_results_job();
81       void job_selected(const QModelIndex & index);
82       void job_activated(const QModelIndex & index);
83       void job_state_changed(const QString & name);
84       void updateButtonsStates();
85       void updateButtonsStatesSingleSelection();
86
87     public:
88       BL::JobTab * _job_tab;
89       BL::JobsTable * _jobs_table;
90
91     protected:
92       BL::MainWindows_Wrap * _wrapper;
93
94       BL::SALOMEServices * _salome_services;
95
96       QMainWindow * _dock_parent;
97       QMainWindow * _tab_parent;
98       QDockWidget * _dw_summary;
99       QDockWidget * _dw_resource_catalog;
100
101       BL::Buttons * _buttons;
102       BL::Summary * _summary;
103
104       QAction * _create_job_action;
105       QAction * _edit_clone_job_action;
106       QAction * _start_job_action;
107       QAction * _restart_job_action;
108       QAction * _delete_job_action;
109       QAction * _stop_job_action;
110       QAction * _get_results_job_action;
111       QAction * _refresh_job_action;
112
113       BL::JobsManager_QT * _jobs_manager;
114       BL::QModelManager * _model_manager;
115       QStandardItemModel * _model;
116       JM::ResourceCatalog * _resource_catalog;
117
118       QString _job_name_selected;
119   };
120 }
121
122 #endif