Bladeren bron

Fix issues with first launch tab in offline

- Do not attempt to install mod if it is not available in (known) repo
- Go immediately to start game tab if there are no mods to install
instead of showing empty tab
Ivan Savenko 9 maanden geleden
bovenliggende
commit
9ee327c723

+ 5 - 4
launcher/firstLaunch/firstlaunch_moc.cpp

@@ -189,10 +189,10 @@ void FirstLaunchView::activateTabModPreset()
 	modPresetUpdate();
 	modPresetUpdate();
 }
 }
 
 
-void FirstLaunchView::exitSetup()
+void FirstLaunchView::exitSetup(bool goToMods)
 {
 {
 	if(auto * mainWindow = dynamic_cast<MainWindow *>(QApplication::activeWindow()))
 	if(auto * mainWindow = dynamic_cast<MainWindow *>(QApplication::activeWindow()))
-		mainWindow->exitSetup();
+		mainWindow->exitSetup(goToMods);
 }
 }
 
 
 // Tab Language
 // Tab Language
@@ -548,7 +548,7 @@ void FirstLaunchView::modPresetUpdate()
 
 
 	// we can't install anything - either repository checkout is off or all recommended mods are already installed
 	// we can't install anything - either repository checkout is off or all recommended mods are already installed
 	if (!checkCanInstallTranslation() && !checkCanInstallExtras() && !checkCanInstallHota() && !checkCanInstallWog())
 	if (!checkCanInstallTranslation() && !checkCanInstallExtras() && !checkCanInstallHota() && !checkCanInstallWog())
-		exitSetup();
+		exitSetup(false);
 }
 }
 
 
 QString FirstLaunchView::findTranslationModName()
 QString FirstLaunchView::findTranslationModName()
@@ -625,7 +625,8 @@ void FirstLaunchView::on_pushButtonPresetNext_clicked()
 	if (ui->buttonPresetHota->isChecked() && checkCanInstallHota())
 	if (ui->buttonPresetHota->isChecked() && checkCanInstallHota())
 		modsToInstall.push_back("hota");
 		modsToInstall.push_back("hota");
 
 
-	exitSetup();
+	bool goToMods = !modsToInstall.empty();
+	exitSetup(goToMods);
 
 
 	for (auto const & modName : modsToInstall)
 	for (auto const & modName : modsToInstall)
 		getModView()->doInstallMod(modName);
 		getModView()->doInstallMod(modName);

+ 1 - 1
launcher/firstLaunch/firstlaunch_moc.h

@@ -29,7 +29,7 @@ class FirstLaunchView : public QWidget
 	void activateTabLanguage();
 	void activateTabLanguage();
 	void activateTabHeroesData();
 	void activateTabHeroesData();
 	void activateTabModPreset();
 	void activateTabModPreset();
-	void exitSetup();
+	void exitSetup(bool goToMods);
 	
 	
 	// Tab Language
 	// Tab Language
 	void languageSelected(const QString & languageCode);
 	void languageSelected(const QString & languageCode);

+ 5 - 2
launcher/mainwindow_moc.cpp

@@ -157,7 +157,7 @@ void MainWindow::enterSetup()
 	ui->tabListWidget->setCurrentIndex(TabRows::SETUP);
 	ui->tabListWidget->setCurrentIndex(TabRows::SETUP);
 }
 }
 
 
-void MainWindow::exitSetup()
+void MainWindow::exitSetup(bool goToMods)
 {
 {
 	Settings writer = settings.write["launcher"]["setupCompleted"];
 	Settings writer = settings.write["launcher"]["setupCompleted"];
 	writer->Bool() = true;
 	writer->Bool() = true;
@@ -166,7 +166,10 @@ void MainWindow::exitSetup()
 	ui->settingsButton->setEnabled(true);
 	ui->settingsButton->setEnabled(true);
 	ui->aboutButton->setEnabled(true);
 	ui->aboutButton->setEnabled(true);
 	ui->modslistButton->setEnabled(true);
 	ui->modslistButton->setEnabled(true);
-	ui->tabListWidget->setCurrentIndex(TabRows::MODS);
+	if (goToMods)
+		ui->tabListWidget->setCurrentIndex(TabRows::MODS);
+	else
+		ui->tabListWidget->setCurrentIndex(TabRows::START);
 }
 }
 
 
 void MainWindow::switchToStartTab()
 void MainWindow::switchToStartTab()

+ 1 - 1
launcher/mainwindow_moc.h

@@ -62,7 +62,7 @@ public:
 	
 	
 	void detectPreferredLanguage();
 	void detectPreferredLanguage();
 	void enterSetup();
 	void enterSetup();
-	void exitSetup();
+	void exitSetup(bool goToMods);
 	void switchToModsTab();
 	void switchToModsTab();
 	void switchToStartTab();
 	void switchToStartTab();
 
 

+ 1 - 1
launcher/modManager/cmodlistview_moc.cpp

@@ -1013,7 +1013,7 @@ void CModListView::doInstallMod(const QString & modName)
 
 
 bool CModListView::isModAvailable(const QString & modName)
 bool CModListView::isModAvailable(const QString & modName)
 {
 {
-	return !modStateModel->isModInstalled(modName);
+	return modStateModel->isModExists(modName) && !modStateModel->isModInstalled(modName);
 }
 }
 
 
 bool CModListView::isModEnabled(const QString & modName)
 bool CModListView::isModEnabled(const QString & modName)