Version: 8.3.0
GenericGui.hxx
Go to the documentation of this file.
1 // Copyright (C) 2006-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 _GENERICGUI_HXX_
21 #define _GENERICGUI_HXX_
22 
23 #include "GenericGuiExport.hxx"
24 
25 #include <QAction>
26 #include <QActionGroup>
27 #include <QObject>
28 #include <QMainWindow>
29 #include <QDockWidget>
30 #include <QString>
31 
32 #include "SuitWrapper.hxx"
33 
34 #include <map>
35 #include <list>
36 #include <string>
37 
38 namespace YACS
39 {
40 
41  namespace ENGINE
42  {
43  class Proc;
44  class Catalog;
45  }
46  namespace HMI
47  {
48  class QtGuiContext;
49  class GuiEditor;
50  class SuitWrapper;
51  class CatalogWidget;
52  class YACSGuiLoader;
53  class SubjectDataPort;
54  class BatchJobsListDialog;
55 
57  {
58  Q_OBJECT
59 
60  public:
61  GenericGui(YACS::HMI::SuitWrapper* wrapper, QMainWindow *parent = 0);
62  virtual ~GenericGui();
63 
64  void createActions();
65  void createMenus();
66  void createTools();
67  void initialMenus();
68  void hideAllMenus();
69  void showBaseMenus(bool show);
70  void showEditionMenus(bool show);
71  void showExecMenus(bool show);
72  void showCommonMenus(bool show);
73  void switchContext(QWidget *view, bool onExit = false);
74  bool closeContext(QWidget *view, bool onExit = false);
75  void showDockWidgets(bool isVisible);
76  void raiseStacked();
77  CatalogWidget* getCatalogWidget() { return _catalogsWidget; };
78  std::list<std::string> getMachineList();
79  void createForEachLoop(std::string type="double");
80  void putGraphInForeachLoop(std::string type);
81  virtual void loadSchema(const std::string& filename,bool edit=true, bool arrangeLocalNodes=false);
82  virtual void onHelpContextModule( const QString&, const QString&, const QString& = QString() );
83  void createContext(YACS::ENGINE::Proc* proc,
84  const QString& schemaName,
85  const QString& runName,
86  bool forEdition);
87  YACSGuiLoader *getLoader() { return _loader; };
88 
89  QAction *_newSchemaAct;
90  QAction *_importSchemaAct;
93  QAction *_exportSchemaAct;
96 
100 
101  QAction *_startResumeAct;
102  QAction *_abortAct;
103  QAction *_pauseAct;
104  QAction *_resetAct;
105 
107  QAction *_newEditionAct;
108 
109  QActionGroup *_execModeGroup;
113 
115 
121 
135  QAction *_cppNodeAct;
136  QAction *_XMLNodeAct;
137  QAction *_inDataNodeAct;
138  QAction *_outDataNodeAct;
139  QAction *_inStudyNodeAct;
143  QAction *_blockNodeAct;
144  QAction *_FORNodeAct;
145  QAction *_FOREACHNodeAct;
146  QAction *_WHILENodeAct;
147  QAction *_SWITCHNodeAct;
150  QAction *_deleteItemAct;
151  QAction *_cutItemAct;
152  QAction *_copyItemAct;
153  QAction *_pasteItemAct;
154  QAction *_putInBlocAct;
161  QAction *_computeLinkAct;
162  QAction *_zoomToBlocAct;
164  QAction *_shrinkExpand;
167 
175  QAction *_whatsThisAct;
176 
179 
184 
189 
191  QAction *_showLinkAct;
192  QAction *_hideLinkAct;
195 
196  QAction *_undoAct;
197  QAction *_redoAct;
198  QAction *_showUndoAct;
199  QAction *_showRedoAct;
200 
202  void setLoadedPresentation(YACS::ENGINE::Proc* proc);
203 
204  public slots:
205  void onCleanOnExit();
206 
207  protected:
208  int getMenuId() { return _menuId++; }
209  QString getSaveFileName(const QString& fileName = QString());
210 
214  QDockWidget* _dwTree;
215  QDockWidget* _dwStacked;
216  QDockWidget* _dwCatalogs;
221  std::map<QWidget*, YACS::HMI::QtGuiContext*> _mapViewContext;
222  int _menuId;
223  int _toolId;
225  bool _isSaved;
226  std::list<std::string> _machineList;
227 
228  private slots:
229 
230  void onNewSchema();
231  void onImportSchema();
232  void onChooseBatchJob();
233  void onImportSupervSchema();
234  void onExportSchema();
235  void onExportSchemaAs();
236  void onImportCatalog();
237 
238  void onRunLoadedSchema(bool withState = false);
239  void onLoadRunStateSchema();
240  void onLoadAndRunSchema();
241 
242  void onStartResume();
243  void onAbort();
244  void onPause();
245  void onReset();
246  void onSaveRunState();
247  void onNewEdition();
248 
249  void onWithoutStopMode(bool checked);
250  void onBreakpointsMode(bool checked);
251  void onStepByStepMode(bool checked);
252 
253  void onToggleStopOnError(bool checked);
254 
255  void onGetYacsContainerLog();
256  void onGetErrorReport();
257  void onGetErrorDetails();
258  void onGetContainerLog();
259  void onShutdownProc();
260 
261  void onEditDataTypes();
262  void onCreateDataType();
263  void onImportDataType();
264 
265  void onNewContainer();
266  void onNewHPContainer();
267  void onSelectComponentInstance();
268  void onNewSalomeComponent();
269  void onNewSalomePythonComponent();
270  void onNewCorbaComponent();
271 
272  void onSalomeServiceNode();
273  void onServiceInlineNode();
274  void onCORBAServiceNode();
275  void onNodeNodeServiceNode();
276  void onCppNode();
277  void onXMLNode();
278  void onInDataNode();
279  void onOutDataNode();
280  void onInStudyNode();
281  void onOutStudyNode();
282  void onInlineScriptNode();
283  void onInlineFunctionNode();
284  void onBlockNode();
285  void onFORNode();
286  void onFOREACHNode();
287  void onWHILENode();
288  void onSWITCHNode();
289  void onOptimizerLoop();
290  void onNodeFromCatalog();
291 
292  void onDeleteItem();
293  void onCutItem();
294  void onCopyItem();
295  void onPasteItem();
296  void onPutInBloc();
297  void onPutGraphInBloc();
298  void onPutGraphInForLoop();
299  void onPutGraphInWhileLoop();
300  void onPutGraphInOptimizerLoop();
301  void onArrangeLocalNodes();
302  void onArrangeRecurseNodes();
303  void onRebuildLinks();
304  void onZoomToBloc();
305  void onCenterOnNode();
306  void onShrinkExpand();
307  void onShrinkExpandChildren();
308  void onShrinkExpandElementaryRecursively();
309  void onToggleStraightLinks(bool checked);
310  void onToggleAutomaticComputeLinks(bool checked);
311  void onToggleSimplifyLinks(bool checked);
312  void onToggleForce2NodesLinks(bool checked);
313  void onToggleAddRowCols(bool checked);
314 
315  void onToggleSceneItemVisible(bool checked);
316 
317  void onShowAllLinks();
318  void onHideAllLinks();
319 
320  void onShowOnlyPortLinks();
321  void onShowPortLinks();
322  void onHidePortLinks();
323  void onEmphasisPortLinks();
324 
325  void onShowOnlyCtrlLinks();
326  void onShowCtrlLinks();
327  void onHideCtrlLinks();
328  void onEmphasisCtrlLinks();
329 
330  void onShowOnlyLink();
331  void onShowLink();
332  void onHideLink();
333  void onEmphasisLink();
334  void onDeEmphasizeAll();
335 
336  void onSelectReference();
337  void onWhatsThis();
338 
339  void onUndo();
340  void onRedo();
341  void onShowUndo();
342  void onShowRedo();
343 
344  private:
345  void displayLinks(bool isShown);
346  void displayControlLinks(bool isShown);
347  void displayPortLinks(bool isShown);
348  void displayALink(bool isShown);
349  void emphasizePortLink(YACS::HMI::SubjectDataPort* sub, bool emphasize);
350  };
351 
352  }
353 }
354 
355 #endif