work towards making timeline actions all undoable

This commit is contained in:
itsmattkc
2019-09-23 23:00:15 +10:00
parent d0d4756129
commit 9fa22938b9
31 changed files with 994 additions and 378 deletions
+10 -1
View File
@@ -1,3 +1,12 @@
#include "undostack.h"
QUndoStack olive::undo_stack;
OliveUndoStack olive::undo_stack;
void OliveUndoStack::pushIfHasChildren(QUndoCommand *command)
{
if (command->childCount() > 0) {
push(command);
} else {
delete command;
}
}
+11 -1
View File
@@ -3,11 +3,21 @@
#include <QUndoStack>
class OliveUndoStack : public QUndoStack {
public:
/**
* @brief A wrapper for push() that either pushes if the command has children or deletes if not
*
* This function takes ownership of `command`, and may delete it so it should never be accessed after this call.
*/
void pushIfHasChildren(QUndoCommand* command);
};
namespace olive {
/**
* @brief A static undo stack for undoable commands throughout Olive
*/
extern QUndoStack undo_stack;
extern OliveUndoStack undo_stack;
}
#endif // UNDOSTACK_H