| 1160 | } |
| 1161 | |
| 1162 | void OnQueryTextFinished(std::optional<std::string> str) override |
| 1163 | { |
| 1164 | if (!str.has_value()) return; |
| 1165 | |
| 1166 | SaveGRFPresetToConfig(*str, this->actives); |
| 1167 | this->grf_presets = GetGRFPresetList(); |
| 1168 | |
| 1169 | /* Switch to this preset */ |
| 1170 | for (uint i = 0; i < this->grf_presets.size(); i++) { |
| 1171 | if (this->grf_presets[i] == str) { |
| 1172 | this->preset = i; |
| 1173 | break; |
| 1174 | } |
| 1175 | } |
| 1176 | |
| 1177 | this->InvalidateData(); |
| 1178 | } |
| 1179 | |
| 1180 | /** |
| 1181 | * Updates the scroll bars for the active and inactive NewGRF lists. |
no test coverage detected