[nostalgia/studio] Add Copy/Paste hooks

This commit is contained in:
2020-10-19 19:36:23 -05:00
parent b6c82c42f0
commit fdda3bd82d
4 changed files with 88 additions and 4 deletions
+25 -1
View File
@@ -13,6 +13,12 @@ namespace nostalgia::studio {
Editor::Editor(QWidget *parent): QWidget(parent) {
}
void Editor::copy() {
}
void Editor::paste() {
}
void Editor::exportFile() {
}
@@ -26,7 +32,7 @@ void Editor::setUnsavedChanges(bool uc) {
emit unsavedChangesChanged(uc);
}
[[nodiscard]] bool Editor::unsavedChanges() noexcept {
bool Editor::unsavedChanges() noexcept {
return m_unsavedChanges;
}
@@ -43,6 +49,24 @@ bool Editor::exportable() const {
return m_exportable;
}
void Editor::setCopyEnabled(bool v) {
m_copyEnabled = v;
emit copyEnabledChanged(v);
}
bool Editor::copyEnabled() const {
return m_copyEnabled;
}
void Editor::setPasteEnabled(bool v) {
m_pasteEnabled = v;
emit pasteEnabledChanged(v);
}
bool Editor::pasteEnabled() const {
return m_pasteEnabled;
}
void Editor::saveItem() {
}
+20 -2
View File
@@ -22,6 +22,8 @@ class NOSTALGIASTUDIO_EXPORT Editor: public QWidget {
QUndoStack m_cmdStack;
bool m_unsavedChanges = false;
bool m_exportable = false;
bool m_copyEnabled = false;
bool m_pasteEnabled = false;
public:
Editor(QWidget *parent);
@@ -33,6 +35,10 @@ class NOSTALGIASTUDIO_EXPORT Editor: public QWidget {
*/
virtual QString itemName() const = 0;
virtual void copy();
virtual void paste();
virtual void exportFile();
/**
@@ -51,11 +57,19 @@ class NOSTALGIASTUDIO_EXPORT Editor: public QWidget {
/**
* Returns the undo stack holding changes to the item being edited.
*/
QUndoStack *undoStack();
[[nodiscard]] QUndoStack *undoStack();
void setExportable(bool);
bool exportable() const;
[[nodiscard]] bool exportable() const;
void setCopyEnabled(bool);
[[nodiscard]] bool copyEnabled() const;
void setPasteEnabled(bool);
[[nodiscard]] bool pasteEnabled() const;
protected:
/**
@@ -68,6 +82,10 @@ class NOSTALGIASTUDIO_EXPORT Editor: public QWidget {
void exportableChanged(bool);
void copyEnabledChanged(bool);
void pasteEnabledChanged(bool);
};
}