kwave  18.07.70
Kwave::UndoReverseAction Class Reference

#include <UndoReverseAction.h>

Inheritance diagram for Kwave::UndoReverseAction:
Inheritance graph
Collaboration diagram for Kwave::UndoReverseAction:
Collaboration graph

Public Member Functions

 UndoReverseAction (Kwave::PluginManager &plugin_manager)
 
virtual ~UndoReverseAction () Q_DECL_OVERRIDE
 
virtual QString description () Q_DECL_OVERRIDE
 
virtual qint64 undoSize () Q_DECL_OVERRIDE
 
virtual qint64 redoSize () Q_DECL_OVERRIDE
 
virtual bool store (Kwave::SignalManager &manager) Q_DECL_OVERRIDE
 
virtual UndoActionundo (Kwave::SignalManager &manager, bool with_redo) Q_DECL_OVERRIDE
 
- Public Member Functions inherited from Kwave::UndoAction
virtual ~UndoAction ()
 
virtual bool containsModification () const
 
virtual void dump (const QString &indent)
 

Private Attributes

Kwave::PluginManagerm_plugin_manager
 

Detailed Description

Definition at line 33 of file UndoReverseAction.h.

Constructor & Destructor Documentation

◆ UndoReverseAction()

Kwave::UndoReverseAction::UndoReverseAction ( Kwave::PluginManager plugin_manager)
explicit

Constructor

Definition at line 30 of file UndoReverseAction.cpp.

32  :m_plugin_manager(plugin_manager)
33 {
34 }
Kwave::PluginManager & m_plugin_manager

◆ ~UndoReverseAction()

Kwave::UndoReverseAction::~UndoReverseAction ( )
virtual

Destructor

Definition at line 37 of file UndoReverseAction.cpp.

38 {
39 }

Member Function Documentation

◆ description()

QString Kwave::UndoReverseAction::description ( )
virtual

Returns a verbose short description of the action.

Implements Kwave::UndoAction.

Definition at line 42 of file UndoReverseAction.cpp.

43 {
44  return i18n("Reverse");
45 }

◆ redoSize()

qint64 Kwave::UndoReverseAction::redoSize ( )
virtual

Returns the difference of needed memory that is needed for redo.

Implements Kwave::UndoAction.

Definition at line 54 of file UndoReverseAction.cpp.

55 {
56  return sizeof(*this);
57 }

◆ store()

bool Kwave::UndoReverseAction::store ( Kwave::SignalManager manager)
virtual

Stores the data needed for undo.

Parameters
managerthe SignalManager for modifying the signal
Note
this is the second step, after size() has been called
Returns
true if successful, false if failed (e.g. out of memory)

Implements Kwave::UndoAction.

Definition at line 60 of file UndoReverseAction.cpp.

61 {
62  Q_UNUSED(manager);
63  return true;
64 }

◆ undo()

Kwave::UndoAction * Kwave::UndoReverseAction::undo ( Kwave::SignalManager manager,
bool  with_redo 
)
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.

Implements Kwave::UndoAction.

Definition at line 67 of file UndoReverseAction.cpp.

References _, Kwave::PluginManager::enqueueCommand(), and m_plugin_manager.

69 {
70  Q_UNUSED(manager);
72  _("nomacro:plugin:execute(reverse,noundo)")
73  );
74  return (with_redo) ? this : Q_NULLPTR;
75 }
void enqueueCommand(const QString &command)
Kwave::PluginManager & m_plugin_manager
#define _(m)
Definition: memcpy.c:66
Here is the call graph for this function:

◆ undoSize()

qint64 Kwave::UndoReverseAction::undoSize ( )
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)

Implements Kwave::UndoAction.

Definition at line 48 of file UndoReverseAction.cpp.

49 {
50  return sizeof(*this);
51 }

Member Data Documentation

◆ m_plugin_manager

Kwave::PluginManager& Kwave::UndoReverseAction::m_plugin_manager
private

plugin manager, for emitting the sigCommand(reverse())

Definition at line 86 of file UndoReverseAction.h.

Referenced by undo().


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