forked from teamnwah/openmw-tes3coop
removed needless argument for cloning
This commit is contained in:
parent
be8b978a89
commit
aa6d1ff4c3
19 changed files with 30 additions and 45 deletions
|
@ -102,8 +102,7 @@ namespace CSMWorld
|
||||||
|
|
||||||
virtual void cloneRecord(const std::string& origin,
|
virtual void cloneRecord(const std::string& origin,
|
||||||
const std::string& destination,
|
const std::string& destination,
|
||||||
const UniversalId::Type type,
|
const UniversalId::Type type);
|
||||||
const UniversalId::ArgumentType argumentType);
|
|
||||||
|
|
||||||
virtual int searchId (const std::string& id) const;
|
virtual int searchId (const std::string& id) const;
|
||||||
////< Search record with \a id.
|
////< Search record with \a id.
|
||||||
|
@ -203,8 +202,7 @@ namespace CSMWorld
|
||||||
template<typename ESXRecordT, typename IdAccessorT>
|
template<typename ESXRecordT, typename IdAccessorT>
|
||||||
void Collection<ESXRecordT, IdAccessorT>::cloneRecord(const std::string& origin,
|
void Collection<ESXRecordT, IdAccessorT>::cloneRecord(const std::string& origin,
|
||||||
const std::string& destination,
|
const std::string& destination,
|
||||||
const UniversalId::Type type,
|
const UniversalId::Type type)
|
||||||
const UniversalId::ArgumentType argumentType)
|
|
||||||
{
|
{
|
||||||
Record<ESXRecordT> copy(getRecord(origin));
|
Record<ESXRecordT> copy(getRecord(origin));
|
||||||
copy.mState = RecordBase::State_ModifiedOnly;
|
copy.mState = RecordBase::State_ModifiedOnly;
|
||||||
|
|
|
@ -76,8 +76,7 @@ namespace CSMWorld
|
||||||
|
|
||||||
virtual void cloneRecord(const std::string& origin,
|
virtual void cloneRecord(const std::string& origin,
|
||||||
const std::string& destination,
|
const std::string& destination,
|
||||||
const UniversalId::Type type,
|
const UniversalId::Type type) = 0;
|
||||||
const UniversalId::ArgumentType argumentType) = 0;
|
|
||||||
|
|
||||||
virtual const RecordBase& getRecord (const std::string& id) const = 0;
|
virtual const RecordBase& getRecord (const std::string& id) const = 0;
|
||||||
|
|
||||||
|
|
|
@ -27,13 +27,11 @@ CSMWorld::CloneCommand::CloneCommand(CSMWorld::IdTable& model,
|
||||||
const std::string& idOrigin,
|
const std::string& idOrigin,
|
||||||
const std::string& IdDestination,
|
const std::string& IdDestination,
|
||||||
const CSMWorld::UniversalId::Type type,
|
const CSMWorld::UniversalId::Type type,
|
||||||
const CSMWorld::UniversalId::ArgumentType argumentType,
|
|
||||||
QUndoCommand* parent) :
|
QUndoCommand* parent) :
|
||||||
QUndoCommand(parent),
|
QUndoCommand(parent),
|
||||||
mModel(model),
|
mModel(model),
|
||||||
mIdOrigin(idOrigin),
|
mIdOrigin(idOrigin),
|
||||||
mIdDestination(Misc::StringUtils::lowerCase(IdDestination)),
|
mIdDestination(Misc::StringUtils::lowerCase(IdDestination)),
|
||||||
mArgumentType(argumentType),
|
|
||||||
mType(type)
|
mType(type)
|
||||||
{
|
{
|
||||||
setText(("Clone record " + idOrigin + " to the " + IdDestination).c_str());
|
setText(("Clone record " + idOrigin + " to the " + IdDestination).c_str());
|
||||||
|
@ -42,7 +40,7 @@ CSMWorld::CloneCommand::CloneCommand(CSMWorld::IdTable& model,
|
||||||
|
|
||||||
void CSMWorld::CloneCommand::redo()
|
void CSMWorld::CloneCommand::redo()
|
||||||
{
|
{
|
||||||
mModel.cloneRecord(mIdOrigin, mIdDestination, mArgumentType, mType);
|
mModel.cloneRecord(mIdOrigin, mIdDestination, mType);
|
||||||
|
|
||||||
for (std::map<int, QVariant>::const_iterator iter(mValues.begin()); iter != mValues.end(); ++iter)
|
for (std::map<int, QVariant>::const_iterator iter(mValues.begin()); iter != mValues.end(); ++iter)
|
||||||
mModel.setData(mModel.getModelIndex(mIdDestination, iter->first), iter->second);
|
mModel.setData(mModel.getModelIndex(mIdDestination, iter->first), iter->second);
|
||||||
|
|
|
@ -45,7 +45,6 @@ namespace CSMWorld
|
||||||
std::string mIdOrigin;
|
std::string mIdOrigin;
|
||||||
std::string mIdDestination;
|
std::string mIdDestination;
|
||||||
UniversalId::Type mType;
|
UniversalId::Type mType;
|
||||||
UniversalId::ArgumentType mArgumentType;
|
|
||||||
std::map<int, QVariant> mValues;
|
std::map<int, QVariant> mValues;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -53,7 +52,6 @@ namespace CSMWorld
|
||||||
CloneCommand (IdTable& model, const std::string& idOrigin,
|
CloneCommand (IdTable& model, const std::string& idOrigin,
|
||||||
const std::string& IdDestination,
|
const std::string& IdDestination,
|
||||||
const UniversalId::Type type,
|
const UniversalId::Type type,
|
||||||
const UniversalId::ArgumentType argumentType,
|
|
||||||
QUndoCommand* parent = 0);
|
QUndoCommand* parent = 0);
|
||||||
|
|
||||||
virtual void redo();
|
virtual void redo();
|
||||||
|
|
|
@ -126,12 +126,11 @@ void CSMWorld::IdTable::addRecord (const std::string& id, UniversalId::Type type
|
||||||
|
|
||||||
void CSMWorld::IdTable::cloneRecord(const std::string& origin,
|
void CSMWorld::IdTable::cloneRecord(const std::string& origin,
|
||||||
const std::string& destination,
|
const std::string& destination,
|
||||||
CSMWorld::UniversalId::ArgumentType argumentType,
|
|
||||||
CSMWorld::UniversalId::Type type)
|
CSMWorld::UniversalId::Type type)
|
||||||
{
|
{
|
||||||
int index = mIdCollection->getAppendIndex (destination);
|
int index = mIdCollection->getAppendIndex (destination);
|
||||||
beginInsertRows (QModelIndex(), index, index);
|
beginInsertRows (QModelIndex(), index, index);
|
||||||
mIdCollection->cloneRecord(origin, destination, type, argumentType);
|
mIdCollection->cloneRecord(origin, destination, type);
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,6 @@ namespace CSMWorld
|
||||||
|
|
||||||
void cloneRecord(const std::string& origin,
|
void cloneRecord(const std::string& origin,
|
||||||
const std::string& destination,
|
const std::string& destination,
|
||||||
UniversalId::ArgumentType argumentType,
|
|
||||||
UniversalId::Type type = UniversalId::Type_None);
|
UniversalId::Type type = UniversalId::Type_None);
|
||||||
|
|
||||||
QModelIndex getModelIndex (const std::string& id, int column) const;
|
QModelIndex getModelIndex (const std::string& id, int column) const;
|
||||||
|
|
|
@ -451,15 +451,13 @@ void CSMWorld::RefIdCollection::replace (int index, const RecordBase& record)
|
||||||
|
|
||||||
void CSMWorld::RefIdCollection::cloneRecord(const std::string& origin,
|
void CSMWorld::RefIdCollection::cloneRecord(const std::string& origin,
|
||||||
const std::string& destination,
|
const std::string& destination,
|
||||||
const CSMWorld::UniversalId::Type type,
|
const CSMWorld::UniversalId::Type type)
|
||||||
const CSMWorld::UniversalId::ArgumentType argumentType)
|
|
||||||
{
|
{
|
||||||
RecordBase *newRecord = mData.getRecord(mData.searchId(origin)).clone();
|
RecordBase *newRecord = mData.getRecord(mData.searchId(origin)).clone();
|
||||||
newRecord->mState = RecordBase::State_ModifiedOnly;
|
newRecord->mState = RecordBase::State_ModifiedOnly;
|
||||||
mAdapters.find(type)->second->setId(*newRecord, destination);
|
mAdapters.find(type)->second->setId(*newRecord, destination);
|
||||||
mData.insertRecord(*newRecord, type, destination);
|
mData.insertRecord(*newRecord, type, destination);
|
||||||
delete newRecord;
|
delete newRecord;
|
||||||
//WIP
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMWorld::RefIdCollection::appendRecord (const RecordBase& record,
|
void CSMWorld::RefIdCollection::appendRecord (const RecordBase& record,
|
||||||
|
|
|
@ -71,8 +71,7 @@ namespace CSMWorld
|
||||||
|
|
||||||
virtual void cloneRecord(const std::string& origin,
|
virtual void cloneRecord(const std::string& origin,
|
||||||
const std::string& destination,
|
const std::string& destination,
|
||||||
const UniversalId::Type type,
|
const UniversalId::Type type);
|
||||||
const UniversalId::ArgumentType argumentType);
|
|
||||||
|
|
||||||
virtual void appendBlankRecord (const std::string& id, UniversalId::Type type);
|
virtual void appendBlankRecord (const std::string& id, UniversalId::Type type);
|
||||||
///< \param type Will be ignored, unless the collection supports multiple record types
|
///< \param type Will be ignored, unless the collection supports multiple record types
|
||||||
|
|
|
@ -82,10 +82,9 @@ void CSVWorld::CellCreator::valueChanged (int index)
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::CellCreator::cloneMode(const std::string& originid,
|
void CSVWorld::CellCreator::cloneMode(const std::string& originid,
|
||||||
const CSMWorld::UniversalId::Type type,
|
const CSMWorld::UniversalId::Type type)
|
||||||
const CSMWorld::UniversalId::ArgumentType argumentType)
|
|
||||||
{
|
{
|
||||||
CSVWorld::GenericCreator::cloneMode(originid, type, argumentType);
|
CSVWorld::GenericCreator::cloneMode(originid, type);
|
||||||
if (*(originid.begin()) == '#') //if originid points to the exterior cell
|
if (*(originid.begin()) == '#') //if originid points to the exterior cell
|
||||||
{
|
{
|
||||||
setType(1); //enable x and y controls
|
setType(1); //enable x and y controls
|
||||||
|
|
|
@ -32,8 +32,7 @@ namespace CSVWorld
|
||||||
virtual void toggleWidgets(bool active = true);
|
virtual void toggleWidgets(bool active = true);
|
||||||
|
|
||||||
virtual void cloneMode(const std::string& originid,
|
virtual void cloneMode(const std::string& originid,
|
||||||
const CSMWorld::UniversalId::Type type,
|
const CSMWorld::UniversalId::Type type);
|
||||||
const CSMWorld::UniversalId::ArgumentType argumentType);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,8 @@ namespace CSVWorld
|
||||||
|
|
||||||
virtual void reset() = 0;
|
virtual void reset() = 0;
|
||||||
|
|
||||||
virtual void cloneMode(const std::string& originid, const CSMWorld::UniversalId::Type type, const CSMWorld::UniversalId::ArgumentType argumentType) = 0;
|
virtual void cloneMode(const std::string& originid,
|
||||||
|
const CSMWorld::UniversalId::Type type) = 0;
|
||||||
|
|
||||||
virtual void setEditLock (bool locked) = 0;
|
virtual void setEditLock (bool locked) = 0;
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ void CSVWorld::GenericCreator::create()
|
||||||
{
|
{
|
||||||
std::string id = getId();
|
std::string id = getId();
|
||||||
std::auto_ptr<CSMWorld::CloneCommand> command (new CSMWorld::CloneCommand (
|
std::auto_ptr<CSMWorld::CloneCommand> command (new CSMWorld::CloneCommand (
|
||||||
dynamic_cast<CSMWorld::IdTable&> (*mData.getTableModel(mListId)), mClonedId, id, mClonedType, mArgumentType));
|
dynamic_cast<CSMWorld::IdTable&> (*mData.getTableModel(mListId)), mClonedId, id, mClonedType));
|
||||||
|
|
||||||
mUndoStack.push(command.release());
|
mUndoStack.push(command.release());
|
||||||
|
|
||||||
|
@ -150,13 +150,11 @@ void CSVWorld::GenericCreator::create()
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::GenericCreator::cloneMode(const std::string& originid,
|
void CSVWorld::GenericCreator::cloneMode(const std::string& originid,
|
||||||
const CSMWorld::UniversalId::Type type,
|
const CSMWorld::UniversalId::Type type)
|
||||||
const CSMWorld::UniversalId::ArgumentType argumentType)
|
|
||||||
{
|
{
|
||||||
mCloneMode = true;
|
mCloneMode = true;
|
||||||
mClonedId = originid;
|
mClonedId = originid;
|
||||||
mClonedType = type;
|
mClonedType = type;
|
||||||
mArgumentType = argumentType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::GenericCreator::toggleWidgets(bool active)
|
void CSVWorld::GenericCreator::toggleWidgets(bool active)
|
||||||
|
|
|
@ -67,8 +67,7 @@ namespace CSVWorld
|
||||||
virtual void toggleWidgets (bool active = true);
|
virtual void toggleWidgets (bool active = true);
|
||||||
|
|
||||||
virtual void cloneMode(const std::string& originid,
|
virtual void cloneMode(const std::string& originid,
|
||||||
const CSMWorld::UniversalId::Type type,
|
const CSMWorld::UniversalId::Type type);
|
||||||
const CSMWorld::UniversalId::ArgumentType argumentType);
|
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -85,8 +85,9 @@ void CSVWorld::ReferenceCreator::toggleWidgets(bool active)
|
||||||
mCell->setEnabled(active);
|
mCell->setEnabled(active);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::ReferenceCreator::cloneMode(const std::string& originid, const CSMWorld::UniversalId::Type type, const CSMWorld::UniversalId::ArgumentType argumentType)
|
void CSVWorld::ReferenceCreator::cloneMode(const std::string& originid,
|
||||||
|
const CSMWorld::UniversalId::Type type)
|
||||||
{
|
{
|
||||||
CSVWorld::GenericCreator::cloneMode(originid, type, argumentType);
|
CSVWorld::GenericCreator::cloneMode(originid, type);
|
||||||
cellChanged(); //otherwise ok button will remain disabled
|
cellChanged(); //otherwise ok button will remain disabled
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,7 @@ namespace CSVWorld
|
||||||
const CSMWorld::UniversalId& id);
|
const CSMWorld::UniversalId& id);
|
||||||
|
|
||||||
virtual void cloneMode(const std::string& originid,
|
virtual void cloneMode(const std::string& originid,
|
||||||
const CSMWorld::UniversalId::Type type,
|
const CSMWorld::UniversalId::Type type);
|
||||||
const CSMWorld::UniversalId::ArgumentType argumentType);
|
|
||||||
|
|
||||||
virtual void reset();
|
virtual void reset();
|
||||||
virtual void toggleWidgets(bool active = true);
|
virtual void toggleWidgets(bool active = true);
|
||||||
|
|
|
@ -160,11 +160,10 @@ void CSVWorld::TableBottomBox::createRequest()
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::TableBottomBox::cloneRequest(const std::string& id,
|
void CSVWorld::TableBottomBox::cloneRequest(const std::string& id,
|
||||||
const CSMWorld::UniversalId::Type type,
|
const CSMWorld::UniversalId::Type type)
|
||||||
const CSMWorld::UniversalId::ArgumentType argumnetType)
|
|
||||||
{
|
{
|
||||||
mCreator->reset();
|
mCreator->reset();
|
||||||
mCreator->cloneMode(id, type, argumnetType);
|
mCreator->cloneMode(id, type);
|
||||||
mLayout->setCurrentWidget(mCreator);
|
mLayout->setCurrentWidget(mCreator);
|
||||||
mCreator->toggleWidgets(false);
|
mCreator->toggleWidgets(false);
|
||||||
setVisible (true);
|
setVisible (true);
|
||||||
|
|
|
@ -77,7 +77,8 @@ namespace CSVWorld
|
||||||
/// \param modified Number of added and modified records
|
/// \param modified Number of added and modified records
|
||||||
|
|
||||||
void createRequest();
|
void createRequest();
|
||||||
void cloneRequest(const std::string& id, const CSMWorld::UniversalId::Type type, const CSMWorld::UniversalId::ArgumentType argumentType);
|
void cloneRequest(const std::string& id,
|
||||||
|
const CSMWorld::UniversalId::Type type);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,9 +49,11 @@ CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::D
|
||||||
{
|
{
|
||||||
connect (mTable, SIGNAL (createRequest()), mBottom, SLOT (createRequest()));
|
connect (mTable, SIGNAL (createRequest()), mBottom, SLOT (createRequest()));
|
||||||
|
|
||||||
connect (mTable, SIGNAL (cloneRequest(const CSMWorld::UniversalId&)), this, SLOT(cloneRequest(const CSMWorld::UniversalId&)));
|
connect (mTable, SIGNAL (cloneRequest(const CSMWorld::UniversalId&)), this,
|
||||||
connect (this, SIGNAL(cloneRequest(const std::string&, const CSMWorld::UniversalId::Type, const CSMWorld::UniversalId::ArgumentType)),
|
SLOT(cloneRequest(const CSMWorld::UniversalId&)));
|
||||||
mBottom, SLOT(cloneRequest(const std::string&, const CSMWorld::UniversalId::Type, const CSMWorld::UniversalId::ArgumentType)));
|
|
||||||
|
connect (this, SIGNAL(cloneRequest(const std::string&, const CSMWorld::UniversalId::Type)),
|
||||||
|
mBottom, SLOT(cloneRequest(const std::string&, const CSMWorld::UniversalId::Type)));
|
||||||
}
|
}
|
||||||
connect (mBottom, SIGNAL (requestFocus (const std::string&)),
|
connect (mBottom, SIGNAL (requestFocus (const std::string&)),
|
||||||
mTable, SLOT (requestFocus (const std::string&)));
|
mTable, SLOT (requestFocus (const std::string&)));
|
||||||
|
@ -84,5 +86,5 @@ void CSVWorld::TableSubView::setStatusBar (bool show)
|
||||||
|
|
||||||
void CSVWorld::TableSubView::cloneRequest(const CSMWorld::UniversalId& toClone)
|
void CSVWorld::TableSubView::cloneRequest(const CSMWorld::UniversalId& toClone)
|
||||||
{
|
{
|
||||||
emit cloneRequest(toClone.getId(), toClone.getType(), toClone.getArgumentType());
|
emit cloneRequest(toClone.getId(), toClone.getType());
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,8 +41,7 @@ namespace CSVWorld
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void cloneRequest(const std::string&,
|
void cloneRequest(const std::string&,
|
||||||
const CSMWorld::UniversalId::Type,
|
const CSMWorld::UniversalId::Type);
|
||||||
const CSMWorld::UniversalId::ArgumentType);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue