Version: 8.3.0
PVGUI_Module.h
Go to the documentation of this file.
1 // PARAVIS : ParaView wrapper SALOME module
2 //
3 // Copyright (C) 2010-2016 CEA/DEN, EDF R&D
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 //
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 //
21 // File : PVGUI_Module.h
22 // Author : Sergey ANIKIN, Adrien BRUNETON
23 //
24 
25 
26 #ifndef PVGUI_Module_H
27 #define PVGUI_Module_H
28 
29 #include <LightApp_Module.h>
30 
31 class QMenu;
32 class QTimer;
33 class vtkEventQtSlotConnect;
34 class pqServer;
35 class pqPythonScriptEditor;
36 class pqPVApplicationCore;
37 class PVViewer_GUIElements;
38 class PVServer_ServiceWrapper;
39 class SUIT_ViewWindow;
40 
42 {
43  Q_OBJECT
44 
46  enum {
47  //-----------
48  // Menu "File"
50  //-
53  //-
57  //-
60  //-
63  //-----------
64  // Menu "Edit"
67  //-
70  //-
76  //-
77  SettingsId, // not used
78  ViewSettingsId, // not used
79  //-----------
80  // Menu "View"
81  FullScreenId, // not used
82  //-----------
83  // Menu "Animation"
84  FirstFrameId, // not used
85  PreviousFrameId, // not used
86  PlayId, // not used
87  NextFrameId, // not used
88  LastFrameId, // not used
89  LoopId, // not used
90  //-----------
91  // Menu "Tools"
94  CreateLookmarkId, // not used
98  DumpWidgetNamesId, // not used
109  //-----------
110  // Menu "Help"
113  EnableTooltipsId, // not used
114  };
115 
116 public:
117  PVGUI_Module();
118  ~PVGUI_Module();
119 
120  virtual void initialize( CAM_Application* );
121  virtual void windows( QMap<int, int>& ) const;
122 
123  void openFile( const char* ); // not used inside PARAVIS
124  void executeScript( const char* ); // not used inside PARAVIS
125 
126  void saveParaviewState( const QString& );
127  void loadParaviewState( const QString& );
128  void clearParaviewState();
129 
130  QString getTraceString();
131  void startTrace();
132  void stopTrace();
133  void saveTrace( const char* );
134 
135  pqServer* getActiveServer();
136 
137  virtual void createPreferences();
138 
139  inline static PVServer_ServiceWrapper* GetEngine();
140  inline static pqPVApplicationCore* GetPVApplication(); // not used inside PARAVIS
141 
142  virtual CAM_DataModel* createDataModel();
143 
144 private:
146  void pvCreateActions();
147 
149  void pvCreateMenus();
150 
152  void pvCreateToolBars();
153 
155  void setupDockWidgets();
156 
158  void saveDockWidgetsState( bool = true );
159 
162 
164  void showView( bool );
165 
167  QStringList getEmbeddedMacrosList();
168 
170  void updateMacros();
171 
174 
177 
178 private slots:
179  void showHelpForProxy( const QString&, const QString& );
180 
181  void onPreAccept(); // not used inside PARAVIS
182  void onPostAccept(); // not used inside PARAVIS
183  void endWaitCursor(); // not used inside PARAVIS
184 
186 
187  void onStartProgress();
188  void onEndProgress();
189  void onShowTrace();
190  void onRestartTrace();
191  void onStopTrace();
192 
193 public slots:
194  virtual bool activateModule( SUIT_Study* );
195  virtual bool deactivateModule( SUIT_Study* );
196  virtual void onApplicationClosed( SUIT_Application* );
197  virtual void studyClosed( SUIT_Study* );
198 
199 protected slots:
200  virtual void onInitTimer();
201  virtual void onViewManagerAdded( SUIT_ViewManager* );
202  virtual void onViewManagerRemoved( SUIT_ViewManager* );
203  virtual void onPVViewCreated( SUIT_ViewWindow* );
204  virtual void onPVViewDelete( SUIT_ViewWindow* );
205 
206 private:
211 
212  typedef QMap<QWidget*, bool> WgMap;
216  QList<QMenu*> myMenus;
217 
218  typedef QMap<int, bool> DockWindowMap;
220 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
221  QtMsgHandler myOldMsgHandler;
222 #else
223  QtMessageHandler myOldMsgHandler;
224 #endif
225  vtkEventQtSlotConnect* VTKConnect;
226 
227  pqPythonScriptEditor* myTraceWindow;
228 
230  QTimer* myInitTimer;
231 
232  PVViewer_GUIElements* myGuiElements;
233 };
234 
235 #endif // PVGUI_Module_H