|
|
|
@ -26,34 +26,6 @@ void CSMWorld::ModifyCommand::undo()
|
|
|
|
|
mModel.setData(mIndex, mOld);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CSMWorld::CloneCommand::CloneCommand(CSMWorld::IdTable& model,
|
|
|
|
|
const std::string& idOrigin,
|
|
|
|
|
const std::string& IdDestination,
|
|
|
|
|
const CSMWorld::UniversalId::Type type,
|
|
|
|
|
QUndoCommand* parent) :
|
|
|
|
|
QUndoCommand(parent),
|
|
|
|
|
mModel(model),
|
|
|
|
|
mIdOrigin(idOrigin),
|
|
|
|
|
mIdDestination(Misc::StringUtils::lowerCase(IdDestination)),
|
|
|
|
|
mType(type)
|
|
|
|
|
{
|
|
|
|
|
setText(("Clone record " + idOrigin + " to the " + IdDestination).c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSMWorld::CloneCommand::redo()
|
|
|
|
|
{
|
|
|
|
|
mModel.cloneRecord(mIdOrigin, mIdDestination, mType);
|
|
|
|
|
|
|
|
|
|
for (std::map<int, QVariant>::const_iterator iter(mValues.begin()); iter != mValues.end(); ++iter)
|
|
|
|
|
mModel.setData(mModel.getModelIndex(mIdDestination, iter->first), iter->second);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSMWorld::CloneCommand::undo()
|
|
|
|
|
{
|
|
|
|
|
mModel.removeRow(mModel.getModelIndex(mIdDestination, 0).row());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CSMWorld::CreateCommand::CreateCommand(IdTable& model, const std::string& id, QUndoCommand* parent)
|
|
|
|
|
: QUndoCommand(parent), mModel(model), mId(id), mType(UniversalId::Type_None)
|
|
|
|
|
{
|
|
|
|
@ -174,4 +146,32 @@ void CSMWorld::ReorderRowsCommand::undo()
|
|
|
|
|
|
|
|
|
|
mModel.reorderRows(mBaseIndex, reverse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CSMWorld::CloneCommand::CloneCommand(CSMWorld::IdTable& model,
|
|
|
|
|
const std::string& idOrigin,
|
|
|
|
|
const std::string& IdDestination,
|
|
|
|
|
const CSMWorld::UniversalId::Type type,
|
|
|
|
|
QUndoCommand* parent) :
|
|
|
|
|
QUndoCommand(parent),
|
|
|
|
|
mModel(model),
|
|
|
|
|
mIdOrigin(idOrigin),
|
|
|
|
|
mIdDestination(Misc::StringUtils::lowerCase(IdDestination)),
|
|
|
|
|
mType(type)
|
|
|
|
|
{
|
|
|
|
|
setText(("Clone record " + idOrigin + " to the " + IdDestination).c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSMWorld::CloneCommand::redo()
|
|
|
|
|
{
|
|
|
|
|
mModel.cloneRecord(mIdOrigin, mIdDestination, mType);
|
|
|
|
|
|
|
|
|
|
for (std::map<int, QVariant>::const_iterator iter(mValues.begin()); iter != mValues.end(); ++iter)
|
|
|
|
|
mModel.setData(mModel.getModelIndex(mIdDestination, iter->first), iter->second);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSMWorld::CloneCommand::undo()
|
|
|
|
|
{
|
|
|
|
|
mModel.removeRow(mModel.getModelIndex(mIdDestination, 0).row());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// kate: indent-mode cstyle; indent-width 4; replace-tabs on;
|
|
|
|
|