1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 07:23:52 +00:00
openmw/apps/opencs/model/world/commandmacro.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
582 B
C++
Raw Normal View History

2016-03-08 09:48:44 +00:00
#include "commandmacro.hpp"
#include <QUndoCommand>
#include <QUndoStack>
CSMWorld::CommandMacro::CommandMacro(QUndoStack& undoStack, const QString& description)
: mUndoStack(undoStack)
, mDescription(description)
, mStarted(false)
{
}
CSMWorld::CommandMacro::~CommandMacro()
{
if (mStarted)
mUndoStack.endMacro();
}
void CSMWorld::CommandMacro::push(QUndoCommand* command)
{
if (!mStarted)
{
mUndoStack.beginMacro(mDescription.isEmpty() ? command->text() : mDescription);
mStarted = true;
}
mUndoStack.push(command);
}