[nostalgia/studio] Move undo stack to Editor

This commit is contained in:
2020-03-23 23:25:05 -05:00
parent 362aeef3c7
commit f90a6e30ea
4 changed files with 22 additions and 26 deletions

View File

@@ -13,10 +13,6 @@ namespace nostalgia::studio {
Editor::Editor(QWidget *parent): QWidget(parent) {
}
QUndoStack *Editor::undoStack() {
return nullptr;
}
void Editor::save() {
saveItem();
setUnsavedChanges(false);
@@ -27,6 +23,10 @@ void Editor::setUnsavedChanges(bool uc) {
emit unsavedChangesUpdate(uc);
}
QUndoStack *Editor::undoStack() {
return &m_cmdStack;
}
void Editor::saveItem() {
}

View File

@@ -19,6 +19,7 @@ class NOSTALGIASTUDIO_EXPORT Editor: public QWidget {
Q_OBJECT
private:
QUndoStack m_cmdStack;
bool m_unsavedChanges = false;
public:
@@ -31,11 +32,6 @@ class NOSTALGIASTUDIO_EXPORT Editor: public QWidget {
*/
virtual QString itemName() = 0;
/**
* Returns the undo stack holding changes to the item being edited.
*/
virtual QUndoStack *undoStack();
/**
* Save changes to item being edited.
*/
@@ -47,6 +43,11 @@ class NOSTALGIASTUDIO_EXPORT Editor: public QWidget {
*/
void setUnsavedChanges(bool);
/**
* Returns the undo stack holding changes to the item being edited.
*/
QUndoStack *undoStack();
protected:
/**
* Save changes to item being edited.