kwave
18.07.70
|
#include <UndoTransactionGuard.h>
Public Member Functions | |
UndoTransactionGuard (Kwave::SignalManager &manager, const QString &name=QString()) | |
UndoTransactionGuard (Kwave::Plugin &plugin, const QString &name=QString()) | |
virtual | ~UndoTransactionGuard () |
bool | registerUndoAction (UndoAction *action) |
void | abort () |
Private Attributes | |
Kwave::SignalManager & | m_manager |
bool | m_initial_modified |
A simple guard class for opening and closing an undo transaction operating on a SignalManager. Several nested UndoTransactionGuards (or undo transactions) are allowed.
Definition at line 40 of file UndoTransactionGuard.h.
|
explicit |
Constructor. Also determines the name of the transaction if it is the first of several nested transactions.
manager | reference to the SignalManager we operate on |
name | the name of the transaction as a user-readable and localized string. [optional] |
Definition at line 32 of file UndoTransactionGuard.cpp.
References m_manager, and Kwave::SignalManager::startUndoTransaction().
|
explicit |
Constructor for use from a plugin. Also determines the name of the transaction if it is the first of several nested transactions.
plugin | reference to the plugin (you should pass *this . |
name | the name of the transaction as a user-readable and localized string. [optional] If you pass null or omit this parameter, the name of the plugin will be used instead. |
Definition at line 41 of file UndoTransactionGuard.cpp.
References m_manager, Kwave::Plugin::name(), Kwave::SignalManager::startUndoTransaction(), and UTF8.
|
virtual |
Destructor.
Definition at line 52 of file UndoTransactionGuard.cpp.
References Kwave::SignalManager::closeUndoTransaction(), and m_manager.
void Kwave::UndoTransactionGuard::abort | ( | ) |
Aborts the undo transaction, discards all undo data and restores the previous "modified" state of the signal.
Definition at line 64 of file UndoTransactionGuard.cpp.
References Kwave::SignalManager::abortUndoTransaction(), Kwave::SignalManager::isModified(), m_initial_modified, m_manager, and Kwave::SignalManager::setModified().
Referenced by Kwave::LabelItem::done(), and Kwave::LabelItem::~LabelItem().
bool Kwave::UndoTransactionGuard::registerUndoAction | ( | UndoAction * | action | ) |
Tries to free memory for a new undo action and stores all needed data if successful.
action | UndoAction to that is to be registered |
Definition at line 58 of file UndoTransactionGuard.cpp.
References m_manager, and Kwave::SignalManager::registerUndoAction().
Referenced by Kwave::LabelItem::moveTo().
|
private |
the initial "modified" state of the signal
Definition at line 96 of file UndoTransactionGuard.h.
Referenced by abort().
|
private |
Reference to the responsible SignalManager
Definition at line 93 of file UndoTransactionGuard.h.
Referenced by abort(), registerUndoAction(), UndoTransactionGuard(), and ~UndoTransactionGuard().