CResourceBrowser: Make use of ranged for

This commit is contained in:
Lioncash 2020-07-03 11:00:34 -04:00
parent c24b9ddb8f
commit 48b292ecee
1 changed files with 7 additions and 10 deletions

View File

@ -248,13 +248,12 @@ void CResourceBrowser::CreateFilterCheckboxes()
std::list<CResTypeInfo*> TypeList; std::list<CResTypeInfo*> TypeList;
CResTypeInfo::GetAllTypesInGame(mpStore->Game(), TypeList); CResTypeInfo::GetAllTypesInGame(mpStore->Game(), TypeList);
for (auto Iter = TypeList.begin(); Iter != TypeList.end(); Iter++) for (auto* type : TypeList)
{ {
CResTypeInfo *pType = *Iter;
QCheckBox *pCheck = new QCheckBox(this); QCheckBox *pCheck = new QCheckBox(this);
pCheck->setFont(mFilterBoxFont); pCheck->setFont(mFilterBoxFont);
pCheck->setText(TO_QSTRING(pType->TypeName())); pCheck->setText(TO_QSTRING(type->TypeName()));
mTypeList << SResourceType { pType, pCheck }; mTypeList << SResourceType{type, pCheck};
} }
std::sort(mTypeList.begin(), mTypeList.end(), [](const SResourceType& rkLeft, const SResourceType& rkRight) { std::sort(mTypeList.begin(), mTypeList.end(), [](const SResourceType& rkLeft, const SResourceType& rkRight) {
@ -305,15 +304,13 @@ void CResourceBrowser::AddCreateAssetMenuActions(QMenu* pMenu)
std::list<CResTypeInfo*> TypeInfos; std::list<CResTypeInfo*> TypeInfos;
CResTypeInfo::GetAllTypesInGame(mpStore->Game(), TypeInfos); CResTypeInfo::GetAllTypesInGame(mpStore->Game(), TypeInfos);
for (auto Iter = TypeInfos.begin(); Iter != TypeInfos.end(); Iter++) for (const auto* typeInfo : TypeInfos)
{ {
CResTypeInfo* pTypeInfo = *Iter; if (typeInfo->CanBeCreated())
if (pTypeInfo->CanBeCreated())
{ {
QString TypeName = TO_QSTRING( pTypeInfo->TypeName() ); QString TypeName = TO_QSTRING(typeInfo->TypeName());
QAction* pAction = pMenu->addAction(TypeName, this, &CResourceBrowser::OnCreateAssetAction); QAction* pAction = pMenu->addAction(TypeName, this, &CResourceBrowser::OnCreateAssetAction);
pAction->setProperty("TypeInfo", QVariant((int) pTypeInfo->Type())); pAction->setProperty("TypeInfo", QVariant(static_cast<int>(typeInfo->Type())));
} }
} }
} }