Serializable stack for undoable actions.
More...
#include <src/gui/backend/backend/actions/undo_stack.h>
|
enum | UndoableActionRoles { UndoableActionPtrRole = Qt::UserRole + 1
} |
|
|
| UndoStack (QObject *parent=nullptr) |
|
QHash< int, QByteArray > | roleNames () const override |
|
int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
|
QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
|
Q_SIGNAL void | rowCountChanged (int rowCount) |
|
void | init_loaded (sample_rate_t engine_sample_rate) |
|
std::string | get_as_string (int limit) const |
| Gets the list of actions as a string.
|
|
template<UndoableActionSubclass T> |
void | push (T *action) |
| Take ownership of the given action.
|
|
std::optional< UndoableActionPtrVariant > | pop () |
|
std::optional< UndoableActionPtrVariant > | pop_last () |
| Pops the last (first added) element and moves everything back.
|
|
auto | size () const |
|
bool | is_empty () const |
|
bool | empty () const |
|
bool | is_full () const |
|
std::optional< UndoableActionPtrVariant > | peek () const |
|
void | clear () |
|
bool | contains_clip (const AudioClip &clip) const |
|
template<UndoableActionSubclass T> |
bool | contains_action (const T &ua) const |
| Checks if the undo stack contains the given action pointer.
|
|
void | get_plugins (std::vector< zrythm::gui::old_dsp::plugins::Plugin * > &arr) const |
| Returns the plugins referred to in the undo stack.
|
|
|
std::vector< UndoableActionPtrVariant > | actions_ |
| Actions on the stack.
|
|
size_t | max_size_ = 0 |
| Max size of the stack (if 0, unlimited).
|
|
Serializable stack for undoable actions.
This is used for both undo and redo.
Definition at line 20 of file undo_stack.h.
◆ UndoableActionRoles
enum zrythm::gui::actions::UndoStack::UndoableActionRoles |
◆ clear()
void zrythm::gui::actions::UndoStack::clear |
( |
| ) |
|
|
inline |
◆ empty()
bool zrythm::gui::actions::UndoStack::empty |
( |
| ) |
const |
|
inline |
◆ is_empty()
bool zrythm::gui::actions::UndoStack::is_empty |
( |
| ) |
const |
|
inline |
◆ is_full()
bool zrythm::gui::actions::UndoStack::is_full |
( |
| ) |
const |
|
inline |
◆ peek()
std::optional< UndoableActionPtrVariant > zrythm::gui::actions::UndoStack::peek |
( |
| ) |
const |
- Note
- The action is owned by the undo stack.
- Returns
- std::optional<UndoableActionPtrVariant>
◆ pop()
std::optional< UndoableActionPtrVariant > zrythm::gui::actions::UndoStack::pop |
( |
| ) |
|
- Note
- The caller takes ownership of the action.
- Returns
- std::optional<UndoableActionPtrVariant>
◆ pop_last()
std::optional< UndoableActionPtrVariant > zrythm::gui::actions::UndoStack::pop_last |
( |
| ) |
|
Pops the last (first added) element and moves everything back.
- Note
- The caller takes ownership of the action.
◆ push()
template<UndoableActionSubclass T>
template void zrythm::gui::actions::UndoStack::push |
( |
T * | action | ) |
|
Take ownership of the given action.
- Template Parameters
-
- Parameters
-
◆ size()
auto zrythm::gui::actions::UndoStack::size |
( |
| ) |
const |
|
inline |
◆ from_json
void from_json |
( |
const nlohmann::json & | j, |
|
|
UndoStack & | stack ) |
|
friend |
◆ to_json
void to_json |
( |
nlohmann::json & | j, |
|
|
const UndoStack & | stack ) |
|
friend |
◆ actions_
std::vector<UndoableActionPtrVariant> zrythm::gui::actions::UndoStack::actions_ |
◆ max_size_
size_t zrythm::gui::actions::UndoStack::max_size_ = 0 |
Max size of the stack (if 0, unlimited).
Definition at line 137 of file undo_stack.h.
◆ rowCount
QML_ELEMENT int zrythm::gui::actions::UndoStack::rowCount |
|
read |
The documentation for this class was generated from the following file: