| 1370 | } |
| 1371 | |
| 1372 | void OnQueryTextFinished(std::optional<std::string> str) override |
| 1373 | { |
| 1374 | /* The user pressed cancel */ |
| 1375 | if (!str.has_value()) return; |
| 1376 | |
| 1377 | assert(this->valuewindow_entry != nullptr); |
| 1378 | const IntSettingDesc *sd = this->valuewindow_entry->setting; |
| 1379 | |
| 1380 | int32_t value; |
| 1381 | if (!str->empty()) { |
| 1382 | auto llvalue = ParseInteger<int64_t>(*str, 10, true); |
| 1383 | if (!llvalue.has_value()) return; |
| 1384 | |
| 1385 | /* Save the correct currency-translated value */ |
| 1386 | if (sd->flags.Test(SettingFlag::GuiCurrency)) llvalue = *llvalue / GetCurrency().rate; |
| 1387 | |
| 1388 | value = ClampTo<int32_t>(*llvalue); |
| 1389 | } else { |
| 1390 | value = sd->GetDefaultValue(); |
| 1391 | } |
| 1392 | |
| 1393 | SetSettingValue(this->valuewindow_entry->setting, value); |
| 1394 | this->SetDirty(); |
| 1395 | } |
| 1396 | |
| 1397 | void OnMouseLoop() override |
| 1398 | { |
nothing calls this directly
no test coverage detected