コード例 #1
0
ファイル: genericcreator.cpp プロジェクト: Allofich/openmw
void CSVWorld::GenericCreator::create()
{
    if (!mLocked)
    {
        std::string id = getId();

        std::unique_ptr<CSMWorld::CreateCommand> command;

        if (mCloneMode)
        {
            command.reset (new CSMWorld::CloneCommand (
                dynamic_cast<CSMWorld::IdTable&> (*mData.getTableModel(mListId)), mClonedId, id, mClonedType));
        }
        else
        {
            command.reset (new CSMWorld::CreateCommand (
                dynamic_cast<CSMWorld::IdTable&> (*mData.getTableModel (mListId)), id));

        }

        configureCreateCommand (*command);
        pushCommand (std::move(command), id);

        emit done();
        emit requestFocus(id);
    }
}
コード例 #2
0
ファイル: genericcreator.cpp プロジェクト: 0xmono/openmw
void CSVWorld::GenericCreator::create()
{
    if (!mLocked)
    {
        if (mCloneMode)
        {
            std::string id = getId();
            std::auto_ptr<CSMWorld::CloneCommand> command (new CSMWorld::CloneCommand (
                dynamic_cast<CSMWorld::IdTable&> (*mData.getTableModel(mListId)), mClonedId, id, mClonedType));

            mUndoStack.push(command.release());

            emit done();
            emit requestFocus(id);
        } else {
            std::string id = getId();

            std::auto_ptr<CSMWorld::CreateCommand> command (new CSMWorld::CreateCommand (
            dynamic_cast<CSMWorld::IdTable&> (*mData.getTableModel (mListId)), id));

            configureCreateCommand (*command);

            mUndoStack.push (command.release());

            emit done();
            emit requestFocus (id);
        }
    }
}