Loading...
Searching...
No Matches
CommandBackupFile.hpp
1#pragma once
2#include <score/command/Command.hpp>
3#include <score/command/CommandData.hpp>
4
5#include <QObject>
6#include <QString>
7#include <QTemporaryFile>
8
9#include <vector>
10
11namespace score
12{
13class CommandStack;
18{
20
22 std::vector<CommandData> savedUndo;
23 std::vector<CommandData> savedRedo;
24};
25
35class CommandBackupFile final : public QObject
36{
37public:
38 CommandBackupFile(const score::CommandStack& stack, QObject* parent);
40 const score::CommandStack& stack, const QByteArray& restored, QObject* parent);
41 QString fileName() const;
42
43private:
44 void init_connections();
45
46 void on_push();
47 void on_undo();
48 void on_redo();
49 void on_indexChanged();
50
52 void commit();
53
54 const score::CommandStack& m_stack;
55 CommandStackBackup m_backup;
56
57#if defined(__EMSCRIPTEN__)
60 QString m_key;
61#else
62 QTemporaryFile m_file;
63#endif
64};
65}
Abstraction over the backup of commands.
Definition CommandBackupFile.hpp:36
Definition CommandStack.hpp:27
Base toolkit upon which the software is built.
Definition Application.cpp:83
Serialized command stack data for backup / restore.
Definition CommandBackupFile.hpp:18
std::vector< CommandData > savedUndo
Laid out as the stack: the undo commands, then the redo ones, bottom first.
Definition CommandBackupFile.hpp:22