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 
6 #include "pqApplicationComponentsModule.h"
7 #include <QObject>
8 
9 #include <QDir>
10 #include <QString>
11 
12 #include "pqUndoStack.h"
14 
29 class PQAPPLICATIONCOMPONENTS_EXPORT pqAutoSaveBehavior : public QObject
30 {
31  Q_OBJECT
32  typedef QObject Superclass;
33 
34 public:
35  pqAutoSaveBehavior(QObject* parent = nullptr);
36  ~pqAutoSaveBehavior() override;
37 
38 public Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
46  static void saveState();
47 
53  static QDir getStateDirectory();
54 
58  static bool autoSaveSettingEnabled();
59 
63  static void setAutoSaveSetting(bool enable);
64 
69  static pqApplicationCore::StateFileFormat getStateFormat();
70 
71 private Q_SLOTS:
76  void updateConnections();
77 
78  void clearConnections();
79 
80 private: // NOLINT(readability-redundant-access-specifiers)
89  static QString getStatePath(bool bak);
90 
95  static QString getLastStatePath();
96 
101  static QString getBakStatePath();
102 
103  Q_DISABLE_COPY(pqAutoSaveBehavior)
104 
105  QPointer<pqUndoStack> ObservedStack;
106  bool HasChanges = false;
107 };
108 
109 #endif
: pqAutoSaveBehavior save states automatically in the background.
StateFileFormat
Enum to capture possible Save State file formats.