From 302eea1f4792bfe0b8ebd31b82f0a05c31ae123d Mon Sep 17 00:00:00 2001 From: HJfod <60038575+HJfod@users.noreply.github.com> Date: Sat, 16 Nov 2024 16:22:03 +0200 Subject: [PATCH] disable enable button on outdated mods --- loader/src/ui/mods/list/ModItem.cpp | 8 ++++++-- loader/src/ui/mods/popups/ModPopup.cpp | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/loader/src/ui/mods/list/ModItem.cpp b/loader/src/ui/mods/list/ModItem.cpp index c88edaf9..baa770c9 100644 --- a/loader/src/ui/mods/list/ModItem.cpp +++ b/loader/src/ui/mods/list/ModItem.cpp @@ -466,8 +466,12 @@ void ModItem::updateState() { if (m_enableToggle && m_source.asMod()) { m_enableToggle->toggle(m_source.asMod()->isOrWillBeEnabled()); - // Disable the toggle if the mod has been uninstalled - if (modRequestedActionIsUninstall(m_source.asMod()->getRequestedAction())) { + // Disable the toggle if the mod has been uninstalled or if the mod is + // outdated + if ( + modRequestedActionIsUninstall(m_source.asMod()->getRequestedAction()) || + m_source.asMod()->targetsOutdatedVersion() + ) { m_enableToggle->setEnabled(false); auto off = typeinfo_cast(m_enableToggle->m_offButton->getNormalImage()); auto on = typeinfo_cast(m_enableToggle->m_onButton->getNormalImage()); diff --git a/loader/src/ui/mods/popups/ModPopup.cpp b/loader/src/ui/mods/popups/ModPopup.cpp index 1cab734e..5656c225 100644 --- a/loader/src/ui/mods/popups/ModPopup.cpp +++ b/loader/src/ui/mods/popups/ModPopup.cpp @@ -672,7 +672,11 @@ void ModPopup::updateState() { m_cancelBtn->setVisible(false); m_enableBtn->toggle(asMod && asMod->isOrWillBeEnabled()); - m_enableBtn->setVisible(asMod && asMod->getRequestedAction() == ModRequestedAction::None); + m_enableBtn->setVisible( + asMod && + asMod->getRequestedAction() == ModRequestedAction::None && + !asMod->targetsOutdatedVersion() + ); m_reenableBtn->toggle(m_enableBtn->isToggled()); m_reenableBtn->setVisible(asMod && modRequestedActionIsToggle(asMod->getRequestedAction()));