pqAutoSaveBehavior.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
3 #ifndef pqAutoSaveBehavior_h
4 #define pqAutoSaveBehavior_h
5 
7 #include <QObject>
8 
9 #include <QDir>
10 #include <QString>
11 
12 #include "pqUndoStack.h"
13 
29 {
30  Q_OBJECT
31  typedef QObject Superclass;
32 
33 public:
34  pqAutoSaveBehavior(QObject* parent = nullptr);
35  ~pqAutoSaveBehavior() override;
36 
37  enum class StateFormat : unsigned int
38  {
39  PVSM = 0,
40  Python = 1
41  };
42 
43 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
51  static void saveState();
52 
58  static QDir getStateDirectory();
59 
65  static QString formatToExtension(StateFormat format);
66 
70  static bool autoSaveSettingEnabled();
71 
75  static void setAutoSaveSetting(bool enable);
76 
81  static StateFormat getStateFormat();
82 
83 private Q_SLOTS:
88  void updateConnections();
89 
90  void clearConnections();
91 
92 private: // NOLINT(readability-redundant-access-specifiers)
101  static QString getStatePath(bool bak);
102 
107  static QString getLastStatePath();
108 
113  static QString getBakStatePath();
114 
115  Q_DISABLE_COPY(pqAutoSaveBehavior)
116 
117  QPointer<pqUndoStack> ObservedStack;
118  bool HasChanges = false;
119 };
120 
121 #endif
int
: pqAutoSaveBehavior save states automatically in the background.
#define PQAPPLICATIONCOMPONENTS_EXPORT