Updated dependencies

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2023-10-21 19:05:31 +03:00
parent 9aac8e389f
commit 35d62cc5f2
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
2 changed files with 13 additions and 4 deletions

View File

@ -45,6 +45,14 @@ static ModPlatform::ModLoaderTypes mcLoaders(BaseInstance* inst)
return static_cast<MinecraftInstance*>(inst)->getPackProfile()->getSupportedModLoaders().value();
}
static bool checkDependencies(std::shared_ptr<GetModDependenciesTask::PackDependency> sel,
Version mcVersion,
ModPlatform::ModLoaderTypes loaders)
{
return (sel->pack->versions.isEmpty() || sel->version.mcVersion.contains(mcVersion.toString())) &&
(!loaders || !sel->version.loaders || sel->version.loaders & loaders);
}
GetModDependenciesTask::GetModDependenciesTask(QObject* parent,
BaseInstance* instance,
ModFolderModel* folder,
@ -67,9 +75,10 @@ GetModDependenciesTask::GetModDependenciesTask(QObject* parent,
void GetModDependenciesTask::prepare()
{
for (auto sel : m_selected) {
for (auto dep : getDependenciesForVersion(sel->version, sel->pack->provider)) {
addTask(prepareDependencyTask(dep, sel->pack->provider, 20));
}
if (checkDependencies(sel, m_version, m_loaderType))
for (auto dep : getDependenciesForVersion(sel->version, sel->pack->provider)) {
addTask(prepareDependencyTask(dep, sel->pack->provider, 20));
}
}
}

View File

@ -53,7 +53,7 @@ ModFilterWidget::ModFilterWidget(MinecraftInstance* instance, bool extendedSuppo
ui->versionsCb->setStyleSheet("combobox-popup: 0;");
ui->versionsSimpleCb->setStyleSheet("combobox-popup: 0;");
connect(ui->snapshotsCb, &QCheckBox::stateChanged, this, &ModFilterWidget::onIncludeSnapshotsChanged);
connect(ui->versionsCb, &QComboBox::currentIndexChanged, this, &ModFilterWidget::onVersionFilterChanged);
connect(ui->versionsCb, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ModFilterWidget::onVersionFilterChanged);
connect(ui->versionsSimpleCb, &QComboBox::currentTextChanged, this, &ModFilterWidget::onVersionFilterTextChanged);
connect(ui->neoForgeCb, &QCheckBox::stateChanged, this, &ModFilterWidget::onLoadersFilterChanged);