1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-30 15:15:31 +00:00

extending refnum functionality to cloning (and also enable cloning of references to a different cell)

This commit is contained in:
Marc Zinnschlag 2014-09-20 12:37:25 +02:00
parent 7733df239e
commit 90ad3f332a
4 changed files with 9 additions and 21 deletions

View file

@ -50,7 +50,7 @@ std::string CSVWorld::GenericCreator::getId() const
void CSVWorld::GenericCreator::configureCreateCommand (CSMWorld::CreateCommand& command) 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) const std::string& id)
{ {
mUndoStack.push (command.release()); mUndoStack.push (command.release());
@ -184,7 +184,7 @@ void CSVWorld::GenericCreator::create()
{ {
std::string id = getId(); std::string id = getId();
std::auto_ptr<QUndoCommand> command; std::auto_ptr<CSMWorld::CreateCommand> command;
if (mCloneMode) if (mCloneMode)
{ {
@ -196,9 +196,9 @@ void CSVWorld::GenericCreator::create()
command.reset (new CSMWorld::CreateCommand ( command.reset (new CSMWorld::CreateCommand (
dynamic_cast<CSMWorld::IdTable&> (*mData.getTableModel (mListId)), id)); dynamic_cast<CSMWorld::IdTable&> (*mData.getTableModel (mListId)), id));
configureCreateCommand (dynamic_cast<CSMWorld::CreateCommand&> (*command));
} }
configureCreateCommand (*command);
pushCommand (command, id); pushCommand (command, id);
emit done(); emit done();

View file

@ -13,7 +13,6 @@ class QLineEdit;
class QHBoxLayout; class QHBoxLayout;
class QComboBox; class QComboBox;
class QLabel; class QLabel;
class QUndoCommand;
namespace CSMWorld namespace CSMWorld
{ {
@ -59,10 +58,12 @@ namespace CSVWorld
virtual std::string getId() const; 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 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); const std::string& id);
CSMWorld::Data& getData() const; CSMWorld::Data& getData() const;

View file

@ -31,7 +31,7 @@ void CSVWorld::ReferenceCreator::configureCreateCommand (CSMWorld::CreateCommand
command.addValue (refNumColumn, getRefNumCount()); 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) const std::string& id)
{ {
// get the old count // get the old count
@ -98,11 +98,6 @@ std::string CSVWorld::ReferenceCreator::getErrors() const
// record is internal and requires neither user input nor verification. // record is internal and requires neither user input nor verification.
std::string errors; std::string errors;
if (mCloneMode)
{
return errors;
}
std::string cell = mCell->text().toUtf8().constData(); std::string cell = mCell->text().toUtf8().constData();
if (cell.empty()) if (cell.empty())
@ -128,12 +123,6 @@ void CSVWorld::ReferenceCreator::cellChanged()
update(); update();
} }
void CSVWorld::ReferenceCreator::toggleWidgets(bool active)
{
CSVWorld::GenericCreator::toggleWidgets(active);
mCell->setEnabled(active);
}
void CSVWorld::ReferenceCreator::cloneMode(const std::string& originId, void CSVWorld::ReferenceCreator::cloneMode(const std::string& originId,
const CSMWorld::UniversalId::Type type) const CSMWorld::UniversalId::Type type)
{ {

View file

@ -20,10 +20,9 @@ namespace CSVWorld
virtual void configureCreateCommand (CSMWorld::CreateCommand& command) const; 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); const std::string& id);
/// Return next available RefNum for the cell the creator is currently operating on
int getRefNumCount() const; int getRefNumCount() const;
public: public:
@ -35,7 +34,6 @@ namespace CSVWorld
const CSMWorld::UniversalId::Type type); const CSMWorld::UniversalId::Type type);
virtual void reset(); virtual void reset();
virtual void toggleWidgets(bool active = true);
virtual std::string getErrors() const; virtual std::string getErrors() const;
///< Return formatted error descriptions for the current state of the creator. if an empty ///< Return formatted error descriptions for the current state of the creator. if an empty