mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-08 21:17:53 +00:00
CResourceTableModel: std::move parameters in DisplayEntryList()
We can allow for moving into this to avoid allocation churning.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
class CSkeletonHierarchyModel : public QAbstractItemModel
|
||||
{
|
||||
CSkeleton *mpSkeleton = nullptr;
|
||||
const CSkeleton *mpSkeleton = nullptr;
|
||||
|
||||
public:
|
||||
explicit CSkeletonHierarchyModel(QObject *pParent = nullptr);
|
||||
|
||||
@@ -178,8 +178,8 @@ void CResourceTableContextMenu::ShowReferencers()
|
||||
if (!mpModel->IsDisplayingUserEntryList())
|
||||
mpBrowser->SetInspectedEntry(mpClickedEntry);
|
||||
|
||||
const QString ListDesc = tr("Referencers of \"%1\"").arg( TO_QSTRING(mpClickedEntry->CookedAssetPath().GetFileName()) );
|
||||
mpModel->DisplayEntryList(EntryList, ListDesc);
|
||||
QString ListDesc = tr("Referencers of \"%1\"").arg(TO_QSTRING(mpClickedEntry->CookedAssetPath().GetFileName()));
|
||||
mpModel->DisplayEntryList(std::move(EntryList), std::move(ListDesc));
|
||||
mpBrowser->ClearFilters();
|
||||
}
|
||||
|
||||
@@ -192,19 +192,17 @@ void CResourceTableContextMenu::ShowDependencies()
|
||||
|
||||
QList<CResourceEntry*> EntryList;
|
||||
|
||||
for (auto Iter = Dependencies.begin(); Iter != Dependencies.end(); Iter++)
|
||||
for (const auto& Dep : Dependencies)
|
||||
{
|
||||
CResourceEntry *pEntry = mpClickedEntry->ResourceStore()->FindEntry(*Iter);
|
||||
|
||||
if (pEntry)
|
||||
if (auto* pEntry = mpClickedEntry->ResourceStore()->FindEntry(Dep))
|
||||
EntryList.push_back(pEntry);
|
||||
}
|
||||
|
||||
if (!mpModel->IsDisplayingUserEntryList())
|
||||
mpBrowser->SetInspectedEntry(mpClickedEntry);
|
||||
|
||||
const QString ListDesc = tr("Dependencies of \"%1\"").arg( TO_QSTRING(mpClickedEntry->CookedAssetPath().GetFileName()) );
|
||||
mpModel->DisplayEntryList(EntryList, ListDesc);
|
||||
QString ListDesc = tr("Dependencies of \"%1\"").arg(TO_QSTRING(mpClickedEntry->CookedAssetPath().GetFileName()));
|
||||
mpModel->DisplayEntryList(std::move(EntryList), std::move(ListDesc));
|
||||
mpBrowser->ClearFilters();
|
||||
}
|
||||
|
||||
@@ -222,7 +220,7 @@ void CResourceTableContextMenu::Delete()
|
||||
Resources.push_back(mpModel->IndexEntry(kIndex));
|
||||
}
|
||||
|
||||
mpBrowser->Delete(Resources, Directories);
|
||||
mpBrowser->Delete(std::move(Resources), std::move(Directories));
|
||||
}
|
||||
|
||||
void CResourceTableContextMenu::CopyName()
|
||||
|
||||
@@ -249,12 +249,12 @@ void CResourceTableModel::FillEntryList(CVirtualDirectory *pDir, bool AssetListM
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void CResourceTableModel::DisplayEntryList(QList<CResourceEntry*>& rkEntries, const QString& rkListDescription)
|
||||
void CResourceTableModel::DisplayEntryList(QList<CResourceEntry*> rkEntries, QString rkListDescription)
|
||||
{
|
||||
beginResetModel();
|
||||
mEntries = rkEntries;
|
||||
mEntries = std::move(rkEntries);
|
||||
mDirectories.clear();
|
||||
mModelDescription = rkListDescription;
|
||||
mModelDescription = std::move(rkListDescription);
|
||||
mIsAssetListMode = true;
|
||||
mIsDisplayingUserEntryList = true;
|
||||
endResetModel();
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
bool IsIndexDirectory(const QModelIndex& rkIndex) const;
|
||||
bool HasParentDirectoryEntry() const;
|
||||
void FillEntryList(CVirtualDirectory *pDir, bool AssetListMode);
|
||||
void DisplayEntryList(QList<CResourceEntry*>& rkEntries, const QString& rkListDescription);
|
||||
void DisplayEntryList(QList<CResourceEntry*> rkEntries, QString rkListDescription);
|
||||
protected:
|
||||
void RecursiveAddDirectoryContents(CVirtualDirectory *pDir);
|
||||
int EntryListIndex(CResourceEntry *pEntry);
|
||||
|
||||
Reference in New Issue
Block a user