mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:23:52 +00:00
rewrote command generation in GenericCreator
This commit is contained in:
parent
90b45e09f7
commit
70275350de
2 changed files with 25 additions and 13 deletions
|
@ -50,6 +50,12 @@ std::string CSVWorld::GenericCreator::getId() const
|
|||
|
||||
void CSVWorld::GenericCreator::configureCreateCommand (CSMWorld::CreateCommand& command) const {}
|
||||
|
||||
void CSVWorld::GenericCreator::pushCommand (std::auto_ptr<QUndoCommand> command,
|
||||
const std::string& id)
|
||||
{
|
||||
mUndoStack.push (command.release());
|
||||
}
|
||||
|
||||
CSMWorld::Data& CSVWorld::GenericCreator::getData() const
|
||||
{
|
||||
return mData;
|
||||
|
@ -173,24 +179,23 @@ void CSVWorld::GenericCreator::create()
|
|||
{
|
||||
std::string id = getId();
|
||||
|
||||
std::auto_ptr<QUndoCommand> command;
|
||||
|
||||
if (mCloneMode)
|
||||
{
|
||||
std::auto_ptr<CSMWorld::CloneCommand> command (new CSMWorld::CloneCommand (
|
||||
command.reset (new CSMWorld::CloneCommand (
|
||||
dynamic_cast<CSMWorld::IdTable&> (*mData.getTableModel(mListId)), mClonedId, id, mClonedType));
|
||||
|
||||
mUndoStack.push(command.release());
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
std::auto_ptr<CSMWorld::CreateCommand> command (new CSMWorld::CreateCommand (
|
||||
command.reset (new CSMWorld::CreateCommand (
|
||||
dynamic_cast<CSMWorld::IdTable&> (*mData.getTableModel (mListId)), id));
|
||||
|
||||
configureCreateCommand (*command);
|
||||
|
||||
mUndoStack.push (command.release());
|
||||
configureCreateCommand (dynamic_cast<CSMWorld::CreateCommand&> (*command));
|
||||
}
|
||||
|
||||
pushCommand (command, id);
|
||||
|
||||
emit done();
|
||||
emit requestFocus(id);
|
||||
}
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
#ifndef CSV_WORLD_GENERICCREATOR_H
|
||||
#define CSV_WORLD_GENERICCREATOR_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "../../model/world/universalid.hpp"
|
||||
|
||||
#include "creator.hpp"
|
||||
|
||||
class QString;
|
||||
class QPushButton;
|
||||
class QLineEdit;
|
||||
class QHBoxLayout;
|
||||
class QComboBox;
|
||||
class QLabel;
|
||||
|
||||
#include "creator.hpp"
|
||||
|
||||
#include "../../model/world/universalid.hpp"
|
||||
class QUndoCommand;
|
||||
|
||||
namespace CSMWorld
|
||||
{
|
||||
|
@ -56,8 +59,12 @@ namespace CSVWorld
|
|||
|
||||
virtual std::string getId() const;
|
||||
|
||||
/// \note This function is not called in case of a clone operation.
|
||||
virtual void configureCreateCommand (CSMWorld::CreateCommand& command) const;
|
||||
|
||||
virtual void pushCommand (std::auto_ptr<QUndoCommand> command,
|
||||
const std::string& id);
|
||||
|
||||
CSMWorld::Data& getData() const;
|
||||
|
||||
const CSMWorld::UniversalId& getCollectionId() const;
|
||||
|
|
Loading…
Reference in a new issue