1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Implement mod update function

This commit is contained in:
Ivan Savenko
2024-12-04 22:53:07 +00:00
parent 3a8b0ead35
commit 9b1ca39818
4 changed files with 44 additions and 5 deletions

View File

@@ -106,13 +106,14 @@ void StartGameTab::refreshTranslation(ETranslationStatus status)
void StartGameTab::refreshMods()
{
constexpr int chroniclesCount = 8;
QStringList updateableMods; // TODO
QStringList updateableMods = getMainWindow()->getModView()->getUpdateableMods();
QStringList chroniclesMods = getMainWindow()->getModView()->getInstalledChronicles();
ui->buttonUpdateMods->setText(tr("Update %n mods", "", updateableMods.size()));
ui->buttonUpdateMods->setVisible(!updateableMods.empty());
ui->buttonUpdateModsHelp->setVisible(!updateableMods.empty());
ui->labelChronicles->setText(tr("Heroes Chronicles:\n%1/%2 installed").arg(chroniclesMods.size()).arg(chroniclesCount));
ui->labelChronicles->setText(tr("Heroes Chronicles:\n%n/%1 installed", "", chroniclesMods.size()).arg(chroniclesCount));
ui->labelChronicles->setVisible(chroniclesMods.size() != chroniclesCount);
ui->buttonChroniclesHelp->setVisible(chroniclesMods.size() != chroniclesCount);
}
@@ -183,7 +184,17 @@ void StartGameTab::on_buttonImportFiles_clicked()
void StartGameTab::on_buttonInstallTranslation_clicked()
{
// TODO
if (getMainWindow()->getTranslationStatus() == ETranslationStatus::NOT_INSTALLLED)
{
getMainWindow()->getModView()->getTranslationModName();
mainWindow->getModView()->doInstallMod(modName);
}
}
else
{
mainWindow->getModView()->enableModByName(modName);
}
}
}
void StartGameTab::on_buttonActivateTranslation_clicked()
@@ -193,7 +204,10 @@ void StartGameTab::on_buttonActivateTranslation_clicked()
void StartGameTab::on_buttonUpdateMods_clicked()
{
// TODO
QStringList updateableMods = getMainWindow()->getModView()->getUpdateableMods();
for (const auto & modName : updateableMods)
getMainWindow()->getModView()->doInstallMod(modName);
}
void StartGameTab::on_buttonHelpImportFiles_clicked()