Higlight installed mods

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97
2023-06-08 20:26:09 +03:00
parent 7fb4c8358b
commit f96b135ef7
21 changed files with 67 additions and 51 deletions

View File

@ -6,8 +6,10 @@
#include "minecraft/MinecraftInstance.h"
#include "minecraft/PackProfile.h"
#include "minecraft/mod/ModFolderModel.h"
#include <QMessageBox>
#include <algorithm>
namespace ResourceDownload {
@ -67,4 +69,14 @@ void ModModel::searchWithTerm(const QString& term, unsigned int sort, bool filte
refresh();
}
bool ModModel::isPackInstalled(ModPlatform::IndexedPack::Ptr pack) const
{
auto allMods = static_cast<MinecraftInstance const&>(m_base_instance).loaderModList()->allMods();
return std::any_of(allMods.cbegin(), allMods.cend(), [pack](Mod* mod) {
if (auto meta = mod->metadata(); meta)
return meta->provider == pack->provider && meta->project_id == pack->addonId;
return false;
});
}
} // namespace ResourceDownload