mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-29 22:15:32 +00:00
extending refnum functionality to cloning (and also enable cloning of references to a different cell)
This commit is contained in:
parent
7733df239e
commit
90ad3f332a
4 changed files with 9 additions and 21 deletions
|
@ -50,7 +50,7 @@ std::string CSVWorld::GenericCreator::getId() const
|
|||
|
||||
void CSVWorld::GenericCreator::configureCreateCommand (CSMWorld::CreateCommand& command) const {}
|
||||
|
||||
void CSVWorld::GenericCreator::pushCommand (std::auto_ptr<QUndoCommand> command,
|
||||
void CSVWorld::GenericCreator::pushCommand (std::auto_ptr<CSMWorld::CreateCommand> command,
|
||||
const std::string& id)
|
||||
{
|
||||
mUndoStack.push (command.release());
|
||||
|
@ -184,7 +184,7 @@ void CSVWorld::GenericCreator::create()
|
|||
{
|
||||
std::string id = getId();
|
||||
|
||||
std::auto_ptr<QUndoCommand> command;
|
||||
std::auto_ptr<CSMWorld::CreateCommand> command;
|
||||
|
||||
if (mCloneMode)
|
||||
{
|
||||
|
@ -196,9 +196,9 @@ void CSVWorld::GenericCreator::create()
|
|||
command.reset (new CSMWorld::CreateCommand (
|
||||
dynamic_cast<CSMWorld::IdTable&> (*mData.getTableModel (mListId)), id));
|
||||
|
||||
configureCreateCommand (dynamic_cast<CSMWorld::CreateCommand&> (*command));
|
||||
}
|
||||
|
||||
configureCreateCommand (*command);
|
||||
pushCommand (command, id);
|
||||
|
||||
emit done();
|
||||
|
|
|
@ -13,7 +13,6 @@ class QLineEdit;
|
|||
class QHBoxLayout;
|
||||
class QComboBox;
|
||||
class QLabel;
|
||||
class QUndoCommand;
|
||||
|
||||
namespace CSMWorld
|
||||
{
|
||||
|
@ -59,10 +58,12 @@ namespace CSVWorld
|
|||
|
||||
virtual std::string getId() const;
|
||||
|
||||
/// \note This function is not called in case of a clone operation.
|
||||
/// Allow subclasses to add additional data to \a command.
|
||||
virtual void configureCreateCommand (CSMWorld::CreateCommand& command) const;
|
||||
|
||||
virtual void pushCommand (std::auto_ptr<QUndoCommand> command,
|
||||
/// Allow subclasses to wrap the create command together with additional commands
|
||||
/// into a macro.
|
||||
virtual void pushCommand (std::auto_ptr<CSMWorld::CreateCommand> command,
|
||||
const std::string& id);
|
||||
|
||||
CSMWorld::Data& getData() const;
|
||||
|
|
|
@ -31,7 +31,7 @@ void CSVWorld::ReferenceCreator::configureCreateCommand (CSMWorld::CreateCommand
|
|||
command.addValue (refNumColumn, getRefNumCount());
|
||||
}
|
||||
|
||||
void CSVWorld::ReferenceCreator::pushCommand (std::auto_ptr<QUndoCommand> command,
|
||||
void CSVWorld::ReferenceCreator::pushCommand (std::auto_ptr<CSMWorld::CreateCommand> command,
|
||||
const std::string& id)
|
||||
{
|
||||
// get the old count
|
||||
|
@ -98,11 +98,6 @@ std::string CSVWorld::ReferenceCreator::getErrors() const
|
|||
// record is internal and requires neither user input nor verification.
|
||||
std::string errors;
|
||||
|
||||
if (mCloneMode)
|
||||
{
|
||||
return errors;
|
||||
}
|
||||
|
||||
std::string cell = mCell->text().toUtf8().constData();
|
||||
|
||||
if (cell.empty())
|
||||
|
@ -128,12 +123,6 @@ void CSVWorld::ReferenceCreator::cellChanged()
|
|||
update();
|
||||
}
|
||||
|
||||
void CSVWorld::ReferenceCreator::toggleWidgets(bool active)
|
||||
{
|
||||
CSVWorld::GenericCreator::toggleWidgets(active);
|
||||
mCell->setEnabled(active);
|
||||
}
|
||||
|
||||
void CSVWorld::ReferenceCreator::cloneMode(const std::string& originId,
|
||||
const CSMWorld::UniversalId::Type type)
|
||||
{
|
||||
|
|
|
@ -20,10 +20,9 @@ namespace CSVWorld
|
|||
|
||||
virtual void configureCreateCommand (CSMWorld::CreateCommand& command) const;
|
||||
|
||||
virtual void pushCommand (std::auto_ptr<QUndoCommand> command,
|
||||
virtual void pushCommand (std::auto_ptr<CSMWorld::CreateCommand> command,
|
||||
const std::string& id);
|
||||
|
||||
/// Return next available RefNum for the cell the creator is currently operating on
|
||||
int getRefNumCount() const;
|
||||
|
||||
public:
|
||||
|
@ -35,7 +34,6 @@ namespace CSVWorld
|
|||
const CSMWorld::UniversalId::Type type);
|
||||
|
||||
virtual void reset();
|
||||
virtual void toggleWidgets(bool active = true);
|
||||
|
||||
virtual std::string getErrors() const;
|
||||
///< Return formatted error descriptions for the current state of the creator. if an empty
|
||||
|
|
Loading…
Reference in a new issue