From db2a2258559289f99e2d8f5bdea445660c3ebe27 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 19 Feb 2022 03:05:45 -0600 Subject: [PATCH] [nostalgia/studio] Add redo and undo triggered signals to UndoStack --- src/nostalgia/studio/lib/undostack.cpp | 2 ++ src/nostalgia/studio/lib/undostack.hpp | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/nostalgia/studio/lib/undostack.cpp b/src/nostalgia/studio/lib/undostack.cpp index dd5bb88e0..a4817245e 100644 --- a/src/nostalgia/studio/lib/undostack.cpp +++ b/src/nostalgia/studio/lib/undostack.cpp @@ -19,12 +19,14 @@ void UndoStack::redo() noexcept { if (m_stackIdx < m_stack.size()) { m_stack[m_stackIdx++]->redo(); } + redoTriggered.emit(); } void UndoStack::undo() noexcept { if (m_stackIdx) { m_stack[--m_stackIdx]->undo(); } + undoTriggered.emit(); } } \ No newline at end of file diff --git a/src/nostalgia/studio/lib/undostack.hpp b/src/nostalgia/studio/lib/undostack.hpp index c08ae3166..71bc64263 100644 --- a/src/nostalgia/studio/lib/undostack.hpp +++ b/src/nostalgia/studio/lib/undostack.hpp @@ -4,6 +4,7 @@ #pragma once +#include #include #include #include @@ -30,14 +31,17 @@ class UndoStack { void undo() noexcept; [[nodiscard]] - constexpr bool canRedo() noexcept { + constexpr bool canRedo() const noexcept { return m_stackIdx < m_stack.size(); } [[nodiscard]] - constexpr bool canUndo() noexcept { + constexpr bool canUndo() const noexcept { return m_stackIdx; } + + ox::Signal redoTriggered; + ox::Signal undoTriggered; }; } \ No newline at end of file