1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 02:37:35 +00:00

LibGUI+Userland: Port Labels to String

This commit is contained in:
thankyouverycool 2023-04-29 10:41:48 -04:00 committed by Andreas Kling
parent 3d53dc8228
commit 91bafc2653
92 changed files with 240 additions and 242 deletions

View file

@ -39,10 +39,10 @@ LoginWindow::LoginWindow(GUI::Window* parent)
m_fail_message = *widget->find_descendant_of_type_named<GUI::Label>("fail_message");
m_username->on_change = [&] {
m_fail_message->set_text("");
m_fail_message->set_text({});
};
m_password->on_change = [&] {
if (!m_password->text().is_empty())
m_fail_message->set_text("");
m_fail_message->set_text({});
};
}

View file

@ -26,7 +26,7 @@ public:
DeprecatedString password() const { return m_password->text(); }
void set_password(StringView password) { m_password->set_text(password); }
void set_fail_message(StringView message) { m_fail_message->set_text(message); }
void set_fail_message(StringView message) { m_fail_message->set_text(String::from_utf8(message).release_value_but_fixme_should_propagate_errors()); }
private:
LoginWindow(GUI::Window* parent = nullptr);

View file

@ -81,10 +81,10 @@ NotificationWindow::NotificationWindow(i32 client_id, DeprecatedString const& te
auto& left_container = widget->add<GUI::Widget>();
left_container.set_layout<GUI::VerticalBoxLayout>();
m_title_label = &left_container.add<GUI::Label>(title);
m_title_label = &left_container.add<GUI::Label>(String::from_deprecated_string(title).release_value_but_fixme_should_propagate_errors());
m_title_label->set_font(Gfx::FontDatabase::default_font().bold_variant());
m_title_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
m_text_label = &left_container.add<GUI::Label>(text);
m_text_label = &left_container.add<GUI::Label>(String::from_deprecated_string(text).release_value_but_fixme_should_propagate_errors());
m_text_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
// FIXME: There used to be code for setting the tooltip here, but since we
@ -131,14 +131,14 @@ void NotificationWindow::leave_event(Core::Event&)
void NotificationWindow::set_text(DeprecatedString const& value)
{
m_text_label->set_text(value);
m_text_label->set_text(String::from_deprecated_string(value).release_value_but_fixme_should_propagate_errors());
if (m_hovering)
resize_to_fit_text();
}
void NotificationWindow::set_title(DeprecatedString const& value)
{
m_title_label->set_text(value);
m_title_label->set_text(String::from_deprecated_string(value).release_value_but_fixme_should_propagate_errors());
}
void NotificationWindow::set_image(Gfx::ShareableBitmap const& image)

View file

@ -65,7 +65,7 @@ ShutdownDialog::ShutdownDialog()
auto& right_container = content_container.add<GUI::Widget>();
right_container.set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 12, 12, 8, 0 });
auto& label = right_container.add<GUI::Label>("What would you like to do?");
auto& label = right_container.add<GUI::Label>("What would you like to do?"_string.release_value_but_fixme_should_propagate_errors());
label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
label.set_fixed_height(22);
label.set_font(Gfx::FontDatabase::default_font().bold_variant());