disable enable button on outdated mods

This commit is contained in:
HJfod 2024-11-16 16:22:03 +02:00
parent 06eb32310c
commit 302eea1f47
2 changed files with 11 additions and 3 deletions

View file

@ -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<CCRGBAProtocol*>(m_enableToggle->m_offButton->getNormalImage());
auto on = typeinfo_cast<CCRGBAProtocol*>(m_enableToggle->m_onButton->getNormalImage());

View file

@ -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()));