1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 08:54:58 +00:00

Userland: Set Button text using the new String class

This commit is contained in:
Karol Kosek 2023-02-11 20:51:04 +01:00 committed by Linus Groh
parent b5cb9a9ebb
commit e39adc4772
49 changed files with 134 additions and 127 deletions

View file

@ -86,7 +86,7 @@ DownloadWidget::DownloadWidget(const URL& url)
destination_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
destination_label.set_fixed_height(16);
m_close_on_finish_checkbox = add<GUI::CheckBox>("Close when finished");
m_close_on_finish_checkbox = add<GUI::CheckBox>(String::from_utf8("Close when finished"sv).release_value_but_fixme_should_propagate_errors());
m_close_on_finish_checkbox->set_checked(close_on_finish);
m_close_on_finish_checkbox->on_checked = [&](bool checked) {
@ -96,7 +96,7 @@ DownloadWidget::DownloadWidget(const URL& url)
auto& button_container = add<GUI::Widget>();
auto& button_container_layout = button_container.set_layout<GUI::HorizontalBoxLayout>();
button_container_layout.add_spacer();
m_cancel_button = button_container.add<GUI::Button>("Cancel");
m_cancel_button = button_container.add<GUI::Button>(String::from_utf8_short_string("Cancel"sv));
m_cancel_button->set_fixed_size(100, 22);
m_cancel_button->on_click = [this](auto) {
bool success = m_download->stop();
@ -104,7 +104,7 @@ DownloadWidget::DownloadWidget(const URL& url)
window()->close();
};
m_close_button = button_container.add<GUI::Button>("OK");
m_close_button = button_container.add<GUI::Button>(String::from_utf8_short_string("OK"sv));
m_close_button->set_enabled(false);
m_close_button->set_fixed_size(100, 22);
m_close_button->on_click = [this](auto) {
@ -153,7 +153,7 @@ void DownloadWidget::did_finish(bool success)
m_browser_image->load_from_file("/res/graphics/download-finished.gif"sv);
window()->set_title("Download finished!");
m_close_button->set_enabled(true);
m_cancel_button->set_text_deprecated("Open in Folder");
m_cancel_button->set_text(String::from_utf8("Open in Folder"sv).release_value_but_fixme_should_propagate_errors());
m_cancel_button->on_click = [this](auto) {
Desktop::Launcher::open(URL::create_with_file_scheme(Core::StandardPaths::downloads_directory(), m_url.basename()));
window()->close();