diff --git a/launcher/firstLaunch/firstlaunch_moc.cpp b/launcher/firstLaunch/firstlaunch_moc.cpp index b9df75f56..c42950be8 100644 --- a/launcher/firstLaunch/firstlaunch_moc.cpp +++ b/launcher/firstLaunch/firstlaunch_moc.cpp @@ -310,6 +310,10 @@ void FirstLaunchView::modPresetUpdate() ui->checkBoxPresetExtras->setEnabled(checkCanInstallExtras()); ui->checkBoxPresetHota->setEnabled(checkCanInstallHota()); ui->checkBoxPresetWog->setEnabled(checkCanInstallWog()); + + // we can't install anything - either repository checkout is off or all recommended mods are already installed + if (!checkCanInstallTranslation() && !checkCanInstallExtras() && !checkCanInstallHota() && !checkCanInstallWog()) + exitSetup(); } QString FirstLaunchView::findTranslationModName() @@ -364,7 +368,7 @@ CModListView * FirstLaunchView::getModView() bool FirstLaunchView::checkCanInstallMod(const QString & modID) { - return getModView() && !getModView()->isModInstalled(modID); + return getModView() && getModView()->isModAvailable(modID); } void FirstLaunchView::on_pushButtonPresetBack_clicked() @@ -376,16 +380,16 @@ void FirstLaunchView::on_pushButtonPresetNext_clicked() { QStringList modsToInstall; - if (ui->checkBoxPresetLanguage && checkCanInstallTranslation()) + if (ui->checkBoxPresetLanguage->isChecked() && checkCanInstallTranslation()) modsToInstall.push_back(findTranslationModName()); - if (ui->checkBoxPresetExtras && checkCanInstallExtras()) + if (ui->checkBoxPresetExtras->isChecked() && checkCanInstallExtras()) modsToInstall.push_back("vcmi-extras"); - if (ui->checkBoxPresetWog && checkCanInstallWog()) + if (ui->checkBoxPresetWog->isChecked() && checkCanInstallWog()) modsToInstall.push_back("wake-of-gods"); - if (ui->checkBoxPresetHota && checkCanInstallHota()) + if (ui->checkBoxPresetHota->isChecked() && checkCanInstallHota()) modsToInstall.push_back("hota"); exitSetup(); diff --git a/launcher/modManager/cmodlistview_moc.cpp b/launcher/modManager/cmodlistview_moc.cpp index 679a8a5e8..1d541d3ae 100644 --- a/launcher/modManager/cmodlistview_moc.cpp +++ b/launcher/modManager/cmodlistview_moc.cpp @@ -829,10 +829,10 @@ void CModListView::doInstallMod(const QString & modName) } } -bool CModListView::isModInstalled(const QString & modName) +bool CModListView::isModAvailable(const QString & modName) { auto mod = modModel->getMod(modName); - return mod.isInstalled(); + return mod.isAvailable(); } bool CModListView::isModEnabled(const QString & modName) diff --git a/launcher/modManager/cmodlistview_moc.h b/launcher/modManager/cmodlistview_moc.h index 7b7566339..985762ab8 100644 --- a/launcher/modManager/cmodlistview_moc.h +++ b/launcher/modManager/cmodlistview_moc.h @@ -86,8 +86,8 @@ public: /// install mod by name void doInstallMod(const QString & modName); - /// returns true if mod is currently installed - bool isModInstalled(const QString & modName); + /// returns true if mod is available in repository and can be installed + bool isModAvailable(const QString & modName); /// finds translation mod for specified languages. Returns empty string on error QString getTranslationModName(const QString & language); diff --git a/launcher/settingsView/csettingsview_moc.cpp b/launcher/settingsView/csettingsview_moc.cpp index 3f464f688..b304f3ea8 100644 --- a/launcher/settingsView/csettingsview_moc.cpp +++ b/launcher/settingsView/csettingsview_moc.cpp @@ -375,7 +375,7 @@ void CSettingsView::loadTranslation() if (!translationExists) return; - bool translationInstalled = mainWindow->getModView()->isModInstalled(modName); + bool translationAvailable = mainWindow->getModView()->isModAvailable(modName); bool translationEnabled = mainWindow->getModView()->isModEnabled(modName); ui->pushButtonTranslation->setVisible(!translationEnabled); @@ -385,13 +385,13 @@ void CSettingsView::loadTranslation() ui->labelTranslationStatus->setText(tr("Active")); } - if (translationInstalled && !translationEnabled) + if (!translationEnabled && !translationAvailable) { ui->labelTranslationStatus->setText(tr("Disabled")); ui->pushButtonTranslation->setText(tr("Enable")); } - if (!translationInstalled) + if (translationAvailable) { ui->labelTranslationStatus->setText(tr("Not Installed")); ui->pushButtonTranslation->setText(tr("Install")); @@ -413,15 +413,15 @@ void CSettingsView::on_pushButtonTranslation_clicked() if (modName.isEmpty()) return; - if (mainWindow->getModView()->isModInstalled(modName)) - { - mainWindow->getModView()->enableModByName(modName); - } - else + if (mainWindow->getModView()->isModAvailable(modName)) { mainWindow->switchToModsTab(); mainWindow->getModView()->doInstallMod(modName); } + else + { + mainWindow->getModView()->enableModByName(modName); + } } void CSettingsView::on_comboBoxLanguageBase_currentIndexChanged(int index)