1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-21 00:19:29 +02:00

Fix installation of multiple mods at once

This commit is contained in:
Ivan Savenko
2024-11-19 22:15:05 +00:00
parent 00f97fb8cd
commit fef19f4846
7 changed files with 52 additions and 38 deletions

View File

@ -99,14 +99,22 @@ bool ModStateController::uninstallMod(QString modname)
return canUninstallMod(modname) && doUninstallMod(modname);
}
bool ModStateController::enableMod(QString modname)
bool ModStateController::enableMods(QStringList modlist)
{
return canEnableMod(modname) && doEnableMod(modname, true);
for (const auto & modname : modlist)
if (!canEnableMod(modname))
return false;
modList->doEnableMods(modlist);
return true;
}
bool ModStateController::disableMod(QString modname)
{
return canDisableMod(modname) && doEnableMod(modname, false);
if (!canDisableMod(modname))
return false;
modList->doDisableMod(modname);
return true;
}
bool ModStateController::canInstallMod(QString modname)
@ -170,16 +178,6 @@ bool ModStateController::canDisableMod(QString modname)
return true;
}
bool ModStateController::doEnableMod(QString mod, bool on)
{
if (on)
modList->doEnableMod(mod);
else
modList->doDisableMod(mod);
return true;
}
bool ModStateController::doInstallMod(QString modname, QString archivePath)
{
const auto destDir = CLauncherDirs::modsPath() + QChar{'/'};