bool CSetting::IsEnabled() const { if (m_dependencies.empty() && m_parentSetting.empty()) return m_enabled; // if the setting has a parent setting and that parent setting is disabled // the setting should automatically also be disabled if (!m_parentSetting.empty()) { CSetting *parentSetting = m_settingsManager->GetSetting(m_parentSetting); if (parentSetting != NULL && !parentSetting->IsEnabled()) return false; } bool enabled = true; for (SettingDependencies::const_iterator depIt = m_dependencies.begin(); depIt != m_dependencies.end(); ++depIt) { if (depIt->GetType() != SettingDependencyTypeEnable) continue; if (!depIt->Check()) { enabled = false; break; } } return enabled; }
bool CSetting::IsEnabled() const { bool enabled = true; for (SettingDependencies::const_iterator depIt = m_dependencies.begin(); depIt != m_dependencies.end(); ++depIt) { if (depIt->GetType() != SettingDependencyTypeEnable) continue; if (!depIt->Check()) { enabled = false; break; } } return enabled; }
bool CSetting::IsVisible() const { if (!ISetting::IsVisible()) return false; bool visible = true; for (SettingDependencies::const_iterator depIt = m_dependencies.begin(); depIt != m_dependencies.end(); ++depIt) { if (depIt->GetType() != SettingDependencyTypeVisible) continue; if (!depIt->Check()) { visible = false; break; } } return visible; }