forked from teamnwah/openmw-tes3coop
changed ID listing to include deleted records by default
This commit is contained in:
parent
9c751ae370
commit
ba5e2a0330
8 changed files with 36 additions and 35 deletions
|
@ -107,10 +107,10 @@ namespace CSMWorld
|
|||
virtual int getAppendIndex (UniversalId::Type type = UniversalId::Type_None) const;
|
||||
///< \param type Will be ignored, unless the collection supports multiple record types
|
||||
|
||||
virtual std::vector<std::string> getIds() const;
|
||||
virtual std::vector<std::string> getIds (bool listDeleted = true) const;
|
||||
///< Return a sorted collection of all IDs
|
||||
///
|
||||
/// \note Deleted records are not listed.
|
||||
/// \param listDeleted include deleted record in the list
|
||||
|
||||
void addColumn (Column<ESXRecordT> *column);
|
||||
|
||||
|
@ -299,14 +299,14 @@ namespace CSMWorld
|
|||
}
|
||||
|
||||
template<typename ESXRecordT, typename IdAccessorT>
|
||||
std::vector<std::string> Collection<ESXRecordT, IdAccessorT>::getIds() const
|
||||
std::vector<std::string> Collection<ESXRecordT, IdAccessorT>::getIds (bool listDeleted) const
|
||||
{
|
||||
std::vector<std::string> ids;
|
||||
|
||||
for (typename std::map<std::string, int>::const_iterator iter = mIndex.begin();
|
||||
iter!=mIndex.end(); ++iter)
|
||||
{
|
||||
if (!mRecords[iter->second].isDeleted())
|
||||
if (listDeleted || !mRecords[iter->second].isDeleted())
|
||||
ids.push_back (IdAccessorT().getId (mRecords[iter->second].get()));
|
||||
}
|
||||
|
||||
|
|
|
@ -79,10 +79,10 @@ namespace CSMWorld
|
|||
virtual int getAppendIndex (UniversalId::Type type = UniversalId::Type_None) const = 0;
|
||||
///< \param type Will be ignored, unless the collection supports multiple record types
|
||||
|
||||
virtual std::vector<std::string> getIds() const = 0;
|
||||
virtual std::vector<std::string> getIds (bool listDeleted = true) const = 0;
|
||||
///< Return a sorted collection of all IDs
|
||||
///
|
||||
/// \note Deleted records are not listed.
|
||||
/// \param listDeleted include deleted record in the list
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -35,9 +35,10 @@ void CSMWorld::Data::addModel (QAbstractItemModel *model, UniversalId::Type type
|
|||
}
|
||||
}
|
||||
|
||||
void CSMWorld::Data::appendIds (std::vector<std::string>& ids, const CollectionBase& collection)
|
||||
void CSMWorld::Data::appendIds (std::vector<std::string>& ids, const CollectionBase& collection,
|
||||
bool listDeleted)
|
||||
{
|
||||
std::vector<std::string> ids2 = collection.getIds();
|
||||
std::vector<std::string> ids2 = collection.getIds (listDeleted);
|
||||
|
||||
ids.insert (ids.end(), ids2.begin(), ids2.end());
|
||||
}
|
||||
|
@ -459,22 +460,22 @@ bool CSMWorld::Data::hasId (const std::string& id) const
|
|||
getReferenceables().searchId (id)!=-1;
|
||||
}
|
||||
|
||||
std::vector<std::string> CSMWorld::Data::getIds() const
|
||||
std::vector<std::string> CSMWorld::Data::getIds (bool listDeleted) const
|
||||
{
|
||||
std::vector<std::string> ids;
|
||||
|
||||
appendIds (ids, mGlobals);
|
||||
appendIds (ids, mGmsts);
|
||||
appendIds (ids, mClasses);
|
||||
appendIds (ids, mFactions);
|
||||
appendIds (ids, mRaces);
|
||||
appendIds (ids, mSounds);
|
||||
appendIds (ids, mScripts);
|
||||
appendIds (ids, mRegions);
|
||||
appendIds (ids, mBirthsigns);
|
||||
appendIds (ids, mSpells);
|
||||
appendIds (ids, mCells);
|
||||
appendIds (ids, mReferenceables);
|
||||
appendIds (ids, mGlobals, listDeleted);
|
||||
appendIds (ids, mGmsts, listDeleted);
|
||||
appendIds (ids, mClasses, listDeleted);
|
||||
appendIds (ids, mFactions, listDeleted);
|
||||
appendIds (ids, mRaces, listDeleted);
|
||||
appendIds (ids, mSounds, listDeleted);
|
||||
appendIds (ids, mScripts, listDeleted);
|
||||
appendIds (ids, mRegions, listDeleted);
|
||||
appendIds (ids, mBirthsigns, listDeleted);
|
||||
appendIds (ids, mSpells, listDeleted);
|
||||
appendIds (ids, mCells, listDeleted);
|
||||
appendIds (ids, mReferenceables, listDeleted);
|
||||
|
||||
std::sort (ids.begin(), ids.end());
|
||||
|
||||
|
@ -483,9 +484,8 @@ std::vector<std::string> CSMWorld::Data::getIds() const
|
|||
|
||||
void CSMWorld::Data::dataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight)
|
||||
{
|
||||
// Note: The performance of of ID list change updates could be improved only emit the signal, if
|
||||
// the state of the record is changed.
|
||||
emit idListChanged();
|
||||
if (topLeft.column()<=0)
|
||||
emit idListChanged();
|
||||
}
|
||||
|
||||
void CSMWorld::Data::rowsChanged (const QModelIndex& parent, int start, int end)
|
||||
|
|
|
@ -62,7 +62,8 @@ namespace CSMWorld
|
|||
void addModel (QAbstractItemModel *model, UniversalId::Type type1,
|
||||
UniversalId::Type type2 = UniversalId::Type_None, bool update = true);
|
||||
|
||||
static void appendIds (std::vector<std::string>& ids, const CollectionBase& collection);
|
||||
static void appendIds (std::vector<std::string>& ids, const CollectionBase& collection,
|
||||
bool listDeleted);
|
||||
///< Append all IDs from collection to \a ids.
|
||||
|
||||
public:
|
||||
|
@ -145,10 +146,10 @@ namespace CSMWorld
|
|||
|
||||
bool hasId (const std::string& id) const;
|
||||
|
||||
std::vector<std::string> getIds() const;
|
||||
std::vector<std::string> getIds (bool listDeleted = true) const;
|
||||
///< Return a sorted collection of all IDs that are not internal to the editor.
|
||||
///
|
||||
/// \note Deleted records are not listed.
|
||||
/// \param listDeleted include deleted record in the list
|
||||
|
||||
signals:
|
||||
|
||||
|
|
|
@ -535,7 +535,7 @@ int CSMWorld::RefIdCollection::getAppendIndex (UniversalId::Type type) const
|
|||
return mData.getAppendIndex (type);
|
||||
}
|
||||
|
||||
std::vector<std::string> CSMWorld::RefIdCollection::getIds() const
|
||||
std::vector<std::string> CSMWorld::RefIdCollection::getIds (bool listDeleted) const
|
||||
{
|
||||
return mData.getIds();
|
||||
return mData.getIds (listDeleted);
|
||||
}
|
||||
|
|
|
@ -90,10 +90,10 @@ namespace CSMWorld
|
|||
virtual int getAppendIndex (UniversalId::Type type) const;
|
||||
///< \param type Will be ignored, unless the collection supports multiple record types
|
||||
|
||||
virtual std::vector<std::string> getIds() const;
|
||||
virtual std::vector<std::string> getIds (bool listDeleted) const;
|
||||
///< Return a sorted collection of all IDs
|
||||
///
|
||||
/// \note Deleted records are not listed.
|
||||
/// \param listDeleted include deleted record in the list
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -197,14 +197,14 @@ int CSMWorld::RefIdData::getSize() const
|
|||
return mIndex.size();
|
||||
}
|
||||
|
||||
std::vector<std::string> CSMWorld::RefIdData::getIds() const
|
||||
std::vector<std::string> CSMWorld::RefIdData::getIds (bool listDeleted) const
|
||||
{
|
||||
std::vector<std::string> ids;
|
||||
|
||||
for (std::map<std::string, LocalIndex>::const_iterator iter (mIndex.begin()); iter!=mIndex.end();
|
||||
++iter)
|
||||
{
|
||||
if (!getRecord (iter->second).isDeleted())
|
||||
if (listDeleted || !getRecord (iter->second).isDeleted())
|
||||
{
|
||||
std::map<UniversalId::Type, RefIdDataContainerBase *>::const_iterator container =
|
||||
mRecordContainers.find (iter->second.second);
|
||||
|
|
|
@ -183,10 +183,10 @@ namespace CSMWorld
|
|||
|
||||
int getSize() const;
|
||||
|
||||
std::vector<std::string> getIds() const;
|
||||
std::vector<std::string> getIds (bool listDeleted = true) const;
|
||||
///< Return a sorted collection of all IDs
|
||||
///
|
||||
/// \note Deleted records are not listed.
|
||||
/// \param listDeleted include deleted record in the list
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue