27 std::string generate_description(
const std::string& modelType,
const TagRow& tagrow);
47 auto item_copy = copy_strategy->createCopy(item);
49 p_impl->backup_strategy->saveItem(item_copy.get());
57 delete parent->takeItem(
p_impl->tagrow);
64 auto item =
p_impl->backup_strategy->restoreItem();
65 if (parent->insertItem(item.get(),
p_impl->tagrow)) {
66 auto result = item.release();
75 std::string generate_description(
const std::string& modelType,
const TagRow& tagrow)
77 std::ostringstream ostr;
78 ostr <<
"Copy item'" << modelType <<
"' tag:'" << tagrow.
tag <<
"', row:" << tagrow.
row;
Abstract command interface to manipulate SessionItem in model context.
SessionItem * itemFromPath(const Path &path) const
void setDescription(const std::string &text)
Sets command description.
CommandResult result() const
void setResult(const CommandResult &command_result)
Path pathFromItem(SessionItem *item) const
void setObsolete(bool flag)
Sets command obsolete flag.
void execute_command() override
std::unique_ptr< CopyItemCommandImpl > p_impl
void undo_command() override
~CopyItemCommand() override
CopyItemCommand(const SessionItem *item, SessionItem *parent, TagRow tagrow)
Supports navigation through SessionModel.
The main object representing an editable/displayable/serializable entity.
SessionModel * model() const
Returns the model to which given item belongs to.
model_type modelType() const
Returns item's model type.
Aggregate to hold (tag, row) information for SessionModel.
materialitems.h Collection of materials to populate MaterialModel.
MVVM_MODEL_EXPORT std::unique_ptr< ItemCopyStrategy > CreateItemCopyStrategy(const SessionModel *model)
Returns strategy for item copying.
MVVM_MODEL_EXPORT std::unique_ptr< ItemBackupStrategy > CreateItemBackupStrategy(const SessionModel *model)
Creates strategy suitable for item saving/restoring.
CopyItemCommandImpl(TagRow tagrow)
std::unique_ptr< ItemBackupStrategy > backup_strategy