Pencil2D Animation
Download Community News Docs Contribute
  • Overview
  • Articles
  • Code
  •  
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • File List
Loading...
Searching...
No Matches
Signals | Public Member Functions | Private Member Functions | Private Attributes | List of all members
UndoRedoManager Class Reference
+ Inheritance diagram for UndoRedoManager:
Inheritance graph
[legend]
+ Collaboration diagram for UndoRedoManager:
Collaboration graph
[legend]

Signals

void didUpdateUndoStack ()
 

Public Member Functions

 UndoRedoManager (Editor *editor)
 
bool init () override
 
Status load (Object *) override
 
Status save (Object *) override
 
void record (const UndoSaveState *&undoState, const QString &description)
 Records the given save state.
 
bool hasUnsavedChanges () const
 Checks whether there are unsaved changes.
 
const UndoSaveState * state (UndoRedoRecordType recordType) const
 Prepares and returns a save state with the given scope.
 
QAction * createUndoAction (QObject *parent, const QIcon &icon)
 
QAction * createRedoAction (QObject *parent, const QIcon &icon)
 
void updateUndoAction (QAction *undoAction)
 
void updateRedoAction (QAction *redoAction)
 
void clearStack ()
 Clears the undo stack.
 
void legacyBackup (const QString &undoText)
 
bool legacyBackup (int backupLayer, int backupFrame, const QString &undoText)
 
void sanitizeLegacyBackupElementsAfterLayerDeletion (int layerIndex)
 Restores integrity of the backup elements after a layer has been deleted.
 
void restoreLegacyKey ()
 
void rememberLastModifiedFrame (int layerNumber, int frameNumber)
 
void onSettingChanged (SETTING setting)
 
- Public Member Functions inherited from BaseManager
Editor * editor () const
 
Object * object () const
 
virtual bool init ()=0
 
virtual Status load (Object *o)=0
 
virtual Status save (Object *o)=0
 
virtual void workingLayerChanged (Layer *)
 
- Public Member Functions inherited from QObject
virtual const QMetaObject * metaObject () const const
 
 QObject (QObject *parent)
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
QString objectName () const const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
bool signalsBlocked () const const
 
bool blockSignals (bool block)
 
QThread * thread () const const
 
void moveToThread (QThread *targetThread)
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
void killTimer (int id)
 
T findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
const QObjectList & children () const const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
void dumpObjectTree () const const
 
void dumpObjectInfo () const const
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const const
 
QList< QByteArray > dynamicPropertyNames () const const
 
void destroyed (QObject *obj)
 
void objectNameChanged (const QString &objectName)
 
QObject * parent () const const
 
bool inherits (const char *className) const const
 
void deleteLater ()
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
T qobject_cast (QObject *object)
 
T qobject_cast (const QObject *object)
 
T qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
 Q_CLASSINFO (Name, Value)
 
 Q_INTERFACES (...)
 
 Q_PROPERTY (...)
 
 Q_ENUMS (...)
 
 Q_FLAGS (...)
 
 Q_ENUM (...)
 
 Q_FLAG (...)
 
 Q_ENUM_NS (...)
 
 Q_FLAG_NS (...)
 
 Q_OBJECT Q_OBJECT
 
 Q_GADGET Q_GADGET
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SLOTS Q_SLOTS
 
 Q_SLOT Q_SLOT
 
 Q_EMIT Q_EMIT
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 

Private Member Functions

void replaceKeyFrame (const UndoSaveState &undoState, const QString &description)
 
void replaceBitmap (const UndoSaveState &undoState, const QString &description)
 
void replaceVector (const UndoSaveState &undoState, const QString &description)
 
const UndoSaveState * savedKeyFrameState () const
 
void pushCommand (QUndoCommand *command)
 
void legacyUndo ()
 
void legacyRedo ()
 

Private Attributes

QUndoStack mUndoStack
 
int mLegacyBackupIndex = -1
 
LegacyBackupElement * mLegacyBackupAtSave = nullptr
 
QList< LegacyBackupElement * > mLegacyBackupList
 
int mLegacyLastModifiedLayer = -1
 
int mLegacyLastModifiedFrame = -1
 
bool mNewBackupSystemEnabled = false
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from BaseManager
 BaseManager (Editor *editor, const QString &name)
 
- Protected Member Functions inherited from QObject
QObject * sender () const const
 
int senderSignalIndex () const const
 
int receivers (const char *signal) const const
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

Definition at line 90 of file undoredomanager.h.

Constructor & Destructor Documentation

◆ UndoRedoManager()

UndoRedoManager::UndoRedoManager ( Editor *  editor)
explicit

Definition at line 45 of file undoredomanager.cpp.

◆ ~UndoRedoManager()

UndoRedoManager::~UndoRedoManager ( )
override

Definition at line 50 of file undoredomanager.cpp.

Member Function Documentation

◆ clearStack()

void UndoRedoManager::clearStack ( )

Clears the undo stack.

Definition at line 336 of file undoredomanager.cpp.

◆ createRedoAction()

QAction * UndoRedoManager::createRedoAction ( QObject *  parent,
const QIcon &  icon 
)

Definition at line 269 of file undoredomanager.cpp.

◆ createUndoAction()

QAction * UndoRedoManager::createUndoAction ( QObject *  parent,
const QIcon &  icon 
)

Definition at line 249 of file undoredomanager.cpp.

◆ hasUnsavedChanges()

bool UndoRedoManager::hasUnsavedChanges ( ) const

Checks whether there are unsaved changes.

Returns
true if there are unsaved changes, otherwise false

Definition at line 125 of file undoredomanager.cpp.

◆ init()

bool UndoRedoManager::init ( )
overridevirtual

Implements BaseManager.

Definition at line 59 of file undoredomanager.cpp.

◆ legacyBackup() [1/2]

void UndoRedoManager::legacyBackup ( const QString &  undoText)

Definition at line 353 of file undoredomanager.cpp.

◆ legacyBackup() [2/2]

bool UndoRedoManager::legacyBackup ( int  backupLayer,
int  backupFrame,
const QString &  undoText 
)

Definition at line 395 of file undoredomanager.cpp.

◆ legacyRedo()

void UndoRedoManager::legacyRedo ( )
private

Definition at line 670 of file undoredomanager.cpp.

◆ legacyUndo()

void UndoRedoManager::legacyUndo ( )
private

Definition at line 629 of file undoredomanager.cpp.

◆ load()

Status UndoRedoManager::load ( Object *  )
overridevirtual

Implements BaseManager.

Definition at line 79 of file undoredomanager.cpp.

◆ onSettingChanged()

void UndoRedoManager::onSettingChanged ( SETTING  setting)

Definition at line 69 of file undoredomanager.cpp.

◆ pushCommand()

void UndoRedoManager::pushCommand ( QUndoCommand *  command)
private

Definition at line 137 of file undoredomanager.cpp.

◆ record()

void UndoRedoManager::record ( const UndoSaveState *&  undoState,
const QString &  description 
)

Records the given save state.

The input save state is cleaned up and set to nullptr after use.

Parameters
undoStateThe state to record.
descriptionThe description that will bound to the undo/redo action.

Definition at line 95 of file undoredomanager.cpp.

◆ rememberLastModifiedFrame()

void UndoRedoManager::rememberLastModifiedFrame ( int  layerNumber,
int  frameNumber 
)

Definition at line 681 of file undoredomanager.cpp.

◆ replaceBitmap()

void UndoRedoManager::replaceBitmap ( const UndoSaveState &  undoState,
const QString &  description 
)
private

Definition at line 156 of file undoredomanager.cpp.

◆ replaceKeyFrame()

void UndoRedoManager::replaceKeyFrame ( const UndoSaveState &  undoState,
const QString &  description 
)
private

Definition at line 144 of file undoredomanager.cpp.

◆ replaceVector()

void UndoRedoManager::replaceVector ( const UndoSaveState &  undoState,
const QString &  description 
)
private

Definition at line 178 of file undoredomanager.cpp.

◆ restoreLegacyKey()

void UndoRedoManager::restoreLegacyKey ( )

Definition at line 574 of file undoredomanager.cpp.

◆ sanitizeLegacyBackupElementsAfterLayerDeletion()

void UndoRedoManager::sanitizeLegacyBackupElementsAfterLayerDeletion ( int  layerIndex)

Restores integrity of the backup elements after a layer has been deleted.

Removes backup elements affecting the deleted layer and adjusts the layer index on other backup elements as necessary.

Parameters
layerIndexThe index of the layer that was deleted
Warning
This serves as a temporary hack to prevent crashes until #864 is done (see #1412).

Definition at line 509 of file undoredomanager.cpp.

◆ save()

Status UndoRedoManager::save ( Object *  )
overridevirtual

Implements BaseManager.

Definition at line 85 of file undoredomanager.cpp.

◆ savedKeyFrameState()

const UndoSaveState * UndoRedoManager::savedKeyFrameState ( ) const
private

Definition at line 215 of file undoredomanager.cpp.

◆ state()

const UndoSaveState * UndoRedoManager::state ( UndoRedoRecordType  recordType) const

Prepares and returns a save state with the given scope.

Returns
A struct with state of the given record type

Definition at line 199 of file undoredomanager.cpp.

◆ updateRedoAction()

void UndoRedoManager::updateRedoAction ( QAction *  redoAction)

Definition at line 315 of file undoredomanager.cpp.

◆ updateUndoAction()

void UndoRedoManager::updateUndoAction ( QAction *  undoAction)

Definition at line 289 of file undoredomanager.cpp.

Member Data Documentation

◆ mLegacyBackupAtSave

LegacyBackupElement* UndoRedoManager::mLegacyBackupAtSave = nullptr
private

Definition at line 170 of file undoredomanager.h.

◆ mLegacyBackupIndex

int UndoRedoManager::mLegacyBackupIndex = -1
private

Definition at line 169 of file undoredomanager.h.

◆ mLegacyBackupList

QList<LegacyBackupElement*> UndoRedoManager::mLegacyBackupList
private

Definition at line 171 of file undoredomanager.h.

◆ mLegacyLastModifiedFrame

int UndoRedoManager::mLegacyLastModifiedFrame = -1
private

Definition at line 174 of file undoredomanager.h.

◆ mLegacyLastModifiedLayer

int UndoRedoManager::mLegacyLastModifiedLayer = -1
private

Definition at line 173 of file undoredomanager.h.

◆ mNewBackupSystemEnabled

bool UndoRedoManager::mNewBackupSystemEnabled = false
private

Definition at line 176 of file undoredomanager.h.

◆ mUndoStack

QUndoStack UndoRedoManager::mUndoStack
private

Definition at line 166 of file undoredomanager.h.


The documentation for this class was generated from the following files:
  • core_lib/src/managers/undoredomanager.h
  • core_lib/src/managers/undoredomanager.cpp
Generated on Thu May 8 2025 04:47:54 for Pencil2D by doxygen 1.9.6 based on revision 4513250b1d5b1a3676ec0e67b06b7a885ceaae39