pqApplicationCore.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: pqApplicationCore.h
5 
6  Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
7  All rights reserved.
8 
9  ParaView is a free software; you can redistribute it and/or modify it
10  under the terms of the ParaView license version 1.2.
11 
12  See License_v1.2.txt for the full ParaView license.
13  A copy of this license can be obtained by contacting
14  Kitware Inc.
15  28 Corporate Drive
16  Clifton Park, NY 12065
17  USA
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
23 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 ========================================================================*/
32 #ifndef pqApplicationCore_h
33 #define pqApplicationCore_h
34 
35 #include "pqCoreModule.h"
36 #include "vtkParaViewDeprecation.h" // for PARAVIEW_DEPRECATED_IN_5_10_0
37 #include "vtkSmartPointer.h" // for vtkSmartPointer
38 #include <QObject>
39 #include <QPointer>
40 #include <exception> // for std::exception
41 
42 class pqInterfaceTracker;
43 class pqLinksModel;
45 class pqObjectBuilder;
46 class pqOptions;
47 class pqPipelineSource;
48 class pqPluginManager;
49 class pqProgressManager;
51 class pqServer;
55 class pqServerResource;
56 class pqSettings;
57 class pqTestUtility;
58 class pqUndoStack;
59 class QApplication;
60 class QHelpEngine;
61 class QStringList;
62 class vtkPVXMLElement;
63 class vtkSMProxyLocator;
64 class vtkSMStateLoader;
65 class vtkCLIOptions;
66 
67 class PQCORE_EXPORT pqApplicationCoreExitCode : public std::exception
68 {
69  int Code = 0;
70 
71 public:
73  : Code(ecode)
74  {
75  }
76  int code() const { return this->Code; }
77 };
78 
89 class PQCORE_EXPORT pqApplicationCore : public QObject
90 {
91  Q_OBJECT
92  typedef QObject Superclass;
93 
94 public:
95  // Get the global instance for the pqApplicationCore.
96  static pqApplicationCore* instance();
97 
112  pqApplicationCore(int& argc, char** argv, vtkCLIOptions* options = nullptr,
113  bool addStandardArgs = true, QObject* parent = nullptr);
114 
116 
120  PARAVIEW_DEPRECATED_IN_5_10_0("Replaced by `vtkCLIOptions` APIs")
121  pqApplicationCore(int& argc, char** argv, pqOptions* options, QObject* parent = nullptr);
122  PARAVIEW_DEPRECATED_IN_5_10_0("Replaced by `vtkCLIOptions` APIs")
123  pqOptions* getOptions() const;
125 
131  pqObjectBuilder* getObjectBuilder() const { return this->ObjectBuilder; }
132 
137  void setUndoStack(pqUndoStack* stack);
138  pqUndoStack* getUndoStack() const { return this->UndoStack; }
139 
151  void registerManager(const QString& function, QObject* manager);
152 
156  //. \sa registerManager
157  QObject* manager(const QString& function);
158 
162  void unRegisterManager(const QString& function);
163 
168  QHelpEngine* helpEngine();
169 
174  void registerDocumentation(const QString& filename);
175 
182  pqServerManagerObserver* getServerManagerObserver() { return this->ServerManagerObserver; }
183 
190  pqServerManagerModel* getServerManagerModel() const { return this->ServerManagerModel; }
191 
197  pqInterfaceTracker* interfaceTracker() const { return this->InterfaceTracker; }
198 
206  pqLinksModel* getLinksModel() const { return this->LinksModel; }
207 
212  {
213  return this->MainWindowEventManager;
214  }
215 
219  pqPluginManager* getPluginManager() const { return this->PluginManager; }
220 
224  pqProgressManager* getProgressManager() const { return this->ProgressManager; }
225 
229  virtual pqTestUtility* testUtility();
230 
235  pqRecentlyUsedResourcesList& recentlyUsedResources();
236 
241  pqServerConfigurationCollection& serverConfigurations();
242 
246  pqSettings* settings();
247 
256  void clearSettings();
257 
261  vtkPVXMLElement* saveState();
262 
267  bool saveState(const QString& filename);
268 
273  void loadState(vtkPVXMLElement* root, pqServer* server, vtkSMStateLoader* loader = nullptr);
274 
280  void loadState(const char* filename, pqServer* server, vtkSMStateLoader* loader = nullptr);
281 
285  void loadStateFromString(
286  const char* xmlcontents, pqServer* server, vtkSMStateLoader* loader = nullptr);
287 
288  void clearViewsForLoadingState(pqServer* server);
289 
294  void loadStateIncremental(
295  vtkPVXMLElement* root, pqServer* server, vtkSMStateLoader* loader = nullptr);
296  void loadStateIncremental(
297  const QString& filename, pqServer* server, vtkSMStateLoader* loader = nullptr);
298 
302  void setLoadingState(bool value) { this->LoadingState = value; };
303 
309  bool isLoadingState() { return this->LoadingState; };
310 
314  pqServer* getActiveServer() const;
315 
319  ~pqApplicationCore() override;
320 
324  void _paraview_client_environment_complete();
325 
326 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
327 
331  void prepareForQuit();
332 
336  void quit();
337 
339 
345  void loadConfiguration(const QString& filename);
346  void loadConfigurationXML(const char* xmldata);
348 
352  void updateAvailableReadersAndWriters();
353 
357  void render();
358 
359 Q_SIGNALS:
367  void aboutToLoadState(vtkPVXMLElement* root);
368 
374  void stateLoaded(vtkPVXMLElement* root, vtkSMProxyLocator* locator);
375 
381  void stateSaved(vtkPVXMLElement* root);
382 
386  void undoStackChanged(pqUndoStack*);
387 
391  void loadXML(vtkPVXMLElement*);
392 
396  void forceFilterMenuRefresh();
397 
401  void updateMasterEnableState(bool);
402 
407  void clientEnvironmentDone();
408 
409 protected Q_SLOTS:
410  void onStateLoaded(vtkPVXMLElement* root, vtkSMProxyLocator* locator);
411  void onStateSaved(vtkPVXMLElement* root);
412  void onHelpEngineWarning(const QString&);
413 
414 private Q_SLOTS:
420  void generalSettingsChanged();
421 
422 protected:
424 
425  PARAVIEW_DEPRECATED_IN_5_10_0("Replaced by `vtkCLIOptions` APIs")
427  PARAVIEW_DEPRECATED_IN_5_10_0("Replaced by `vtkCLIOptions` APIs")
428  void setOptions(pqOptions* options);
429  pqLinksModel* LinksModel;
430  pqObjectBuilder* ObjectBuilder;
431  pqInterfaceTracker* InterfaceTracker;
432  pqMainWindowEventManager* MainWindowEventManager;
433  pqPluginManager* PluginManager;
434  pqProgressManager* ProgressManager;
435  pqServerManagerModel* ServerManagerModel;
436  pqServerManagerObserver* ServerManagerObserver;
437  pqUndoStack* UndoStack;
438  pqRecentlyUsedResourcesList* RecentlyUsedResourcesList;
439  pqServerConfigurationCollection* ServerConfigurations;
440  pqSettings* Settings;
441  QHelpEngine* HelpEngine;
442  QPointer<pqTestUtility> TestUtility;
443 
444 private:
445  Q_DISABLE_COPY(pqApplicationCore)
446 
447  class pqInternals;
448  pqInternals* Internal;
449  static pqApplicationCore* Instance;
450  void constructor();
451 };
452 
453 #endif
#define PARAVIEW_DEPRECATED_IN_5_10_0(reason)
This class is the crux of the ParaView application.
void setLoadingState(bool value)
Set the loading state flag.
pqInterfaceTracker * interfaceTracker() const
Locates the interface tracker for the application.
manages recently used resources
A Qt based model to represent the vtkSMLinks in the server manager.
Definition: pqLinksModel.h:55
pqPluginManager * getPluginManager() const
pqPluginManager manages all functionality associated with loading plugins.
pqProgressManager is progress manager.
pqObjectBuilder is loosely based on the Builder design pattern.
pqProgressManager * getProgressManager() const
ProgressManager is the manager that streamlines progress.
pqServerManagerObserver * getServerManagerObserver()
ServerManagerObserver observer the vtkSMProxyManager for changes to the server manager and fires sign...
command line options manager
Definition: vtkCLIOptions.h:58
pqMainWindowEventManager is a manager for marshalling a main window&#39;s events to pqReactions.
pqServerConfigurationCollection maintains a serializable collection of server-configurations defined ...
pqSettings extends QSettings to add support for following:
Definition: pqSettings.h:47
This is a vtkSMProxyManager observer.
#define PQCORE_EXPORT
Definition: pqCoreModule.h:15
pqServerManagerModel is the model for the Server Manager.
is used to locate proxies referred to in state xmls while loading state files.
bool isLoadingState()
Check to see if its in the process of loading a state Reliance on this flag is chimerical since we ca...
pqObjectBuilder * getObjectBuilder() const
Get the Object Builder.
PQ representation for a vtkSMProxy that can be involved in a pipeline.
pqServerManagerModel * getServerManagerModel() const
ServerManagerModel is the representation of the ServerManager using pqServerManagerModelItem subclass...
Utility class to load state from XML.
This is used by vtkPVXMLParser to represent an XML document starting at the root element.
pqUndoStack * getUndoStack() const
pqUndoStack represents a vtkSMUndoStack along with a a vtkSMUndoStackBuilder.
Definition: pqUndoStack.h:56
Command line options for pqClient.
Definition: pqOptions.h:45
pqLinksModel * getLinksModel() const
pqLinksModel is the model used to keep track of proxy/property links maintained by vtkSMProxyManager...
pqInterfaceTracker is used by ParaView components to locate interface-implementations.
pqServerResource encapsulates a resource in ParaView.
pqPluginManager works with vtkSMPluginManager to keep track for plugins loaded/available.
pqServer (should be renamed to pqSession) is a pqServerManagerModelItem subclass that represents a vt...
Definition: pqServer.h:63
pqMainWindowEventManager * getMainWindowEventManager() const
pqMainWindowManager manages signals called for main window events.