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

Merge pull request #5153 from IvanSavenko/first_launch_fix

Fix issues with first launch tab in offline
This commit is contained in:
Ivan Savenko 2024-12-25 22:00:49 +02:00 committed by GitHub
commit b2cf37735d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 13 additions and 9 deletions

View File

@ -189,10 +189,10 @@ void FirstLaunchView::activateTabModPreset()
modPresetUpdate();
}
void FirstLaunchView::exitSetup()
void FirstLaunchView::exitSetup(bool goToMods)
{
if(auto * mainWindow = dynamic_cast<MainWindow *>(QApplication::activeWindow()))
mainWindow->exitSetup();
mainWindow->exitSetup(goToMods);
}
// 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
if (!checkCanInstallTranslation() && !checkCanInstallExtras() && !checkCanInstallHota() && !checkCanInstallWog())
exitSetup();
exitSetup(false);
}
QString FirstLaunchView::findTranslationModName()
@ -625,7 +625,8 @@ void FirstLaunchView::on_pushButtonPresetNext_clicked()
if (ui->buttonPresetHota->isChecked() && checkCanInstallHota())
modsToInstall.push_back("hota");
exitSetup();
bool goToMods = !modsToInstall.empty();
exitSetup(goToMods);
for (auto const & modName : modsToInstall)
getModView()->doInstallMod(modName);

View File

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

View File

@ -157,7 +157,7 @@ void MainWindow::enterSetup()
ui->tabListWidget->setCurrentIndex(TabRows::SETUP);
}
void MainWindow::exitSetup()
void MainWindow::exitSetup(bool goToMods)
{
Settings writer = settings.write["launcher"]["setupCompleted"];
writer->Bool() = true;
@ -166,7 +166,10 @@ void MainWindow::exitSetup()
ui->settingsButton->setEnabled(true);
ui->aboutButton->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()

View File

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

View File

@ -1013,7 +1013,7 @@ void CModListView::doInstallMod(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)