* Load badge column preferences. * @param ini IniFile to load to. * @param feature Feature to load. */
| 136 | * @param feature Feature to load. |
| 137 | */ |
| 138 | static void BadgeClassLoadConfigFeature(const IniFile &ini, GrfSpecFeature feature) |
| 139 | { |
| 140 | assert(BadgeClassConfig::CONFIGURABLE_FEATURES.Test(feature)); |
| 141 | assert(!BadgeClassConfig::sections[feature].empty()); |
| 142 | |
| 143 | auto &config = _badge_config.features[feature]; |
| 144 | config.clear(); |
| 145 | |
| 146 | const IniGroup *group = ini.GetGroup(BadgeClassConfig::sections[feature]); |
| 147 | if (group == nullptr) return; |
| 148 | |
| 149 | for (const IniItem &item : group->items) { |
| 150 | int column = 0; |
| 151 | bool show_icon = true; |
| 152 | bool show_filter = false; |
| 153 | |
| 154 | if (item.value.has_value() && !item.value.value().empty()) { |
| 155 | StringConsumer consumer(item.value.value()); |
| 156 | if (consumer.ReadCharIf('?')) show_filter = true; |
| 157 | if (consumer.ReadCharIf('!')) show_icon = false; |
| 158 | if (auto value = consumer.TryReadIntegerBase<int>(10); value.has_value()) column = *value; |
| 159 | } |
| 160 | |
| 161 | config.emplace_back(item.name, column, show_icon, show_filter); |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | /** |
| 166 | * Load badge column preferences. |
no test coverage detected