From cd89ef190901c77cc0db78b39887c4140696f967 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Tue, 12 Sep 2023 18:15:17 +0300 Subject: [PATCH] fix the toggling thing with dependencies --- loader/src/ui/internal/list/ModListCell.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/loader/src/ui/internal/list/ModListCell.cpp b/loader/src/ui/internal/list/ModListCell.cpp index b4f1923b8..766ba83ee 100644 --- a/loader/src/ui/internal/list/ModListCell.cpp +++ b/loader/src/ui/internal/list/ModListCell.cpp @@ -251,13 +251,14 @@ void ModCell::onRestart(CCObject*) { void ModCell::updateState() { bool unresolved = m_mod->hasUnresolvedDependencies(); bool shouldLoad = m_mod->shouldLoad(); + auto toggleable = !unresolved || !shouldLoad; if (m_enableToggle) { m_enableToggle->toggle(m_mod->isEnabled()); - m_enableToggle->setEnabled(!unresolved || shouldLoad); - m_enableToggle->m_offButton->setOpacity(unresolved ? 100 : 255); - m_enableToggle->m_offButton->setColor(unresolved ? cc3x(155) : cc3x(255)); - m_enableToggle->m_onButton->setOpacity(unresolved ? 100 : 255); - m_enableToggle->m_onButton->setColor(unresolved ? cc3x(155) : cc3x(255)); + m_enableToggle->setEnabled(toggleable); + m_enableToggle->m_offButton->setOpacity(toggleable ? 100 : 255); + m_enableToggle->m_offButton->setColor(toggleable ? cc3x(155) : cc3x(255)); + m_enableToggle->m_onButton->setOpacity(toggleable ? 100 : 255); + m_enableToggle->m_onButton->setColor(toggleable ? cc3x(155) : cc3x(255)); } bool hasProblems = false; for (auto const& item : Loader::get()->getProblems()) {