CommandBackupFile.hpp
1 #pragma once
2 #include <score/command/Command.hpp>
3 #include <score/command/CommandData.hpp>
4 
5 #include <QObject>
6 #include <QStack>
7 #include <QString>
8 #include <QTemporaryFile>
9 
10 namespace score
11 {
12 class CommandStack;
17 {
19 
20  QStack<CommandData> savedUndo;
21  QStack<CommandData> savedRedo;
22 };
23 
33 class CommandBackupFile final : public QObject
34 {
35 public:
36  CommandBackupFile(const score::CommandStack& stack, QObject* parent);
38  const score::CommandStack& stack, const QByteArray& restored, QObject* parent);
39  QString fileName() const;
40 
41 private:
42  void init_connections();
43 
44  void on_push();
45  void on_undo();
46  void on_redo();
47  void on_indexChanged();
48 
50  void commit();
51 
52  const score::CommandStack& m_stack;
53  CommandStackBackup m_backup;
54 
55  QTemporaryFile m_file;
56 };
57 }
Abstraction over the backup of commands.
Definition: CommandBackupFile.hpp:34
Definition: CommandStack.hpp:26
Base toolkit upon which the software is built.
Definition: Application.cpp:90
Serialized command stack data for backup / restore.
Definition: CommandBackupFile.hpp:17