diff options
author | thankyouverycool <66646555+thankyouverycool@users.noreply.github.com> | 2023-04-29 10:41:48 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-04-30 05:48:14 +0200 |
commit | 91bafc2653bcbcc0b8d05b5589324375b92f91b5 (patch) | |
tree | 3ebc611c104c9c1c47c4b85b594e36f91c66c026 /Userland/Applications | |
parent | 3d53dc82283e7eccf7a27918dbbcd391dc4988f7 (diff) | |
download | serenity-91bafc2653bcbcc0b8d05b5589324375b92f91b5.zip |
LibGUI+Userland: Port Labels to String
Diffstat (limited to 'Userland/Applications')
63 files changed, 172 insertions, 174 deletions
diff --git a/Userland/Applications/3DFileViewer/main.cpp b/Userland/Applications/3DFileViewer/main.cpp index 0859873dbc..6f618a8c1f 100644 --- a/Userland/Applications/3DFileViewer/main.cpp +++ b/Userland/Applications/3DFileViewer/main.cpp @@ -266,7 +266,7 @@ void GLContextWidget::timer_event(Core::TimerEvent&) if ((m_cycles % 30) == 0) { auto render_time = static_cast<double>(m_accumulated_time.to_milliseconds()) / 30.0; auto frame_rate = render_time > 0 ? 1000 / render_time : 0; - m_stats->set_text(DeprecatedString::formatted("{:.0f} fps, {:.1f} ms", frame_rate, render_time)); + m_stats->set_text(String::formatted("{:.0f} fps, {:.1f} ms", frame_rate, render_time).release_value_but_fixme_should_propagate_errors()); m_accumulated_time = {}; glEnable(GL_LIGHT0); diff --git a/Userland/Applications/Browser/DownloadWidget.cpp b/Userland/Applications/Browser/DownloadWidget.cpp index ac6cfa313f..2c06e5aa32 100644 --- a/Userland/Applications/Browser/DownloadWidget.cpp +++ b/Userland/Applications/Browser/DownloadWidget.cpp @@ -69,7 +69,7 @@ DownloadWidget::DownloadWidget(const URL& url) m_browser_image->load_from_file("/res/graphics/download-animation.gif"sv); animation_container.add_spacer().release_value_but_fixme_should_propagate_errors(); - auto& source_label = add<GUI::Label>(DeprecatedString::formatted("From: {}", url)); + auto& source_label = add<GUI::Label>(String::formatted("From: {}", url).release_value_but_fixme_should_propagate_errors()); source_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); source_label.set_fixed_height(16); @@ -80,7 +80,7 @@ DownloadWidget::DownloadWidget(const URL& url) m_progress_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); m_progress_label->set_fixed_height(16); - auto& destination_label = add<GUI::Label>(DeprecatedString::formatted("To: {}", m_destination_path)); + auto& destination_label = add<GUI::Label>(String::formatted("To: {}", m_destination_path).release_value_but_fixme_should_propagate_errors()); destination_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); destination_label.set_fixed_height(16); @@ -127,7 +127,7 @@ void DownloadWidget::did_progress(Optional<u32> total_size, u32 downloaded_size) builder.append("Downloaded "sv); builder.append(human_readable_size(downloaded_size)); builder.appendff(" in {} sec", m_elapsed_timer.elapsed_time().to_seconds()); - m_progress_label->set_text(builder.to_deprecated_string()); + m_progress_label->set_text(builder.to_string().release_value_but_fixme_should_propagate_errors()); } { diff --git a/Userland/Applications/Calculator/CalculatorWidget.cpp b/Userland/Applications/Calculator/CalculatorWidget.cpp index 971457bc11..2c7d959007 100644 --- a/Userland/Applications/Calculator/CalculatorWidget.cpp +++ b/Userland/Applications/Calculator/CalculatorWidget.cpp @@ -152,9 +152,9 @@ void CalculatorWidget::update_display() { m_entry->set_text(m_keypad.to_deprecated_string()); if (m_calculator.has_error()) - m_label->set_text("E"); + m_label->set_text("E"_short_string); else - m_label->set_text(""); + m_label->set_text({}); } void CalculatorWidget::keydown_event(GUI::KeyEvent& event) diff --git a/Userland/Applications/Calendar/AddEventDialog.cpp b/Userland/Applications/Calendar/AddEventDialog.cpp index 3be8ec5aa7..72466ef258 100644 --- a/Userland/Applications/Calendar/AddEventDialog.cpp +++ b/Userland/Applications/Calendar/AddEventDialog.cpp @@ -36,7 +36,7 @@ AddEventDialog::AddEventDialog(Core::DateTime date_time, Window* parent_window) top_container.set_layout<GUI::VerticalBoxLayout>(4); top_container.set_fixed_height(45); - auto& add_label = top_container.add<GUI::Label>("Add title & date:"); + auto& add_label = top_container.add<GUI::Label>("Add title & date:"_string.release_value_but_fixme_should_propagate_errors()); add_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); add_label.set_fixed_height(14); add_label.set_font(Gfx::FontDatabase::default_font().bold_variant()); diff --git a/Userland/Applications/CharacterMap/CharacterMapWidget.cpp b/Userland/Applications/CharacterMap/CharacterMapWidget.cpp index e642de77bc..c559c78450 100644 --- a/Userland/Applications/CharacterMap/CharacterMapWidget.cpp +++ b/Userland/Applications/CharacterMap/CharacterMapWidget.cpp @@ -169,7 +169,7 @@ void CharacterMapWidget::did_change_font() { // No need to track glyph modifications by cloning m_glyph_map->GUI::AbstractScrollableWidget::set_font(font()); - m_font_name_label->set_text(font().human_readable_name()); + m_font_name_label->set_text(String::from_deprecated_string(font().human_readable_name()).release_value_but_fixme_should_propagate_errors()); m_output_box->set_font(font()); } diff --git a/Userland/Applications/ClockSettings/ClockSettingsWidget.cpp b/Userland/Applications/ClockSettings/ClockSettingsWidget.cpp index 665db476bb..9199faf669 100644 --- a/Userland/Applications/ClockSettings/ClockSettingsWidget.cpp +++ b/Userland/Applications/ClockSettings/ClockSettingsWidget.cpp @@ -119,5 +119,5 @@ void ClockSettingsWidget::update_time_format_string() void ClockSettingsWidget::update_clock_preview() { - m_clock_preview->set_text(Core::DateTime::now().to_deprecated_string(m_time_format)); + m_clock_preview->set_text(Core::DateTime::now().to_string(m_time_format).release_value_but_fixme_should_propagate_errors()); } diff --git a/Userland/Applications/CrashReporter/main.cpp b/Userland/Applications/CrashReporter/main.cpp index 01a62acbfa..42bdfa8d65 100644 --- a/Userland/Applications/CrashReporter/main.cpp +++ b/Userland/Applications/CrashReporter/main.cpp @@ -214,24 +214,24 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) app_name = af->name(); auto& description_label = *widget->find_descendant_of_type_named<GUI::Label>("description"); - description_label.set_text(DeprecatedString::formatted("\"{}\" (PID {}) has crashed - {} (signal {})", app_name, pid, strsignal(termination_signal), termination_signal)); + description_label.set_text(TRY(String::formatted("\"{}\" (PID {}) has crashed - {} (signal {})", app_name, pid, strsignal(termination_signal), termination_signal))); auto& executable_link_label = *widget->find_descendant_of_type_named<GUI::LinkLabel>("executable_link"); - executable_link_label.set_text(LexicalPath::canonicalized_path(executable_path)); + executable_link_label.set_text(TRY(String::from_deprecated_string(LexicalPath::canonicalized_path(executable_path)))); executable_link_label.on_click = [&] { LexicalPath path { executable_path }; Desktop::Launcher::open(URL::create_with_file_scheme(path.dirname(), path.basename())); }; auto& coredump_link_label = *widget->find_descendant_of_type_named<GUI::LinkLabel>("coredump_link"); - coredump_link_label.set_text(LexicalPath::canonicalized_path(coredump_path)); + coredump_link_label.set_text(TRY(String::from_deprecated_string(LexicalPath::canonicalized_path(coredump_path)))); coredump_link_label.on_click = [&] { LexicalPath path { coredump_path }; Desktop::Launcher::open(URL::create_with_file_scheme(path.dirname(), path.basename())); }; auto& arguments_label = *widget->find_descendant_of_type_named<GUI::Label>("arguments_label"); - arguments_label.set_text(DeprecatedString::join(' ', crashed_process_arguments)); + arguments_label.set_text(TRY(String::join(' ', crashed_process_arguments))); auto& progressbar = *widget->find_descendant_of_type_named<GUI::Progressbar>("progressbar"); auto& tab_widget = *widget->find_descendant_of_type_named<GUI::TabWidget>("tab_widget"); @@ -239,7 +239,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto backtrace_tab = TRY(tab_widget.try_add_tab<GUI::Widget>(TRY("Backtrace"_string))); TRY(backtrace_tab->try_set_layout<GUI::VerticalBoxLayout>(4)); - auto backtrace_label = TRY(backtrace_tab->try_add<GUI::Label>("A backtrace for each thread alive during the crash is listed below:")); + auto backtrace_label = TRY(backtrace_tab->try_add<GUI::Label>(TRY("A backtrace for each thread alive during the crash is listed below:"_string))); backtrace_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); backtrace_label->set_fixed_height(16); @@ -249,7 +249,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) auto cpu_registers_tab = TRY(tab_widget.try_add_tab<GUI::Widget>(TRY("CPU Registers"_string))); cpu_registers_tab->set_layout<GUI::VerticalBoxLayout>(4); - auto cpu_registers_label = TRY(cpu_registers_tab->try_add<GUI::Label>("The CPU register state for each thread alive during the crash is listed below:")); + auto cpu_registers_label = TRY(cpu_registers_tab->try_add<GUI::Label>(TRY("The CPU register state for each thread alive during the crash is listed below:"_string))); cpu_registers_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); cpu_registers_label->set_fixed_height(16); diff --git a/Userland/Applications/DisplaySettings/DesktopSettingsWidget.cpp b/Userland/Applications/DisplaySettings/DesktopSettingsWidget.cpp index e832a5d35f..6a5b4b065c 100644 --- a/Userland/Applications/DisplaySettings/DesktopSettingsWidget.cpp +++ b/Userland/Applications/DisplaySettings/DesktopSettingsWidget.cpp @@ -37,7 +37,7 @@ ErrorOr<void> DesktopSettingsWidget::create_frame() }; auto& keyboard_shortcuts_label = *find_descendant_of_type_named<GUI::Label>("keyboard_shortcuts_label"); - keyboard_shortcuts_label.set_text("\xE2\x84\xB9\tCtrl+Alt+{Shift}+Arrows moves between workspaces"); + keyboard_shortcuts_label.set_text(TRY("\xE2\x84\xB9\tCtrl+Alt+{Shift}+Arrows moves between workspaces"_string)); return {}; } diff --git a/Userland/Applications/DisplaySettings/FontSettingsWidget.cpp b/Userland/Applications/DisplaySettings/FontSettingsWidget.cpp index d3e02499ae..a76487d733 100644 --- a/Userland/Applications/DisplaySettings/FontSettingsWidget.cpp +++ b/Userland/Applications/DisplaySettings/FontSettingsWidget.cpp @@ -72,7 +72,7 @@ ErrorOr<void> FontSettingsWidget::setup_interface() static void update_label_with_font(GUI::Label& label, Gfx::Font const& font) { - label.set_text(font.human_readable_name()); + label.set_text(String::from_deprecated_string(font.human_readable_name()).release_value_but_fixme_should_propagate_errors()); label.set_font(font); } diff --git a/Userland/Applications/DisplaySettings/MonitorSettingsWidget.cpp b/Userland/Applications/DisplaySettings/MonitorSettingsWidget.cpp index 0dc5607a00..466d4c83b9 100644 --- a/Userland/Applications/DisplaySettings/MonitorSettingsWidget.cpp +++ b/Userland/Applications/DisplaySettings/MonitorSettingsWidget.cpp @@ -217,7 +217,7 @@ ErrorOr<void> MonitorSettingsWidget::selected_screen_index_or_resolution_changed auto dpi_label_value = String::formatted("{} dpi", screen_dpi.value()); if (screen_dpi.has_value() && !dpi_label_value.is_error()) { m_dpi_label->set_tooltip(screen_dpi_tooltip.to_deprecated_string()); - m_dpi_label->set_text(dpi_label_value.release_value().to_deprecated_string()); + m_dpi_label->set_text(dpi_label_value.release_value()); m_dpi_label->set_visible(true); } else { m_dpi_label->set_visible(false); diff --git a/Userland/Applications/Escalator/EscalatorWindow.cpp b/Userland/Applications/Escalator/EscalatorWindow.cpp index abed1f7c4a..f8cbd0d97f 100644 --- a/Userland/Applications/Escalator/EscalatorWindow.cpp +++ b/Userland/Applications/Escalator/EscalatorWindow.cpp @@ -36,13 +36,13 @@ EscalatorWindow::EscalatorWindow(StringView executable, Vector<StringView> argum RefPtr<GUI::Label> app_label = *main_widget->find_descendant_of_type_named<GUI::Label>("description"); - DeprecatedString prompt; + String prompt; if (options.description.is_empty()) - prompt = DeprecatedString::formatted("{} requires root access. Please enter password for user \"{}\".", m_arguments[0], m_current_user.username()); + prompt = String::formatted("{} requires root access. Please enter password for user \"{}\".", m_arguments[0], m_current_user.username()).release_value_but_fixme_should_propagate_errors(); else - prompt = options.description; + prompt = String::from_utf8(options.description).release_value_but_fixme_should_propagate_errors(); - app_label->set_text(prompt); + app_label->set_text(move(prompt)); m_icon_image_widget = *main_widget->find_descendant_of_type_named<GUI::ImageWidget>("icon"); m_icon_image_widget->set_bitmap(app_icon.bitmap_for_size(32)); diff --git a/Userland/Applications/FileManager/DirectoryView.cpp b/Userland/Applications/FileManager/DirectoryView.cpp index 3c846073d7..d55a8dbe21 100644 --- a/Userland/Applications/FileManager/DirectoryView.cpp +++ b/Userland/Applications/FileManager/DirectoryView.cpp @@ -153,7 +153,7 @@ void DirectoryView::setup_model() { m_model->on_directory_change_error = [this](int, char const* error_string) { auto failed_path = m_model->root_path(); - auto error_message = DeprecatedString::formatted("Could not read {}:\n{}", failed_path, error_string); + auto error_message = String::formatted("Could not read {}:\n{}", failed_path, error_string).release_value_but_fixme_should_propagate_errors(); m_error_label->set_text(error_message); set_active_widget(m_error_label); diff --git a/Userland/Applications/FileManager/FileOperationProgressWidget.cpp b/Userland/Applications/FileManager/FileOperationProgressWidget.cpp index 97c1fb2ee6..3dc21046f8 100644 --- a/Userland/Applications/FileManager/FileOperationProgressWidget.cpp +++ b/Userland/Applications/FileManager/FileOperationProgressWidget.cpp @@ -54,16 +54,16 @@ FileOperationProgressWidget::FileOperationProgressWidget(FileOperation operation switch (m_operation) { case FileOperation::Copy: - files_copied_label.set_text("Copying files..."); - current_file_action_label.set_text("Copying: "); + files_copied_label.set_text("Copying files..."_string.release_value_but_fixme_should_propagate_errors()); + current_file_action_label.set_text("Copying: "_string.release_value_but_fixme_should_propagate_errors()); break; case FileOperation::Move: - files_copied_label.set_text("Moving files..."); - current_file_action_label.set_text("Moving: "); + files_copied_label.set_text("Moving files..."_string.release_value_but_fixme_should_propagate_errors()); + current_file_action_label.set_text("Moving: "_string.release_value_but_fixme_should_propagate_errors()); break; case FileOperation::Delete: - files_copied_label.set_text("Deleting files..."); - current_file_action_label.set_text("Deleting: "); + files_copied_label.set_text("Deleting files..."_string.release_value_but_fixme_should_propagate_errors()); + current_file_action_label.set_text("Deleting: "_string.release_value_but_fixme_should_propagate_errors()); break; default: VERIFY_NOT_REACHED(); @@ -179,23 +179,23 @@ void FileOperationProgressWidget::did_progress(off_t bytes_done, off_t total_byt auto& overall_progressbar = *find_descendant_of_type_named<GUI::Progressbar>("overall_progressbar"); auto& estimated_time_label = *find_descendant_of_type_named<GUI::Label>("estimated_time_label"); - current_file_label.set_text(current_filename); + current_file_label.set_text(String::from_utf8(current_filename).release_value_but_fixme_should_propagate_errors()); switch (m_operation) { case FileOperation::Copy: - files_copied_label.set_text(DeprecatedString::formatted("Copying file {} of {}", files_done, total_file_count)); + files_copied_label.set_text(String::formatted("Copying file {} of {}", files_done, total_file_count).release_value_but_fixme_should_propagate_errors()); break; case FileOperation::Move: - files_copied_label.set_text(DeprecatedString::formatted("Moving file {} of {}", files_done, total_file_count)); + files_copied_label.set_text(String::formatted("Moving file {} of {}", files_done, total_file_count).release_value_but_fixme_should_propagate_errors()); break; case FileOperation::Delete: - files_copied_label.set_text(DeprecatedString::formatted("Deleting file {} of {}", files_done, total_file_count)); + files_copied_label.set_text(String::formatted("Deleting file {} of {}", files_done, total_file_count).release_value_but_fixme_should_propagate_errors()); break; default: VERIFY_NOT_REACHED(); } - estimated_time_label.set_text(estimate_time(bytes_done, total_byte_count)); + estimated_time_label.set_text(String::from_deprecated_string(estimate_time(bytes_done, total_byte_count)).release_value_but_fixme_should_propagate_errors()); if (total_byte_count) { window()->set_progress(100.0f * bytes_done / total_byte_count); diff --git a/Userland/Applications/FileManager/PropertiesWindow.cpp b/Userland/Applications/FileManager/PropertiesWindow.cpp index c08a6b5d62..7ee23df3f7 100644 --- a/Userland/Applications/FileManager/PropertiesWindow.cpp +++ b/Userland/Applications/FileManager/PropertiesWindow.cpp @@ -72,7 +72,7 @@ ErrorOr<void> PropertiesWindow::create_widgets(bool disable_rename) }; auto* location = general_tab->find_descendant_of_type_named<GUI::LinkLabel>("location"); - location->set_text(m_path); + location->set_text(TRY(String::from_deprecated_string(m_path))); location->on_click = [this] { Desktop::Launcher::open(URL::create_with_file_scheme(m_parent_path, m_name)); }; @@ -98,18 +98,18 @@ ErrorOr<void> PropertiesWindow::create_widgets(bool disable_rename) m_old_mode = st.st_mode; auto* type = general_tab->find_descendant_of_type_named<GUI::Label>("type"); - type->set_text(get_description(m_mode)); + type->set_text(TRY(String::from_deprecated_string(get_description(m_mode)))); if (S_ISLNK(m_mode)) { auto link_destination_or_error = FileSystem::read_link(m_path); if (link_destination_or_error.is_error()) { perror("readlink"); } else { - auto link_destination = link_destination_or_error.release_value().to_deprecated_string(); + auto link_destination = link_destination_or_error.release_value(); auto* link_location = general_tab->find_descendant_of_type_named<GUI::LinkLabel>("link_location"); link_location->set_text(link_destination); link_location->on_click = [link_destination] { - auto link_directory = LexicalPath(link_destination); + auto link_directory = LexicalPath(link_destination.to_deprecated_string()); Desktop::Launcher::open(URL::create_with_file_scheme(link_directory.dirname(), link_directory.basename())); }; } @@ -119,19 +119,21 @@ ErrorOr<void> PropertiesWindow::create_widgets(bool disable_rename) } m_size_label = general_tab->find_descendant_of_type_named<GUI::Label>("size"); - m_size_label->set_text(S_ISDIR(st.st_mode) ? "Calculating..." : human_readable_size_long(st.st_size, UseThousandsSeparator::Yes)); + m_size_label->set_text(S_ISDIR(st.st_mode) + ? TRY("Calculating..."_string) + : TRY(String::from_deprecated_string(human_readable_size_long(st.st_size, UseThousandsSeparator::Yes)))); auto* owner = general_tab->find_descendant_of_type_named<GUI::Label>("owner"); - owner->set_text(DeprecatedString::formatted("{} ({})", owner_name, st.st_uid)); + owner->set_text(String::formatted("{} ({})", owner_name, st.st_uid).release_value_but_fixme_should_propagate_errors()); auto* group = general_tab->find_descendant_of_type_named<GUI::Label>("group"); - group->set_text(DeprecatedString::formatted("{} ({})", group_name, st.st_gid)); + group->set_text(String::formatted("{} ({})", group_name, st.st_gid).release_value_but_fixme_should_propagate_errors()); auto* created_at = general_tab->find_descendant_of_type_named<GUI::Label>("created_at"); - created_at->set_text(GUI::FileSystemModel::timestamp_string(st.st_ctime)); + created_at->set_text(String::from_deprecated_string(GUI::FileSystemModel::timestamp_string(st.st_ctime)).release_value_but_fixme_should_propagate_errors()); auto* last_modified = general_tab->find_descendant_of_type_named<GUI::Label>("last_modified"); - last_modified->set_text(GUI::FileSystemModel::timestamp_string(st.st_mtime)); + last_modified->set_text(String::from_deprecated_string(GUI::FileSystemModel::timestamp_string(st.st_mtime)).release_value_but_fixme_should_propagate_errors()); auto* owner_read = general_tab->find_descendant_of_type_named<GUI::CheckBox>("owner_read"); auto* owner_write = general_tab->find_descendant_of_type_named<GUI::CheckBox>("owner_write"); @@ -173,7 +175,7 @@ ErrorOr<void> PropertiesWindow::create_widgets(bool disable_rename) m_directory_statistics_calculator->on_update = [this, origin_event_loop = &Core::EventLoop::current()](off_t total_size_in_bytes, size_t file_count, size_t directory_count) { origin_event_loop->deferred_invoke([=, weak_this = make_weak_ptr<PropertiesWindow>()] { if (auto strong_this = weak_this.strong_ref()) - strong_this->m_size_label->set_text(DeprecatedString::formatted("{}\n{:'d} files, {:'d} subdirectories", human_readable_size_long(total_size_in_bytes, UseThousandsSeparator::Yes), file_count, directory_count)); + strong_this->m_size_label->set_text(String::formatted("{}\n{} files, {} subdirectories", human_readable_size_long(total_size_in_bytes, UseThousandsSeparator::Yes), file_count, directory_count).release_value_but_fixme_should_propagate_errors()); }); }; m_directory_statistics_calculator->start(); diff --git a/Userland/Applications/FontEditor/MainWidget.cpp b/Userland/Applications/FontEditor/MainWidget.cpp index c47f81a2cd..8c6a234225 100644 --- a/Userland/Applications/FontEditor/MainWidget.cpp +++ b/Userland/Applications/FontEditor/MainWidget.cpp @@ -73,7 +73,7 @@ ErrorOr<RefPtr<GUI::Window>> MainWidget::create_preview_window() m_preview_textbox = find_descendant_of_type_named<GUI::TextBox>("preview_textbox"); m_preview_textbox->on_change = [&] { - auto preview = DeprecatedString::formatted("{}\n{}", m_preview_textbox->text(), Unicode::to_unicode_uppercase_full(m_preview_textbox->text()).release_value_but_fixme_should_propagate_errors()); + auto preview = String::formatted("{}\n{}", m_preview_textbox->text(), Unicode::to_unicode_uppercase_full(m_preview_textbox->text()).release_value_but_fixme_should_propagate_errors()).release_value_but_fixme_should_propagate_errors(); m_preview_label->set_text(preview); }; m_preview_textbox->set_text(pangrams[0]); diff --git a/Userland/Applications/MouseSettings/MouseWidget.cpp b/Userland/Applications/MouseSettings/MouseWidget.cpp index 32100a6b98..f8d5940d9e 100644 --- a/Userland/Applications/MouseSettings/MouseWidget.cpp +++ b/Userland/Applications/MouseSettings/MouseWidget.cpp @@ -92,19 +92,19 @@ void MouseWidget::reset_default_values() void MouseWidget::update_speed_label() { - m_speed_label->set_text(DeprecatedString::formatted("{} %", m_speed_slider->value())); + m_speed_label->set_text(String::formatted("{} %", m_speed_slider->value()).release_value_but_fixme_should_propagate_errors()); } void MouseWidget::update_double_click_speed_label() { - m_double_click_speed_label->set_text(DeprecatedString::formatted("{} ms", m_double_click_speed_slider->value())); + m_double_click_speed_label->set_text(String::formatted("{} ms", m_double_click_speed_slider->value()).release_value_but_fixme_should_propagate_errors()); } void MouseWidget::update_switch_buttons_image_label() { if (m_switch_buttons_checkbox->is_checked()) { - m_switch_buttons_image_label->set_icon_from_path("/res/graphics/mouse-button-right.png"); + m_switch_buttons_image_label->set_icon_from_path("/res/graphics/mouse-button-right.png"sv); } else { - m_switch_buttons_image_label->set_icon_from_path("/res/graphics/mouse-button-left.png"); + m_switch_buttons_image_label->set_icon_from_path("/res/graphics/mouse-button-left.png"sv); } } diff --git a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp index c35f5bc731..b3d0a5ea49 100644 --- a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp +++ b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp @@ -387,7 +387,7 @@ PDF::PDFErrorOr<void> PDFViewerWidget::try_open_file(StringView path, NonnullOwn TRY(document->initialize()); TRY(m_viewer->set_document(document)); - m_total_page_label->set_text(DeprecatedString::formatted("of {}", document->get_page_count())); + m_total_page_label->set_text(TRY(String::formatted("of {}", document->get_page_count()))); m_page_text_box->set_enabled(true); m_page_text_box->set_current_number(1, GUI::AllowCallback::No); diff --git a/Userland/Applications/Piano/ExportProgressWindow.cpp b/Userland/Applications/Piano/ExportProgressWindow.cpp index 3716e9f847..ab4a801083 100644 --- a/Userland/Applications/Piano/ExportProgressWindow.cpp +++ b/Userland/Applications/Piano/ExportProgressWindow.cpp @@ -38,7 +38,7 @@ ErrorOr<void> ExportProgressWindow::initialize_fallibles() void ExportProgressWindow::set_filename(StringView filename) { - m_label->set_text(DeprecatedString::formatted("Rendering audio to {}…", filename)); + m_label->set_text(String::formatted("Rendering audio to {}…", filename).release_value_but_fixme_should_propagate_errors()); update(); } diff --git a/Userland/Applications/Piano/MainWidget.cpp b/Userland/Applications/Piano/MainWidget.cpp index 65e7615f48..02b3741ddf 100644 --- a/Userland/Applications/Piano/MainWidget.cpp +++ b/Userland/Applications/Piano/MainWidget.cpp @@ -59,9 +59,9 @@ ErrorOr<void> MainWidget::initialize() m_octave_container = TRY(m_keys_and_knobs_container->try_add<GUI::Widget>()); m_octave_container->set_preferred_width(GUI::SpecialDimension::Fit); TRY(m_octave_container->try_set_layout<GUI::VerticalBoxLayout>()); - auto octave_label = TRY(m_octave_container->try_add<GUI::Label>("Octave")); + auto octave_label = TRY(m_octave_container->try_add<GUI::Label>("Octave"_short_string)); octave_label->set_preferred_width(GUI::SpecialDimension::Fit); - m_octave_value = TRY(m_octave_container->try_add<GUI::Label>(DeprecatedString::number(m_track_manager.keyboard()->virtual_keyboard_octave()))); + m_octave_value = TRY(m_octave_container->try_add<GUI::Label>(TRY(String::number(m_track_manager.keyboard()->virtual_keyboard_octave())))); m_octave_value->set_preferred_width(GUI::SpecialDimension::Fit); // FIXME: Implement vertical flipping in GUI::Slider, not here. @@ -75,7 +75,7 @@ ErrorOr<void> MainWidget::initialize() int new_octave = octave_max - value; set_octave_via_slider(new_octave); VERIFY(new_octave == m_track_manager.keyboard()->virtual_keyboard_octave()); - m_octave_value->set_text(DeprecatedString::number(new_octave)); + m_octave_value->set_text(String::number(new_octave).release_value_but_fixme_should_propagate_errors()); }; m_knobs_widget = TRY(m_keys_and_knobs_container->try_add<TrackControlsWidget>(m_track_manager, *this)); diff --git a/Userland/Applications/Piano/PlayerWidget.cpp b/Userland/Applications/Piano/PlayerWidget.cpp index 0b2e54b15a..be4011d6eb 100644 --- a/Userland/Applications/Piano/PlayerWidget.cpp +++ b/Userland/Applications/Piano/PlayerWidget.cpp @@ -43,7 +43,7 @@ ErrorOr<void> PlayerWidget::initialize() set_fill_with_background_color(true); TRY(m_track_number_choices.try_append("1")); - RefPtr<GUI::Label> label = TRY(try_add<GUI::Label>("Track")); + RefPtr<GUI::Label> label = TRY(try_add<GUI::Label>("Track"_short_string)); label->set_max_width(75); m_track_dropdown = TRY(try_add<GUI::ComboBox>()); diff --git a/Userland/Applications/Piano/ProcessorParameterWidget/ParameterWidget.cpp b/Userland/Applications/Piano/ProcessorParameterWidget/ParameterWidget.cpp index 3d0c0d389b..16d7377b49 100644 --- a/Userland/Applications/Piano/ProcessorParameterWidget/ParameterWidget.cpp +++ b/Userland/Applications/Piano/ProcessorParameterWidget/ParameterWidget.cpp @@ -15,11 +15,11 @@ ProcessorParameterWidget::ProcessorParameterWidget(DSP::ProcessorParameter& raw_ : m_parameter(raw_parameter) { set_layout<GUI::VerticalBoxLayout>(); - m_label = add<GUI::Label>(raw_parameter.name().to_deprecated_string()); + m_label = add<GUI::Label>(raw_parameter.name()); switch (raw_parameter.type()) { case DSP::ParameterType::Range: { auto& parameter = static_cast<DSP::ProcessorRangeParameter&>(raw_parameter); - m_value_label = add<GUI::Label>(DeprecatedString::number(static_cast<double>(parameter.value()))); + m_value_label = add<GUI::Label>(String::number(static_cast<double>(parameter.value())).release_value_but_fixme_should_propagate_errors()); m_parameter_modifier = add<ProcessorParameterSlider>(Orientation::Vertical, parameter, m_value_label); break; } diff --git a/Userland/Applications/Piano/ProcessorParameterWidget/Slider.cpp b/Userland/Applications/Piano/ProcessorParameterWidget/Slider.cpp index 7882577826..120cf8dca4 100644 --- a/Userland/Applications/Piano/ProcessorParameterWidget/Slider.cpp +++ b/Userland/Applications/Piano/ProcessorParameterWidget/Slider.cpp @@ -28,7 +28,7 @@ ProcessorParameterSlider::ProcessorParameterSlider(Orientation orientation, DSP: } set_tooltip(m_parameter.name().to_deprecated_string()); if (m_value_label != nullptr) - m_value_label->set_text(DeprecatedString::formatted("{:.2f}", static_cast<double>(m_parameter))); + m_value_label->set_text(String::formatted("{:.2f}", static_cast<double>(m_parameter)).release_value_but_fixme_should_propagate_errors()); on_change = [this](auto raw_value) { if (m_currently_setting_from_ui) @@ -43,13 +43,9 @@ ProcessorParameterSlider::ProcessorParameterSlider(Orientation orientation, DSP: m_parameter.set_value(real_value); if (m_value_label) { double value = static_cast<double>(m_parameter); - DeprecatedString label_text = DeprecatedString::formatted("{:.2f}", value); - // FIXME: This is a magic value; we know that with normal font sizes, the label will disappear starting from approximately this length. - // Can we do this dynamically? - if (label_text.length() > 7) - m_value_label->set_text(DeprecatedString::formatted("{:.0f}", value)); - else - m_value_label->set_text(label_text); + auto label_text = String::formatted("{:.2f}", value).release_value_but_fixme_should_propagate_errors(); + m_value_label->set_autosize(true); + m_value_label->set_text(label_text); } m_currently_setting_from_ui = false; }; diff --git a/Userland/Applications/Piano/SamplerWidget.cpp b/Userland/Applications/Piano/SamplerWidget.cpp index bfe7e4f779..74d0d9e9f7 100644 --- a/Userland/Applications/Piano/SamplerWidget.cpp +++ b/Userland/Applications/Piano/SamplerWidget.cpp @@ -56,11 +56,11 @@ SamplerWidget::SamplerWidget(TrackManager& track_manager) if (!open_path.has_value()) return; // TODO: We don't actually load the sample. - m_recorded_sample_name->set_text(open_path.value()); + m_recorded_sample_name->set_text(String::from_deprecated_string(open_path.value()).release_value_but_fixme_should_propagate_errors()); m_wave_editor->update(); }; - m_recorded_sample_name = m_open_button_and_recorded_sample_name_container->add<GUI::Label>("No sample loaded"); + m_recorded_sample_name = m_open_button_and_recorded_sample_name_container->add<GUI::Label>("No sample loaded"_string.release_value_but_fixme_should_propagate_errors()); m_recorded_sample_name->set_text_alignment(Gfx::TextAlignment::CenterLeft); m_wave_editor = add<WaveEditor>(m_track_manager); diff --git a/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp b/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp index f837a5e0cf..628547639e 100644 --- a/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp +++ b/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp @@ -32,7 +32,7 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window) main_widget->set_layout<GUI::VerticalBoxLayout>(4); - auto& name_label = main_widget->add<GUI::Label>("Name:"); + auto& name_label = main_widget->add<GUI::Label>("Name:"_short_string); name_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); m_name_textbox = main_widget->add<GUI::TextBox>(); @@ -42,12 +42,12 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window) auto default_name = Config::read_string("PixelPaint"sv, "NewImage"sv, "Name"sv); m_name_textbox->set_text(default_name); - auto& width_label = main_widget->add<GUI::Label>("Width:"); + auto& width_label = main_widget->add<GUI::Label>("Width:"_short_string); width_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); auto& width_spinbox = main_widget->add<GUI::SpinBox>(); - auto& height_label = main_widget->add<GUI::Label>("Height:"); + auto& height_label = main_widget->add<GUI::Label>("Height:"_short_string); height_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); auto& height_spinbox = main_widget->add<GUI::SpinBox>(); @@ -80,7 +80,7 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window) return BackgroundIndex::Custom; }(); - auto& background_label = main_widget->add<GUI::Label>("Background:"); + auto& background_label = main_widget->add<GUI::Label>("Background:"_string.release_value_but_fixme_should_propagate_errors()); background_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); auto& background_color_combo = main_widget->add<GUI::ComboBox>(); auto& background_color_input = main_widget->add<GUI::ColorInput>(); diff --git a/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp b/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp index 51cbeb6645..ccbe748a55 100644 --- a/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp +++ b/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp @@ -24,7 +24,7 @@ CreateNewLayerDialog::CreateNewLayerDialog(Gfx::IntSize suggested_size, GUI::Win main_widget->set_fill_with_background_color(true); main_widget->set_layout<GUI::VerticalBoxLayout>(4); - auto& name_label = main_widget->add<GUI::Label>("Name:"); + auto& name_label = main_widget->add<GUI::Label>("Name:"_short_string); name_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); m_name_textbox = main_widget->add<GUI::TextBox>(); @@ -34,12 +34,12 @@ CreateNewLayerDialog::CreateNewLayerDialog(Gfx::IntSize suggested_size, GUI::Win m_layer_name = m_name_textbox->text(); }; - auto& width_label = main_widget->add<GUI::Label>("Width:"); + auto& width_label = main_widget->add<GUI::Label>("Width:"_short_string); width_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); auto& width_spinbox = main_widget->add<GUI::SpinBox>(); - auto& height_label = main_widget->add<GUI::Label>("Height:"); + auto& height_label = main_widget->add<GUI::Label>("Height:"_short_string); height_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); auto& height_spinbox = main_widget->add<GUI::SpinBox>(); diff --git a/Userland/Applications/PixelPaint/FilterGallery.cpp b/Userland/Applications/PixelPaint/FilterGallery.cpp index 264c8d5565..6a1eb84734 100644 --- a/Userland/Applications/PixelPaint/FilterGallery.cpp +++ b/Userland/Applications/PixelPaint/FilterGallery.cpp @@ -64,7 +64,7 @@ FilterGallery::FilterGallery(GUI::Window* parent_window, ImageEditor* editor) auto settings_widget_or_error = m_selected_filter->get_settings_widget(); if (settings_widget_or_error.is_error()) { - m_error_label->set_text(DeprecatedString::formatted("Error creating settings: {}", settings_widget_or_error.error())); + m_error_label->set_text(String::formatted("Error creating settings: {}", settings_widget_or_error.error()).release_value_but_fixme_should_propagate_errors()); m_selected_filter_config_widget = m_error_label; } else { m_selected_filter_config_widget = settings_widget_or_error.release_value(); diff --git a/Userland/Applications/PixelPaint/Filters/Bloom.cpp b/Userland/Applications/PixelPaint/Filters/Bloom.cpp index 589c36b55f..eced484fd5 100644 --- a/Userland/Applications/PixelPaint/Filters/Bloom.cpp +++ b/Userland/Applications/PixelPaint/Filters/Bloom.cpp @@ -40,7 +40,7 @@ ErrorOr<RefPtr<GUI::Widget>> Bloom::get_settings_widget() auto settings_widget = TRY(GUI::Widget::try_create()); TRY(settings_widget->try_set_layout<GUI::VerticalBoxLayout>()); - auto name_label = TRY(settings_widget->try_add<GUI::Label>("Bloom Filter")); + auto name_label = TRY(settings_widget->try_add<GUI::Label>(TRY("Bloom Filter"_string))); name_label->set_font_weight(Gfx::FontWeight::Bold); name_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); name_label->set_fixed_height(20); @@ -49,7 +49,7 @@ ErrorOr<RefPtr<GUI::Widget>> Bloom::get_settings_widget() luma_lower_container->set_fixed_height(50); TRY(luma_lower_container->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 4, 0, 4, 0 })); - auto luma_lower_label = TRY(luma_lower_container->try_add<GUI::Label>("Luma lower bound:")); + auto luma_lower_label = TRY(luma_lower_container->try_add<GUI::Label>(TRY("Luma lower bound:"_string))); luma_lower_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); luma_lower_label->set_fixed_height(20); @@ -65,7 +65,7 @@ ErrorOr<RefPtr<GUI::Widget>> Bloom::get_settings_widget() radius_container->set_fixed_height(50); TRY(radius_container->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 4, 0, 4, 0 })); - auto radius_label = TRY(radius_container->try_add<GUI::Label>("Blur Radius:")); + auto radius_label = TRY(radius_container->try_add<GUI::Label>(TRY("Blur Radius:"_string))); radius_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); radius_label->set_fixed_height(20); diff --git a/Userland/Applications/PixelPaint/Filters/FastBoxBlur.cpp b/Userland/Applications/PixelPaint/Filters/FastBoxBlur.cpp index 870163dbd6..efe44bb56a 100644 --- a/Userland/Applications/PixelPaint/Filters/FastBoxBlur.cpp +++ b/Userland/Applications/PixelPaint/Filters/FastBoxBlur.cpp @@ -42,7 +42,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget() auto settings_widget = TRY(GUI::Widget::try_create()); TRY(settings_widget->try_set_layout<GUI::VerticalBoxLayout>()); - auto name_label = TRY(settings_widget->try_add<GUI::Label>("Fast Box Blur Filter")); + auto name_label = TRY(settings_widget->try_add<GUI::Label>(TRY("Fast Box Blur Filter"_string))); name_label->set_font_weight(Gfx::FontWeight::Bold); name_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); name_label->set_fixed_height(10); @@ -88,7 +88,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget() m_radius_container->set_fixed_height(20); TRY(m_radius_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 4, 0, 4, 0 })); - auto radius_label = TRY(m_radius_container->try_add<GUI::Label>("Radius:")); + auto radius_label = TRY(m_radius_container->try_add<GUI::Label>("Radius:"_short_string)); radius_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); radius_label->set_fixed_size(50, 20); @@ -109,7 +109,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget() radius_x_container->set_fixed_height(20); radius_x_container->set_layout<GUI::HorizontalBoxLayout>(); - auto radius_x_label = TRY(radius_x_container->try_add<GUI::Label>("Radius X:")); + auto radius_x_label = TRY(radius_x_container->try_add<GUI::Label>(TRY("Radius X:"_string))); radius_x_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); radius_x_label->set_fixed_size(50, 20); @@ -125,7 +125,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget() radius_y_container->set_fixed_height(20); TRY(radius_y_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto radius_y_label = TRY(radius_y_container->try_add<GUI::Label>("Radius Y:")); + auto radius_y_label = TRY(radius_y_container->try_add<GUI::Label>(TRY("Radius Y:"_string))); radius_y_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); radius_y_label->set_fixed_size(50, 20); @@ -146,7 +146,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget() angle_container->set_fixed_height(20); TRY(angle_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto angle_label = TRY(angle_container->try_add<GUI::Label>("Angle:")); + auto angle_label = TRY(angle_container->try_add<GUI::Label>("Angle:"_short_string)); angle_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); angle_label->set_fixed_size(60, 20); @@ -162,7 +162,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget() magnitude_container->set_fixed_height(20); TRY(magnitude_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto magnitude_label = TRY(magnitude_container->try_add<GUI::Label>("Magnitude:")); + auto magnitude_label = TRY(magnitude_container->try_add<GUI::Label>(TRY("Magnitude:"_string))); magnitude_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); magnitude_label->set_fixed_size(60, 20); diff --git a/Userland/Applications/PixelPaint/Filters/Filter.cpp b/Userland/Applications/PixelPaint/Filters/Filter.cpp index e62424acfa..177ad5a03a 100644 --- a/Userland/Applications/PixelPaint/Filters/Filter.cpp +++ b/Userland/Applications/PixelPaint/Filters/Filter.cpp @@ -28,7 +28,7 @@ ErrorOr<RefPtr<GUI::Widget>> Filter::get_settings_widget() auto settings_widget = TRY(GUI::Widget::try_create()); (void)TRY(settings_widget->try_set_layout<GUI::VerticalBoxLayout>()); - auto name_label = TRY(settings_widget->try_add<GUI::Label>(filter_name())); + auto name_label = TRY(settings_widget->try_add<GUI::Label>(TRY(String::from_utf8(filter_name())))); name_label->set_text_alignment(Gfx::TextAlignment::TopLeft); (void)TRY(settings_widget->try_add<GUI::Widget>()); diff --git a/Userland/Applications/PixelPaint/Filters/HueAndSaturation.cpp b/Userland/Applications/PixelPaint/Filters/HueAndSaturation.cpp index 253ffb9525..b442715013 100644 --- a/Userland/Applications/PixelPaint/Filters/HueAndSaturation.cpp +++ b/Userland/Applications/PixelPaint/Filters/HueAndSaturation.cpp @@ -34,7 +34,7 @@ ErrorOr<RefPtr<GUI::Widget>> HueAndSaturation::get_settings_widget() (void)TRY(settings_widget->try_set_layout<GUI::VerticalBoxLayout>()); auto add_slider = [&](auto name, int min, int max, auto member) -> ErrorOr<void> { - auto name_label = TRY(settings_widget->try_add<GUI::Label>(name)); + auto name_label = TRY(settings_widget->try_add<GUI::Label>(TRY(String::from_utf8(name)))); name_label->set_font_weight(Gfx::FontWeight::Bold); name_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); name_label->set_fixed_height(20); @@ -49,9 +49,9 @@ ErrorOr<RefPtr<GUI::Widget>> HueAndSaturation::get_settings_widget() return {}; }; - TRY(add_slider("Hue", -180, 180, &HueAndSaturation::m_hue)); - TRY(add_slider("Saturation", -100, 100, &HueAndSaturation::m_saturation)); - TRY(add_slider("Lightness", -100, 100, &HueAndSaturation::m_lightness)); + TRY(add_slider("Hue"sv, -180, 180, &HueAndSaturation::m_hue)); + TRY(add_slider("Saturation"sv, -100, 100, &HueAndSaturation::m_saturation)); + TRY(add_slider("Lightness"sv, -100, 100, &HueAndSaturation::m_lightness)); m_settings_widget = settings_widget; } diff --git a/Userland/Applications/PixelPaint/Filters/Sepia.cpp b/Userland/Applications/PixelPaint/Filters/Sepia.cpp index 1755e8f96a..f736aa0f19 100644 --- a/Userland/Applications/PixelPaint/Filters/Sepia.cpp +++ b/Userland/Applications/PixelPaint/Filters/Sepia.cpp @@ -23,7 +23,7 @@ ErrorOr<RefPtr<GUI::Widget>> Sepia::get_settings_widget() auto settings_widget = TRY(GUI::Widget::try_create()); TRY(settings_widget->try_set_layout<GUI::VerticalBoxLayout>()); - auto name_label = TRY(settings_widget->try_add<GUI::Label>("Sepia Filter")); + auto name_label = TRY(settings_widget->try_add<GUI::Label>(TRY("Sepia Filter"_string))); name_label->set_font_weight(Gfx::FontWeight::Bold); name_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); name_label->set_fixed_height(20); @@ -32,7 +32,7 @@ ErrorOr<RefPtr<GUI::Widget>> Sepia::get_settings_widget() amount_container->set_fixed_height(20); TRY(amount_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 4, 0, 4, 0 })); - auto amount_label = TRY(amount_container->try_add<GUI::Label>("Amount:")); + auto amount_label = TRY(amount_container->try_add<GUI::Label>("Amount:"_short_string)); amount_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); amount_label->set_fixed_size(50, 20); diff --git a/Userland/Applications/PixelPaint/LayerPropertiesWidget.cpp b/Userland/Applications/PixelPaint/LayerPropertiesWidget.cpp index c9ba4f8137..fdd752f744 100644 --- a/Userland/Applications/PixelPaint/LayerPropertiesWidget.cpp +++ b/Userland/Applications/PixelPaint/LayerPropertiesWidget.cpp @@ -30,7 +30,7 @@ LayerPropertiesWidget::LayerPropertiesWidget() name_container.set_fixed_height(20); name_container.set_layout<GUI::HorizontalBoxLayout>(); - auto& name_label = name_container.add<GUI::Label>("Name:"); + auto& name_label = name_container.add<GUI::Label>("Name:"_short_string); name_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); name_label.set_fixed_size(80, 20); @@ -45,7 +45,7 @@ LayerPropertiesWidget::LayerPropertiesWidget() opacity_container.set_fixed_height(20); opacity_container.set_layout<GUI::HorizontalBoxLayout>(); - auto& opacity_label = opacity_container.add<GUI::Label>("Opacity:"); + auto& opacity_label = opacity_container.add<GUI::Label>("Opacity:"_string.release_value_but_fixme_should_propagate_errors()); opacity_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); opacity_label.set_fixed_size(80, 20); diff --git a/Userland/Applications/PixelPaint/LevelsDialog.cpp b/Userland/Applications/PixelPaint/LevelsDialog.cpp index b7577a95e0..80b8b652c3 100644 --- a/Userland/Applications/PixelPaint/LevelsDialog.cpp +++ b/Userland/Applications/PixelPaint/LevelsDialog.cpp @@ -41,7 +41,7 @@ LevelsDialog::LevelsDialog(GUI::Window* parent_window, ImageEditor* editor) VERIFY(cancel_button); VERIFY(m_editor->active_layer()); - context_label->set_text(DeprecatedString::formatted("Working on layer: {}", m_editor->active_layer()->name())); + context_label->set_text(String::formatted("Working on layer: {}", m_editor->active_layer()->name()).release_value_but_fixme_should_propagate_errors()); m_gamma_slider->set_value(100); m_brightness_slider->on_change = [this](auto) { diff --git a/Userland/Applications/PixelPaint/ToolPropertiesWidget.cpp b/Userland/Applications/PixelPaint/ToolPropertiesWidget.cpp index 299ba1dda6..699a47eb75 100644 --- a/Userland/Applications/PixelPaint/ToolPropertiesWidget.cpp +++ b/Userland/Applications/PixelPaint/ToolPropertiesWidget.cpp @@ -36,7 +36,7 @@ void ToolPropertiesWidget::set_active_tool(Tool* tool) auto active_tool_widget_or_error = tool->get_properties_widget(); if (active_tool_widget_or_error.is_error()) { m_active_tool_widget = nullptr; - m_error_label->set_text(DeprecatedString::formatted("Error creating tool properties: {}", active_tool_widget_or_error.release_error())); + m_error_label->set_text(String::formatted("Error creating tool properties: {}", active_tool_widget_or_error.release_error()).release_value_but_fixme_should_propagate_errors()); m_tool_widget_stack->set_active_widget(m_error_label); return; } diff --git a/Userland/Applications/PixelPaint/Tools/BrushTool.cpp b/Userland/Applications/PixelPaint/Tools/BrushTool.cpp index 383963c14b..3fe39457e3 100644 --- a/Userland/Applications/PixelPaint/Tools/BrushTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/BrushTool.cpp @@ -147,7 +147,7 @@ ErrorOr<GUI::Widget*> BrushTool::get_properties_widget() size_container->set_fixed_height(20); (void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto size_label = TRY(size_container->try_add<GUI::Label>("Size:")); + auto size_label = TRY(size_container->try_add<GUI::Label>("Size:"_short_string)); size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); size_label->set_fixed_size(80, 20); @@ -167,7 +167,7 @@ ErrorOr<GUI::Widget*> BrushTool::get_properties_widget() hardness_container->set_fixed_height(20); (void)TRY(hardness_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto hardness_label = TRY(hardness_container->try_add<GUI::Label>("Hardness:")); + auto hardness_label = TRY(hardness_container->try_add<GUI::Label>(TRY("Hardness:"_string))); hardness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); hardness_label->set_fixed_size(80, 20); diff --git a/Userland/Applications/PixelPaint/Tools/BucketTool.cpp b/Userland/Applications/PixelPaint/Tools/BucketTool.cpp index 39e6a83f0c..80e4af0799 100644 --- a/Userland/Applications/PixelPaint/Tools/BucketTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/BucketTool.cpp @@ -71,7 +71,7 @@ ErrorOr<GUI::Widget*> BucketTool::get_properties_widget() threshold_container->set_fixed_height(20); (void)TRY(threshold_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto threshold_label = TRY(threshold_container->try_add<GUI::Label>("Threshold:")); + auto threshold_label = TRY(threshold_container->try_add<GUI::Label>(TRY("Threshold:"_string))); threshold_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); threshold_label->set_fixed_size(80, 20); diff --git a/Userland/Applications/PixelPaint/Tools/CloneTool.cpp b/Userland/Applications/PixelPaint/Tools/CloneTool.cpp index d7a7e8f71e..2a858fcc61 100644 --- a/Userland/Applications/PixelPaint/Tools/CloneTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/CloneTool.cpp @@ -135,7 +135,7 @@ ErrorOr<GUI::Widget*> CloneTool::get_properties_widget() size_container->set_fixed_height(20); (void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto size_label = TRY(size_container->try_add<GUI::Label>("Size:")); + auto size_label = TRY(size_container->try_add<GUI::Label>("Size:"_short_string)); size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); size_label->set_fixed_size(80, 20); @@ -154,7 +154,7 @@ ErrorOr<GUI::Widget*> CloneTool::get_properties_widget() hardness_container->set_fixed_height(20); (void)TRY(hardness_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto hardness_label = TRY(hardness_container->try_add<GUI::Label>("Hardness:")); + auto hardness_label = TRY(hardness_container->try_add<GUI::Label>(TRY("Hardness:"_string))); hardness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); hardness_label->set_fixed_size(80, 20); diff --git a/Userland/Applications/PixelPaint/Tools/EllipseTool.cpp b/Userland/Applications/PixelPaint/Tools/EllipseTool.cpp index a1140171fe..759cf6fb32 100644 --- a/Userland/Applications/PixelPaint/Tools/EllipseTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/EllipseTool.cpp @@ -136,7 +136,7 @@ ErrorOr<GUI::Widget*> EllipseTool::get_properties_widget() thickness_container->set_fixed_height(20); (void)TRY(thickness_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto thickness_label = TRY(thickness_container->try_add<GUI::Label>("Thickness:")); + auto thickness_label = TRY(thickness_container->try_add<GUI::Label>(TRY("Thickness:"_string))); thickness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); thickness_label->set_fixed_size(80, 20); @@ -152,7 +152,7 @@ ErrorOr<GUI::Widget*> EllipseTool::get_properties_widget() auto mode_container = TRY(properties_widget->try_add<GUI::Widget>()); mode_container->set_fixed_height(70); (void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto mode_label = TRY(mode_container->try_add<GUI::Label>("Mode:")); + auto mode_label = TRY(mode_container->try_add<GUI::Label>("Mode:"_short_string)); mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); auto mode_radio_container = TRY(mode_container->try_add<GUI::Widget>()); @@ -180,7 +180,7 @@ ErrorOr<GUI::Widget*> EllipseTool::get_properties_widget() aspect_container->set_fixed_height(20); (void)TRY(aspect_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto aspect_label = TRY(aspect_container->try_add<GUI::Label>("Aspect Ratio:")); + auto aspect_label = TRY(aspect_container->try_add<GUI::Label>(TRY("Aspect Ratio:"_string))); aspect_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); aspect_label->set_fixed_size(80, 20); @@ -197,7 +197,7 @@ ErrorOr<GUI::Widget*> EllipseTool::get_properties_widget() } }; - auto multiply_label = TRY(aspect_container->try_add<GUI::Label>("x")); + auto multiply_label = TRY(aspect_container->try_add<GUI::Label>("x"_short_string)); multiply_label->set_text_alignment(Gfx::TextAlignment::Center); multiply_label->set_fixed_size(10, 20); diff --git a/Userland/Applications/PixelPaint/Tools/EraseTool.cpp b/Userland/Applications/PixelPaint/Tools/EraseTool.cpp index 46c432f479..924912b504 100644 --- a/Userland/Applications/PixelPaint/Tools/EraseTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/EraseTool.cpp @@ -63,7 +63,7 @@ ErrorOr<GUI::Widget*> EraseTool::get_properties_widget() size_container->set_fixed_height(20); (void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto size_label = TRY(size_container->try_add<GUI::Label>("Size:")); + auto size_label = TRY(size_container->try_add<GUI::Label>("Size:"_short_string)); size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); size_label->set_fixed_size(80, 20); @@ -81,7 +81,7 @@ ErrorOr<GUI::Widget*> EraseTool::get_properties_widget() hardness_container->set_fixed_height(20); (void)TRY(hardness_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto hardness_label = TRY(hardness_container->try_add<GUI::Label>("Hardness:")); + auto hardness_label = TRY(hardness_container->try_add<GUI::Label>(TRY("Hardness:"_string))); hardness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); hardness_label->set_fixed_size(80, 20); @@ -108,7 +108,7 @@ ErrorOr<GUI::Widget*> EraseTool::get_properties_widget() auto mode_container = TRY(properties_widget->try_add<GUI::Widget>()); mode_container->set_fixed_height(46); (void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto mode_label = TRY(mode_container->try_add<GUI::Label>("Draw Mode:")); + auto mode_label = TRY(mode_container->try_add<GUI::Label>(TRY("Draw Mode:"_string))); mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); mode_label->set_fixed_size(80, 20); diff --git a/Userland/Applications/PixelPaint/Tools/GradientTool.cpp b/Userland/Applications/PixelPaint/Tools/GradientTool.cpp index e43cd28d13..24f2307d84 100644 --- a/Userland/Applications/PixelPaint/Tools/GradientTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/GradientTool.cpp @@ -206,7 +206,7 @@ ErrorOr<GUI::Widget*> GradientTool::get_properties_widget() auto mode_container = TRY(properties_widget->try_add<GUI::Widget>()); mode_container->set_fixed_height(20); (void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto mode_label = TRY(mode_container->try_add<GUI::Label>("Gradient Type:")); + auto mode_label = TRY(mode_container->try_add<GUI::Label>(TRY("Gradient Type:"_string))); mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); mode_label->set_fixed_size(80, 20); @@ -236,7 +236,7 @@ ErrorOr<GUI::Widget*> GradientTool::get_properties_widget() size_container->set_fixed_height(20); (void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto size_label = TRY(size_container->try_add<GUI::Label>("Opacity:")); + auto size_label = TRY(size_container->try_add<GUI::Label>(TRY("Opacity:"_string))); size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); size_label->set_fixed_size(80, 20); @@ -270,7 +270,7 @@ ErrorOr<GUI::Widget*> GradientTool::get_properties_widget() hardness_container->set_visible(m_mode == GradientMode::Radial); }; - auto hardness_label = TRY(hardness_container->try_add<GUI::Label>("Hardness:")); + auto hardness_label = TRY(hardness_container->try_add<GUI::Label>(TRY("Hardness:"_string))); hardness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); auto hardness_slider = TRY(hardness_container->try_add<GUI::HorizontalOpacitySlider>()); diff --git a/Userland/Applications/PixelPaint/Tools/GuideTool.cpp b/Userland/Applications/PixelPaint/Tools/GuideTool.cpp index fcc45b42aa..88e2026f22 100644 --- a/Userland/Applications/PixelPaint/Tools/GuideTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/GuideTool.cpp @@ -186,7 +186,7 @@ ErrorOr<GUI::Widget*> GuideTool::get_properties_widget() snapping_container->set_fixed_height(20); (void)TRY(snapping_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto snapping_label = TRY(snapping_container->try_add<GUI::Label>("Snap offset:")); + auto snapping_label = TRY(snapping_container->try_add<GUI::Label>(TRY("Snap offset:"_string))); snapping_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); snapping_label->set_fixed_size(80, 20); snapping_label->set_tooltip("Press Shift to snap"); diff --git a/Userland/Applications/PixelPaint/Tools/LassoSelectTool.cpp b/Userland/Applications/PixelPaint/Tools/LassoSelectTool.cpp index b4e6243a6c..d1026145bc 100644 --- a/Userland/Applications/PixelPaint/Tools/LassoSelectTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/LassoSelectTool.cpp @@ -185,7 +185,7 @@ ErrorOr<GUI::Widget*> LassoSelectTool::get_properties_widget() (void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>()); auto mode_label = TRY(mode_container->try_add<GUI::Label>()); - mode_label->set_text("Mode:"); + mode_label->set_text("Mode:"_short_string); mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); mode_label->set_fixed_size(80, 20); diff --git a/Userland/Applications/PixelPaint/Tools/LineTool.cpp b/Userland/Applications/PixelPaint/Tools/LineTool.cpp index a6cfc85caa..a1d240c4c5 100644 --- a/Userland/Applications/PixelPaint/Tools/LineTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/LineTool.cpp @@ -129,7 +129,7 @@ ErrorOr<GUI::Widget*> LineTool::get_properties_widget() thickness_container->set_fixed_height(20); (void)TRY(thickness_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto thickness_label = TRY(thickness_container->try_add<GUI::Label>("Thickness:")); + auto thickness_label = TRY(thickness_container->try_add<GUI::Label>(TRY("Thickness:"_string))); thickness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); thickness_label->set_fixed_size(80, 20); @@ -146,7 +146,7 @@ ErrorOr<GUI::Widget*> LineTool::get_properties_widget() mode_container->set_fixed_height(20); (void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto mode_label = TRY(mode_container->try_add<GUI::Label>("Mode:")); + auto mode_label = TRY(mode_container->try_add<GUI::Label>("Mode:"_short_string)); mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); mode_label->set_fixed_size(80, 20); diff --git a/Userland/Applications/PixelPaint/Tools/MoveTool.cpp b/Userland/Applications/PixelPaint/Tools/MoveTool.cpp index e473c95c39..56fe2117e2 100644 --- a/Userland/Applications/PixelPaint/Tools/MoveTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/MoveTool.cpp @@ -298,7 +298,7 @@ ErrorOr<GUI::Widget*> MoveTool::get_properties_widget() auto selection_mode_container = TRY(properties_widget->try_add<GUI::Widget>()); (void)TRY(selection_mode_container->try_set_layout<GUI::HorizontalBoxLayout>()); selection_mode_container->set_fixed_height(46); - auto selection_mode_label = TRY(selection_mode_container->try_add<GUI::Label>("Selection Mode:")); + auto selection_mode_label = TRY(selection_mode_container->try_add<GUI::Label>(TRY("Selection Mode:"_string))); selection_mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); selection_mode_label->set_fixed_size(80, 40); diff --git a/Userland/Applications/PixelPaint/Tools/PenTool.cpp b/Userland/Applications/PixelPaint/Tools/PenTool.cpp index b72c48ef73..dbb65e36c2 100644 --- a/Userland/Applications/PixelPaint/Tools/PenTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/PenTool.cpp @@ -45,7 +45,7 @@ ErrorOr<GUI::Widget*> PenTool::get_properties_widget() size_container->set_fixed_height(20); (void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto size_label = TRY(size_container->try_add<GUI::Label>("Thickness:")); + auto size_label = TRY(size_container->try_add<GUI::Label>(TRY("Thickness:"_string))); size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); size_label->set_fixed_size(80, 20); diff --git a/Userland/Applications/PixelPaint/Tools/PolygonalSelectTool.cpp b/Userland/Applications/PixelPaint/Tools/PolygonalSelectTool.cpp index 2f4a60aa4f..94063e422d 100644 --- a/Userland/Applications/PixelPaint/Tools/PolygonalSelectTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/PolygonalSelectTool.cpp @@ -190,7 +190,7 @@ ErrorOr<GUI::Widget*> PolygonalSelectTool::get_properties_widget() (void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>()); auto mode_label = TRY(mode_container->try_add<GUI::Label>()); - mode_label->set_text("Mode:"); + mode_label->set_text("Mode:"_short_string); mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); mode_label->set_fixed_size(80, 20); diff --git a/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.cpp b/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.cpp index f1bfc6c269..e8415b4cdf 100644 --- a/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.cpp @@ -161,7 +161,7 @@ ErrorOr<GUI::Widget*> RectangleSelectTool::get_properties_widget() (void)TRY(feather_container->try_set_layout<GUI::HorizontalBoxLayout>()); auto feather_label = TRY(feather_container->try_add<GUI::Label>()); - feather_label->set_text("Feather:"); + feather_label->set_text(TRY("Feather:"_string)); feather_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); feather_label->set_fixed_size(80, 20); @@ -180,7 +180,7 @@ ErrorOr<GUI::Widget*> RectangleSelectTool::get_properties_widget() (void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>()); auto mode_label = TRY(mode_container->try_add<GUI::Label>()); - mode_label->set_text("Mode:"); + mode_label->set_text("Mode:"_short_string); mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); mode_label->set_fixed_size(80, 20); diff --git a/Userland/Applications/PixelPaint/Tools/RectangleTool.cpp b/Userland/Applications/PixelPaint/Tools/RectangleTool.cpp index f7987dd1dd..179ddab5c1 100644 --- a/Userland/Applications/PixelPaint/Tools/RectangleTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/RectangleTool.cpp @@ -165,14 +165,14 @@ ErrorOr<GUI::Widget*> RectangleTool::get_properties_widget() auto update_slider = [this, thickness_or_radius_label, thickness_or_radius_slider] { auto update_values = [&](auto label, int value, int range_min, int range_max = 10) { - thickness_or_radius_label->set_text(label); + thickness_or_radius_label->set_text(String::from_utf8(label).release_value_but_fixme_should_propagate_errors()); thickness_or_radius_slider->set_range(range_min, range_max); thickness_or_radius_slider->set_value(value); }; if (m_fill_mode == FillMode::RoundedCorners) - update_values("Radius:", m_corner_radius, 0, 50); + update_values("Radius:"sv, m_corner_radius, 0, 50); else - update_values("Thickness:", m_thickness, 1); + update_values("Thickness:"sv, m_thickness, 1); }; update_slider(); @@ -181,7 +181,7 @@ ErrorOr<GUI::Widget*> RectangleTool::get_properties_widget() auto mode_container = TRY(properties_widget->try_add<GUI::Widget>()); mode_container->set_fixed_height(90); (void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto mode_label = TRY(mode_container->try_add<GUI::Label>("Mode:")); + auto mode_label = TRY(mode_container->try_add<GUI::Label>("Mode:"_short_string)); mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); mode_label->set_fixed_size(30, 20); @@ -225,7 +225,7 @@ ErrorOr<GUI::Widget*> RectangleTool::get_properties_widget() (void)TRY(aspect_container->try_set_layout<GUI::VerticalBoxLayout>()); aspect_container->set_fixed_width(75); - auto aspect_label = TRY(aspect_container->try_add<GUI::Label>("Aspect Ratio:")); + auto aspect_label = TRY(aspect_container->try_add<GUI::Label>(TRY("Aspect Ratio:"_string))); aspect_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); aspect_label->set_fixed_size(75, 20); @@ -246,7 +246,7 @@ ErrorOr<GUI::Widget*> RectangleTool::get_properties_widget() } }; - auto multiply_label = TRY(aspect_fields_container->try_add<GUI::Label>("x")); + auto multiply_label = TRY(aspect_fields_container->try_add<GUI::Label>("x"_short_string)); multiply_label->set_text_alignment(Gfx::TextAlignment::Center); multiply_label->set_fixed_size(10, 20); diff --git a/Userland/Applications/PixelPaint/Tools/SprayTool.cpp b/Userland/Applications/PixelPaint/Tools/SprayTool.cpp index c56185e781..f249a4f736 100644 --- a/Userland/Applications/PixelPaint/Tools/SprayTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/SprayTool.cpp @@ -100,7 +100,7 @@ ErrorOr<GUI::Widget*> SprayTool::get_properties_widget() size_container->set_fixed_height(20); (void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto size_label = TRY(size_container->try_add<GUI::Label>("Size:")); + auto size_label = TRY(size_container->try_add<GUI::Label>("Size:"_short_string)); size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); size_label->set_fixed_size(80, 20); @@ -117,7 +117,7 @@ ErrorOr<GUI::Widget*> SprayTool::get_properties_widget() density_container->set_fixed_height(20); (void)TRY(density_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto density_label = TRY(density_container->try_add<GUI::Label>("Density:")); + auto density_label = TRY(density_container->try_add<GUI::Label>(TRY("Density:"_string))); density_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); density_label->set_fixed_size(80, 20); diff --git a/Userland/Applications/PixelPaint/Tools/TextTool.cpp b/Userland/Applications/PixelPaint/Tools/TextTool.cpp index 25484f3951..09be4adfcb 100644 --- a/Userland/Applications/PixelPaint/Tools/TextTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/TextTool.cpp @@ -111,16 +111,16 @@ ErrorOr<GUI::Widget*> TextTool::get_properties_widget() auto properties_widget = TRY(GUI::Widget::try_create()); (void)TRY(properties_widget->try_set_layout<GUI::VerticalBoxLayout>()); - auto font_header = TRY(properties_widget->try_add<GUI::Label>("Current Font:")); + auto font_header = TRY(properties_widget->try_add<GUI::Label>(TRY("Current Font:"_string))); font_header->set_text_alignment(Gfx::TextAlignment::CenterLeft); - m_font_label = TRY(properties_widget->try_add<GUI::Label>(m_selected_font->human_readable_name())); + m_font_label = TRY(properties_widget->try_add<GUI::Label>(TRY(String::from_deprecated_string(m_selected_font->human_readable_name())))); auto change_font_button = TRY(properties_widget->try_add<GUI::Button>(TRY("Change Font..."_string))); change_font_button->on_click = [this](auto) { auto picker = GUI::FontPicker::construct(nullptr, m_selected_font, false); if (picker->exec() == GUI::Dialog::ExecResult::OK) { - m_font_label->set_text(picker->font()->human_readable_name()); + m_font_label->set_text(String::from_deprecated_string(picker->font()->human_readable_name()).release_value_but_fixme_should_propagate_errors()); m_selected_font = picker->font(); m_text_editor->set_font(m_selected_font); m_editor->set_focus(true); diff --git a/Userland/Applications/PixelPaint/Tools/WandSelectTool.cpp b/Userland/Applications/PixelPaint/Tools/WandSelectTool.cpp index c7fe74a2fc..c00144c294 100644 --- a/Userland/Applications/PixelPaint/Tools/WandSelectTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/WandSelectTool.cpp @@ -77,7 +77,7 @@ ErrorOr<GUI::Widget*> WandSelectTool::get_properties_widget() threshold_container->set_fixed_height(20); (void)TRY(threshold_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto threshold_label = TRY(threshold_container->try_add<GUI::Label>("Threshold:")); + auto threshold_label = TRY(threshold_container->try_add<GUI::Label>(TRY("Threshold:"_string))); threshold_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); threshold_label->set_fixed_size(80, 20); @@ -95,7 +95,7 @@ ErrorOr<GUI::Widget*> WandSelectTool::get_properties_widget() (void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>()); auto mode_label = TRY(mode_container->try_add<GUI::Label>()); - mode_label->set_text("Mode:"); + mode_label->set_text("Mode:"_short_string); mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); mode_label->set_fixed_size(80, 20); diff --git a/Userland/Applications/PixelPaint/Tools/ZoomTool.cpp b/Userland/Applications/PixelPaint/Tools/ZoomTool.cpp index dc61602174..83c29511b2 100644 --- a/Userland/Applications/PixelPaint/Tools/ZoomTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/ZoomTool.cpp @@ -33,7 +33,7 @@ ErrorOr<GUI::Widget*> ZoomTool::get_properties_widget() sensitivity_container->set_fixed_height(20); (void)TRY(sensitivity_container->try_set_layout<GUI::HorizontalBoxLayout>()); - auto sensitivity_label = TRY(sensitivity_container->try_add<GUI::Label>("Sensitivity:")); + auto sensitivity_label = TRY(sensitivity_container->try_add<GUI::Label>(TRY("Sensitivity:"_string))); sensitivity_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); sensitivity_label->set_fixed_size(80, 20); diff --git a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp index dad1e03cb9..7d63df2a93 100644 --- a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp +++ b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp @@ -239,7 +239,7 @@ void SoundPlayerWidgetAdvancedView::shuffle_mode_changed(Player::ShuffleMode) void SoundPlayerWidgetAdvancedView::time_elapsed(int seconds) { - m_timestamp_label->set_text(DeprecatedString::formatted("Elapsed: {:02}:{:02}:{:02}", seconds / 3600, seconds / 60, seconds % 60)); + m_timestamp_label->set_text(String::formatted("Elapsed: {:02}:{:02}:{:02}", seconds / 3600, seconds / 60, seconds % 60).release_value_but_fixme_should_propagate_errors()); } void SoundPlayerWidgetAdvancedView::file_name_changed(StringView name) @@ -275,7 +275,7 @@ void SoundPlayerWidgetAdvancedView::sound_buffer_played(FixedArray<Audio::Sample void SoundPlayerWidgetAdvancedView::volume_changed(double volume) { - m_volume_label->set_text(DeprecatedString::formatted("{}%", static_cast<int>(volume * 100))); + m_volume_label->set_text(String::formatted("{}%", static_cast<int>(volume * 100)).release_value_but_fixme_should_propagate_errors()); } void SoundPlayerWidgetAdvancedView::playlist_loaded(StringView path, bool loaded) diff --git a/Userland/Applications/SpaceAnalyzer/ProgressWindow.cpp b/Userland/Applications/SpaceAnalyzer/ProgressWindow.cpp index 01b2b08b22..e9e5ac83ba 100644 --- a/Userland/Applications/SpaceAnalyzer/ProgressWindow.cpp +++ b/Userland/Applications/SpaceAnalyzer/ProgressWindow.cpp @@ -18,7 +18,7 @@ ErrorOr<NonnullRefPtr<ProgressWindow>> ProgressWindow::try_create(StringView tit main_widget->set_fill_with_background_color(true); TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>()); - auto label = TRY(main_widget->try_add<GUI::Label>("Analyzing storage space...")); + auto label = TRY(main_widget->try_add<GUI::Label>(TRY("Analyzing storage space..."_string))); label->set_fixed_height(22); window->m_progress_label = TRY(main_widget->try_add<GUI::Label>()); @@ -42,7 +42,7 @@ ProgressWindow::~ProgressWindow() = default; void ProgressWindow::update_progress_label(size_t files_encountered_count) { - m_progress_label->set_text(DeprecatedString::formatted("{} files...", files_encountered_count)); + m_progress_label->set_text(String::formatted("{} files...", files_encountered_count).release_value_but_fixme_should_propagate_errors()); // FIXME: Why is this necessary to make the window repaint? Core::EventLoop::current().pump(Core::EventLoop::WaitMode::PollForEvents); } diff --git a/Userland/Applications/Spreadsheet/CellTypeDialog.cpp b/Userland/Applications/Spreadsheet/CellTypeDialog.cpp index 90093fa841..59c516eb9a 100644 --- a/Userland/Applications/Spreadsheet/CellTypeDialog.cpp +++ b/Userland/Applications/Spreadsheet/CellTypeDialog.cpp @@ -209,7 +209,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector<Position> const& po auto& horizontal_alignment_label = horizontal_alignment_selection_container.add<GUI::Label>(); horizontal_alignment_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); - horizontal_alignment_label.set_text("Horizontal text alignment"); + horizontal_alignment_label.set_text("Horizontal text alignment"_string.release_value_but_fixme_should_propagate_errors()); auto& horizontal_combobox = alignment_tab.add<GUI::ComboBox>(); horizontal_combobox.set_only_allow_values_from_model(true); @@ -240,7 +240,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector<Position> const& po auto& vertical_alignment_label = vertical_alignment_container.add<GUI::Label>(); vertical_alignment_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); - vertical_alignment_label.set_text("Vertical text alignment"); + vertical_alignment_label.set_text("Vertical text alignment"_string.release_value_but_fixme_should_propagate_errors()); auto& vertical_combobox = alignment_tab.add<GUI::ComboBox>(); vertical_combobox.set_only_allow_values_from_model(true); @@ -281,7 +281,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector<Position> const& po auto& foreground_label = foreground_container.add<GUI::Label>(); foreground_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); - foreground_label.set_text("Static foreground color"); + foreground_label.set_text("Static foreground color"_string.release_value_but_fixme_should_propagate_errors()); auto& foreground_selector = foreground_container.add<GUI::ColorInput>(); if (m_static_format.foreground_color.has_value()) @@ -300,7 +300,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector<Position> const& po auto& background_label = background_container.add<GUI::Label>(); background_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); - background_label.set_text("Static background color"); + background_label.set_text("Static background color"_string.release_value_but_fixme_should_propagate_errors()); auto& background_selector = background_container.add<GUI::ColorInput>(); if (m_static_format.background_color.has_value()) diff --git a/Userland/Applications/Spreadsheet/ImportDialog.cpp b/Userland/Applications/Spreadsheet/ImportDialog.cpp index 55a00335bc..7b07765403 100644 --- a/Userland/Applications/Spreadsheet/ImportDialog.cpp +++ b/Userland/Applications/Spreadsheet/ImportDialog.cpp @@ -153,7 +153,7 @@ void CSVImportDialogPage::update_preview() m_previously_made_reader = make_reader(); if (!m_previously_made_reader.has_value()) { m_data_preview_table_view->set_model(nullptr); - m_data_preview_error_label->set_text("Could not read the given file"); + m_data_preview_error_label->set_text("Could not read the given file"_string.release_value_but_fixme_should_propagate_errors()); m_data_preview_widget->set_active_widget(m_data_preview_error_label); return; } @@ -161,7 +161,7 @@ void CSVImportDialogPage::update_preview() auto& reader = *m_previously_made_reader; if (reader.has_error()) { m_data_preview_table_view->set_model(nullptr); - m_data_preview_error_label->set_text(DeprecatedString::formatted("XSV parse error:\n{}", reader.error_string())); + m_data_preview_error_label->set_text(String::formatted("XSV parse error:\n{}", reader.error_string()).release_value_but_fixme_should_propagate_errors()); m_data_preview_widget->set_active_widget(m_data_preview_error_label); return; } diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp index 717ff58c1b..76edfaec2d 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp @@ -41,7 +41,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, Vector<NonnullR auto& top_bar = container.add<GUI::Frame>(); top_bar.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 1); top_bar.set_preferred_height(26); - auto& current_cell_label = top_bar.add<GUI::Label>(""); + auto& current_cell_label = top_bar.add<GUI::Label>(); current_cell_label.set_fixed_width(50); auto& help_button = top_bar.add<GUI::Button>(); @@ -361,7 +361,7 @@ void SpreadsheetWidget::setup_tabs(Vector<NonnullRefPtr<Sheet>> new_sheets) if (selection.size() == 1) { auto& position = selection.first(); - m_current_cell_label->set_text(position.to_cell_identifier(sheet)); + m_current_cell_label->set_text(String::from_deprecated_string(position.to_cell_identifier(sheet)).release_value_but_fixme_should_propagate_errors()); auto& cell = sheet.ensure(position); m_cell_value_editor->on_change = nullptr; @@ -382,7 +382,7 @@ void SpreadsheetWidget::setup_tabs(Vector<NonnullRefPtr<Sheet>> new_sheets) // There are many cells selected, change all of them. StringBuilder builder; builder.appendff("<{}>", selection.size()); - m_current_cell_label->set_text(builder.string_view()); + m_current_cell_label->set_text(builder.to_string().release_value_but_fixme_should_propagate_errors()); Vector<Cell&> cells; for (auto& position : selection) @@ -456,7 +456,7 @@ void SpreadsheetWidget::try_generate_tip_for_input_expression(StringView source, if (text.is_empty()) { m_inline_documentation_window->hide(); } else { - m_inline_documentation_label->set_text(move(text)); + m_inline_documentation_label->set_text(String::from_deprecated_string(text).release_value_but_fixme_should_propagate_errors()); m_inline_documentation_window->show(); } } @@ -524,7 +524,7 @@ void SpreadsheetWidget::load_file(String const& filename, Core::File& file) } m_cell_value_editor->on_change = nullptr; - m_current_cell_label->set_text(""); + m_current_cell_label->set_text({}); m_should_change_selected_cells = false; while (auto* widget = m_tab_widget->active_widget()) { m_tab_widget->remove_tab(*widget); @@ -549,7 +549,7 @@ void SpreadsheetWidget::import_sheets(String const& filename, Core::File& file) window()->set_modified(true); m_cell_value_editor->on_change = nullptr; - m_current_cell_label->set_text(""); + m_current_cell_label->set_text({}); m_should_change_selected_cells = false; while (auto* widget = m_tab_widget->active_widget()) { m_tab_widget->remove_tab(*widget); diff --git a/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp b/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp index e1543c0cbf..75e9229f54 100644 --- a/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp +++ b/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp @@ -45,7 +45,7 @@ MemoryStatsWidget::MemoryStatsWidget(GraphWidget* graph) set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 8, 0, 0 }, 3); - auto build_widgets_for_label = [this](DeprecatedString const& description) -> RefPtr<GUI::Label> { + auto build_widgets_for_label = [this](String const& description) -> RefPtr<GUI::Label> { auto& container = add<GUI::Widget>(); container.set_layout<GUI::HorizontalBoxLayout>(); container.set_fixed_size(275, 12); @@ -57,12 +57,12 @@ MemoryStatsWidget::MemoryStatsWidget(GraphWidget* graph) return label; }; - m_physical_pages_label = build_widgets_for_label("Physical memory:"); - m_physical_pages_committed_label = build_widgets_for_label("Committed memory:"); - m_kmalloc_space_label = build_widgets_for_label("Kernel heap:"); - m_kmalloc_count_label = build_widgets_for_label("Calls kmalloc:"); - m_kfree_count_label = build_widgets_for_label("Calls kfree:"); - m_kmalloc_difference_label = build_widgets_for_label("Difference:"); + m_physical_pages_label = build_widgets_for_label("Physical memory:"_string.release_value_but_fixme_should_propagate_errors()); + m_physical_pages_committed_label = build_widgets_for_label("Committed memory:"_string.release_value_but_fixme_should_propagate_errors()); + m_kmalloc_space_label = build_widgets_for_label("Kernel heap:"_string.release_value_but_fixme_should_propagate_errors()); + m_kmalloc_count_label = build_widgets_for_label("Calls kmalloc:"_string.release_value_but_fixme_should_propagate_errors()); + m_kfree_count_label = build_widgets_for_label("Calls kfree:"_string.release_value_but_fixme_should_propagate_errors()); + m_kmalloc_difference_label = build_widgets_for_label("Difference:"_string.release_value_but_fixme_should_propagate_errors()); refresh(); } @@ -125,12 +125,12 @@ void MemoryStatsWidget::refresh() u64 physical_pages_in_use = physical_allocated; u64 total_userphysical_and_swappable_pages = physical_allocated + physical_committed + physical_uncommitted; - m_kmalloc_space_label->set_text(DeprecatedString::formatted("{}/{}", human_readable_size(kmalloc_allocated), human_readable_size(kmalloc_bytes_total))); - m_physical_pages_label->set_text(DeprecatedString::formatted("{}/{}", human_readable_size(page_count_to_bytes(physical_pages_in_use)), human_readable_size(page_count_to_bytes(physical_pages_total)))); - m_physical_pages_committed_label->set_text(DeprecatedString::formatted("{}", human_readable_size(page_count_to_bytes(physical_committed)))); - m_kmalloc_count_label->set_text(DeprecatedString::formatted("{}", kmalloc_call_count)); - m_kfree_count_label->set_text(DeprecatedString::formatted("{}", kfree_call_count)); - m_kmalloc_difference_label->set_text(DeprecatedString::formatted("{:+}", kmalloc_call_count - kfree_call_count)); + m_kmalloc_space_label->set_text(String::formatted("{}/{}", human_readable_size(kmalloc_allocated), human_readable_size(kmalloc_bytes_total)).release_value_but_fixme_should_propagate_errors()); + m_physical_pages_label->set_text(String::formatted("{}/{}", human_readable_size(page_count_to_bytes(physical_pages_in_use)), human_readable_size(page_count_to_bytes(physical_pages_total))).release_value_but_fixme_should_propagate_errors()); + m_physical_pages_committed_label->set_text(String::formatted("{}", human_readable_size(page_count_to_bytes(physical_committed))).release_value_but_fixme_should_propagate_errors()); + m_kmalloc_count_label->set_text(String::formatted("{}", kmalloc_call_count).release_value_but_fixme_should_propagate_errors()); + m_kfree_count_label->set_text(String::formatted("{}", kfree_call_count).release_value_but_fixme_should_propagate_errors()); + m_kmalloc_difference_label->set_text(String::formatted("{:+}", kmalloc_call_count - kfree_call_count).release_value_but_fixme_should_propagate_errors()); // Because the initialization order of us and the graph is unknown, we might get a couple of updates where the graph widget lookup fails. // Therefore, we can retry indefinitely. (Should not be too much of a performance hit, as we don't update that often.) diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp index 96ae7a36c2..8ffe417bc9 100644 --- a/Userland/Applications/SystemMonitor/main.cpp +++ b/Userland/Applications/SystemMonitor/main.cpp @@ -542,7 +542,7 @@ ErrorOr<NonnullRefPtr<GUI::Window>> build_process_window(pid_t pid) main_widget->find_descendant_of_type_named<GUI::Label>("icon_label")->set_icon(icon_data.as_icon().bitmap_for_size(32)); } - main_widget->find_descendant_of_type_named<GUI::Label>("process_name")->set_text(DeprecatedString::formatted("{} (PID {})", process_index.sibling_at_column(ProcessModel::Column::Name).data().to_deprecated_string(), pid)); + main_widget->find_descendant_of_type_named<GUI::Label>("process_name")->set_text(String::formatted("{} (PID {})", process_index.sibling_at_column(ProcessModel::Column::Name).data().to_deprecated_string(), pid).release_value_but_fixme_should_propagate_errors()); main_widget->find_descendant_of_type_named<SystemMonitor::ProcessStateWidget>("process_state")->set_pid(pid); main_widget->find_descendant_of_type_named<SystemMonitor::ProcessFileDescriptorMapWidget>("open_files")->set_pid(pid); diff --git a/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp b/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp index df005586b1..5ef088abf1 100644 --- a/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp +++ b/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp @@ -101,13 +101,13 @@ TerminalSettingsViewWidget::TerminalSettingsViewWidget() else m_font = Gfx::FontDatabase::the().get_by_name(font_name); m_original_font = m_font; - font_text.set_text(m_font->human_readable_name()); + font_text.set_text(String::from_deprecated_string(m_font->human_readable_name()).release_value_but_fixme_should_propagate_errors()); font_text.set_font(m_font); font_button.on_click = [&](auto) { auto picker = GUI::FontPicker::construct(window(), m_font.ptr(), true); if (picker->exec() == GUI::Dialog::ExecResult::OK) { m_font = picker->font(); - font_text.set_text(m_font->human_readable_name()); + font_text.set_text(String::from_deprecated_string(m_font->human_readable_name()).release_value_but_fixme_should_propagate_errors()); font_text.set_font(m_font); Config::write_string("Terminal"sv, "Text"sv, "Font"sv, m_font->qualified_name()); set_modified(true); @@ -120,7 +120,7 @@ TerminalSettingsViewWidget::TerminalSettingsViewWidget() if (use_default_font) { font_selection.set_enabled(false); m_font = Gfx::FontDatabase::the().default_fixed_width_font(); - font_text.set_text(m_font->human_readable_name()); + font_text.set_text(String::from_deprecated_string(m_font->human_readable_name()).release_value_but_fixme_should_propagate_errors()); font_text.set_font(m_font); Config::write_string("Terminal"sv, "Text"sv, "Font"sv, m_font->qualified_name()); } else { diff --git a/Userland/Applications/ThemeEditor/MainWidget.cpp b/Userland/Applications/ThemeEditor/MainWidget.cpp index fe7df40623..a721bfc6b7 100644 --- a/Userland/Applications/ThemeEditor/MainWidget.cpp +++ b/Userland/Applications/ThemeEditor/MainWidget.cpp @@ -456,7 +456,7 @@ ErrorOr<void> MainWidget::add_property_tab(PropertyTab const& property_tab) TRY(row_widget->load_from_gml(alignment_property_gml)); auto& name_label = *row_widget->find_descendant_of_type_named<GUI::Label>("name"); - name_label.set_text(to_string(role)); + name_label.set_text(TRY(String::from_utf8(to_string(role)))); auto& alignment_picker = *row_widget->find_descendant_of_type_named<GUI::ComboBox>("combo_box"); alignment_picker.set_model(*m_alignment_model); @@ -473,7 +473,7 @@ ErrorOr<void> MainWidget::add_property_tab(PropertyTab const& property_tab) TRY(row_widget->load_from_gml(color_property_gml)); auto& name_label = *row_widget->find_descendant_of_type_named<GUI::Label>("name"); - name_label.set_text(to_string(role)); + name_label.set_text(TRY(String::from_utf8(to_string(role)))); auto& color_input = *row_widget->find_descendant_of_type_named<GUI::ColorInput>("color_input"); color_input.on_change = [&, role] { @@ -503,7 +503,7 @@ ErrorOr<void> MainWidget::add_property_tab(PropertyTab const& property_tab) TRY(row_widget->load_from_gml(metric_property_gml)); auto& name_label = *row_widget->find_descendant_of_type_named<GUI::Label>("name"); - name_label.set_text(to_string(role)); + name_label.set_text(TRY(String::from_utf8(to_string(role)))); auto& spin_box = *row_widget->find_descendant_of_type_named<GUI::SpinBox>("spin_box"); spin_box.on_change = [&, role](int value) { @@ -519,7 +519,7 @@ ErrorOr<void> MainWidget::add_property_tab(PropertyTab const& property_tab) TRY(row_widget->load_from_gml(path_property_gml)); auto& name_label = *row_widget->find_descendant_of_type_named<GUI::Label>("name"); - name_label.set_text(to_string(role)); + name_label.set_text(TRY(String::from_utf8(to_string(role)))); auto& path_input = *row_widget->find_descendant_of_type_named<GUI::TextBox>("path_input"); path_input.on_change = [&, role] { diff --git a/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp b/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp index 70e99f4ab3..e9854bd200 100644 --- a/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp +++ b/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp @@ -263,7 +263,7 @@ void VideoPlayerWidget::set_time_label(Time timestamp) string_builder.append(" / --:--:--"sv); } - m_timestamp_label->set_text(string_builder.string_view()); + m_timestamp_label->set_text(string_builder.to_string().release_value_but_fixme_should_propagate_errors()); } void VideoPlayerWidget::drop_event(GUI::DropEvent& event) diff --git a/Userland/Applications/Welcome/WelcomeWidget.cpp b/Userland/Applications/Welcome/WelcomeWidget.cpp index 3569c1a57f..7241a5379f 100644 --- a/Userland/Applications/Welcome/WelcomeWidget.cpp +++ b/Userland/Applications/Welcome/WelcomeWidget.cpp @@ -50,7 +50,7 @@ ErrorOr<void> WelcomeWidget::create_widgets() m_tip_index++; if (m_tip_index >= m_tips.size()) m_tip_index = 0; - m_tip_label->set_text(m_tips[m_tip_index].to_deprecated_string()); + m_tip_label->set_text(m_tips[m_tip_index]); }; m_help_button = find_descendant_of_type_named<GUI::Button>("help_button"); @@ -82,7 +82,7 @@ ErrorOr<void> WelcomeWidget::create_widgets() if (auto result = open_and_parse_tips_file(); result.is_error()) { auto path = TRY(String::formatted("{}/tips.txt", Core::StandardPaths::documents_directory())); auto error = TRY(String::formatted("Opening \"{}\" failed: {}", path, result.error())); - m_tip_label->set_text(error.to_deprecated_string()); + m_tip_label->set_text(error); warnln(error); } @@ -114,7 +114,7 @@ void WelcomeWidget::set_random_tip() return; m_tip_index = get_random_uniform(m_tips.size()); - m_tip_label->set_text(m_tips[m_tip_index].to_deprecated_string()); + m_tip_label->set_text(m_tips[m_tip_index]); } void WelcomeWidget::paint_event(GUI::PaintEvent& event) |