pqApplicationCore.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 #ifndef pqApplicationCore_h
5 #define pqApplicationCore_h
6 
7 #include "pqCoreModule.h"
8 #include "vtkSmartPointer.h" // for vtkSmartPointer
9 #include <QObject>
10 #include <QPointer>
11 #include <QStringList>
12 #include <QTranslator>
13 #include <exception> // for std::exception
14 
15 class pqInterfaceTracker;
16 class pqLinksModel;
18 class pqObjectBuilder;
19 class pqPipelineSource;
20 class pqPluginManager;
21 class pqProgressManager;
23 class pqServer;
27 class pqServerResource;
28 class pqSettings;
29 class pqTestUtility;
30 class pqUndoStack;
31 class QApplication;
32 class QHelpEngine;
33 class vtkPVXMLElement;
34 class vtkSMProxyLocator;
35 class vtkSMStateLoader;
36 class vtkCLIOptions;
37 
38 class PQCORE_EXPORT pqApplicationCoreExitCode : public std::exception
39 {
40  int Code = 0;
41 
42 public:
44  : Code(ecode)
45  {
46  }
47  int code() const { return this->Code; }
48 };
49 
60 class PQCORE_EXPORT pqApplicationCore : public QObject
61 {
62  Q_OBJECT
63  typedef QObject Superclass;
64 
65 public:
66  // Get the global instance for the pqApplicationCore.
67  static pqApplicationCore* instance();
68 
83  pqApplicationCore(int& argc, char** argv, vtkCLIOptions* options = nullptr,
84  bool addStandardArgs = true, QObject* parent = nullptr);
85 
91  pqObjectBuilder* getObjectBuilder() const { return this->ObjectBuilder; }
92 
97  void setUndoStack(pqUndoStack* stack);
98  pqUndoStack* getUndoStack() const { return this->UndoStack; }
99 
111  void registerManager(const QString& function, QObject* manager);
112 
116  //. \sa registerManager
117  QObject* manager(const QString& function);
118 
122  void unRegisterManager(const QString& function);
123 
128  QHelpEngine* helpEngine();
129 
134  void registerDocumentation(const QString& filename);
135 
142  pqServerManagerObserver* getServerManagerObserver() { return this->ServerManagerObserver; }
143 
150  pqServerManagerModel* getServerManagerModel() const { return this->ServerManagerModel; }
151 
157  pqInterfaceTracker* interfaceTracker() const { return this->InterfaceTracker; }
158 
166  pqLinksModel* getLinksModel() const { return this->LinksModel; }
167 
172  {
173  return this->MainWindowEventManager;
174  }
175 
179  pqPluginManager* getPluginManager() const { return this->PluginManager; }
180 
184  pqProgressManager* getProgressManager() const { return this->ProgressManager; }
185 
189  virtual pqTestUtility* testUtility();
190 
195  pqRecentlyUsedResourcesList& recentlyUsedResources();
196 
201  pqServerConfigurationCollection& serverConfigurations();
202 
206  pqSettings* settings();
207 
216  void clearSettings();
217 
221  vtkPVXMLElement* saveState();
222 
227  bool saveState(const QString& filename, vtkTypeUInt32 location = 0x10 /*vtkPVSession::CLIENT*/);
228 
233  void loadState(vtkPVXMLElement* root, pqServer* server, vtkSMStateLoader* loader = nullptr);
234 
240  void loadState(const char* filename, pqServer* server, vtkSMStateLoader* loader = nullptr);
241 
245  void loadStateFromString(
246  const char* xmlcontents, pqServer* server, vtkSMStateLoader* loader = nullptr);
247 
248  void clearViewsForLoadingState(pqServer* server);
249 
254  void loadStateIncremental(
255  vtkPVXMLElement* root, pqServer* server, vtkSMStateLoader* loader = nullptr);
256  void loadStateIncremental(
257  const QString& filename, pqServer* server, vtkSMStateLoader* loader = nullptr);
258 
262  void setLoadingState(bool value) { this->LoadingState = value; };
263 
269  bool isLoadingState() { return this->LoadingState; };
270 
274  pqServer* getActiveServer() const;
275 
285  QString getTranslationsPathFromInterfaceLanguage(QString prefix, QString locale);
286 
294  QTranslator* getQtTranslations(QString prefix, QString locale);
295 
302  QString getInterfaceLanguage();
303 
307  ~pqApplicationCore() override;
308 
312  void _paraview_client_environment_complete();
313 
314 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
315 
319  void prepareForQuit();
320 
324  void quit();
325 
327 
333  void loadConfiguration(const QString& filename);
334  void loadConfigurationXML(const char* xmldata);
336 
340  void updateAvailableReadersAndWriters();
341 
345  void render();
346 
347 Q_SIGNALS:
352  void aboutToWriteState(QString filename);
353 
358  void aboutToReadState(QString filename);
359 
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 
437  QHelpEngine* HelpEngine;
438  QPointer<pqTestUtility> TestUtility;
439 
440 private:
441  Q_DISABLE_COPY(pqApplicationCore)
442 
443  class pqInternals;
444  pqInternals* Internal;
445  static pqApplicationCore* Instance;
446  void constructor();
447 };
448 
449 #endif
pqProgressManager * ProgressManager
location
pqLinksModel * LinksModel
pqServerManagerObserver * ServerManagerObserver
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:28
pqPluginManager * PluginManager
pqRecentlyUsedResourcesList * RecentlyUsedResourcesList
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.
pqServerManagerModel * ServerManagerModel
pqServerManagerObserver * getServerManagerObserver()
ServerManagerObserver observer the vtkSMProxyManager for changes to the server manager and fires sign...
command line options manager
Definition: vtkCLIOptions.h:46
pqInterfaceTracker * InterfaceTracker
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:19
This is a vtkSMProxyManager observer.
pqServerConfigurationCollection * ServerConfigurations
#define PQCORE_EXPORT
Definition: pqCoreModule.h:15
QPointer< pqTestUtility > TestUtility
QHelpEngine * HelpEngine
pqObjectBuilder * ObjectBuilder
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...
pqUndoStack * UndoStack
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...
pqMainWindowEventManager * MainWindowEventManager
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:28
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:35
pqMainWindowEventManager * getMainWindowEventManager() const
pqMainWindowManager manages signals called for main window events.