kwave  18.07.70
Kwave::UndoAction Class Referenceabstract

#include <UndoAction.h>

Inheritance diagram for Kwave::UndoAction:
Inheritance graph
Collaboration diagram for Kwave::UndoAction:
Collaboration graph

Public Member Functions

virtual ~UndoAction ()
 
virtual QString description ()=0
 
virtual qint64 undoSize ()=0
 
virtual qint64 redoSize ()=0
 
virtual bool store (Kwave::SignalManager &manager)=0
 
virtual Kwave::UndoActionundo (Kwave::SignalManager &manager, bool with_redo)=0
 
virtual bool containsModification () const
 
virtual void dump (const QString &indent)
 

Detailed Description

This is an abstract base class used for implementation of undo and redo. The constructor should take all information needed for storing the undo data and for being able to guess the amount of the needed memory. After construction, the caller can call size() for retaining the amount of needed memory and o provide enough space. The store() function can then save the data for further undo. Calling the undo() function also creates a new UndoAction object that is responsible for holding all information for undoing that undo (redo).

Definition at line 44 of file UndoAction.h.

Constructor & Destructor Documentation

◆ ~UndoAction()

virtual Kwave::UndoAction::~UndoAction ( )
inlinevirtual

Destructor

Definition at line 50 of file UndoAction.h.

51  {
52  }

Member Function Documentation

◆ containsModification()

virtual bool Kwave::UndoAction::containsModification ( ) const
inlinevirtual

Determines whether a undo action has to do with a modification of the signal or meta information and leads to a "modified" file. The default implementation returns "true". An example for a implementation that returns "false" is the UndoSelection class which contains only information about a change in selected samples.

Returns
true if a modification is contained, false if not.

Reimplemented in Kwave::SelectionTracker::Undo, and Kwave::UndoSelection.

Definition at line 102 of file UndoAction.h.

Referenced by Kwave::UndoTransaction::containsModification().

102 { return true; }
Here is the caller graph for this function:

◆ description()

virtual QString Kwave::UndoAction::description ( )
pure virtual

◆ dump()

virtual void Kwave::UndoAction::dump ( const QString &  indent)
inlinevirtual

dump, for debugging purposes

Reimplemented in Kwave::SelectionTracker::Undo, Kwave::UndoSelection, Kwave::UndoDeleteAction, Kwave::UndoInsertAction, Kwave::UndoDeleteMetaDataAction, and Kwave::UndoModifyMetaDataAction.

Definition at line 105 of file UndoAction.h.

References DBG.

Referenced by Kwave::UndoTransaction::dump().

105  {
106  qDebug("%s%s", DBG(indent), DBG(description()));
107  }
virtual QString description()=0
#define DBG(qs)
Definition: String.h:55
Here is the caller graph for this function:

◆ redoSize()

virtual qint64 Kwave::UndoAction::redoSize ( )
pure virtual

◆ store()

◆ undo()

virtual Kwave::UndoAction* Kwave::UndoAction::undo ( Kwave::SignalManager manager,
bool  with_redo 
)
pure virtual

Takes back an action by creating a new undo action (for further redo) and restoring the previous state.

Parameters
managerthe SignalManager for modifying the signal
with_redoif true a UndoAction for redo will be created
Note
The return value is allowed to be the same object. This is useful for objects that can re-use their data for undo/redo. You have to check for this when deleting an UndoAction object after undo.

Implemented in Kwave::SelectionTracker::Undo, Kwave::UndoReverseAction, Kwave::UndoDeleteAction, Kwave::UndoSelection, Kwave::UndoInsertAction, Kwave::UndoModifyAction, Kwave::UndoAddMetaDataAction, Kwave::UndoDeleteTrack, Kwave::UndoInsertTrack, Kwave::UndoDeleteMetaDataAction, and Kwave::UndoModifyMetaDataAction.

Referenced by Kwave::SignalManager::closeUndoTransaction(), Kwave::SignalManager::redo(), and Kwave::SignalManager::undo().

Here is the caller graph for this function:

◆ undoSize()

virtual qint64 Kwave::UndoAction::undoSize ( )
pure virtual

Returns the required amount of memory that is needed for storing undo data for the operation. This will be called to determine the free memory to be reserved.

Note
this is the first step (after the constructor)

Implemented in Kwave::SelectionTracker::Undo, Kwave::UndoSelection, Kwave::UndoDeleteAction, Kwave::UndoAddMetaDataAction, Kwave::UndoDeleteTrack, Kwave::UndoInsertAction, Kwave::UndoInsertTrack, Kwave::UndoDeleteMetaDataAction, Kwave::UndoModifyMetaDataAction, Kwave::UndoReverseAction, and Kwave::UndoModifyAction.

Referenced by Kwave::SignalManager::registerUndoAction(), and Kwave::UndoTransaction::undoSize().

Here is the caller graph for this function:

The documentation for this class was generated from the following file: