Removed extra loop

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2023-05-28 17:54:46 +03:00
parent 27c3775f99
commit bdff8591aa
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
2 changed files with 4 additions and 6 deletions

View File

@ -314,11 +314,9 @@ void ResourcePage::addResourceToDialog(ModPlatform::IndexedPack::Ptr pack, ModPl
m_parent_dialog->addResource(pack, version);
}
void ResourcePage::removeResourceFromDialog(ModPlatform::IndexedPack::Ptr pack)
void ResourcePage::removeResourceFromDialog(const QString& pack_name)
{
m_parent_dialog->removeResource(pack->name);
for (auto& ver : pack->versions)
ver.is_currently_selected = false;
m_parent_dialog->removeResource(pack_name);
}
void ResourcePage::addResourceToPage(ModPlatform::IndexedPack::Ptr pack,
@ -344,7 +342,7 @@ void ResourcePage::onResourceSelected()
auto& version = current_pack->versions[m_selected_version_index];
if (version.is_currently_selected)
removeResourceFromDialog(current_pack);
removeResourceFromDialog(current_pack->name);
else
addResourceToDialog(current_pack, version);

View File

@ -76,7 +76,7 @@ class ResourcePage : public QWidget, public BasePage {
virtual void updateVersionList();
void addResourceToDialog(ModPlatform::IndexedPack::Ptr, ModPlatform::IndexedVersion&);
void removeResourceFromDialog(ModPlatform::IndexedPack::Ptr pack);
void removeResourceFromDialog(const QString& pack_name);
virtual void removeResourceFromPage(const QString& name);
virtual void addResourceToPage(ModPlatform::IndexedPack::Ptr, ModPlatform::IndexedVersion&, const std::shared_ptr<ResourceFolderModel>);