Browse Source

Merge pull request #5035 from IvanSavenko/launcher_fix

Fixes for mod management in Launcher
Ivan Savenko 1 year ago
parent
commit
55c594e591
1 changed files with 8 additions and 1 deletions
  1. 8 1
      launcher/modManager/cmodlistview_moc.cpp

+ 8 - 1
launcher/modManager/cmodlistview_moc.cpp

@@ -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,7 +934,8 @@ void CModListView::installMods(QStringList archives)
 		manager->installMod(modNames[i], archives[i]);
 	}
 
-	manager->enableMods(modsToEnable);
+	if (!modsToEnable.empty())
+		manager->enableMods(modsToEnable);
 
 	checkManagerErrors();