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,
|
||||
const std::string& destination,
|
||||
const UniversalId::Type type,
|
||||
const UniversalId::ArgumentType argumentType);
|
||||
const UniversalId::Type type);
|
||||
|
||||
virtual int searchId (const std::string& id) const;
|
||||
////< Search record with \a id.
|
||||
|
@ -203,8 +202,7 @@ namespace CSMWorld
|
|||
template<typename ESXRecordT, typename IdAccessorT>
|
||||
void Collection<ESXRecordT, IdAccessorT>::cloneRecord(const std::string& origin,
|
||||
const std::string& destination,
|
||||
const UniversalId::Type type,
|
||||
const UniversalId::ArgumentType argumentType)
|
||||
const UniversalId::Type type)
|
||||
{
|
||||
Record<ESXRecordT> copy(getRecord(origin));
|
||||
copy.mState = RecordBase::State_ModifiedOnly;
|
||||
|
|
|
@ -76,8 +76,7 @@ namespace CSMWorld
|
|||
|
||||
virtual void cloneRecord(const std::string& origin,
|
||||
const std::string& destination,
|
||||
const UniversalId::Type type,
|
||||
const UniversalId::ArgumentType argumentType) = 0;
|
||||
const UniversalId::Type type) = 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& IdDestination,
|
||||
const CSMWorld::UniversalId::Type type,
|
||||
const CSMWorld::UniversalId::ArgumentType argumentType,
|
||||
QUndoCommand* parent) :
|
||||
QUndoCommand(parent),
|
||||
mModel(model),
|
||||
mIdOrigin(idOrigin),
|
||||
mIdDestination(Misc::StringUtils::lowerCase(IdDestination)),
|
||||
mArgumentType(argumentType),
|
||||
mType(type)
|
||||
{
|
||||
setText(("Clone record " + idOrigin + " to the " + IdDestination).c_str());
|
||||
|
@ -42,7 +40,7 @@ CSMWorld::CloneCommand::CloneCommand(CSMWorld::IdTable& model,
|
|||
|
||||
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)
|
||||
mModel.setData(mModel.getModelIndex(mIdDestination, iter->first), iter->second);
|
||||
|
|
|
@ -45,7 +45,6 @@ namespace CSMWorld
|
|||
std::string mIdOrigin;
|
||||
std::string mIdDestination;
|
||||
UniversalId::Type mType;
|
||||
UniversalId::ArgumentType mArgumentType;
|
||||
std::map<int, QVariant> mValues;
|
||||
|
||||
public:
|
||||
|
@ -53,7 +52,6 @@ namespace CSMWorld
|
|||
CloneCommand (IdTable& model, const std::string& idOrigin,
|
||||
const std::string& IdDestination,
|
||||
const UniversalId::Type type,
|
||||
const UniversalId::ArgumentType argumentType,
|
||||
QUndoCommand* parent = 0);
|
||||
|
||||
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,
|
||||
const std::string& destination,
|
||||
CSMWorld::UniversalId::ArgumentType argumentType,
|
||||
CSMWorld::UniversalId::Type type)
|
||||
{
|
||||
int index = mIdCollection->getAppendIndex (destination);
|
||||
beginInsertRows (QModelIndex(), index, index);
|
||||
mIdCollection->cloneRecord(origin, destination, type, argumentType);
|
||||
mIdCollection->cloneRecord(origin, destination, type);
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,6 @@ namespace CSMWorld
|
|||
|
||||
void cloneRecord(const std::string& origin,
|
||||
const std::string& destination,
|
||||
UniversalId::ArgumentType argumentType,
|
||||
UniversalId::Type type = UniversalId::Type_None);
|
||||
|
||||
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,
|
||||
const std::string& destination,
|
||||
const CSMWorld::UniversalId::Type type,
|
||||
const CSMWorld::UniversalId::ArgumentType argumentType)
|
||||
const CSMWorld::UniversalId::Type type)
|
||||
{
|
||||
RecordBase *newRecord = mData.getRecord(mData.searchId(origin)).clone();
|
||||
newRecord->mState = RecordBase::State_ModifiedOnly;
|
||||
mAdapters.find(type)->second->setId(*newRecord, destination);
|
||||
mData.insertRecord(*newRecord, type, destination);
|
||||
delete newRecord;
|
||||
//WIP
|
||||
}
|
||||
|
||||
void CSMWorld::RefIdCollection::appendRecord (const RecordBase& record,
|
||||
|
|
|
@ -71,8 +71,7 @@ namespace CSMWorld
|
|||
|
||||
virtual void cloneRecord(const std::string& origin,
|
||||
const std::string& destination,
|
||||
const UniversalId::Type type,
|
||||
const UniversalId::ArgumentType argumentType);
|
||||
const 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
|
||||
|
|
|
@ -82,10 +82,9 @@ void CSVWorld::CellCreator::valueChanged (int index)
|
|||
}
|
||||
|
||||
void CSVWorld::CellCreator::cloneMode(const std::string& originid,
|
||||
const CSMWorld::UniversalId::Type type,
|
||||
const CSMWorld::UniversalId::ArgumentType argumentType)
|
||||
const CSMWorld::UniversalId::Type type)
|
||||
{
|
||||
CSVWorld::GenericCreator::cloneMode(originid, type, argumentType);
|
||||
CSVWorld::GenericCreator::cloneMode(originid, type);
|
||||
if (*(originid.begin()) == '#') //if originid points to the exterior cell
|
||||
{
|
||||
setType(1); //enable x and y controls
|
||||
|
|
|
@ -32,8 +32,7 @@ namespace CSVWorld
|
|||
virtual void toggleWidgets(bool active = true);
|
||||
|
||||
virtual void cloneMode(const std::string& originid,
|
||||
const CSMWorld::UniversalId::Type type,
|
||||
const CSMWorld::UniversalId::ArgumentType argumentType);
|
||||
const CSMWorld::UniversalId::Type type);
|
||||
|
||||
private slots:
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@ namespace CSVWorld
|
|||
|
||||
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;
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ void CSVWorld::GenericCreator::create()
|
|||
{
|
||||
std::string id = getId();
|
||||
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());
|
||||
|
||||
|
@ -150,13 +150,11 @@ void CSVWorld::GenericCreator::create()
|
|||
}
|
||||
|
||||
void CSVWorld::GenericCreator::cloneMode(const std::string& originid,
|
||||
const CSMWorld::UniversalId::Type type,
|
||||
const CSMWorld::UniversalId::ArgumentType argumentType)
|
||||
const CSMWorld::UniversalId::Type type)
|
||||
{
|
||||
mCloneMode = true;
|
||||
mClonedId = originid;
|
||||
mClonedType = type;
|
||||
mArgumentType = argumentType;
|
||||
}
|
||||
|
||||
void CSVWorld::GenericCreator::toggleWidgets(bool active)
|
||||
|
|
|
@ -67,8 +67,7 @@ namespace CSVWorld
|
|||
virtual void toggleWidgets (bool active = true);
|
||||
|
||||
virtual void cloneMode(const std::string& originid,
|
||||
const CSMWorld::UniversalId::Type type,
|
||||
const CSMWorld::UniversalId::ArgumentType argumentType);
|
||||
const CSMWorld::UniversalId::Type type);
|
||||
|
||||
virtual std::string getErrors() const;
|
||||
///< 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);
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
|
|
@ -26,8 +26,7 @@ namespace CSVWorld
|
|||
const CSMWorld::UniversalId& id);
|
||||
|
||||
virtual void cloneMode(const std::string& originid,
|
||||
const CSMWorld::UniversalId::Type type,
|
||||
const CSMWorld::UniversalId::ArgumentType argumentType);
|
||||
const CSMWorld::UniversalId::Type type);
|
||||
|
||||
virtual void reset();
|
||||
virtual void toggleWidgets(bool active = true);
|
||||
|
|
|
@ -160,11 +160,10 @@ void CSVWorld::TableBottomBox::createRequest()
|
|||
}
|
||||
|
||||
void CSVWorld::TableBottomBox::cloneRequest(const std::string& id,
|
||||
const CSMWorld::UniversalId::Type type,
|
||||
const CSMWorld::UniversalId::ArgumentType argumnetType)
|
||||
const CSMWorld::UniversalId::Type type)
|
||||
{
|
||||
mCreator->reset();
|
||||
mCreator->cloneMode(id, type, argumnetType);
|
||||
mCreator->cloneMode(id, type);
|
||||
mLayout->setCurrentWidget(mCreator);
|
||||
mCreator->toggleWidgets(false);
|
||||
setVisible (true);
|
||||
|
|
|
@ -77,7 +77,8 @@ namespace CSVWorld
|
|||
/// \param modified Number of added and modified records
|
||||
|
||||
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 (cloneRequest(const CSMWorld::UniversalId&)), this, SLOT(cloneRequest(const CSMWorld::UniversalId&)));
|
||||
connect (this, SIGNAL(cloneRequest(const std::string&, const CSMWorld::UniversalId::Type, const CSMWorld::UniversalId::ArgumentType)),
|
||||
mBottom, SLOT(cloneRequest(const std::string&, const CSMWorld::UniversalId::Type, const CSMWorld::UniversalId::ArgumentType)));
|
||||
connect (mTable, SIGNAL (cloneRequest(const CSMWorld::UniversalId&)), this,
|
||||
SLOT(cloneRequest(const CSMWorld::UniversalId&)));
|
||||
|
||||
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&)),
|
||||
mTable, SLOT (requestFocus (const std::string&)));
|
||||
|
@ -84,5 +86,5 @@ void CSVWorld::TableSubView::setStatusBar (bool show)
|
|||
|
||||
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:
|
||||
void cloneRequest(const std::string&,
|
||||
const CSMWorld::UniversalId::Type,
|
||||
const CSMWorld::UniversalId::ArgumentType);
|
||||
const CSMWorld::UniversalId::Type);
|
||||
|
||||
private slots:
|
||||
|
||||
|
|
Loading…
Reference in a new issue