mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:48:10 +00:00
AK: Make string-to-number conversion helpers return Optional
Get rid of the weird old signature: - int StringType::to_int(bool& ok) const And replace it with sensible new signature: - Optional<int> StringType::to_int() const
This commit is contained in:
parent
15f4043a7a
commit
fdfda6dec2
55 changed files with 354 additions and 455 deletions
|
@ -303,19 +303,9 @@ void DisplaySettingsWidget::load_current_settings()
|
|||
/// Resolution ////////////////////////////////////////////////////////////////////////////////
|
||||
Gfx::IntSize find_size;
|
||||
|
||||
bool okay = false;
|
||||
// Let's attempt to find the current resolution and select it!
|
||||
find_size.set_width(ws_config->read_entry("Screen", "Width", "1024").to_int(okay));
|
||||
if (!okay) {
|
||||
fprintf(stderr, "DisplaySettings: failed to convert width to int!");
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
find_size.set_height(ws_config->read_entry("Screen", "Height", "768").to_int(okay));
|
||||
if (!okay) {
|
||||
fprintf(stderr, "DisplaySettings: failed to convert height to int!");
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
find_size.set_width(ws_config->read_num_entry("Screen", "Width", 1024));
|
||||
find_size.set_height(ws_config->read_num_entry("Screen", "Height", 768));
|
||||
|
||||
size_t index = m_resolutions.find_first_index(find_size).value_or(0);
|
||||
Gfx::IntSize m_current_resolution = m_resolutions.at(index);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue