1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:38:10 +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

@ -266,7 +266,7 @@ void GLContextWidget::timer_event(Core::TimerEvent&)
if ((m_cycles % 30) == 0) { if ((m_cycles % 30) == 0) {
auto render_time = static_cast<double>(m_accumulated_time.to_milliseconds()) / 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; 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 = {}; m_accumulated_time = {};
glEnable(GL_LIGHT0); glEnable(GL_LIGHT0);

View file

@ -69,7 +69,7 @@ DownloadWidget::DownloadWidget(const URL& url)
m_browser_image->load_from_file("/res/graphics/download-animation.gif"sv); m_browser_image->load_from_file("/res/graphics/download-animation.gif"sv);
animation_container.add_spacer().release_value_but_fixme_should_propagate_errors(); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
source_label.set_fixed_height(16); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
m_progress_label->set_fixed_height(16); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
destination_label.set_fixed_height(16); 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("Downloaded "sv);
builder.append(human_readable_size(downloaded_size)); builder.append(human_readable_size(downloaded_size));
builder.appendff(" in {} sec", m_elapsed_timer.elapsed_time().to_seconds()); 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());
} }
{ {

View file

@ -152,9 +152,9 @@ void CalculatorWidget::update_display()
{ {
m_entry->set_text(m_keypad.to_deprecated_string()); m_entry->set_text(m_keypad.to_deprecated_string());
if (m_calculator.has_error()) if (m_calculator.has_error())
m_label->set_text("E"); m_label->set_text("E"_short_string);
else else
m_label->set_text(""); m_label->set_text({});
} }
void CalculatorWidget::keydown_event(GUI::KeyEvent& event) void CalculatorWidget::keydown_event(GUI::KeyEvent& event)

View file

@ -36,7 +36,7 @@ AddEventDialog::AddEventDialog(Core::DateTime date_time, Window* parent_window)
top_container.set_layout<GUI::VerticalBoxLayout>(4); top_container.set_layout<GUI::VerticalBoxLayout>(4);
top_container.set_fixed_height(45); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
add_label.set_fixed_height(14); add_label.set_fixed_height(14);
add_label.set_font(Gfx::FontDatabase::default_font().bold_variant()); add_label.set_font(Gfx::FontDatabase::default_font().bold_variant());

View file

@ -169,7 +169,7 @@ void CharacterMapWidget::did_change_font()
{ {
// No need to track glyph modifications by cloning // No need to track glyph modifications by cloning
m_glyph_map->GUI::AbstractScrollableWidget::set_font(font()); 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()); m_output_box->set_font(font());
} }

View file

@ -119,5 +119,5 @@ void ClockSettingsWidget::update_time_format_string()
void ClockSettingsWidget::update_clock_preview() 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());
} }

View file

@ -214,24 +214,24 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
app_name = af->name(); app_name = af->name();
auto& description_label = *widget->find_descendant_of_type_named<GUI::Label>("description"); 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"); 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 = [&] { executable_link_label.on_click = [&] {
LexicalPath path { executable_path }; LexicalPath path { executable_path };
Desktop::Launcher::open(URL::create_with_file_scheme(path.dirname(), path.basename())); 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"); 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 = [&] { coredump_link_label.on_click = [&] {
LexicalPath path { coredump_path }; LexicalPath path { coredump_path };
Desktop::Launcher::open(URL::create_with_file_scheme(path.dirname(), path.basename())); 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"); 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& progressbar = *widget->find_descendant_of_type_named<GUI::Progressbar>("progressbar");
auto& tab_widget = *widget->find_descendant_of_type_named<GUI::TabWidget>("tab_widget"); 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))); auto backtrace_tab = TRY(tab_widget.try_add_tab<GUI::Widget>(TRY("Backtrace"_string)));
TRY(backtrace_tab->try_set_layout<GUI::VerticalBoxLayout>(4)); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
backtrace_label->set_fixed_height(16); 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))); auto cpu_registers_tab = TRY(tab_widget.try_add_tab<GUI::Widget>(TRY("CPU Registers"_string)));
cpu_registers_tab->set_layout<GUI::VerticalBoxLayout>(4); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
cpu_registers_label->set_fixed_height(16); cpu_registers_label->set_fixed_height(16);

View file

@ -37,7 +37,7 @@ ErrorOr<void> DesktopSettingsWidget::create_frame()
}; };
auto& keyboard_shortcuts_label = *find_descendant_of_type_named<GUI::Label>("keyboard_shortcuts_label"); 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 {}; return {};
} }

View file

@ -72,7 +72,7 @@ ErrorOr<void> FontSettingsWidget::setup_interface()
static void update_label_with_font(GUI::Label& label, Gfx::Font const& font) 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); label.set_font(font);
} }

View file

@ -217,7 +217,7 @@ ErrorOr<void> MonitorSettingsWidget::selected_screen_index_or_resolution_changed
auto dpi_label_value = String::formatted("{} dpi", screen_dpi.value()); auto dpi_label_value = String::formatted("{} dpi", screen_dpi.value());
if (screen_dpi.has_value() && !dpi_label_value.is_error()) { 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_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); m_dpi_label->set_visible(true);
} else { } else {
m_dpi_label->set_visible(false); m_dpi_label->set_visible(false);

View file

@ -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"); RefPtr<GUI::Label> app_label = *main_widget->find_descendant_of_type_named<GUI::Label>("description");
DeprecatedString prompt; String prompt;
if (options.description.is_empty()) 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 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 = *main_widget->find_descendant_of_type_named<GUI::ImageWidget>("icon");
m_icon_image_widget->set_bitmap(app_icon.bitmap_for_size(32)); m_icon_image_widget->set_bitmap(app_icon.bitmap_for_size(32));

View file

@ -153,7 +153,7 @@ void DirectoryView::setup_model()
{ {
m_model->on_directory_change_error = [this](int, char const* error_string) { m_model->on_directory_change_error = [this](int, char const* error_string) {
auto failed_path = m_model->root_path(); 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); m_error_label->set_text(error_message);
set_active_widget(m_error_label); set_active_widget(m_error_label);

View file

@ -54,16 +54,16 @@ FileOperationProgressWidget::FileOperationProgressWidget(FileOperation operation
switch (m_operation) { switch (m_operation) {
case FileOperation::Copy: case FileOperation::Copy:
files_copied_label.set_text("Copying files..."); files_copied_label.set_text("Copying files..."_string.release_value_but_fixme_should_propagate_errors());
current_file_action_label.set_text("Copying: "); current_file_action_label.set_text("Copying: "_string.release_value_but_fixme_should_propagate_errors());
break; break;
case FileOperation::Move: case FileOperation::Move:
files_copied_label.set_text("Moving files..."); files_copied_label.set_text("Moving files..."_string.release_value_but_fixme_should_propagate_errors());
current_file_action_label.set_text("Moving: "); current_file_action_label.set_text("Moving: "_string.release_value_but_fixme_should_propagate_errors());
break; break;
case FileOperation::Delete: case FileOperation::Delete:
files_copied_label.set_text("Deleting files..."); files_copied_label.set_text("Deleting files..."_string.release_value_but_fixme_should_propagate_errors());
current_file_action_label.set_text("Deleting: "); current_file_action_label.set_text("Deleting: "_string.release_value_but_fixme_should_propagate_errors());
break; break;
default: default:
VERIFY_NOT_REACHED(); 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& 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"); 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) { switch (m_operation) {
case FileOperation::Copy: 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; break;
case FileOperation::Move: 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; break;
case FileOperation::Delete: 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; break;
default: default:
VERIFY_NOT_REACHED(); 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) { if (total_byte_count) {
window()->set_progress(100.0f * bytes_done / total_byte_count); window()->set_progress(100.0f * bytes_done / total_byte_count);

View file

@ -72,7 +72,7 @@ ErrorOr<void> PropertiesWindow::create_widgets(bool disable_rename)
}; };
auto* location = general_tab->find_descendant_of_type_named<GUI::LinkLabel>("location"); 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] { location->on_click = [this] {
Desktop::Launcher::open(URL::create_with_file_scheme(m_parent_path, m_name)); 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; m_old_mode = st.st_mode;
auto* type = general_tab->find_descendant_of_type_named<GUI::Label>("type"); 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)) { if (S_ISLNK(m_mode)) {
auto link_destination_or_error = FileSystem::read_link(m_path); auto link_destination_or_error = FileSystem::read_link(m_path);
if (link_destination_or_error.is_error()) { if (link_destination_or_error.is_error()) {
perror("readlink"); perror("readlink");
} else { } 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"); auto* link_location = general_tab->find_descendant_of_type_named<GUI::LinkLabel>("link_location");
link_location->set_text(link_destination); link_location->set_text(link_destination);
link_location->on_click = [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())); 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 = 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"); 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"); 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"); 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"); 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_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"); 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) { 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>()] { origin_event_loop->deferred_invoke([=, weak_this = make_weak_ptr<PropertiesWindow>()] {
if (auto strong_this = weak_this.strong_ref()) 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(); m_directory_statistics_calculator->start();

View file

@ -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 = find_descendant_of_type_named<GUI::TextBox>("preview_textbox");
m_preview_textbox->on_change = [&] { 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_label->set_text(preview);
}; };
m_preview_textbox->set_text(pangrams[0]); m_preview_textbox->set_text(pangrams[0]);

View file

@ -92,19 +92,19 @@ void MouseWidget::reset_default_values()
void MouseWidget::update_speed_label() 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() 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() void MouseWidget::update_switch_buttons_image_label()
{ {
if (m_switch_buttons_checkbox->is_checked()) { 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 { } 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);
} }
} }

View file

@ -387,7 +387,7 @@ PDF::PDFErrorOr<void> PDFViewerWidget::try_open_file(StringView path, NonnullOwn
TRY(document->initialize()); TRY(document->initialize());
TRY(m_viewer->set_document(document)); 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_enabled(true);
m_page_text_box->set_current_number(1, GUI::AllowCallback::No); m_page_text_box->set_current_number(1, GUI::AllowCallback::No);

View file

@ -38,7 +38,7 @@ ErrorOr<void> ExportProgressWindow::initialize_fallibles()
void ExportProgressWindow::set_filename(StringView filename) 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(); update();
} }

View file

@ -59,9 +59,9 @@ ErrorOr<void> MainWidget::initialize()
m_octave_container = TRY(m_keys_and_knobs_container->try_add<GUI::Widget>()); m_octave_container = TRY(m_keys_and_knobs_container->try_add<GUI::Widget>());
m_octave_container->set_preferred_width(GUI::SpecialDimension::Fit); m_octave_container->set_preferred_width(GUI::SpecialDimension::Fit);
TRY(m_octave_container->try_set_layout<GUI::VerticalBoxLayout>()); 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); 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); m_octave_value->set_preferred_width(GUI::SpecialDimension::Fit);
// FIXME: Implement vertical flipping in GUI::Slider, not here. // FIXME: Implement vertical flipping in GUI::Slider, not here.
@ -75,7 +75,7 @@ ErrorOr<void> MainWidget::initialize()
int new_octave = octave_max - value; int new_octave = octave_max - value;
set_octave_via_slider(new_octave); set_octave_via_slider(new_octave);
VERIFY(new_octave == m_track_manager.keyboard()->virtual_keyboard_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)); m_knobs_widget = TRY(m_keys_and_knobs_container->try_add<TrackControlsWidget>(m_track_manager, *this));

View file

@ -43,7 +43,7 @@ ErrorOr<void> PlayerWidget::initialize()
set_fill_with_background_color(true); set_fill_with_background_color(true);
TRY(m_track_number_choices.try_append("1")); 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); label->set_max_width(75);
m_track_dropdown = TRY(try_add<GUI::ComboBox>()); m_track_dropdown = TRY(try_add<GUI::ComboBox>());

View file

@ -15,11 +15,11 @@ ProcessorParameterWidget::ProcessorParameterWidget(DSP::ProcessorParameter& raw_
: m_parameter(raw_parameter) : m_parameter(raw_parameter)
{ {
set_layout<GUI::VerticalBoxLayout>(); 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()) { switch (raw_parameter.type()) {
case DSP::ParameterType::Range: { case DSP::ParameterType::Range: {
auto& parameter = static_cast<DSP::ProcessorRangeParameter&>(raw_parameter); 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); m_parameter_modifier = add<ProcessorParameterSlider>(Orientation::Vertical, parameter, m_value_label);
break; break;
} }

View file

@ -28,7 +28,7 @@ ProcessorParameterSlider::ProcessorParameterSlider(Orientation orientation, DSP:
} }
set_tooltip(m_parameter.name().to_deprecated_string()); set_tooltip(m_parameter.name().to_deprecated_string());
if (m_value_label != nullptr) 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) { on_change = [this](auto raw_value) {
if (m_currently_setting_from_ui) if (m_currently_setting_from_ui)
@ -43,13 +43,9 @@ ProcessorParameterSlider::ProcessorParameterSlider(Orientation orientation, DSP:
m_parameter.set_value(real_value); m_parameter.set_value(real_value);
if (m_value_label) { if (m_value_label) {
double value = static_cast<double>(m_parameter); double value = static_cast<double>(m_parameter);
DeprecatedString label_text = DeprecatedString::formatted("{:.2f}", value); auto label_text = String::formatted("{:.2f}", value).release_value_but_fixme_should_propagate_errors();
// FIXME: This is a magic value; we know that with normal font sizes, the label will disappear starting from approximately this length. m_value_label->set_autosize(true);
// Can we do this dynamically? m_value_label->set_text(label_text);
if (label_text.length() > 7)
m_value_label->set_text(DeprecatedString::formatted("{:.0f}", value));
else
m_value_label->set_text(label_text);
} }
m_currently_setting_from_ui = false; m_currently_setting_from_ui = false;
}; };

View file

@ -56,11 +56,11 @@ SamplerWidget::SamplerWidget(TrackManager& track_manager)
if (!open_path.has_value()) if (!open_path.has_value())
return; return;
// TODO: We don't actually load the sample. // 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_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_recorded_sample_name->set_text_alignment(Gfx::TextAlignment::CenterLeft);
m_wave_editor = add<WaveEditor>(m_track_manager); m_wave_editor = add<WaveEditor>(m_track_manager);

View file

@ -32,7 +32,7 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window)
main_widget->set_layout<GUI::VerticalBoxLayout>(4); 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); name_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
m_name_textbox = main_widget->add<GUI::TextBox>(); 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); auto default_name = Config::read_string("PixelPaint"sv, "NewImage"sv, "Name"sv);
m_name_textbox->set_text(default_name); 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); width_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
auto& width_spinbox = main_widget->add<GUI::SpinBox>(); 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); height_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
auto& height_spinbox = main_widget->add<GUI::SpinBox>(); auto& height_spinbox = main_widget->add<GUI::SpinBox>();
@ -80,7 +80,7 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window)
return BackgroundIndex::Custom; 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); background_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
auto& background_color_combo = main_widget->add<GUI::ComboBox>(); auto& background_color_combo = main_widget->add<GUI::ComboBox>();
auto& background_color_input = main_widget->add<GUI::ColorInput>(); auto& background_color_input = main_widget->add<GUI::ColorInput>();

View file

@ -24,7 +24,7 @@ CreateNewLayerDialog::CreateNewLayerDialog(Gfx::IntSize suggested_size, GUI::Win
main_widget->set_fill_with_background_color(true); main_widget->set_fill_with_background_color(true);
main_widget->set_layout<GUI::VerticalBoxLayout>(4); 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); name_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
m_name_textbox = main_widget->add<GUI::TextBox>(); 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(); 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); width_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
auto& width_spinbox = main_widget->add<GUI::SpinBox>(); 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); height_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
auto& height_spinbox = main_widget->add<GUI::SpinBox>(); auto& height_spinbox = main_widget->add<GUI::SpinBox>();

View file

@ -64,7 +64,7 @@ FilterGallery::FilterGallery(GUI::Window* parent_window, ImageEditor* editor)
auto settings_widget_or_error = m_selected_filter->get_settings_widget(); auto settings_widget_or_error = m_selected_filter->get_settings_widget();
if (settings_widget_or_error.is_error()) { 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; m_selected_filter_config_widget = m_error_label;
} else { } else {
m_selected_filter_config_widget = settings_widget_or_error.release_value(); m_selected_filter_config_widget = settings_widget_or_error.release_value();

View file

@ -40,7 +40,7 @@ ErrorOr<RefPtr<GUI::Widget>> Bloom::get_settings_widget()
auto settings_widget = TRY(GUI::Widget::try_create()); auto settings_widget = TRY(GUI::Widget::try_create());
TRY(settings_widget->try_set_layout<GUI::VerticalBoxLayout>()); 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_font_weight(Gfx::FontWeight::Bold);
name_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); name_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
name_label->set_fixed_height(20); 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); luma_lower_container->set_fixed_height(50);
TRY(luma_lower_container->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 4, 0, 4, 0 })); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
luma_lower_label->set_fixed_height(20); 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); radius_container->set_fixed_height(50);
TRY(radius_container->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 4, 0, 4, 0 })); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
radius_label->set_fixed_height(20); radius_label->set_fixed_height(20);

View file

@ -42,7 +42,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
auto settings_widget = TRY(GUI::Widget::try_create()); auto settings_widget = TRY(GUI::Widget::try_create());
TRY(settings_widget->try_set_layout<GUI::VerticalBoxLayout>()); 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_font_weight(Gfx::FontWeight::Bold);
name_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); name_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
name_label->set_fixed_height(10); 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); m_radius_container->set_fixed_height(20);
TRY(m_radius_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 4, 0, 4, 0 })); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
radius_label->set_fixed_size(50, 20); 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_fixed_height(20);
radius_x_container->set_layout<GUI::HorizontalBoxLayout>(); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
radius_x_label->set_fixed_size(50, 20); 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); radius_y_container->set_fixed_height(20);
TRY(radius_y_container->try_set_layout<GUI::HorizontalBoxLayout>()); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
radius_y_label->set_fixed_size(50, 20); 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); angle_container->set_fixed_height(20);
TRY(angle_container->try_set_layout<GUI::HorizontalBoxLayout>()); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
angle_label->set_fixed_size(60, 20); 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); magnitude_container->set_fixed_height(20);
TRY(magnitude_container->try_set_layout<GUI::HorizontalBoxLayout>()); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
magnitude_label->set_fixed_size(60, 20); magnitude_label->set_fixed_size(60, 20);

View file

@ -28,7 +28,7 @@ ErrorOr<RefPtr<GUI::Widget>> Filter::get_settings_widget()
auto settings_widget = TRY(GUI::Widget::try_create()); auto settings_widget = TRY(GUI::Widget::try_create());
(void)TRY(settings_widget->try_set_layout<GUI::VerticalBoxLayout>()); (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); name_label->set_text_alignment(Gfx::TextAlignment::TopLeft);
(void)TRY(settings_widget->try_add<GUI::Widget>()); (void)TRY(settings_widget->try_add<GUI::Widget>());

View file

@ -34,7 +34,7 @@ ErrorOr<RefPtr<GUI::Widget>> HueAndSaturation::get_settings_widget()
(void)TRY(settings_widget->try_set_layout<GUI::VerticalBoxLayout>()); (void)TRY(settings_widget->try_set_layout<GUI::VerticalBoxLayout>());
auto add_slider = [&](auto name, int min, int max, auto member) -> ErrorOr<void> { 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_font_weight(Gfx::FontWeight::Bold);
name_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); name_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
name_label->set_fixed_height(20); name_label->set_fixed_height(20);
@ -49,9 +49,9 @@ ErrorOr<RefPtr<GUI::Widget>> HueAndSaturation::get_settings_widget()
return {}; return {};
}; };
TRY(add_slider("Hue", -180, 180, &HueAndSaturation::m_hue)); TRY(add_slider("Hue"sv, -180, 180, &HueAndSaturation::m_hue));
TRY(add_slider("Saturation", -100, 100, &HueAndSaturation::m_saturation)); TRY(add_slider("Saturation"sv, -100, 100, &HueAndSaturation::m_saturation));
TRY(add_slider("Lightness", -100, 100, &HueAndSaturation::m_lightness)); TRY(add_slider("Lightness"sv, -100, 100, &HueAndSaturation::m_lightness));
m_settings_widget = settings_widget; m_settings_widget = settings_widget;
} }

View file

@ -23,7 +23,7 @@ ErrorOr<RefPtr<GUI::Widget>> Sepia::get_settings_widget()
auto settings_widget = TRY(GUI::Widget::try_create()); auto settings_widget = TRY(GUI::Widget::try_create());
TRY(settings_widget->try_set_layout<GUI::VerticalBoxLayout>()); 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_font_weight(Gfx::FontWeight::Bold);
name_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); name_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
name_label->set_fixed_height(20); name_label->set_fixed_height(20);
@ -32,7 +32,7 @@ ErrorOr<RefPtr<GUI::Widget>> Sepia::get_settings_widget()
amount_container->set_fixed_height(20); amount_container->set_fixed_height(20);
TRY(amount_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 4, 0, 4, 0 })); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
amount_label->set_fixed_size(50, 20); amount_label->set_fixed_size(50, 20);

View file

@ -30,7 +30,7 @@ LayerPropertiesWidget::LayerPropertiesWidget()
name_container.set_fixed_height(20); name_container.set_fixed_height(20);
name_container.set_layout<GUI::HorizontalBoxLayout>(); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
name_label.set_fixed_size(80, 20); name_label.set_fixed_size(80, 20);
@ -45,7 +45,7 @@ LayerPropertiesWidget::LayerPropertiesWidget()
opacity_container.set_fixed_height(20); opacity_container.set_fixed_height(20);
opacity_container.set_layout<GUI::HorizontalBoxLayout>(); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
opacity_label.set_fixed_size(80, 20); opacity_label.set_fixed_size(80, 20);

View file

@ -41,7 +41,7 @@ LevelsDialog::LevelsDialog(GUI::Window* parent_window, ImageEditor* editor)
VERIFY(cancel_button); VERIFY(cancel_button);
VERIFY(m_editor->active_layer()); 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_gamma_slider->set_value(100);
m_brightness_slider->on_change = [this](auto) { m_brightness_slider->on_change = [this](auto) {

View file

@ -36,7 +36,7 @@ void ToolPropertiesWidget::set_active_tool(Tool* tool)
auto active_tool_widget_or_error = tool->get_properties_widget(); auto active_tool_widget_or_error = tool->get_properties_widget();
if (active_tool_widget_or_error.is_error()) { if (active_tool_widget_or_error.is_error()) {
m_active_tool_widget = nullptr; 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); m_tool_widget_stack->set_active_widget(m_error_label);
return; return;
} }

View file

@ -147,7 +147,7 @@ ErrorOr<GUI::Widget*> BrushTool::get_properties_widget()
size_container->set_fixed_height(20); size_container->set_fixed_height(20);
(void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>()); (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_text_alignment(Gfx::TextAlignment::CenterLeft);
size_label->set_fixed_size(80, 20); size_label->set_fixed_size(80, 20);
@ -167,7 +167,7 @@ ErrorOr<GUI::Widget*> BrushTool::get_properties_widget()
hardness_container->set_fixed_height(20); hardness_container->set_fixed_height(20);
(void)TRY(hardness_container->try_set_layout<GUI::HorizontalBoxLayout>()); (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_text_alignment(Gfx::TextAlignment::CenterLeft);
hardness_label->set_fixed_size(80, 20); hardness_label->set_fixed_size(80, 20);

View file

@ -71,7 +71,7 @@ ErrorOr<GUI::Widget*> BucketTool::get_properties_widget()
threshold_container->set_fixed_height(20); threshold_container->set_fixed_height(20);
(void)TRY(threshold_container->try_set_layout<GUI::HorizontalBoxLayout>()); (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_text_alignment(Gfx::TextAlignment::CenterLeft);
threshold_label->set_fixed_size(80, 20); threshold_label->set_fixed_size(80, 20);

View file

@ -135,7 +135,7 @@ ErrorOr<GUI::Widget*> CloneTool::get_properties_widget()
size_container->set_fixed_height(20); size_container->set_fixed_height(20);
(void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>()); (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_text_alignment(Gfx::TextAlignment::CenterLeft);
size_label->set_fixed_size(80, 20); size_label->set_fixed_size(80, 20);
@ -154,7 +154,7 @@ ErrorOr<GUI::Widget*> CloneTool::get_properties_widget()
hardness_container->set_fixed_height(20); hardness_container->set_fixed_height(20);
(void)TRY(hardness_container->try_set_layout<GUI::HorizontalBoxLayout>()); (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_text_alignment(Gfx::TextAlignment::CenterLeft);
hardness_label->set_fixed_size(80, 20); hardness_label->set_fixed_size(80, 20);

View file

@ -136,7 +136,7 @@ ErrorOr<GUI::Widget*> EllipseTool::get_properties_widget()
thickness_container->set_fixed_height(20); thickness_container->set_fixed_height(20);
(void)TRY(thickness_container->try_set_layout<GUI::HorizontalBoxLayout>()); (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_text_alignment(Gfx::TextAlignment::CenterLeft);
thickness_label->set_fixed_size(80, 20); 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>()); auto mode_container = TRY(properties_widget->try_add<GUI::Widget>());
mode_container->set_fixed_height(70); mode_container->set_fixed_height(70);
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>()); (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_text_alignment(Gfx::TextAlignment::CenterLeft);
auto mode_radio_container = TRY(mode_container->try_add<GUI::Widget>()); 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); aspect_container->set_fixed_height(20);
(void)TRY(aspect_container->try_set_layout<GUI::HorizontalBoxLayout>()); (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_text_alignment(Gfx::TextAlignment::CenterLeft);
aspect_label->set_fixed_size(80, 20); 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_text_alignment(Gfx::TextAlignment::Center);
multiply_label->set_fixed_size(10, 20); multiply_label->set_fixed_size(10, 20);

View file

@ -63,7 +63,7 @@ ErrorOr<GUI::Widget*> EraseTool::get_properties_widget()
size_container->set_fixed_height(20); size_container->set_fixed_height(20);
(void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>()); (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_text_alignment(Gfx::TextAlignment::CenterLeft);
size_label->set_fixed_size(80, 20); size_label->set_fixed_size(80, 20);
@ -81,7 +81,7 @@ ErrorOr<GUI::Widget*> EraseTool::get_properties_widget()
hardness_container->set_fixed_height(20); hardness_container->set_fixed_height(20);
(void)TRY(hardness_container->try_set_layout<GUI::HorizontalBoxLayout>()); (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_text_alignment(Gfx::TextAlignment::CenterLeft);
hardness_label->set_fixed_size(80, 20); 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>()); auto mode_container = TRY(properties_widget->try_add<GUI::Widget>());
mode_container->set_fixed_height(46); mode_container->set_fixed_height(46);
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>()); (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_text_alignment(Gfx::TextAlignment::CenterLeft);
mode_label->set_fixed_size(80, 20); mode_label->set_fixed_size(80, 20);

View file

@ -206,7 +206,7 @@ ErrorOr<GUI::Widget*> GradientTool::get_properties_widget()
auto mode_container = TRY(properties_widget->try_add<GUI::Widget>()); auto mode_container = TRY(properties_widget->try_add<GUI::Widget>());
mode_container->set_fixed_height(20); mode_container->set_fixed_height(20);
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>()); (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_text_alignment(Gfx::TextAlignment::CenterLeft);
mode_label->set_fixed_size(80, 20); mode_label->set_fixed_size(80, 20);
@ -236,7 +236,7 @@ ErrorOr<GUI::Widget*> GradientTool::get_properties_widget()
size_container->set_fixed_height(20); size_container->set_fixed_height(20);
(void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>()); (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_text_alignment(Gfx::TextAlignment::CenterLeft);
size_label->set_fixed_size(80, 20); 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); 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); hardness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
auto hardness_slider = TRY(hardness_container->try_add<GUI::HorizontalOpacitySlider>()); auto hardness_slider = TRY(hardness_container->try_add<GUI::HorizontalOpacitySlider>());

View file

@ -186,7 +186,7 @@ ErrorOr<GUI::Widget*> GuideTool::get_properties_widget()
snapping_container->set_fixed_height(20); snapping_container->set_fixed_height(20);
(void)TRY(snapping_container->try_set_layout<GUI::HorizontalBoxLayout>()); (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_text_alignment(Gfx::TextAlignment::CenterLeft);
snapping_label->set_fixed_size(80, 20); snapping_label->set_fixed_size(80, 20);
snapping_label->set_tooltip("Press Shift to snap"); snapping_label->set_tooltip("Press Shift to snap");

View file

@ -185,7 +185,7 @@ ErrorOr<GUI::Widget*> LassoSelectTool::get_properties_widget()
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>()); (void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto mode_label = TRY(mode_container->try_add<GUI::Label>()); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
mode_label->set_fixed_size(80, 20); mode_label->set_fixed_size(80, 20);

View file

@ -129,7 +129,7 @@ ErrorOr<GUI::Widget*> LineTool::get_properties_widget()
thickness_container->set_fixed_height(20); thickness_container->set_fixed_height(20);
(void)TRY(thickness_container->try_set_layout<GUI::HorizontalBoxLayout>()); (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_text_alignment(Gfx::TextAlignment::CenterLeft);
thickness_label->set_fixed_size(80, 20); thickness_label->set_fixed_size(80, 20);
@ -146,7 +146,7 @@ ErrorOr<GUI::Widget*> LineTool::get_properties_widget()
mode_container->set_fixed_height(20); mode_container->set_fixed_height(20);
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>()); (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_text_alignment(Gfx::TextAlignment::CenterLeft);
mode_label->set_fixed_size(80, 20); mode_label->set_fixed_size(80, 20);

View file

@ -298,7 +298,7 @@ ErrorOr<GUI::Widget*> MoveTool::get_properties_widget()
auto selection_mode_container = TRY(properties_widget->try_add<GUI::Widget>()); auto selection_mode_container = TRY(properties_widget->try_add<GUI::Widget>());
(void)TRY(selection_mode_container->try_set_layout<GUI::HorizontalBoxLayout>()); (void)TRY(selection_mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
selection_mode_container->set_fixed_height(46); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
selection_mode_label->set_fixed_size(80, 40); selection_mode_label->set_fixed_size(80, 40);

View file

@ -45,7 +45,7 @@ ErrorOr<GUI::Widget*> PenTool::get_properties_widget()
size_container->set_fixed_height(20); size_container->set_fixed_height(20);
(void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>()); (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_text_alignment(Gfx::TextAlignment::CenterLeft);
size_label->set_fixed_size(80, 20); size_label->set_fixed_size(80, 20);

View file

@ -190,7 +190,7 @@ ErrorOr<GUI::Widget*> PolygonalSelectTool::get_properties_widget()
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>()); (void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto mode_label = TRY(mode_container->try_add<GUI::Label>()); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
mode_label->set_fixed_size(80, 20); mode_label->set_fixed_size(80, 20);

View file

@ -161,7 +161,7 @@ ErrorOr<GUI::Widget*> RectangleSelectTool::get_properties_widget()
(void)TRY(feather_container->try_set_layout<GUI::HorizontalBoxLayout>()); (void)TRY(feather_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto feather_label = TRY(feather_container->try_add<GUI::Label>()); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
feather_label->set_fixed_size(80, 20); 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>()); (void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto mode_label = TRY(mode_container->try_add<GUI::Label>()); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
mode_label->set_fixed_size(80, 20); mode_label->set_fixed_size(80, 20);

View file

@ -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_slider = [this, thickness_or_radius_label, thickness_or_radius_slider] {
auto update_values = [&](auto label, int value, int range_min, int range_max = 10) { 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_range(range_min, range_max);
thickness_or_radius_slider->set_value(value); thickness_or_radius_slider->set_value(value);
}; };
if (m_fill_mode == FillMode::RoundedCorners) if (m_fill_mode == FillMode::RoundedCorners)
update_values("Radius:", m_corner_radius, 0, 50); update_values("Radius:"sv, m_corner_radius, 0, 50);
else else
update_values("Thickness:", m_thickness, 1); update_values("Thickness:"sv, m_thickness, 1);
}; };
update_slider(); update_slider();
@ -181,7 +181,7 @@ ErrorOr<GUI::Widget*> RectangleTool::get_properties_widget()
auto mode_container = TRY(properties_widget->try_add<GUI::Widget>()); auto mode_container = TRY(properties_widget->try_add<GUI::Widget>());
mode_container->set_fixed_height(90); mode_container->set_fixed_height(90);
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>()); (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_text_alignment(Gfx::TextAlignment::CenterLeft);
mode_label->set_fixed_size(30, 20); 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>()); (void)TRY(aspect_container->try_set_layout<GUI::VerticalBoxLayout>());
aspect_container->set_fixed_width(75); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
aspect_label->set_fixed_size(75, 20); 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_text_alignment(Gfx::TextAlignment::Center);
multiply_label->set_fixed_size(10, 20); multiply_label->set_fixed_size(10, 20);

View file

@ -100,7 +100,7 @@ ErrorOr<GUI::Widget*> SprayTool::get_properties_widget()
size_container->set_fixed_height(20); size_container->set_fixed_height(20);
(void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>()); (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_text_alignment(Gfx::TextAlignment::CenterLeft);
size_label->set_fixed_size(80, 20); size_label->set_fixed_size(80, 20);
@ -117,7 +117,7 @@ ErrorOr<GUI::Widget*> SprayTool::get_properties_widget()
density_container->set_fixed_height(20); density_container->set_fixed_height(20);
(void)TRY(density_container->try_set_layout<GUI::HorizontalBoxLayout>()); (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_text_alignment(Gfx::TextAlignment::CenterLeft);
density_label->set_fixed_size(80, 20); density_label->set_fixed_size(80, 20);

View file

@ -111,16 +111,16 @@ ErrorOr<GUI::Widget*> TextTool::get_properties_widget()
auto properties_widget = TRY(GUI::Widget::try_create()); auto properties_widget = TRY(GUI::Widget::try_create());
(void)TRY(properties_widget->try_set_layout<GUI::VerticalBoxLayout>()); (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); 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))); auto change_font_button = TRY(properties_widget->try_add<GUI::Button>(TRY("Change Font..."_string)));
change_font_button->on_click = [this](auto) { change_font_button->on_click = [this](auto) {
auto picker = GUI::FontPicker::construct(nullptr, m_selected_font, false); auto picker = GUI::FontPicker::construct(nullptr, m_selected_font, false);
if (picker->exec() == GUI::Dialog::ExecResult::OK) { 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_selected_font = picker->font();
m_text_editor->set_font(m_selected_font); m_text_editor->set_font(m_selected_font);
m_editor->set_focus(true); m_editor->set_focus(true);

View file

@ -77,7 +77,7 @@ ErrorOr<GUI::Widget*> WandSelectTool::get_properties_widget()
threshold_container->set_fixed_height(20); threshold_container->set_fixed_height(20);
(void)TRY(threshold_container->try_set_layout<GUI::HorizontalBoxLayout>()); (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_text_alignment(Gfx::TextAlignment::CenterLeft);
threshold_label->set_fixed_size(80, 20); 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>()); (void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto mode_label = TRY(mode_container->try_add<GUI::Label>()); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
mode_label->set_fixed_size(80, 20); mode_label->set_fixed_size(80, 20);

View file

@ -33,7 +33,7 @@ ErrorOr<GUI::Widget*> ZoomTool::get_properties_widget()
sensitivity_container->set_fixed_height(20); sensitivity_container->set_fixed_height(20);
(void)TRY(sensitivity_container->try_set_layout<GUI::HorizontalBoxLayout>()); (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_text_alignment(Gfx::TextAlignment::CenterLeft);
sensitivity_label->set_fixed_size(80, 20); sensitivity_label->set_fixed_size(80, 20);

View file

@ -239,7 +239,7 @@ void SoundPlayerWidgetAdvancedView::shuffle_mode_changed(Player::ShuffleMode)
void SoundPlayerWidgetAdvancedView::time_elapsed(int seconds) 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) 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) 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) void SoundPlayerWidgetAdvancedView::playlist_loaded(StringView path, bool loaded)

View file

@ -18,7 +18,7 @@ ErrorOr<NonnullRefPtr<ProgressWindow>> ProgressWindow::try_create(StringView tit
main_widget->set_fill_with_background_color(true); main_widget->set_fill_with_background_color(true);
TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>()); 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); label->set_fixed_height(22);
window->m_progress_label = TRY(main_widget->try_add<GUI::Label>()); 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) 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? // FIXME: Why is this necessary to make the window repaint?
Core::EventLoop::current().pump(Core::EventLoop::WaitMode::PollForEvents); Core::EventLoop::current().pump(Core::EventLoop::WaitMode::PollForEvents);
} }

View file

@ -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>(); 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_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>(); auto& horizontal_combobox = alignment_tab.add<GUI::ComboBox>();
horizontal_combobox.set_only_allow_values_from_model(true); 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>(); auto& vertical_alignment_label = vertical_alignment_container.add<GUI::Label>();
vertical_alignment_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); 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>(); auto& vertical_combobox = alignment_tab.add<GUI::ComboBox>();
vertical_combobox.set_only_allow_values_from_model(true); 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>(); auto& foreground_label = foreground_container.add<GUI::Label>();
foreground_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); 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>(); auto& foreground_selector = foreground_container.add<GUI::ColorInput>();
if (m_static_format.foreground_color.has_value()) 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>(); auto& background_label = background_container.add<GUI::Label>();
background_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); 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>(); auto& background_selector = background_container.add<GUI::ColorInput>();
if (m_static_format.background_color.has_value()) if (m_static_format.background_color.has_value())

View file

@ -153,7 +153,7 @@ void CSVImportDialogPage::update_preview()
m_previously_made_reader = make_reader(); m_previously_made_reader = make_reader();
if (!m_previously_made_reader.has_value()) { if (!m_previously_made_reader.has_value()) {
m_data_preview_table_view->set_model(nullptr); 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); m_data_preview_widget->set_active_widget(m_data_preview_error_label);
return; return;
} }
@ -161,7 +161,7 @@ void CSVImportDialogPage::update_preview()
auto& reader = *m_previously_made_reader; auto& reader = *m_previously_made_reader;
if (reader.has_error()) { if (reader.has_error()) {
m_data_preview_table_view->set_model(nullptr); 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); m_data_preview_widget->set_active_widget(m_data_preview_error_label);
return; return;
} }

View file

@ -41,7 +41,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, Vector<NonnullR
auto& top_bar = container.add<GUI::Frame>(); auto& top_bar = container.add<GUI::Frame>();
top_bar.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 1); top_bar.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 1);
top_bar.set_preferred_height(26); 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); current_cell_label.set_fixed_width(50);
auto& help_button = top_bar.add<GUI::Button>(); 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) { if (selection.size() == 1) {
auto& position = selection.first(); 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); auto& cell = sheet.ensure(position);
m_cell_value_editor->on_change = nullptr; 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. // There are many cells selected, change all of them.
StringBuilder builder; StringBuilder builder;
builder.appendff("<{}>", selection.size()); 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; Vector<Cell&> cells;
for (auto& position : selection) for (auto& position : selection)
@ -456,7 +456,7 @@ void SpreadsheetWidget::try_generate_tip_for_input_expression(StringView source,
if (text.is_empty()) { if (text.is_empty()) {
m_inline_documentation_window->hide(); m_inline_documentation_window->hide();
} else { } 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(); 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_cell_value_editor->on_change = nullptr;
m_current_cell_label->set_text(""); m_current_cell_label->set_text({});
m_should_change_selected_cells = false; m_should_change_selected_cells = false;
while (auto* widget = m_tab_widget->active_widget()) { while (auto* widget = m_tab_widget->active_widget()) {
m_tab_widget->remove_tab(*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); window()->set_modified(true);
m_cell_value_editor->on_change = nullptr; 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; m_should_change_selected_cells = false;
while (auto* widget = m_tab_widget->active_widget()) { while (auto* widget = m_tab_widget->active_widget()) {
m_tab_widget->remove_tab(*widget); m_tab_widget->remove_tab(*widget);

View file

@ -45,7 +45,7 @@ MemoryStatsWidget::MemoryStatsWidget(GraphWidget* graph)
set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 8, 0, 0 }, 3); 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>(); auto& container = add<GUI::Widget>();
container.set_layout<GUI::HorizontalBoxLayout>(); container.set_layout<GUI::HorizontalBoxLayout>();
container.set_fixed_size(275, 12); container.set_fixed_size(275, 12);
@ -57,12 +57,12 @@ MemoryStatsWidget::MemoryStatsWidget(GraphWidget* graph)
return label; return label;
}; };
m_physical_pages_label = build_widgets_for_label("Physical memory:"); 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:"); 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:"); 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:"); 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:"); 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:"); m_kmalloc_difference_label = build_widgets_for_label("Difference:"_string.release_value_but_fixme_should_propagate_errors());
refresh(); refresh();
} }
@ -125,12 +125,12 @@ void MemoryStatsWidget::refresh()
u64 physical_pages_in_use = physical_allocated; u64 physical_pages_in_use = physical_allocated;
u64 total_userphysical_and_swappable_pages = physical_allocated + physical_committed + physical_uncommitted; 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_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(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_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(DeprecatedString::formatted("{}", human_readable_size(page_count_to_bytes(physical_committed)))); 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(DeprecatedString::formatted("{}", kmalloc_call_count)); m_kmalloc_count_label->set_text(String::formatted("{}", kmalloc_call_count).release_value_but_fixme_should_propagate_errors());
m_kfree_count_label->set_text(DeprecatedString::formatted("{}", kfree_call_count)); m_kfree_count_label->set_text(String::formatted("{}", kfree_call_count).release_value_but_fixme_should_propagate_errors());
m_kmalloc_difference_label->set_text(DeprecatedString::formatted("{:+}", kmalloc_call_count - kfree_call_count)); 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. // 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.) // Therefore, we can retry indefinitely. (Should not be too much of a performance hit, as we don't update that often.)

View file

@ -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>("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::ProcessStateWidget>("process_state")->set_pid(pid);
main_widget->find_descendant_of_type_named<SystemMonitor::ProcessFileDescriptorMapWidget>("open_files")->set_pid(pid); main_widget->find_descendant_of_type_named<SystemMonitor::ProcessFileDescriptorMapWidget>("open_files")->set_pid(pid);

View file

@ -101,13 +101,13 @@ TerminalSettingsViewWidget::TerminalSettingsViewWidget()
else else
m_font = Gfx::FontDatabase::the().get_by_name(font_name); m_font = Gfx::FontDatabase::the().get_by_name(font_name);
m_original_font = m_font; 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_text.set_font(m_font);
font_button.on_click = [&](auto) { font_button.on_click = [&](auto) {
auto picker = GUI::FontPicker::construct(window(), m_font.ptr(), true); auto picker = GUI::FontPicker::construct(window(), m_font.ptr(), true);
if (picker->exec() == GUI::Dialog::ExecResult::OK) { if (picker->exec() == GUI::Dialog::ExecResult::OK) {
m_font = picker->font(); 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); font_text.set_font(m_font);
Config::write_string("Terminal"sv, "Text"sv, "Font"sv, m_font->qualified_name()); Config::write_string("Terminal"sv, "Text"sv, "Font"sv, m_font->qualified_name());
set_modified(true); set_modified(true);
@ -120,7 +120,7 @@ TerminalSettingsViewWidget::TerminalSettingsViewWidget()
if (use_default_font) { if (use_default_font) {
font_selection.set_enabled(false); font_selection.set_enabled(false);
m_font = Gfx::FontDatabase::the().default_fixed_width_font(); 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); font_text.set_font(m_font);
Config::write_string("Terminal"sv, "Text"sv, "Font"sv, m_font->qualified_name()); Config::write_string("Terminal"sv, "Text"sv, "Font"sv, m_font->qualified_name());
} else { } else {

View file

@ -456,7 +456,7 @@ ErrorOr<void> MainWidget::add_property_tab(PropertyTab const& property_tab)
TRY(row_widget->load_from_gml(alignment_property_gml)); TRY(row_widget->load_from_gml(alignment_property_gml));
auto& name_label = *row_widget->find_descendant_of_type_named<GUI::Label>("name"); 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"); auto& alignment_picker = *row_widget->find_descendant_of_type_named<GUI::ComboBox>("combo_box");
alignment_picker.set_model(*m_alignment_model); 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)); TRY(row_widget->load_from_gml(color_property_gml));
auto& name_label = *row_widget->find_descendant_of_type_named<GUI::Label>("name"); 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"); auto& color_input = *row_widget->find_descendant_of_type_named<GUI::ColorInput>("color_input");
color_input.on_change = [&, role] { 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)); TRY(row_widget->load_from_gml(metric_property_gml));
auto& name_label = *row_widget->find_descendant_of_type_named<GUI::Label>("name"); 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"); auto& spin_box = *row_widget->find_descendant_of_type_named<GUI::SpinBox>("spin_box");
spin_box.on_change = [&, role](int value) { 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)); TRY(row_widget->load_from_gml(path_property_gml));
auto& name_label = *row_widget->find_descendant_of_type_named<GUI::Label>("name"); 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"); auto& path_input = *row_widget->find_descendant_of_type_named<GUI::TextBox>("path_input");
path_input.on_change = [&, role] { path_input.on_change = [&, role] {

View file

@ -263,7 +263,7 @@ void VideoPlayerWidget::set_time_label(Time timestamp)
string_builder.append(" / --:--:--"sv); 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) void VideoPlayerWidget::drop_event(GUI::DropEvent& event)

View file

@ -50,7 +50,7 @@ ErrorOr<void> WelcomeWidget::create_widgets()
m_tip_index++; m_tip_index++;
if (m_tip_index >= m_tips.size()) if (m_tip_index >= m_tips.size())
m_tip_index = 0; 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"); 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()) { if (auto result = open_and_parse_tips_file(); result.is_error()) {
auto path = TRY(String::formatted("{}/tips.txt", Core::StandardPaths::documents_directory())); auto path = TRY(String::formatted("{}/tips.txt", Core::StandardPaths::documents_directory()));
auto error = TRY(String::formatted("Opening \"{}\" failed: {}", path, result.error())); 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); warnln(error);
} }
@ -114,7 +114,7 @@ void WelcomeWidget::set_random_tip()
return; return;
m_tip_index = get_random_uniform(m_tips.size()); 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) void WelcomeWidget::paint_event(GUI::PaintEvent& event)

View file

@ -63,7 +63,7 @@ GalleryWidget::GalleryWidget()
}; };
m_frame_shape_combobox->on_return_pressed = [&]() { m_frame_shape_combobox->on_return_pressed = [&]() {
m_enabled_label->set_text(m_frame_shape_combobox->text()); m_enabled_label->set_text(String::from_deprecated_string(m_frame_shape_combobox->text()).release_value_but_fixme_should_propagate_errors());
}; };
m_thickness_spinbox = basics_tab->find_descendant_of_type_named<GUI::SpinBox>("thickness_spinbox"); m_thickness_spinbox = basics_tab->find_descendant_of_type_named<GUI::SpinBox>("thickness_spinbox");

View file

@ -30,7 +30,7 @@ DisassemblyWidget::DisassemblyWidget()
m_top_container->set_layout<GUI::HorizontalBoxLayout>(); m_top_container->set_layout<GUI::HorizontalBoxLayout>();
m_top_container->set_fixed_height(20); m_top_container->set_fixed_height(20);
m_function_name_label = m_top_container->add<GUI::Label>(""); m_function_name_label = m_top_container->add<GUI::Label>();
m_disassembly_view = add<GUI::TableView>(); m_disassembly_view = add<GUI::TableView>();
@ -49,9 +49,9 @@ void DisassemblyWidget::update_state(Debug::DebugSession const& debug_session, P
return; return;
auto containing_function = lib->debug_info->get_containing_function(regs.ip() - lib->base_address); auto containing_function = lib->debug_info->get_containing_function(regs.ip() - lib->base_address);
if (containing_function.has_value()) if (containing_function.has_value())
m_function_name_label->set_text(containing_function.value().name); m_function_name_label->set_text(String::from_deprecated_string(containing_function.value().name).release_value_but_fixme_should_propagate_errors());
else else
m_function_name_label->set_text("<missing>"); m_function_name_label->set_text("<missing>"_string.release_value_but_fixme_should_propagate_errors());
show_disassembly(); show_disassembly();
} else { } else {
hide_disassembly("No disassembly to show for this function"); hide_disassembly("No disassembly to show for this function");
@ -61,7 +61,7 @@ void DisassemblyWidget::update_state(Debug::DebugSession const& debug_session, P
void DisassemblyWidget::program_stopped() void DisassemblyWidget::program_stopped()
{ {
m_disassembly_view->set_model({}); m_disassembly_view->set_model({});
m_function_name_label->set_text(""); m_function_name_label->set_text({});
hide_disassembly("Program isn't running"); hide_disassembly("Program isn't running");
} }

View file

@ -32,7 +32,7 @@ GitCommitDialog::GitCommitDialog(GUI::Window* parent)
auto line = m_message_editor->cursor().line() + 1; auto line = m_message_editor->cursor().line() + 1;
auto col = m_message_editor->cursor().column(); auto col = m_message_editor->cursor().column();
m_line_and_col_label->set_text(DeprecatedString::formatted("Line: {}, Col: {}", line, col)); m_line_and_col_label->set_text(String::formatted("Line: {}, Col: {}", line, col).release_value_but_fixme_should_propagate_errors());
}; };
m_commit_button->set_enabled(!m_message_editor->text().is_empty() && on_commit); m_commit_button->set_enabled(!m_message_editor->text().is_empty() && on_commit);

View file

@ -113,18 +113,18 @@ void NewProjectDialog::update_dialog()
m_input_valid = true; m_input_valid = true;
if (project_template) { if (project_template) {
m_description_label->set_text(project_template->description()); m_description_label->set_text(String::from_deprecated_string(project_template->description()).release_value_but_fixme_should_propagate_errors());
} else { } else {
m_description_label->set_text("Select a project template to continue."); m_description_label->set_text("Select a project template to continue."_string.release_value_but_fixme_should_propagate_errors());
m_input_valid = false; m_input_valid = false;
} }
auto maybe_project_path = get_project_full_path(); auto maybe_project_path = get_project_full_path();
if (maybe_project_path.has_value()) { if (maybe_project_path.has_value()) {
m_full_path_label->set_text(maybe_project_path.value()); m_full_path_label->set_text(String::from_deprecated_string(maybe_project_path.value()).release_value_but_fixme_should_propagate_errors());
} else { } else {
m_full_path_label->set_text("Invalid name or creation directory."); m_full_path_label->set_text("Invalid name or creation directory."_string.release_value_but_fixme_should_propagate_errors());
m_input_valid = false; m_input_valid = false;
} }

View file

@ -22,19 +22,19 @@ void GMLPreviewWidget::load_gml(DeprecatedString const& gml)
if (gml.is_empty()) { if (gml.is_empty()) {
auto& label = add<GUI::Label>(); auto& label = add<GUI::Label>();
label.set_text("Open a .gml file to show the preview"); label.set_text("Open a .gml file to show the preview"_string.release_value_but_fixme_should_propagate_errors());
return; return;
} }
// FIXME: Parsing errors happen while the user is typing. What should we do about them? // FIXME: Parsing errors happen while the user is typing. What should we do about them?
(void)load_from_gml(gml, [](DeprecatedString const& name) -> ErrorOr<NonnullRefPtr<Core::Object>> { (void)load_from_gml(gml, [](DeprecatedString const& name) -> ErrorOr<NonnullRefPtr<Core::Object>> {
return GUI::Label::try_create(DeprecatedString::formatted("{} is not registered as a GML element!", name)); return GUI::Label::try_create(TRY(String::formatted("{} is not registered as a GML element!", name)));
}); });
if (children().is_empty()) { if (children().is_empty()) {
auto& label = add<GUI::Label>(); auto& label = add<GUI::Label>();
label.set_text("Failed to load GML!"); label.set_text("Failed to load GML!"_string.release_value_but_fixme_should_propagate_errors());
} }
} }

View file

@ -36,7 +36,7 @@ GitWidget::GitWidget()
refresh_button.on_click = [this](int) { refresh(); }; refresh_button.on_click = [this](int) { refresh(); };
auto& unstaged_label = unstaged_header.add<GUI::Label>(); auto& unstaged_label = unstaged_header.add<GUI::Label>();
unstaged_label.set_text("Unstaged"); unstaged_label.set_text("Unstaged"_string.release_value_but_fixme_should_propagate_errors());
unstaged_header.set_fixed_height(20); unstaged_header.set_fixed_height(20);
m_unstaged_files = unstaged.add<GitFilesView>( m_unstaged_files = unstaged.add<GitFilesView>(
@ -64,7 +64,7 @@ GitWidget::GitWidget()
commit_button.on_click = [this](int) { commit(); }; commit_button.on_click = [this](int) { commit(); };
auto& staged_label = staged_header.add<GUI::Label>(); auto& staged_label = staged_header.add<GUI::Label>();
staged_label.set_text("Staged"); staged_label.set_text("Staged"_short_string);
staged_header.set_fixed_height(20); staged_header.set_fixed_height(20);
m_staged_files = staged.add<GitFilesView>( m_staged_files = staged.add<GitFilesView>(

View file

@ -317,11 +317,11 @@ static bool prompt_to_stop_profiling(pid_t pid, DeprecatedString const& process_
widget->set_fill_with_background_color(true); widget->set_fill_with_background_color(true);
widget->set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 0, 0, 16 }); widget->set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 0, 0, 16 });
auto& timer_label = widget->add<GUI::Label>("..."); auto& timer_label = widget->add<GUI::Label>("..."_short_string);
Core::ElapsedTimer clock; Core::ElapsedTimer clock;
clock.start(); clock.start();
auto update_timer = Core::Timer::create_repeating(100, [&] { auto update_timer = Core::Timer::create_repeating(100, [&] {
timer_label.set_text(DeprecatedString::formatted("{:.1} seconds", static_cast<float>(clock.elapsed()) / 1000.0f)); timer_label.set_text(String::formatted("{:.1} seconds", static_cast<float>(clock.elapsed()) / 1000.0f).release_value_but_fixme_should_propagate_errors());
}).release_value_but_fixme_should_propagate_errors(); }).release_value_but_fixme_should_propagate_errors();
update_timer->start(); update_timer->start();

View file

@ -32,7 +32,7 @@ GameSizeDialog::GameSizeDialog(GUI::Window* parent, size_t board_size, size_t ta
board_size_spinbox->set_value(m_board_size); board_size_spinbox->set_value(m_board_size);
auto tile_value_label = main_widget->find_descendant_of_type_named<GUI::Label>("tile_value_label"); auto tile_value_label = main_widget->find_descendant_of_type_named<GUI::Label>("tile_value_label");
tile_value_label->set_text(DeprecatedString::number(target_tile())); tile_value_label->set_text(String::number(target_tile()).release_value_but_fixme_should_propagate_errors());
auto target_spinbox = main_widget->find_descendant_of_type_named<GUI::SpinBox>("target_spinbox"); auto target_spinbox = main_widget->find_descendant_of_type_named<GUI::SpinBox>("target_spinbox");
target_spinbox->set_max(Game::max_power_for_board(m_board_size)); target_spinbox->set_max(Game::max_power_for_board(m_board_size));
target_spinbox->set_value(m_target_tile_power); target_spinbox->set_value(m_target_tile_power);
@ -44,7 +44,7 @@ GameSizeDialog::GameSizeDialog(GUI::Window* parent, size_t board_size, size_t ta
target_spinbox->on_change = [this, tile_value_label](auto value) { target_spinbox->on_change = [this, tile_value_label](auto value) {
m_target_tile_power = value; m_target_tile_power = value;
tile_value_label->set_text(DeprecatedString::number(target_tile())); tile_value_label->set_text(String::number(target_tile()).release_value_but_fixme_should_propagate_errors());
}; };
auto evil_ai_checkbox = main_widget->find_descendant_of_type_named<GUI::CheckBox>("evil_ai_checkbox"); auto evil_ai_checkbox = main_widget->find_descendant_of_type_named<GUI::CheckBox>("evil_ai_checkbox");

View file

@ -27,7 +27,7 @@ SettingsDialog::SettingsDialog(GUI::Window* parent, DeprecatedString player_name
auto& name_box = main_widget->add<GUI::Widget>(); auto& name_box = main_widget->add<GUI::Widget>();
name_box.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 4); name_box.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 4);
auto& name_label = name_box.add<GUI::Label>("Name:"); auto& name_label = name_box.add<GUI::Label>("Name:"_short_string);
name_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); name_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
auto& textbox = name_box.add<GUI::TextBox>(); auto& textbox = name_box.add<GUI::TextBox>();

View file

@ -137,7 +137,7 @@ void Field::initialize()
m_timer = Core::Timer::create_repeating( m_timer = Core::Timer::create_repeating(
1000, [this] { 1000, [this] {
++m_time_elapsed; ++m_time_elapsed;
m_time_label.set_text(human_readable_digital_time(m_time_elapsed)); m_time_label.set_text(String::from_deprecated_string(human_readable_digital_time(m_time_elapsed)).release_value_but_fixme_should_propagate_errors());
}, },
this) this)
.release_value_but_fixme_should_propagate_errors(); .release_value_but_fixme_should_propagate_errors();
@ -213,9 +213,9 @@ void Field::reset()
m_first_click = true; m_first_click = true;
set_updates_enabled(false); set_updates_enabled(false);
m_time_elapsed = 0; m_time_elapsed = 0;
m_time_label.set_text("00:00"); m_time_label.set_text("00:00"_short_string);
m_flags_left = m_mine_count; m_flags_left = m_mine_count;
m_flag_label.set_text(DeprecatedString::number(m_flags_left)); m_flag_label.set_text(String::number(m_flags_left).release_value_but_fixme_should_propagate_errors());
m_timer->stop(); m_timer->stop();
set_greedy_for_hits(false); set_greedy_for_hits(false);
set_face(Face::Default); set_face(Face::Default);
@ -461,7 +461,7 @@ void Field::set_flag(Square& square, bool flag)
} }
square.has_flag = flag; square.has_flag = flag;
m_flag_label.set_text(DeprecatedString::number(m_flags_left)); m_flag_label.set_text(String::number(m_flags_left).release_value_but_fixme_should_propagate_errors());
square.button->set_icon(square.has_flag ? m_flag_bitmap : nullptr); square.button->set_icon(square.has_flag ? m_flag_bitmap : nullptr);
square.button->update(); square.button->update();
} }
@ -473,7 +473,7 @@ void Field::on_square_middle_clicked(Square& square)
if (square.has_flag) { if (square.has_flag) {
++m_flags_left; ++m_flags_left;
square.has_flag = false; square.has_flag = false;
m_flag_label.set_text(DeprecatedString::number(m_flags_left)); m_flag_label.set_text(String::number(m_flags_left).release_value_but_fixme_should_propagate_errors());
} }
square.is_considering = !square.is_considering; square.is_considering = !square.is_considering;
square.button->set_icon(square.is_considering ? m_consider_bitmap : nullptr); square.button->set_icon(square.is_considering ? m_consider_bitmap : nullptr);

View file

@ -36,10 +36,10 @@ ErrorOr<NonnullRefPtr<AboutDialog>> AboutDialog::try_create(String name, String
icon_wrapper->set_visible(false); icon_wrapper->set_visible(false);
} }
widget->find_descendant_of_type_named<GUI::Label>("name")->set_text(name.to_deprecated_string()); widget->find_descendant_of_type_named<GUI::Label>("name")->set_text(name);
// If we are displaying a dialog for an application, insert 'SerenityOS' below the application name // If we are displaying a dialog for an application, insert 'SerenityOS' below the application name
widget->find_descendant_of_type_named<GUI::Label>("serenity_os")->set_visible(name != "SerenityOS"); widget->find_descendant_of_type_named<GUI::Label>("serenity_os")->set_visible(name != "SerenityOS");
widget->find_descendant_of_type_named<GUI::Label>("version")->set_text(version.to_deprecated_string()); widget->find_descendant_of_type_named<GUI::Label>("version")->set_text(version);
auto ok_button = widget->find_descendant_of_type_named<DialogButton>("ok_button"); auto ok_button = widget->find_descendant_of_type_named<DialogButton>("ok_button");
ok_button->on_click = [dialog](auto) { ok_button->on_click = [dialog](auto) {

View file

@ -27,7 +27,7 @@ class Application::TooltipWindow final : public Window {
public: public:
void set_tooltip(DeprecatedString const& tooltip) void set_tooltip(DeprecatedString const& tooltip)
{ {
m_label->set_text(Gfx::parse_ampersand_string(tooltip)); m_label->set_text(String::from_deprecated_string(Gfx::parse_ampersand_string(tooltip)).release_value_but_fixme_should_propagate_errors());
int tooltip_width = m_label->effective_min_size().width().as_int() + 10; int tooltip_width = m_label->effective_min_size().width().as_int() + 10;
int line_count = m_label->text().count("\n"sv); int line_count = m_label->text().count("\n"sv);
int font_size = m_label->font().pixel_size_rounded_up(); int font_size = m_label->font().pixel_size_rounded_up();

View file

@ -109,7 +109,7 @@ AutocompleteBox::AutocompleteBox(TextEditor& editor)
apply_suggestion(); apply_suggestion();
}; };
m_no_suggestions_view = main_widget->add<GUI::Label>("No suggestions"); m_no_suggestions_view = main_widget->add<GUI::Label>("No suggestions"_string.release_value_but_fixme_should_propagate_errors());
} }
void AutocompleteBox::update_suggestions(Vector<CodeComprehension::AutocompleteResultEntry>&& suggestions) void AutocompleteBox::update_suggestions(Vector<CodeComprehension::AutocompleteResultEntry>&& suggestions)

View file

@ -332,7 +332,7 @@ void ColorPicker::build_ui_custom(Widget& root_container)
auto& html_label = html_container.add<GUI::Label>(); auto& html_label = html_container.add<GUI::Label>();
html_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); html_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
html_label.set_preferred_width(48); html_label.set_preferred_width(48);
html_label.set_text("HTML:"); html_label.set_text("HTML:"_short_string);
m_html_text = html_container.add<GUI::TextBox>(); m_html_text = html_container.add<GUI::TextBox>();
m_html_text->set_text(m_color_has_alpha_channel ? m_color.to_deprecated_string() : m_color.to_deprecated_string_without_alpha()); m_html_text->set_text(m_color_has_alpha_channel ? m_color.to_deprecated_string() : m_color.to_deprecated_string_without_alpha());
@ -388,16 +388,16 @@ void ColorPicker::build_ui_custom(Widget& root_container)
}; };
if (component == Red) { if (component == Red) {
rgb_label.set_text("Red:"); rgb_label.set_text("Red:"_short_string);
m_red_spinbox = spinbox; m_red_spinbox = spinbox;
} else if (component == Green) { } else if (component == Green) {
rgb_label.set_text("Green:"); rgb_label.set_text("Green:"_short_string);
m_green_spinbox = spinbox; m_green_spinbox = spinbox;
} else if (component == Blue) { } else if (component == Blue) {
rgb_label.set_text("Blue:"); rgb_label.set_text("Blue:"_short_string);
m_blue_spinbox = spinbox; m_blue_spinbox = spinbox;
} else if (component == Alpha) { } else if (component == Alpha) {
rgb_label.set_text("Alpha:"); rgb_label.set_text("Alpha:"_short_string);
m_alpha_spinbox = spinbox; m_alpha_spinbox = spinbox;
} }
}; };

View file

@ -272,7 +272,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St
}; };
m_model->on_directory_change_error = [&](int, char const* error_string) { m_model->on_directory_change_error = [&](int, char const* error_string) {
m_error_label->set_text(DeprecatedString::formatted("Could not open {}:\n{}", m_model->root_path(), error_string)); m_error_label->set_text(String::formatted("Could not open {}:\n{}", m_model->root_path(), error_string).release_value_but_fixme_should_propagate_errors());
m_view->set_active_widget(m_error_label); m_view->set_active_widget(m_error_label);
m_view->view_as_icons_action().set_enabled(false); m_view->view_as_icons_action().set_enabled(false);

View file

@ -93,7 +93,7 @@ void IncrementalSearchBanner::search(TextEditor::SearchDirection direction)
auto needle = m_search_textbox->text(); auto needle = m_search_textbox->text();
if (needle.is_empty()) { if (needle.is_empty()) {
m_editor->reset_search_results(); m_editor->reset_search_results();
m_index_label->set_text(DeprecatedString::empty()); m_index_label->set_text({});
return; return;
} }
@ -107,9 +107,9 @@ void IncrementalSearchBanner::search(TextEditor::SearchDirection direction)
auto result = m_editor->find_text(needle, direction, m_wrap_search, false, m_match_case); auto result = m_editor->find_text(needle, direction, m_wrap_search, false, m_match_case);
index = m_editor->search_result_index().value_or(0) + 1; index = m_editor->search_result_index().value_or(0) + 1;
if (result.is_valid()) if (result.is_valid())
m_index_label->set_text(DeprecatedString::formatted("{} of {}", index, m_editor->search_results().size())); m_index_label->set_text(String::formatted("{} of {}", index, m_editor->search_results().size()).release_value_but_fixme_should_propagate_errors());
else else
m_index_label->set_text(DeprecatedString::empty()); m_index_label->set_text({});
} }
void IncrementalSearchBanner::paint_event(PaintEvent& event) void IncrementalSearchBanner::paint_event(PaintEvent& event)

View file

@ -151,7 +151,7 @@ ErrorOr<void> InputBox::build()
m_prompt_label->set_autosize(true); m_prompt_label->set_autosize(true);
m_prompt_label->set_text_wrapping(Gfx::TextWrapping::DontWrap); m_prompt_label->set_text_wrapping(Gfx::TextWrapping::DontWrap);
m_prompt_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); m_prompt_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
m_prompt_label->set_text(move(m_prompt).to_deprecated_string()); m_prompt_label->set_text(move(m_prompt));
} }
switch (m_input_type) { switch (m_input_type) {

View file

@ -16,7 +16,7 @@ REGISTER_WIDGET(GUI, Label)
namespace GUI { namespace GUI {
Label::Label(DeprecatedString text) Label::Label(String text)
: m_text(move(text)) : m_text(move(text))
{ {
REGISTER_TEXT_ALIGNMENT_PROPERTY("text_alignment", text_alignment, set_text_alignment); REGISTER_TEXT_ALIGNMENT_PROPERTY("text_alignment", text_alignment, set_text_alignment);
@ -31,7 +31,7 @@ Label::Label(DeprecatedString text)
set_foreground_role(Gfx::ColorRole::WindowText); set_foreground_role(Gfx::ColorRole::WindowText);
REGISTER_DEPRECATED_STRING_PROPERTY("text", text, set_text); REGISTER_STRING_PROPERTY("text", text, set_text);
REGISTER_BOOL_PROPERTY("autosize", is_autosize, set_autosize); REGISTER_BOOL_PROPERTY("autosize", is_autosize, set_autosize);
REGISTER_WRITE_ONLY_STRING_PROPERTY("icon", set_icon_from_path); REGISTER_WRITE_ONLY_STRING_PROPERTY("icon", set_icon_from_path);
} }
@ -54,7 +54,7 @@ void Label::set_icon(Gfx::Bitmap const* icon)
update(); update();
} }
void Label::set_icon_from_path(DeprecatedString const& path) void Label::set_icon_from_path(StringView path)
{ {
auto maybe_bitmap = Gfx::Bitmap::load_from_file(path); auto maybe_bitmap = Gfx::Bitmap::load_from_file(path);
if (maybe_bitmap.is_error()) { if (maybe_bitmap.is_error()) {
@ -64,7 +64,7 @@ void Label::set_icon_from_path(DeprecatedString const& path)
set_icon(maybe_bitmap.release_value()); set_icon(maybe_bitmap.release_value());
} }
void Label::set_text(DeprecatedString text) void Label::set_text(String text)
{ {
if (text == m_text) if (text == m_text)
return; return;

View file

@ -19,11 +19,11 @@ class Label : public Frame {
public: public:
virtual ~Label() override = default; virtual ~Label() override = default;
DeprecatedString text() const { return m_text; } String const& text() const { return m_text; }
void set_text(DeprecatedString); void set_text(String);
void set_icon(Gfx::Bitmap const*); void set_icon(Gfx::Bitmap const*);
void set_icon_from_path(DeprecatedString const&); void set_icon_from_path(StringView);
Gfx::Bitmap const* icon() const { return m_icon.ptr(); } Gfx::Bitmap const* icon() const { return m_icon.ptr(); }
Gfx::TextAlignment text_alignment() const { return m_text_alignment; } Gfx::TextAlignment text_alignment() const { return m_text_alignment; }
@ -46,7 +46,7 @@ public:
Gfx::IntRect text_rect() const; Gfx::IntRect text_rect() const;
protected: protected:
explicit Label(DeprecatedString text = {}); explicit Label(String text = {});
virtual void paint_event(PaintEvent&) override; virtual void paint_event(PaintEvent&) override;
virtual void did_change_font() override; virtual void did_change_font() override;
@ -55,7 +55,7 @@ protected:
private: private:
void size_to_fit(); void size_to_fit();
DeprecatedString m_text; String m_text;
RefPtr<Gfx::Bitmap const> m_icon; RefPtr<Gfx::Bitmap const> m_icon;
Gfx::TextAlignment m_text_alignment { Gfx::TextAlignment::Center }; Gfx::TextAlignment m_text_alignment { Gfx::TextAlignment::Center };
Gfx::TextWrapping m_text_wrapping { Gfx::TextWrapping::Wrap }; Gfx::TextWrapping m_text_wrapping { Gfx::TextWrapping::Wrap };

View file

@ -19,7 +19,7 @@ REGISTER_WIDGET(GUI, LinkLabel)
namespace GUI { namespace GUI {
LinkLabel::LinkLabel(DeprecatedString text) LinkLabel::LinkLabel(String text)
: Label(move(text)) : Label(move(text))
{ {
set_foreground_role(Gfx::ColorRole::Link); set_foreground_role(Gfx::ColorRole::Link);
@ -102,7 +102,7 @@ void LinkLabel::did_change_text()
void LinkLabel::update_tooltip_if_needed() void LinkLabel::update_tooltip_if_needed()
{ {
if (width() < font().width(text())) { if (width() < font().width(text())) {
set_tooltip(text()); set_tooltip(text().to_deprecated_string());
} else { } else {
set_tooltip({}); set_tooltip({});
} }

View file

@ -17,7 +17,7 @@ public:
Function<void()> on_click; Function<void()> on_click;
private: private:
explicit LinkLabel(DeprecatedString text = {}); explicit LinkLabel(String text = {});
virtual void mousemove_event(MouseEvent&) override; virtual void mousemove_event(MouseEvent&) override;
virtual void mousedown_event(MouseEvent&) override; virtual void mousedown_event(MouseEvent&) override;

View file

@ -87,7 +87,7 @@ ErrorOr<Dialog::ExecResult> MessageBox::try_ask_about_unsaved_changes(Window* pa
void MessageBox::set_text(String text) void MessageBox::set_text(String text)
{ {
m_text_label->set_text(move(text).to_deprecated_string()); m_text_label->set_text(move(text));
} }
MessageBox::MessageBox(Window* parent_window, Type type, InputType input_type) MessageBox::MessageBox(Window* parent_window, Type type, InputType input_type)

View file

@ -30,10 +30,10 @@ PasswordInputDialog::PasswordInputDialog(Window* parent_window, DeprecatedString
key_icon_label.set_icon(Gfx::Bitmap::load_from_file("/res/icons/32x32/key.png"sv).release_value_but_fixme_should_propagate_errors()); key_icon_label.set_icon(Gfx::Bitmap::load_from_file("/res/icons/32x32/key.png"sv).release_value_but_fixme_should_propagate_errors());
auto& server_label = *widget->find_descendant_of_type_named<GUI::Label>("server_label"); auto& server_label = *widget->find_descendant_of_type_named<GUI::Label>("server_label");
server_label.set_text(move(server)); server_label.set_text(String::from_deprecated_string(server).release_value_but_fixme_should_propagate_errors());
auto& username_label = *widget->find_descendant_of_type_named<GUI::Label>("username_label"); auto& username_label = *widget->find_descendant_of_type_named<GUI::Label>("username_label");
username_label.set_text(move(username)); username_label.set_text(String::from_deprecated_string(username).release_value_but_fixme_should_propagate_errors());
auto& password_box = *widget->find_descendant_of_type_named<GUI::PasswordBox>("password_box"); auto& password_box = *widget->find_descendant_of_type_named<GUI::PasswordBox>("password_box");

View file

@ -37,12 +37,12 @@ CoverWizardPage::CoverWizardPage()
void CoverWizardPage::set_header_text(DeprecatedString const& text) void CoverWizardPage::set_header_text(DeprecatedString const& text)
{ {
m_header_label->set_text(text); m_header_label->set_text(String::from_deprecated_string(text).release_value_but_fixme_should_propagate_errors());
} }
void CoverWizardPage::set_body_text(DeprecatedString const& text) void CoverWizardPage::set_body_text(DeprecatedString const& text)
{ {
m_body_label->set_text(text); m_body_label->set_text(String::from_deprecated_string(text).release_value_but_fixme_should_propagate_errors());
} }
} }

View file

@ -25,11 +25,11 @@ WizardPage::WizardPage(DeprecatedString const& title_text, DeprecatedString cons
header_widget.set_fixed_height(58); header_widget.set_fixed_height(58);
header_widget.set_layout<VerticalBoxLayout>(GUI::Margins { 15, 30, 0 }); header_widget.set_layout<VerticalBoxLayout>(GUI::Margins { 15, 30, 0 });
m_title_label = header_widget.add<Label>(title_text); m_title_label = header_widget.add<Label>(String::from_deprecated_string(title_text).release_value_but_fixme_should_propagate_errors());
m_title_label->set_font(Gfx::FontDatabase::default_font().bold_variant()); m_title_label->set_font(Gfx::FontDatabase::default_font().bold_variant());
m_title_label->set_fixed_height(m_title_label->font().pixel_size_rounded_up() + 2); m_title_label->set_fixed_height(m_title_label->font().pixel_size_rounded_up() + 2);
m_title_label->set_text_alignment(Gfx::TextAlignment::TopLeft); m_title_label->set_text_alignment(Gfx::TextAlignment::TopLeft);
m_subtitle_label = header_widget.add<Label>(subtitle_text); m_subtitle_label = header_widget.add<Label>(String::from_deprecated_string(subtitle_text).release_value_but_fixme_should_propagate_errors());
m_subtitle_label->set_text_alignment(Gfx::TextAlignment::TopLeft); m_subtitle_label->set_text_alignment(Gfx::TextAlignment::TopLeft);
m_subtitle_label->set_fixed_height(m_subtitle_label->font().pixel_size_rounded_up()); m_subtitle_label->set_fixed_height(m_subtitle_label->font().pixel_size_rounded_up());
header_widget.add_spacer().release_value_but_fixme_should_propagate_errors(); header_widget.add_spacer().release_value_but_fixme_should_propagate_errors();
@ -43,12 +43,12 @@ WizardPage::WizardPage(DeprecatedString const& title_text, DeprecatedString cons
void WizardPage::set_page_title(DeprecatedString const& text) void WizardPage::set_page_title(DeprecatedString const& text)
{ {
m_title_label->set_text(text); m_title_label->set_text(String::from_deprecated_string(text).release_value_but_fixme_should_propagate_errors());
} }
void WizardPage::set_page_subtitle(DeprecatedString const& text) void WizardPage::set_page_subtitle(DeprecatedString const& text)
{ {
m_subtitle_label->set_text(text); m_subtitle_label->set_text(String::from_deprecated_string(text).release_value_but_fixme_should_propagate_errors());
} }
} }

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_fail_message = *widget->find_descendant_of_type_named<GUI::Label>("fail_message");
m_username->on_change = [&] { m_username->on_change = [&] {
m_fail_message->set_text(""); m_fail_message->set_text({});
}; };
m_password->on_change = [&] { m_password->on_change = [&] {
if (!m_password->text().is_empty()) 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(); } DeprecatedString password() const { return m_password->text(); }
void set_password(StringView password) { m_password->set_text(password); } 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: private:
LoginWindow(GUI::Window* parent = nullptr); 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>(); auto& left_container = widget->add<GUI::Widget>();
left_container.set_layout<GUI::VerticalBoxLayout>(); 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_font(Gfx::FontDatabase::default_font().bold_variant());
m_title_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); 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); m_text_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
// FIXME: There used to be code for setting the tooltip here, but since we // 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) 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) if (m_hovering)
resize_to_fit_text(); resize_to_fit_text();
} }
void NotificationWindow::set_title(DeprecatedString const& value) 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) void NotificationWindow::set_image(Gfx::ShareableBitmap const& image)

View file

@ -65,7 +65,7 @@ ShutdownDialog::ShutdownDialog()
auto& right_container = content_container.add<GUI::Widget>(); auto& right_container = content_container.add<GUI::Widget>();
right_container.set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 12, 12, 8, 0 }); 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_text_alignment(Gfx::TextAlignment::CenterLeft);
label.set_fixed_height(22); label.set_fixed_height(22);
label.set_font(Gfx::FontDatabase::default_font().bold_variant()); label.set_font(Gfx::FontDatabase::default_font().bold_variant());