mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:57:44 +00:00
LibGUI+Userland: Convert MessageBox to fallible construction
Adds fallible versions of MessageBox's helper factories, ports DeprecatedString, and rewrites build() to be both fallible and more responsive to font changes. MessageBox now auto shrinks and no longer has to re-build its layout when text changes. It is manually resized once at creation to position properly as a Dialog before being shown.
This commit is contained in:
parent
aa94b944de
commit
c9404c3a63
4 changed files with 92 additions and 83 deletions
|
@ -265,8 +265,9 @@ void MonitorSettingsWidget::apply_settings()
|
|||
return;
|
||||
auto current_box_text = current_box_text_or_error.release_value();
|
||||
|
||||
auto box = GUI::MessageBox::construct(window(), current_box_text, "Apply new screen layout"sv,
|
||||
GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
|
||||
auto box = GUI::MessageBox::create(window(), current_box_text, "Apply new screen layout"sv,
|
||||
GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo)
|
||||
.release_value_but_fixme_should_propagate_errors();
|
||||
box->set_icon(window()->icon());
|
||||
|
||||
// If after 10 seconds the user doesn't close the message box, just close it.
|
||||
|
@ -279,7 +280,7 @@ void MonitorSettingsWidget::apply_settings()
|
|||
return;
|
||||
}
|
||||
auto current_box_text = current_box_text_or_error.release_value();
|
||||
box->set_text(current_box_text.to_deprecated_string());
|
||||
box->set_text(current_box_text);
|
||||
if (seconds_until_revert <= 0) {
|
||||
box->close();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue