void CGUIWindowSettingsCategory::CheckDependency(BaseSettingControlPtr pSettingControl, const CSettingDependency &dependency) { if (pSettingControl == NULL || pSettingControl->GetControl() == NULL) return; CSetting *pSetting = pSettingControl->GetSetting(); if (pSetting == NULL) return; switch (dependency.GetType()) { case SettingDependencyTypeEnable: pSettingControl->SetEnabled(dependency.Check()); break; case SettingDependencyTypeUpdate: { FillControl(pSetting, pSettingControl->GetControl()); break; } case SettingDependencyTypeNone: default: break; } }
void CSettingsManager::UpdateSettingByDependency(const std::string &settingId, const CSettingDependency &dependency) { CSetting *setting = GetSetting(settingId); if (setting == NULL) return; switch (dependency.GetType()) { case SettingDependencyTypeEnable: // just trigger the property changed callback and a call to // CSetting::IsEnabled() will automatically determine the new // enabled state OnSettingPropertyChanged(setting, "enabled"); break; case SettingDependencyTypeUpdate: { SettingType type = (SettingType)setting->GetType(); if (type == SettingTypeInteger) { CSettingInt *settingInt = ((CSettingInt*)setting); if (settingInt->GetOptionsType() == SettingOptionsTypeDynamic) settingInt->UpdateDynamicOptions(); } else if (type == SettingTypeString) { CSettingString *settingString = ((CSettingString*)setting); if (settingString->GetOptionsType() == SettingOptionsTypeDynamic) settingString->UpdateDynamicOptions(); } break; } case SettingDependencyTypeVisible: // just trigger the property changed callback and a call to // CSetting::IsVisible() will automatically determine the new // visible state OnSettingPropertyChanged(setting, "visible"); break; case SettingDependencyTypeNone: default: break; } }
void CSettingsManager::UpdateSettingByDependency(const std::string &settingId, const CSettingDependency &dependency) { UpdateSettingByDependency(settingId, dependency.GetType()); }