LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UndoCommandGroup Class Reference

The UndoCommandGroup class makes it possible to pack multiple undo commands together (it acts as a parent of it's child commands) More...

#include <undocommandgroup.h>

+ Inheritance diagram for UndoCommandGroup:
+ Collaboration diagram for UndoCommandGroup:

Public Member Functions

 UndoCommandGroup ()=delete
 
 UndoCommandGroup (const UndoCommandGroup &other)=delete
 
 UndoCommandGroup (const QString &text) noexcept
 
virtual ~UndoCommandGroup () noexcept
 
int getChildCount () const noexcept
 
void appendChild (UndoCommand *cmd)
 Append a new command to the list of child commands. More...
 
UndoCommandGroupoperator= (const UndoCommandGroup &rhs)=delete
 
- Public Member Functions inherited from UndoCommand
 UndoCommand ()=delete
 
 UndoCommand (const UndoCommand &other)=delete
 
 UndoCommand (const QString &text) noexcept
 
virtual ~UndoCommand () noexcept
 
const QString & getText () const noexcept
 
bool wasEverExecuted () const noexcept
 This method shows whether that command was ever executed (execute() called successfully) More...
 
bool wasEverReverted () const noexcept
 This method shows whether that command was ever reverted (undo() called at least one time) More...
 
bool isCurrentlyExecuted () const noexcept
 This method shows whether that command is currently executed (redo() called one time more than undo()) More...
 
virtual bool execute () final
 Execute the command (must only be called once) More...
 
virtual void undo () final
 Undo the command. More...
 
virtual void redo () final
 Redo the command. More...
 
UndoCommandoperator= (const UndoCommand &rhs)=delete
 

Protected Member Functions

virtual bool performExecute () override
 Execute the command the first time. More...
 
virtual void performUndo () override
 Undo the command. More...
 
virtual void performRedo () override
 Redo the command. More...
 
void execNewChildCmd (UndoCommand *cmd)
 Helper method for derived classes to execute and add new child commands. More...
 

Private Attributes

QList< UndoCommand * > mChilds
 All child commands. More...
 

Detailed Description

The UndoCommandGroup class makes it possible to pack multiple undo commands together (it acts as a parent of it's child commands)

Author
ubruhin
Date
2016-03-11

Constructor & Destructor Documentation

UndoCommandGroup ( )
delete
UndoCommandGroup ( const UndoCommandGroup other)
delete
UndoCommandGroup ( const QString &  text)
explicitnoexcept
~UndoCommandGroup ( )
virtualnoexcept

Member Function Documentation

int getChildCount ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

void appendChild ( UndoCommand cmd)

Append a new command to the list of child commands.

Parameters
cmdThe command to add (must not be executed already)
Note
If this command was already executed (execute() called), this method will also immediately execute the newly added child command. Otherwise, it will be executed as soon as execute() is called.
Warning
This method must not be called after undo() was called the first time.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

UndoCommandGroup& operator= ( const UndoCommandGroup rhs)
delete
bool performExecute ( )
overrideprotectedvirtual

Execute the command the first time.

Note
This method must be implemented in all derived classes. If the first time execution is exactly identical to an "redo" action, you can simple call performRedo() in the implementation of this method.
Return values
trueIf the command has done some changes
falseIf the command has done nothing (the command can be deleted)

Implements UndoCommand.

Reimplemented in CmdRemoveBoardItems, CmdMoveSelectedFootprintItems, CmdMoveSelectedSymbolItems, CmdAddDeviceToBoard, CmdAddSymbolToSchematic, CmdRemoveSelectedSchematicItems, CmdAddComponentToCircuit, CmdMoveSelectedBoardItems, CmdRotateSelectedFootprintItems, CmdRotateSelectedSymbolItems, CmdCombineSchematicNetSegments, CmdRemoveSelectedFootprintItems, CmdRemoveSelectedSymbolItems, CmdCombineBoardNetSegments, CmdReplaceDevice, CmdChangeNetSignalOfSchematicNetSegment, CmdMoveSelectedSchematicItems, CmdCombineAllNetSignalsUnderSchematicNetPoint, CmdCombineNetSignals, CmdFlipSelectedBoardItems, CmdMirrorSelectedSchematicItems, CmdRotateSelectedSchematicItems, CmdRemoveUnusedNetSignals, CmdRotateSelectedBoardItems, CmdFootprintStrokeTextsReset, and CmdRemoveUnusedLibraryElements.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void performUndo ( )
overrideprotectedvirtual

Undo the command.

Note
This method must be implemented in all derived classes.

Implements UndoCommand.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void performRedo ( )
overrideprotectedvirtual

Redo the command.

Note
This method must be implemented in all derived classes.

Implements UndoCommand.

+ Here is the call graph for this function:

void execNewChildCmd ( UndoCommand cmd)
protected

Helper method for derived classes to execute and add new child commands.

Parameters
cmdThe command to execute and add (must not be executed already)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

QList<UndoCommand*> mChilds
private

All child commands.

The child which is executed first is at index zero, the last executed command is at the top of the list.


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