[nostalgia/studio] Add Export menu item and hook

This commit is contained in:
2020-03-24 21:42:42 -05:00
parent f90a6e30ea
commit 26747a6d0f
4 changed files with 55 additions and 7 deletions
+17 -1
View File
@@ -13,6 +13,9 @@ namespace nostalgia::studio {
Editor::Editor(QWidget *parent): QWidget(parent) {
}
void Editor::exportFile() {
}
void Editor::save() {
saveItem();
setUnsavedChanges(false);
@@ -20,13 +23,26 @@ void Editor::save() {
void Editor::setUnsavedChanges(bool uc) {
m_unsavedChanges = uc;
emit unsavedChangesUpdate(uc);
emit unsavedChangesChanged(uc);
}
[[nodiscard]] bool Editor::unsavedChanges() noexcept {
return m_unsavedChanges;
}
QUndoStack *Editor::undoStack() {
return &m_cmdStack;
}
void Editor::setExportable(bool exportable) {
m_exportable = exportable;
emit exportableChanged(exportable);
}
bool Editor::exportable() {
return m_exportable;
}
void Editor::saveItem() {
}
+13 -2
View File
@@ -21,6 +21,7 @@ class NOSTALGIASTUDIO_EXPORT Editor: public QWidget {
private:
QUndoStack m_cmdStack;
bool m_unsavedChanges = false;
bool m_exportable = false;
public:
Editor(QWidget *parent);
@@ -32,6 +33,8 @@ class NOSTALGIASTUDIO_EXPORT Editor: public QWidget {
*/
virtual QString itemName() = 0;
virtual void exportFile();
/**
* Save changes to item being edited.
*/
@@ -39,15 +42,21 @@ class NOSTALGIASTUDIO_EXPORT Editor: public QWidget {
/**
* Sets indication of item being edited has unsaved changes. Also emits
* unsavedChangesUpdate signal.
* unsavedChangesChanged signal.
*/
void setUnsavedChanges(bool);
[[nodiscard]] bool unsavedChanges() noexcept;
/**
* Returns the undo stack holding changes to the item being edited.
*/
QUndoStack *undoStack();
void setExportable(bool);
bool exportable();
protected:
/**
* Save changes to item being edited.
@@ -55,7 +64,9 @@ class NOSTALGIASTUDIO_EXPORT Editor: public QWidget {
virtual void saveItem();
signals:
void unsavedChangesUpdate(bool);
void unsavedChangesChanged(bool);
void exportableChanged(bool);
};