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 
214  pqSettings* settings();
215 
226  void clearSettings();
227 
231  enum class StateFileFormat : unsigned int
232  {
233  PVSM = 0,
234  Python = 1
235  };
236 
242  static QString stateFileFormatToExtension(pqApplicationCore::StateFileFormat format);
243 
248  QString getDefaultSaveStateFileFormatQString(bool pythonAvailable, bool loading);
249 
258  void useVersionedSettings(bool use);
259 
263  vtkPVXMLElement* saveState();
264 
269  bool saveState(const QString& filename, vtkTypeUInt32 location = 0x10 /*vtkPVSession::CLIENT*/);
270 
275  void loadState(vtkPVXMLElement* root, pqServer* server, vtkSMStateLoader* loader = nullptr);
276 
282  void loadState(const char* filename, pqServer* server, vtkSMStateLoader* loader = nullptr);
283 
287  void loadStateFromString(
288  const char* xmlcontents, pqServer* server, vtkSMStateLoader* loader = nullptr);
289 
290  void clearViewsForLoadingState(pqServer* server);
291 
296  void loadStateIncremental(
297  vtkPVXMLElement* root, pqServer* server, vtkSMStateLoader* loader = nullptr);
298  void loadStateIncremental(
299  const QString& filename, pqServer* server, vtkSMStateLoader* loader = nullptr);
300 
304  void setLoadingState(bool value) { this->LoadingState = value; };
305 
311  bool isLoadingState() { return this->LoadingState; };
312 
316  pqServer* getActiveServer() const;
317 
327  QString getTranslationsPathFromInterfaceLanguage(QString prefix, QString locale);
328 
336  QTranslator* getQtTranslations(QString prefix, QString locale);
337 
344  QString getInterfaceLanguage();
345 
349  ~pqApplicationCore() override;
350 
354  void _paraview_client_environment_complete();
355 
356 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
357 
361  void prepareForQuit();
362 
366  void quit();
367 
369 
375  void loadConfiguration(const QString& filename);
376  void loadConfigurationXML(const char* xmldata);
378 
382  void updateAvailableReadersAndWriters();
383 
387  void render();
388 
389 Q_SIGNALS:
394  void aboutToWriteState(QString filename);
395 
400  void aboutToReadState(QString filename);
401 
409  void aboutToLoadState(vtkPVXMLElement* root);
410 
416  void stateLoaded(vtkPVXMLElement* root, vtkSMProxyLocator* locator);
417 
423  void stateSaved(vtkPVXMLElement* root);
424 
428  void undoStackChanged(pqUndoStack*);
429 
433  void loadXML(vtkPVXMLElement*);
434 
438  void forceFilterMenuRefresh();
439 
443  void updateMasterEnableState(bool);
444 
449  void clientEnvironmentDone();
450 
451 protected Q_SLOTS:
452  void onStateLoaded(vtkPVXMLElement* root, vtkSMProxyLocator* locator);
453  void onStateSaved(vtkPVXMLElement* root);
454  void onHelpEngineWarning(const QString&);
455 
456 private Q_SLOTS:
462  void generalSettingsChanged();
463 
464 protected:
466 
479  QHelpEngine* HelpEngine;
480  QPointer<pqTestUtility> TestUtility;
481 
482 private:
483  Q_DISABLE_COPY(pqApplicationCore)
484 
485  class pqInternals;
486  pqInternals* Internal;
487  static pqApplicationCore* Instance;
488  void constructor();
489 
494  QString getSettingFileBaseName();
495 
496  bool VersionedSettings = false;
497 };
498 
499 #endif
pqProgressManager * ProgressManager
location
int
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:23
This is a vtkSMProxyManager observer.
pqServerConfigurationCollection * ServerConfigurations
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.
StateFileFormat
Enum to capture possible Save State file formats.
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:37
pqMainWindowEventManager * getMainWindowEventManager() const
pqMainWindowManager manages signals called for main window events.