1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00

Merge pull request #5035 from IvanSavenko/launcher_fix

Fixes for mod management in Launcher
This commit is contained in:
Ivan Savenko 2024-12-05 16:30:53 +02:00 committed by GitHub
commit 55c594e591
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -144,6 +144,7 @@ CModListView::CModListView(QWidget * parent)
ui->splitter->setStyleSheet("QSplitter::handle {background: palette('window');}");
disableModInfo();
setupModModel();
setupFilterModel();
setupModsView();
@ -151,6 +152,7 @@ CModListView::CModListView(QWidget * parent)
ui->progressWidget->setVisible(false);
dlManager = nullptr;
modModel->reloadRepositories();
if(settings["launcher"]["autoCheckRepositories"].Bool())
loadRepositories();
@ -597,6 +599,10 @@ QStringList CModListView::getModsToInstall(QString mod)
void CModListView::on_updateButton_clicked()
{
QString modName = ui->allModsView->currentIndex().data(ModRoles::ModNameRole).toString();
auto targetMod = modStateModel->getMod(modName);
if(targetMod.isUpdateAvailable())
downloadFile(modName + ".zip", targetMod.getDownloadUrl(), modName, targetMod.getDownloadSizeBytes());
for(const auto & name : getModsToInstall(modName))
{
@ -928,6 +934,7 @@ void CModListView::installMods(QStringList archives)
manager->installMod(modNames[i], archives[i]);
}
if (!modsToEnable.empty())
manager->enableMods(modsToEnable);
checkManagerErrors();