kwave  18.07.70
Kwave::UndoInsertTrack Class Reference

#include <UndoInsertTrack.h>

Inheritance diagram for Kwave::UndoInsertTrack:
Inheritance graph
Collaboration diagram for Kwave::UndoInsertTrack:
Collaboration graph

Public Member Functions

 UndoInsertTrack (Kwave::Signal &signal, unsigned int track)
 
virtual ~UndoInsertTrack () 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 Kwave::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)
 

Protected Attributes

Kwave::Signalm_signal
 
unsigned int m_track
 

Detailed Description

Undo action for inserting a track.

Definition at line 36 of file UndoInsertTrack.h.

Constructor & Destructor Documentation

◆ UndoInsertTrack()

Kwave::UndoInsertTrack::UndoInsertTrack ( Kwave::Signal signal,
unsigned int  track 
)

Constructor

Parameters
signalreference to the signal
trackindex of the inserted track.

Definition at line 30 of file UndoInsertTrack.cpp.

32  :UndoAction(), m_signal(signal), m_track(track)
33 {
34 }
Kwave::Signal & m_signal

◆ ~UndoInsertTrack()

Kwave::UndoInsertTrack::~UndoInsertTrack ( )
virtual

Destructor

Definition at line 37 of file UndoInsertTrack.cpp.

38 {
39 }

Member Function Documentation

◆ description()

QString Kwave::UndoInsertTrack::description ( )
virtual

Returns a verbose short description of the action.

Implements Kwave::UndoAction.

Definition at line 42 of file UndoInsertTrack.cpp.

43 {
44  return i18n("Insert Track");
45 }

◆ redoSize()

qint64 Kwave::UndoInsertTrack::redoSize ( )
virtual
See also
UndoAction::redoSize()

Implements Kwave::UndoAction.

Definition at line 54 of file UndoInsertTrack.cpp.

References Kwave::Signal::length(), and m_signal.

55 {
56  return (m_signal.length() * sizeof(sample_t)) + sizeof(UndoDeleteTrack);
57 }
sample_index_t length()
Definition: Signal.cpp:258
Kwave::Signal & m_signal
qint32 sample_t
Definition: Sample.h:37
Here is the call graph for this function:

◆ store()

bool Kwave::UndoInsertTrack::store ( Kwave::SignalManager manager)
virtual
See also
UndoAction::store()

Implements Kwave::UndoAction.

Definition at line 60 of file UndoInsertTrack.cpp.

61 {
62  // nothing to do, the track number has already
63  // been stored in the constructor
64  return true;
65 }

◆ undo()

Kwave::UndoAction * Kwave::UndoInsertTrack::undo ( Kwave::SignalManager manager,
bool  with_redo 
)
virtual
See also
UndoAction::undo()

Implements Kwave::UndoAction.

Definition at line 68 of file UndoInsertTrack.cpp.

References Kwave::Signal::deleteTrack(), m_signal, m_track, and Kwave::UndoAction::store().

70 {
71  Kwave::UndoAction *redo = Q_NULLPTR;
72 
73  // store data for redo
74  if (with_redo) {
75  redo = new(std::nothrow) Kwave::UndoDeleteTrack(m_signal, m_track);
76  Q_ASSERT(redo);
77  if (redo) redo->store(manager);
78  }
79 
80  // remove the track from the signal
82 
83  return redo;
84 }
void deleteTrack(unsigned int index)
Definition: Signal.cpp:119
Kwave::Signal & m_signal
virtual bool store(Kwave::SignalManager &manager)=0
Here is the call graph for this function:

◆ undoSize()

qint64 Kwave::UndoInsertTrack::undoSize ( )
virtual
See also
UndoAction::undoSize()

Implements Kwave::UndoAction.

Definition at line 48 of file UndoInsertTrack.cpp.

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

Member Data Documentation

◆ m_signal

Kwave::Signal& Kwave::UndoInsertTrack::m_signal
protected

Reference to the signal

Definition at line 72 of file UndoInsertTrack.h.

Referenced by redoSize(), and undo().

◆ m_track

unsigned int Kwave::UndoInsertTrack::m_track
protected

Index of the inserted track

Definition at line 75 of file UndoInsertTrack.h.

Referenced by undo().


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