1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 13:37:44 +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) {
auto render_time = static_cast<double>(m_accumulated_time.to_milliseconds()) / 30.0;
auto frame_rate = render_time > 0 ? 1000 / render_time : 0;
m_stats->set_text(DeprecatedString::formatted("{:.0f} fps, {:.1f} ms", frame_rate, render_time));
m_stats->set_text(String::formatted("{:.0f} fps, {:.1f} ms", frame_rate, render_time).release_value_but_fixme_should_propagate_errors());
m_accumulated_time = {};
glEnable(GL_LIGHT0);

View file

@ -69,7 +69,7 @@ DownloadWidget::DownloadWidget(const URL& url)
m_browser_image->load_from_file("/res/graphics/download-animation.gif"sv);
animation_container.add_spacer().release_value_but_fixme_should_propagate_errors();
auto& source_label = add<GUI::Label>(DeprecatedString::formatted("From: {}", url));
auto& source_label = add<GUI::Label>(String::formatted("From: {}", url).release_value_but_fixme_should_propagate_errors());
source_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
source_label.set_fixed_height(16);
@ -80,7 +80,7 @@ DownloadWidget::DownloadWidget(const URL& url)
m_progress_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
m_progress_label->set_fixed_height(16);
auto& destination_label = add<GUI::Label>(DeprecatedString::formatted("To: {}", m_destination_path));
auto& destination_label = add<GUI::Label>(String::formatted("To: {}", m_destination_path).release_value_but_fixme_should_propagate_errors());
destination_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
destination_label.set_fixed_height(16);
@ -127,7 +127,7 @@ void DownloadWidget::did_progress(Optional<u32> total_size, u32 downloaded_size)
builder.append("Downloaded "sv);
builder.append(human_readable_size(downloaded_size));
builder.appendff(" in {} sec", m_elapsed_timer.elapsed_time().to_seconds());
m_progress_label->set_text(builder.to_deprecated_string());
m_progress_label->set_text(builder.to_string().release_value_but_fixme_should_propagate_errors());
}
{

View file

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

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_fixed_height(45);
auto& add_label = top_container.add<GUI::Label>("Add title & date:");
auto& add_label = top_container.add<GUI::Label>("Add title & date:"_string.release_value_but_fixme_should_propagate_errors());
add_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
add_label.set_fixed_height(14);
add_label.set_font(Gfx::FontDatabase::default_font().bold_variant());

View file

@ -169,7 +169,7 @@ void CharacterMapWidget::did_change_font()
{
// No need to track glyph modifications by cloning
m_glyph_map->GUI::AbstractScrollableWidget::set_font(font());
m_font_name_label->set_text(font().human_readable_name());
m_font_name_label->set_text(String::from_deprecated_string(font().human_readable_name()).release_value_but_fixme_should_propagate_errors());
m_output_box->set_font(font());
}

View file

@ -119,5 +119,5 @@ void ClockSettingsWidget::update_time_format_string()
void ClockSettingsWidget::update_clock_preview()
{
m_clock_preview->set_text(Core::DateTime::now().to_deprecated_string(m_time_format));
m_clock_preview->set_text(Core::DateTime::now().to_string(m_time_format).release_value_but_fixme_should_propagate_errors());
}

View file

@ -214,24 +214,24 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
app_name = af->name();
auto& description_label = *widget->find_descendant_of_type_named<GUI::Label>("description");
description_label.set_text(DeprecatedString::formatted("\"{}\" (PID {}) has crashed - {} (signal {})", app_name, pid, strsignal(termination_signal), termination_signal));
description_label.set_text(TRY(String::formatted("\"{}\" (PID {}) has crashed - {} (signal {})", app_name, pid, strsignal(termination_signal), termination_signal)));
auto& executable_link_label = *widget->find_descendant_of_type_named<GUI::LinkLabel>("executable_link");
executable_link_label.set_text(LexicalPath::canonicalized_path(executable_path));
executable_link_label.set_text(TRY(String::from_deprecated_string(LexicalPath::canonicalized_path(executable_path))));
executable_link_label.on_click = [&] {
LexicalPath path { executable_path };
Desktop::Launcher::open(URL::create_with_file_scheme(path.dirname(), path.basename()));
};
auto& coredump_link_label = *widget->find_descendant_of_type_named<GUI::LinkLabel>("coredump_link");
coredump_link_label.set_text(LexicalPath::canonicalized_path(coredump_path));
coredump_link_label.set_text(TRY(String::from_deprecated_string(LexicalPath::canonicalized_path(coredump_path))));
coredump_link_label.on_click = [&] {
LexicalPath path { coredump_path };
Desktop::Launcher::open(URL::create_with_file_scheme(path.dirname(), path.basename()));
};
auto& arguments_label = *widget->find_descendant_of_type_named<GUI::Label>("arguments_label");
arguments_label.set_text(DeprecatedString::join(' ', crashed_process_arguments));
arguments_label.set_text(TRY(String::join(' ', crashed_process_arguments)));
auto& progressbar = *widget->find_descendant_of_type_named<GUI::Progressbar>("progressbar");
auto& tab_widget = *widget->find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
@ -239,7 +239,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto backtrace_tab = TRY(tab_widget.try_add_tab<GUI::Widget>(TRY("Backtrace"_string)));
TRY(backtrace_tab->try_set_layout<GUI::VerticalBoxLayout>(4));
auto backtrace_label = TRY(backtrace_tab->try_add<GUI::Label>("A backtrace for each thread alive during the crash is listed below:"));
auto backtrace_label = TRY(backtrace_tab->try_add<GUI::Label>(TRY("A backtrace for each thread alive during the crash is listed below:"_string)));
backtrace_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
backtrace_label->set_fixed_height(16);
@ -249,7 +249,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto cpu_registers_tab = TRY(tab_widget.try_add_tab<GUI::Widget>(TRY("CPU Registers"_string)));
cpu_registers_tab->set_layout<GUI::VerticalBoxLayout>(4);
auto cpu_registers_label = TRY(cpu_registers_tab->try_add<GUI::Label>("The CPU register state for each thread alive during the crash is listed below:"));
auto cpu_registers_label = TRY(cpu_registers_tab->try_add<GUI::Label>(TRY("The CPU register state for each thread alive during the crash is listed below:"_string)));
cpu_registers_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
cpu_registers_label->set_fixed_height(16);

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");
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 {};
}

View file

@ -72,7 +72,7 @@ ErrorOr<void> FontSettingsWidget::setup_interface()
static void update_label_with_font(GUI::Label& label, Gfx::Font const& font)
{
label.set_text(font.human_readable_name());
label.set_text(String::from_deprecated_string(font.human_readable_name()).release_value_but_fixme_should_propagate_errors());
label.set_font(font);
}

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());
if (screen_dpi.has_value() && !dpi_label_value.is_error()) {
m_dpi_label->set_tooltip(screen_dpi_tooltip.to_deprecated_string());
m_dpi_label->set_text(dpi_label_value.release_value().to_deprecated_string());
m_dpi_label->set_text(dpi_label_value.release_value());
m_dpi_label->set_visible(true);
} else {
m_dpi_label->set_visible(false);

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");
DeprecatedString prompt;
String prompt;
if (options.description.is_empty())
prompt = DeprecatedString::formatted("{} requires root access. Please enter password for user \"{}\".", m_arguments[0], m_current_user.username());
prompt = String::formatted("{} requires root access. Please enter password for user \"{}\".", m_arguments[0], m_current_user.username()).release_value_but_fixme_should_propagate_errors();
else
prompt = options.description;
prompt = String::from_utf8(options.description).release_value_but_fixme_should_propagate_errors();
app_label->set_text(prompt);
app_label->set_text(move(prompt));
m_icon_image_widget = *main_widget->find_descendant_of_type_named<GUI::ImageWidget>("icon");
m_icon_image_widget->set_bitmap(app_icon.bitmap_for_size(32));

View file

@ -153,7 +153,7 @@ void DirectoryView::setup_model()
{
m_model->on_directory_change_error = [this](int, char const* error_string) {
auto failed_path = m_model->root_path();
auto error_message = DeprecatedString::formatted("Could not read {}:\n{}", failed_path, error_string);
auto error_message = String::formatted("Could not read {}:\n{}", failed_path, error_string).release_value_but_fixme_should_propagate_errors();
m_error_label->set_text(error_message);
set_active_widget(m_error_label);

View file

@ -54,16 +54,16 @@ FileOperationProgressWidget::FileOperationProgressWidget(FileOperation operation
switch (m_operation) {
case FileOperation::Copy:
files_copied_label.set_text("Copying files...");
current_file_action_label.set_text("Copying: ");
files_copied_label.set_text("Copying files..."_string.release_value_but_fixme_should_propagate_errors());
current_file_action_label.set_text("Copying: "_string.release_value_but_fixme_should_propagate_errors());
break;
case FileOperation::Move:
files_copied_label.set_text("Moving files...");
current_file_action_label.set_text("Moving: ");
files_copied_label.set_text("Moving files..."_string.release_value_but_fixme_should_propagate_errors());
current_file_action_label.set_text("Moving: "_string.release_value_but_fixme_should_propagate_errors());
break;
case FileOperation::Delete:
files_copied_label.set_text("Deleting files...");
current_file_action_label.set_text("Deleting: ");
files_copied_label.set_text("Deleting files..."_string.release_value_but_fixme_should_propagate_errors());
current_file_action_label.set_text("Deleting: "_string.release_value_but_fixme_should_propagate_errors());
break;
default:
VERIFY_NOT_REACHED();
@ -179,23 +179,23 @@ void FileOperationProgressWidget::did_progress(off_t bytes_done, off_t total_byt
auto& overall_progressbar = *find_descendant_of_type_named<GUI::Progressbar>("overall_progressbar");
auto& estimated_time_label = *find_descendant_of_type_named<GUI::Label>("estimated_time_label");
current_file_label.set_text(current_filename);
current_file_label.set_text(String::from_utf8(current_filename).release_value_but_fixme_should_propagate_errors());
switch (m_operation) {
case FileOperation::Copy:
files_copied_label.set_text(DeprecatedString::formatted("Copying file {} of {}", files_done, total_file_count));
files_copied_label.set_text(String::formatted("Copying file {} of {}", files_done, total_file_count).release_value_but_fixme_should_propagate_errors());
break;
case FileOperation::Move:
files_copied_label.set_text(DeprecatedString::formatted("Moving file {} of {}", files_done, total_file_count));
files_copied_label.set_text(String::formatted("Moving file {} of {}", files_done, total_file_count).release_value_but_fixme_should_propagate_errors());
break;
case FileOperation::Delete:
files_copied_label.set_text(DeprecatedString::formatted("Deleting file {} of {}", files_done, total_file_count));
files_copied_label.set_text(String::formatted("Deleting file {} of {}", files_done, total_file_count).release_value_but_fixme_should_propagate_errors());
break;
default:
VERIFY_NOT_REACHED();
}
estimated_time_label.set_text(estimate_time(bytes_done, total_byte_count));
estimated_time_label.set_text(String::from_deprecated_string(estimate_time(bytes_done, total_byte_count)).release_value_but_fixme_should_propagate_errors());
if (total_byte_count) {
window()->set_progress(100.0f * bytes_done / total_byte_count);

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");
location->set_text(m_path);
location->set_text(TRY(String::from_deprecated_string(m_path)));
location->on_click = [this] {
Desktop::Launcher::open(URL::create_with_file_scheme(m_parent_path, m_name));
};
@ -98,18 +98,18 @@ ErrorOr<void> PropertiesWindow::create_widgets(bool disable_rename)
m_old_mode = st.st_mode;
auto* type = general_tab->find_descendant_of_type_named<GUI::Label>("type");
type->set_text(get_description(m_mode));
type->set_text(TRY(String::from_deprecated_string(get_description(m_mode))));
if (S_ISLNK(m_mode)) {
auto link_destination_or_error = FileSystem::read_link(m_path);
if (link_destination_or_error.is_error()) {
perror("readlink");
} else {
auto link_destination = link_destination_or_error.release_value().to_deprecated_string();
auto link_destination = link_destination_or_error.release_value();
auto* link_location = general_tab->find_descendant_of_type_named<GUI::LinkLabel>("link_location");
link_location->set_text(link_destination);
link_location->on_click = [link_destination] {
auto link_directory = LexicalPath(link_destination);
auto link_directory = LexicalPath(link_destination.to_deprecated_string());
Desktop::Launcher::open(URL::create_with_file_scheme(link_directory.dirname(), link_directory.basename()));
};
}
@ -119,19 +119,21 @@ ErrorOr<void> PropertiesWindow::create_widgets(bool disable_rename)
}
m_size_label = general_tab->find_descendant_of_type_named<GUI::Label>("size");
m_size_label->set_text(S_ISDIR(st.st_mode) ? "Calculating..." : human_readable_size_long(st.st_size, UseThousandsSeparator::Yes));
m_size_label->set_text(S_ISDIR(st.st_mode)
? TRY("Calculating..."_string)
: TRY(String::from_deprecated_string(human_readable_size_long(st.st_size, UseThousandsSeparator::Yes))));
auto* owner = general_tab->find_descendant_of_type_named<GUI::Label>("owner");
owner->set_text(DeprecatedString::formatted("{} ({})", owner_name, st.st_uid));
owner->set_text(String::formatted("{} ({})", owner_name, st.st_uid).release_value_but_fixme_should_propagate_errors());
auto* group = general_tab->find_descendant_of_type_named<GUI::Label>("group");
group->set_text(DeprecatedString::formatted("{} ({})", group_name, st.st_gid));
group->set_text(String::formatted("{} ({})", group_name, st.st_gid).release_value_but_fixme_should_propagate_errors());
auto* created_at = general_tab->find_descendant_of_type_named<GUI::Label>("created_at");
created_at->set_text(GUI::FileSystemModel::timestamp_string(st.st_ctime));
created_at->set_text(String::from_deprecated_string(GUI::FileSystemModel::timestamp_string(st.st_ctime)).release_value_but_fixme_should_propagate_errors());
auto* last_modified = general_tab->find_descendant_of_type_named<GUI::Label>("last_modified");
last_modified->set_text(GUI::FileSystemModel::timestamp_string(st.st_mtime));
last_modified->set_text(String::from_deprecated_string(GUI::FileSystemModel::timestamp_string(st.st_mtime)).release_value_but_fixme_should_propagate_errors());
auto* owner_read = general_tab->find_descendant_of_type_named<GUI::CheckBox>("owner_read");
auto* owner_write = general_tab->find_descendant_of_type_named<GUI::CheckBox>("owner_write");
@ -173,7 +175,7 @@ ErrorOr<void> PropertiesWindow::create_widgets(bool disable_rename)
m_directory_statistics_calculator->on_update = [this, origin_event_loop = &Core::EventLoop::current()](off_t total_size_in_bytes, size_t file_count, size_t directory_count) {
origin_event_loop->deferred_invoke([=, weak_this = make_weak_ptr<PropertiesWindow>()] {
if (auto strong_this = weak_this.strong_ref())
strong_this->m_size_label->set_text(DeprecatedString::formatted("{}\n{:'d} files, {:'d} subdirectories", human_readable_size_long(total_size_in_bytes, UseThousandsSeparator::Yes), file_count, directory_count));
strong_this->m_size_label->set_text(String::formatted("{}\n{} files, {} subdirectories", human_readable_size_long(total_size_in_bytes, UseThousandsSeparator::Yes), file_count, directory_count).release_value_but_fixme_should_propagate_errors());
});
};
m_directory_statistics_calculator->start();

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->on_change = [&] {
auto preview = DeprecatedString::formatted("{}\n{}", m_preview_textbox->text(), Unicode::to_unicode_uppercase_full(m_preview_textbox->text()).release_value_but_fixme_should_propagate_errors());
auto preview = String::formatted("{}\n{}", m_preview_textbox->text(), Unicode::to_unicode_uppercase_full(m_preview_textbox->text()).release_value_but_fixme_should_propagate_errors()).release_value_but_fixme_should_propagate_errors();
m_preview_label->set_text(preview);
};
m_preview_textbox->set_text(pangrams[0]);

View file

@ -92,19 +92,19 @@ void MouseWidget::reset_default_values()
void MouseWidget::update_speed_label()
{
m_speed_label->set_text(DeprecatedString::formatted("{} %", m_speed_slider->value()));
m_speed_label->set_text(String::formatted("{} %", m_speed_slider->value()).release_value_but_fixme_should_propagate_errors());
}
void MouseWidget::update_double_click_speed_label()
{
m_double_click_speed_label->set_text(DeprecatedString::formatted("{} ms", m_double_click_speed_slider->value()));
m_double_click_speed_label->set_text(String::formatted("{} ms", m_double_click_speed_slider->value()).release_value_but_fixme_should_propagate_errors());
}
void MouseWidget::update_switch_buttons_image_label()
{
if (m_switch_buttons_checkbox->is_checked()) {
m_switch_buttons_image_label->set_icon_from_path("/res/graphics/mouse-button-right.png");
m_switch_buttons_image_label->set_icon_from_path("/res/graphics/mouse-button-right.png"sv);
} else {
m_switch_buttons_image_label->set_icon_from_path("/res/graphics/mouse-button-left.png");
m_switch_buttons_image_label->set_icon_from_path("/res/graphics/mouse-button-left.png"sv);
}
}

View file

@ -387,7 +387,7 @@ PDF::PDFErrorOr<void> PDFViewerWidget::try_open_file(StringView path, NonnullOwn
TRY(document->initialize());
TRY(m_viewer->set_document(document));
m_total_page_label->set_text(DeprecatedString::formatted("of {}", document->get_page_count()));
m_total_page_label->set_text(TRY(String::formatted("of {}", document->get_page_count())));
m_page_text_box->set_enabled(true);
m_page_text_box->set_current_number(1, GUI::AllowCallback::No);

View file

@ -38,7 +38,7 @@ ErrorOr<void> ExportProgressWindow::initialize_fallibles()
void ExportProgressWindow::set_filename(StringView filename)
{
m_label->set_text(DeprecatedString::formatted("Rendering audio to {}…", filename));
m_label->set_text(String::formatted("Rendering audio to {}…", filename).release_value_but_fixme_should_propagate_errors());
update();
}

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->set_preferred_width(GUI::SpecialDimension::Fit);
TRY(m_octave_container->try_set_layout<GUI::VerticalBoxLayout>());
auto octave_label = TRY(m_octave_container->try_add<GUI::Label>("Octave"));
auto octave_label = TRY(m_octave_container->try_add<GUI::Label>("Octave"_short_string));
octave_label->set_preferred_width(GUI::SpecialDimension::Fit);
m_octave_value = TRY(m_octave_container->try_add<GUI::Label>(DeprecatedString::number(m_track_manager.keyboard()->virtual_keyboard_octave())));
m_octave_value = TRY(m_octave_container->try_add<GUI::Label>(TRY(String::number(m_track_manager.keyboard()->virtual_keyboard_octave()))));
m_octave_value->set_preferred_width(GUI::SpecialDimension::Fit);
// FIXME: Implement vertical flipping in GUI::Slider, not here.
@ -75,7 +75,7 @@ ErrorOr<void> MainWidget::initialize()
int new_octave = octave_max - value;
set_octave_via_slider(new_octave);
VERIFY(new_octave == m_track_manager.keyboard()->virtual_keyboard_octave());
m_octave_value->set_text(DeprecatedString::number(new_octave));
m_octave_value->set_text(String::number(new_octave).release_value_but_fixme_should_propagate_errors());
};
m_knobs_widget = TRY(m_keys_and_knobs_container->try_add<TrackControlsWidget>(m_track_manager, *this));

View file

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

View file

@ -15,11 +15,11 @@ ProcessorParameterWidget::ProcessorParameterWidget(DSP::ProcessorParameter& raw_
: m_parameter(raw_parameter)
{
set_layout<GUI::VerticalBoxLayout>();
m_label = add<GUI::Label>(raw_parameter.name().to_deprecated_string());
m_label = add<GUI::Label>(raw_parameter.name());
switch (raw_parameter.type()) {
case DSP::ParameterType::Range: {
auto& parameter = static_cast<DSP::ProcessorRangeParameter&>(raw_parameter);
m_value_label = add<GUI::Label>(DeprecatedString::number(static_cast<double>(parameter.value())));
m_value_label = add<GUI::Label>(String::number(static_cast<double>(parameter.value())).release_value_but_fixme_should_propagate_errors());
m_parameter_modifier = add<ProcessorParameterSlider>(Orientation::Vertical, parameter, m_value_label);
break;
}

View file

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

View file

@ -56,11 +56,11 @@ SamplerWidget::SamplerWidget(TrackManager& track_manager)
if (!open_path.has_value())
return;
// TODO: We don't actually load the sample.
m_recorded_sample_name->set_text(open_path.value());
m_recorded_sample_name->set_text(String::from_deprecated_string(open_path.value()).release_value_but_fixme_should_propagate_errors());
m_wave_editor->update();
};
m_recorded_sample_name = m_open_button_and_recorded_sample_name_container->add<GUI::Label>("No sample loaded");
m_recorded_sample_name = m_open_button_and_recorded_sample_name_container->add<GUI::Label>("No sample loaded"_string.release_value_but_fixme_should_propagate_errors());
m_recorded_sample_name->set_text_alignment(Gfx::TextAlignment::CenterLeft);
m_wave_editor = add<WaveEditor>(m_track_manager);

View file

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

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_layout<GUI::VerticalBoxLayout>(4);
auto& name_label = main_widget->add<GUI::Label>("Name:");
auto& name_label = main_widget->add<GUI::Label>("Name:"_short_string);
name_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
m_name_textbox = main_widget->add<GUI::TextBox>();
@ -34,12 +34,12 @@ CreateNewLayerDialog::CreateNewLayerDialog(Gfx::IntSize suggested_size, GUI::Win
m_layer_name = m_name_textbox->text();
};
auto& width_label = main_widget->add<GUI::Label>("Width:");
auto& width_label = main_widget->add<GUI::Label>("Width:"_short_string);
width_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
auto& width_spinbox = main_widget->add<GUI::SpinBox>();
auto& height_label = main_widget->add<GUI::Label>("Height:");
auto& height_label = main_widget->add<GUI::Label>("Height:"_short_string);
height_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
auto& height_spinbox = main_widget->add<GUI::SpinBox>();

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();
if (settings_widget_or_error.is_error()) {
m_error_label->set_text(DeprecatedString::formatted("Error creating settings: {}", settings_widget_or_error.error()));
m_error_label->set_text(String::formatted("Error creating settings: {}", settings_widget_or_error.error()).release_value_but_fixme_should_propagate_errors());
m_selected_filter_config_widget = m_error_label;
} else {
m_selected_filter_config_widget = settings_widget_or_error.release_value();

View file

@ -40,7 +40,7 @@ ErrorOr<RefPtr<GUI::Widget>> Bloom::get_settings_widget()
auto settings_widget = TRY(GUI::Widget::try_create());
TRY(settings_widget->try_set_layout<GUI::VerticalBoxLayout>());
auto name_label = TRY(settings_widget->try_add<GUI::Label>("Bloom Filter"));
auto name_label = TRY(settings_widget->try_add<GUI::Label>(TRY("Bloom Filter"_string)));
name_label->set_font_weight(Gfx::FontWeight::Bold);
name_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
name_label->set_fixed_height(20);
@ -49,7 +49,7 @@ ErrorOr<RefPtr<GUI::Widget>> Bloom::get_settings_widget()
luma_lower_container->set_fixed_height(50);
TRY(luma_lower_container->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
auto luma_lower_label = TRY(luma_lower_container->try_add<GUI::Label>("Luma lower bound:"));
auto luma_lower_label = TRY(luma_lower_container->try_add<GUI::Label>(TRY("Luma lower bound:"_string)));
luma_lower_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
luma_lower_label->set_fixed_height(20);
@ -65,7 +65,7 @@ ErrorOr<RefPtr<GUI::Widget>> Bloom::get_settings_widget()
radius_container->set_fixed_height(50);
TRY(radius_container->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
auto radius_label = TRY(radius_container->try_add<GUI::Label>("Blur Radius:"));
auto radius_label = TRY(radius_container->try_add<GUI::Label>(TRY("Blur Radius:"_string)));
radius_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
radius_label->set_fixed_height(20);

View file

@ -42,7 +42,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
auto settings_widget = TRY(GUI::Widget::try_create());
TRY(settings_widget->try_set_layout<GUI::VerticalBoxLayout>());
auto name_label = TRY(settings_widget->try_add<GUI::Label>("Fast Box Blur Filter"));
auto name_label = TRY(settings_widget->try_add<GUI::Label>(TRY("Fast Box Blur Filter"_string)));
name_label->set_font_weight(Gfx::FontWeight::Bold);
name_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
name_label->set_fixed_height(10);
@ -88,7 +88,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
m_radius_container->set_fixed_height(20);
TRY(m_radius_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
auto radius_label = TRY(m_radius_container->try_add<GUI::Label>("Radius:"));
auto radius_label = TRY(m_radius_container->try_add<GUI::Label>("Radius:"_short_string));
radius_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
radius_label->set_fixed_size(50, 20);
@ -109,7 +109,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
radius_x_container->set_fixed_height(20);
radius_x_container->set_layout<GUI::HorizontalBoxLayout>();
auto radius_x_label = TRY(radius_x_container->try_add<GUI::Label>("Radius X:"));
auto radius_x_label = TRY(radius_x_container->try_add<GUI::Label>(TRY("Radius X:"_string)));
radius_x_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
radius_x_label->set_fixed_size(50, 20);
@ -125,7 +125,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
radius_y_container->set_fixed_height(20);
TRY(radius_y_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto radius_y_label = TRY(radius_y_container->try_add<GUI::Label>("Radius Y:"));
auto radius_y_label = TRY(radius_y_container->try_add<GUI::Label>(TRY("Radius Y:"_string)));
radius_y_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
radius_y_label->set_fixed_size(50, 20);
@ -146,7 +146,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
angle_container->set_fixed_height(20);
TRY(angle_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto angle_label = TRY(angle_container->try_add<GUI::Label>("Angle:"));
auto angle_label = TRY(angle_container->try_add<GUI::Label>("Angle:"_short_string));
angle_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
angle_label->set_fixed_size(60, 20);
@ -162,7 +162,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
magnitude_container->set_fixed_height(20);
TRY(magnitude_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto magnitude_label = TRY(magnitude_container->try_add<GUI::Label>("Magnitude:"));
auto magnitude_label = TRY(magnitude_container->try_add<GUI::Label>(TRY("Magnitude:"_string)));
magnitude_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
magnitude_label->set_fixed_size(60, 20);

View file

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

View file

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

View file

@ -23,7 +23,7 @@ ErrorOr<RefPtr<GUI::Widget>> Sepia::get_settings_widget()
auto settings_widget = TRY(GUI::Widget::try_create());
TRY(settings_widget->try_set_layout<GUI::VerticalBoxLayout>());
auto name_label = TRY(settings_widget->try_add<GUI::Label>("Sepia Filter"));
auto name_label = TRY(settings_widget->try_add<GUI::Label>(TRY("Sepia Filter"_string)));
name_label->set_font_weight(Gfx::FontWeight::Bold);
name_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
name_label->set_fixed_height(20);
@ -32,7 +32,7 @@ ErrorOr<RefPtr<GUI::Widget>> Sepia::get_settings_widget()
amount_container->set_fixed_height(20);
TRY(amount_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
auto amount_label = TRY(amount_container->try_add<GUI::Label>("Amount:"));
auto amount_label = TRY(amount_container->try_add<GUI::Label>("Amount:"_short_string));
amount_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
amount_label->set_fixed_size(50, 20);

View file

@ -30,7 +30,7 @@ LayerPropertiesWidget::LayerPropertiesWidget()
name_container.set_fixed_height(20);
name_container.set_layout<GUI::HorizontalBoxLayout>();
auto& name_label = name_container.add<GUI::Label>("Name:");
auto& name_label = name_container.add<GUI::Label>("Name:"_short_string);
name_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
name_label.set_fixed_size(80, 20);
@ -45,7 +45,7 @@ LayerPropertiesWidget::LayerPropertiesWidget()
opacity_container.set_fixed_height(20);
opacity_container.set_layout<GUI::HorizontalBoxLayout>();
auto& opacity_label = opacity_container.add<GUI::Label>("Opacity:");
auto& opacity_label = opacity_container.add<GUI::Label>("Opacity:"_string.release_value_but_fixme_should_propagate_errors());
opacity_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
opacity_label.set_fixed_size(80, 20);

View file

@ -41,7 +41,7 @@ LevelsDialog::LevelsDialog(GUI::Window* parent_window, ImageEditor* editor)
VERIFY(cancel_button);
VERIFY(m_editor->active_layer());
context_label->set_text(DeprecatedString::formatted("Working on layer: {}", m_editor->active_layer()->name()));
context_label->set_text(String::formatted("Working on layer: {}", m_editor->active_layer()->name()).release_value_but_fixme_should_propagate_errors());
m_gamma_slider->set_value(100);
m_brightness_slider->on_change = [this](auto) {

View file

@ -36,7 +36,7 @@ void ToolPropertiesWidget::set_active_tool(Tool* tool)
auto active_tool_widget_or_error = tool->get_properties_widget();
if (active_tool_widget_or_error.is_error()) {
m_active_tool_widget = nullptr;
m_error_label->set_text(DeprecatedString::formatted("Error creating tool properties: {}", active_tool_widget_or_error.release_error()));
m_error_label->set_text(String::formatted("Error creating tool properties: {}", active_tool_widget_or_error.release_error()).release_value_but_fixme_should_propagate_errors());
m_tool_widget_stack->set_active_widget(m_error_label);
return;
}

View file

@ -147,7 +147,7 @@ ErrorOr<GUI::Widget*> BrushTool::get_properties_widget()
size_container->set_fixed_height(20);
(void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto size_label = TRY(size_container->try_add<GUI::Label>("Size:"));
auto size_label = TRY(size_container->try_add<GUI::Label>("Size:"_short_string));
size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
size_label->set_fixed_size(80, 20);
@ -167,7 +167,7 @@ ErrorOr<GUI::Widget*> BrushTool::get_properties_widget()
hardness_container->set_fixed_height(20);
(void)TRY(hardness_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto hardness_label = TRY(hardness_container->try_add<GUI::Label>("Hardness:"));
auto hardness_label = TRY(hardness_container->try_add<GUI::Label>(TRY("Hardness:"_string)));
hardness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
hardness_label->set_fixed_size(80, 20);

View file

@ -71,7 +71,7 @@ ErrorOr<GUI::Widget*> BucketTool::get_properties_widget()
threshold_container->set_fixed_height(20);
(void)TRY(threshold_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto threshold_label = TRY(threshold_container->try_add<GUI::Label>("Threshold:"));
auto threshold_label = TRY(threshold_container->try_add<GUI::Label>(TRY("Threshold:"_string)));
threshold_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
threshold_label->set_fixed_size(80, 20);

View file

@ -135,7 +135,7 @@ ErrorOr<GUI::Widget*> CloneTool::get_properties_widget()
size_container->set_fixed_height(20);
(void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto size_label = TRY(size_container->try_add<GUI::Label>("Size:"));
auto size_label = TRY(size_container->try_add<GUI::Label>("Size:"_short_string));
size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
size_label->set_fixed_size(80, 20);
@ -154,7 +154,7 @@ ErrorOr<GUI::Widget*> CloneTool::get_properties_widget()
hardness_container->set_fixed_height(20);
(void)TRY(hardness_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto hardness_label = TRY(hardness_container->try_add<GUI::Label>("Hardness:"));
auto hardness_label = TRY(hardness_container->try_add<GUI::Label>(TRY("Hardness:"_string)));
hardness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
hardness_label->set_fixed_size(80, 20);

View file

@ -136,7 +136,7 @@ ErrorOr<GUI::Widget*> EllipseTool::get_properties_widget()
thickness_container->set_fixed_height(20);
(void)TRY(thickness_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto thickness_label = TRY(thickness_container->try_add<GUI::Label>("Thickness:"));
auto thickness_label = TRY(thickness_container->try_add<GUI::Label>(TRY("Thickness:"_string)));
thickness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
thickness_label->set_fixed_size(80, 20);
@ -152,7 +152,7 @@ ErrorOr<GUI::Widget*> EllipseTool::get_properties_widget()
auto mode_container = TRY(properties_widget->try_add<GUI::Widget>());
mode_container->set_fixed_height(70);
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto mode_label = TRY(mode_container->try_add<GUI::Label>("Mode:"));
auto mode_label = TRY(mode_container->try_add<GUI::Label>("Mode:"_short_string));
mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
auto mode_radio_container = TRY(mode_container->try_add<GUI::Widget>());
@ -180,7 +180,7 @@ ErrorOr<GUI::Widget*> EllipseTool::get_properties_widget()
aspect_container->set_fixed_height(20);
(void)TRY(aspect_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto aspect_label = TRY(aspect_container->try_add<GUI::Label>("Aspect Ratio:"));
auto aspect_label = TRY(aspect_container->try_add<GUI::Label>(TRY("Aspect Ratio:"_string)));
aspect_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
aspect_label->set_fixed_size(80, 20);
@ -197,7 +197,7 @@ ErrorOr<GUI::Widget*> EllipseTool::get_properties_widget()
}
};
auto multiply_label = TRY(aspect_container->try_add<GUI::Label>("x"));
auto multiply_label = TRY(aspect_container->try_add<GUI::Label>("x"_short_string));
multiply_label->set_text_alignment(Gfx::TextAlignment::Center);
multiply_label->set_fixed_size(10, 20);

View file

@ -63,7 +63,7 @@ ErrorOr<GUI::Widget*> EraseTool::get_properties_widget()
size_container->set_fixed_height(20);
(void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto size_label = TRY(size_container->try_add<GUI::Label>("Size:"));
auto size_label = TRY(size_container->try_add<GUI::Label>("Size:"_short_string));
size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
size_label->set_fixed_size(80, 20);
@ -81,7 +81,7 @@ ErrorOr<GUI::Widget*> EraseTool::get_properties_widget()
hardness_container->set_fixed_height(20);
(void)TRY(hardness_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto hardness_label = TRY(hardness_container->try_add<GUI::Label>("Hardness:"));
auto hardness_label = TRY(hardness_container->try_add<GUI::Label>(TRY("Hardness:"_string)));
hardness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
hardness_label->set_fixed_size(80, 20);
@ -108,7 +108,7 @@ ErrorOr<GUI::Widget*> EraseTool::get_properties_widget()
auto mode_container = TRY(properties_widget->try_add<GUI::Widget>());
mode_container->set_fixed_height(46);
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto mode_label = TRY(mode_container->try_add<GUI::Label>("Draw Mode:"));
auto mode_label = TRY(mode_container->try_add<GUI::Label>(TRY("Draw Mode:"_string)));
mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
mode_label->set_fixed_size(80, 20);

View file

@ -206,7 +206,7 @@ ErrorOr<GUI::Widget*> GradientTool::get_properties_widget()
auto mode_container = TRY(properties_widget->try_add<GUI::Widget>());
mode_container->set_fixed_height(20);
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto mode_label = TRY(mode_container->try_add<GUI::Label>("Gradient Type:"));
auto mode_label = TRY(mode_container->try_add<GUI::Label>(TRY("Gradient Type:"_string)));
mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
mode_label->set_fixed_size(80, 20);
@ -236,7 +236,7 @@ ErrorOr<GUI::Widget*> GradientTool::get_properties_widget()
size_container->set_fixed_height(20);
(void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto size_label = TRY(size_container->try_add<GUI::Label>("Opacity:"));
auto size_label = TRY(size_container->try_add<GUI::Label>(TRY("Opacity:"_string)));
size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
size_label->set_fixed_size(80, 20);
@ -270,7 +270,7 @@ ErrorOr<GUI::Widget*> GradientTool::get_properties_widget()
hardness_container->set_visible(m_mode == GradientMode::Radial);
};
auto hardness_label = TRY(hardness_container->try_add<GUI::Label>("Hardness:"));
auto hardness_label = TRY(hardness_container->try_add<GUI::Label>(TRY("Hardness:"_string)));
hardness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
auto hardness_slider = TRY(hardness_container->try_add<GUI::HorizontalOpacitySlider>());

View file

@ -186,7 +186,7 @@ ErrorOr<GUI::Widget*> GuideTool::get_properties_widget()
snapping_container->set_fixed_height(20);
(void)TRY(snapping_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto snapping_label = TRY(snapping_container->try_add<GUI::Label>("Snap offset:"));
auto snapping_label = TRY(snapping_container->try_add<GUI::Label>(TRY("Snap offset:"_string)));
snapping_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
snapping_label->set_fixed_size(80, 20);
snapping_label->set_tooltip("Press Shift to snap");

View file

@ -185,7 +185,7 @@ ErrorOr<GUI::Widget*> LassoSelectTool::get_properties_widget()
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto mode_label = TRY(mode_container->try_add<GUI::Label>());
mode_label->set_text("Mode:");
mode_label->set_text("Mode:"_short_string);
mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
mode_label->set_fixed_size(80, 20);

View file

@ -129,7 +129,7 @@ ErrorOr<GUI::Widget*> LineTool::get_properties_widget()
thickness_container->set_fixed_height(20);
(void)TRY(thickness_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto thickness_label = TRY(thickness_container->try_add<GUI::Label>("Thickness:"));
auto thickness_label = TRY(thickness_container->try_add<GUI::Label>(TRY("Thickness:"_string)));
thickness_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
thickness_label->set_fixed_size(80, 20);
@ -146,7 +146,7 @@ ErrorOr<GUI::Widget*> LineTool::get_properties_widget()
mode_container->set_fixed_height(20);
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto mode_label = TRY(mode_container->try_add<GUI::Label>("Mode:"));
auto mode_label = TRY(mode_container->try_add<GUI::Label>("Mode:"_short_string));
mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
mode_label->set_fixed_size(80, 20);

View file

@ -298,7 +298,7 @@ ErrorOr<GUI::Widget*> MoveTool::get_properties_widget()
auto selection_mode_container = TRY(properties_widget->try_add<GUI::Widget>());
(void)TRY(selection_mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
selection_mode_container->set_fixed_height(46);
auto selection_mode_label = TRY(selection_mode_container->try_add<GUI::Label>("Selection Mode:"));
auto selection_mode_label = TRY(selection_mode_container->try_add<GUI::Label>(TRY("Selection Mode:"_string)));
selection_mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
selection_mode_label->set_fixed_size(80, 40);

View file

@ -45,7 +45,7 @@ ErrorOr<GUI::Widget*> PenTool::get_properties_widget()
size_container->set_fixed_height(20);
(void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto size_label = TRY(size_container->try_add<GUI::Label>("Thickness:"));
auto size_label = TRY(size_container->try_add<GUI::Label>(TRY("Thickness:"_string)));
size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
size_label->set_fixed_size(80, 20);

View file

@ -190,7 +190,7 @@ ErrorOr<GUI::Widget*> PolygonalSelectTool::get_properties_widget()
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto mode_label = TRY(mode_container->try_add<GUI::Label>());
mode_label->set_text("Mode:");
mode_label->set_text("Mode:"_short_string);
mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
mode_label->set_fixed_size(80, 20);

View file

@ -161,7 +161,7 @@ ErrorOr<GUI::Widget*> RectangleSelectTool::get_properties_widget()
(void)TRY(feather_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto feather_label = TRY(feather_container->try_add<GUI::Label>());
feather_label->set_text("Feather:");
feather_label->set_text(TRY("Feather:"_string));
feather_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
feather_label->set_fixed_size(80, 20);
@ -180,7 +180,7 @@ ErrorOr<GUI::Widget*> RectangleSelectTool::get_properties_widget()
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto mode_label = TRY(mode_container->try_add<GUI::Label>());
mode_label->set_text("Mode:");
mode_label->set_text("Mode:"_short_string);
mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
mode_label->set_fixed_size(80, 20);

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_values = [&](auto label, int value, int range_min, int range_max = 10) {
thickness_or_radius_label->set_text(label);
thickness_or_radius_label->set_text(String::from_utf8(label).release_value_but_fixme_should_propagate_errors());
thickness_or_radius_slider->set_range(range_min, range_max);
thickness_or_radius_slider->set_value(value);
};
if (m_fill_mode == FillMode::RoundedCorners)
update_values("Radius:", m_corner_radius, 0, 50);
update_values("Radius:"sv, m_corner_radius, 0, 50);
else
update_values("Thickness:", m_thickness, 1);
update_values("Thickness:"sv, m_thickness, 1);
};
update_slider();
@ -181,7 +181,7 @@ ErrorOr<GUI::Widget*> RectangleTool::get_properties_widget()
auto mode_container = TRY(properties_widget->try_add<GUI::Widget>());
mode_container->set_fixed_height(90);
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto mode_label = TRY(mode_container->try_add<GUI::Label>("Mode:"));
auto mode_label = TRY(mode_container->try_add<GUI::Label>("Mode:"_short_string));
mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
mode_label->set_fixed_size(30, 20);
@ -225,7 +225,7 @@ ErrorOr<GUI::Widget*> RectangleTool::get_properties_widget()
(void)TRY(aspect_container->try_set_layout<GUI::VerticalBoxLayout>());
aspect_container->set_fixed_width(75);
auto aspect_label = TRY(aspect_container->try_add<GUI::Label>("Aspect Ratio:"));
auto aspect_label = TRY(aspect_container->try_add<GUI::Label>(TRY("Aspect Ratio:"_string)));
aspect_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
aspect_label->set_fixed_size(75, 20);
@ -246,7 +246,7 @@ ErrorOr<GUI::Widget*> RectangleTool::get_properties_widget()
}
};
auto multiply_label = TRY(aspect_fields_container->try_add<GUI::Label>("x"));
auto multiply_label = TRY(aspect_fields_container->try_add<GUI::Label>("x"_short_string));
multiply_label->set_text_alignment(Gfx::TextAlignment::Center);
multiply_label->set_fixed_size(10, 20);

View file

@ -100,7 +100,7 @@ ErrorOr<GUI::Widget*> SprayTool::get_properties_widget()
size_container->set_fixed_height(20);
(void)TRY(size_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto size_label = TRY(size_container->try_add<GUI::Label>("Size:"));
auto size_label = TRY(size_container->try_add<GUI::Label>("Size:"_short_string));
size_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
size_label->set_fixed_size(80, 20);
@ -117,7 +117,7 @@ ErrorOr<GUI::Widget*> SprayTool::get_properties_widget()
density_container->set_fixed_height(20);
(void)TRY(density_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto density_label = TRY(density_container->try_add<GUI::Label>("Density:"));
auto density_label = TRY(density_container->try_add<GUI::Label>(TRY("Density:"_string)));
density_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
density_label->set_fixed_size(80, 20);

View file

@ -111,16 +111,16 @@ ErrorOr<GUI::Widget*> TextTool::get_properties_widget()
auto properties_widget = TRY(GUI::Widget::try_create());
(void)TRY(properties_widget->try_set_layout<GUI::VerticalBoxLayout>());
auto font_header = TRY(properties_widget->try_add<GUI::Label>("Current Font:"));
auto font_header = TRY(properties_widget->try_add<GUI::Label>(TRY("Current Font:"_string)));
font_header->set_text_alignment(Gfx::TextAlignment::CenterLeft);
m_font_label = TRY(properties_widget->try_add<GUI::Label>(m_selected_font->human_readable_name()));
m_font_label = TRY(properties_widget->try_add<GUI::Label>(TRY(String::from_deprecated_string(m_selected_font->human_readable_name()))));
auto change_font_button = TRY(properties_widget->try_add<GUI::Button>(TRY("Change Font..."_string)));
change_font_button->on_click = [this](auto) {
auto picker = GUI::FontPicker::construct(nullptr, m_selected_font, false);
if (picker->exec() == GUI::Dialog::ExecResult::OK) {
m_font_label->set_text(picker->font()->human_readable_name());
m_font_label->set_text(String::from_deprecated_string(picker->font()->human_readable_name()).release_value_but_fixme_should_propagate_errors());
m_selected_font = picker->font();
m_text_editor->set_font(m_selected_font);
m_editor->set_focus(true);

View file

@ -77,7 +77,7 @@ ErrorOr<GUI::Widget*> WandSelectTool::get_properties_widget()
threshold_container->set_fixed_height(20);
(void)TRY(threshold_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto threshold_label = TRY(threshold_container->try_add<GUI::Label>("Threshold:"));
auto threshold_label = TRY(threshold_container->try_add<GUI::Label>(TRY("Threshold:"_string)));
threshold_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
threshold_label->set_fixed_size(80, 20);
@ -95,7 +95,7 @@ ErrorOr<GUI::Widget*> WandSelectTool::get_properties_widget()
(void)TRY(mode_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto mode_label = TRY(mode_container->try_add<GUI::Label>());
mode_label->set_text("Mode:");
mode_label->set_text("Mode:"_short_string);
mode_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
mode_label->set_fixed_size(80, 20);

View file

@ -33,7 +33,7 @@ ErrorOr<GUI::Widget*> ZoomTool::get_properties_widget()
sensitivity_container->set_fixed_height(20);
(void)TRY(sensitivity_container->try_set_layout<GUI::HorizontalBoxLayout>());
auto sensitivity_label = TRY(sensitivity_container->try_add<GUI::Label>("Sensitivity:"));
auto sensitivity_label = TRY(sensitivity_container->try_add<GUI::Label>(TRY("Sensitivity:"_string)));
sensitivity_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
sensitivity_label->set_fixed_size(80, 20);

View file

@ -239,7 +239,7 @@ void SoundPlayerWidgetAdvancedView::shuffle_mode_changed(Player::ShuffleMode)
void SoundPlayerWidgetAdvancedView::time_elapsed(int seconds)
{
m_timestamp_label->set_text(DeprecatedString::formatted("Elapsed: {:02}:{:02}:{:02}", seconds / 3600, seconds / 60, seconds % 60));
m_timestamp_label->set_text(String::formatted("Elapsed: {:02}:{:02}:{:02}", seconds / 3600, seconds / 60, seconds % 60).release_value_but_fixme_should_propagate_errors());
}
void SoundPlayerWidgetAdvancedView::file_name_changed(StringView name)
@ -275,7 +275,7 @@ void SoundPlayerWidgetAdvancedView::sound_buffer_played(FixedArray<Audio::Sample
void SoundPlayerWidgetAdvancedView::volume_changed(double volume)
{
m_volume_label->set_text(DeprecatedString::formatted("{}%", static_cast<int>(volume * 100)));
m_volume_label->set_text(String::formatted("{}%", static_cast<int>(volume * 100)).release_value_but_fixme_should_propagate_errors());
}
void SoundPlayerWidgetAdvancedView::playlist_loaded(StringView path, bool loaded)

View file

@ -18,7 +18,7 @@ ErrorOr<NonnullRefPtr<ProgressWindow>> ProgressWindow::try_create(StringView tit
main_widget->set_fill_with_background_color(true);
TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>());
auto label = TRY(main_widget->try_add<GUI::Label>("Analyzing storage space..."));
auto label = TRY(main_widget->try_add<GUI::Label>(TRY("Analyzing storage space..."_string)));
label->set_fixed_height(22);
window->m_progress_label = TRY(main_widget->try_add<GUI::Label>());
@ -42,7 +42,7 @@ ProgressWindow::~ProgressWindow() = default;
void ProgressWindow::update_progress_label(size_t files_encountered_count)
{
m_progress_label->set_text(DeprecatedString::formatted("{} files...", files_encountered_count));
m_progress_label->set_text(String::formatted("{} files...", files_encountered_count).release_value_but_fixme_should_propagate_errors());
// FIXME: Why is this necessary to make the window repaint?
Core::EventLoop::current().pump(Core::EventLoop::WaitMode::PollForEvents);
}

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>();
horizontal_alignment_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
horizontal_alignment_label.set_text("Horizontal text alignment");
horizontal_alignment_label.set_text("Horizontal text alignment"_string.release_value_but_fixme_should_propagate_errors());
auto& horizontal_combobox = alignment_tab.add<GUI::ComboBox>();
horizontal_combobox.set_only_allow_values_from_model(true);
@ -240,7 +240,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector<Position> const& po
auto& vertical_alignment_label = vertical_alignment_container.add<GUI::Label>();
vertical_alignment_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
vertical_alignment_label.set_text("Vertical text alignment");
vertical_alignment_label.set_text("Vertical text alignment"_string.release_value_but_fixme_should_propagate_errors());
auto& vertical_combobox = alignment_tab.add<GUI::ComboBox>();
vertical_combobox.set_only_allow_values_from_model(true);
@ -281,7 +281,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector<Position> const& po
auto& foreground_label = foreground_container.add<GUI::Label>();
foreground_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
foreground_label.set_text("Static foreground color");
foreground_label.set_text("Static foreground color"_string.release_value_but_fixme_should_propagate_errors());
auto& foreground_selector = foreground_container.add<GUI::ColorInput>();
if (m_static_format.foreground_color.has_value())
@ -300,7 +300,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector<Position> const& po
auto& background_label = background_container.add<GUI::Label>();
background_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
background_label.set_text("Static background color");
background_label.set_text("Static background color"_string.release_value_but_fixme_should_propagate_errors());
auto& background_selector = background_container.add<GUI::ColorInput>();
if (m_static_format.background_color.has_value())

View file

@ -153,7 +153,7 @@ void CSVImportDialogPage::update_preview()
m_previously_made_reader = make_reader();
if (!m_previously_made_reader.has_value()) {
m_data_preview_table_view->set_model(nullptr);
m_data_preview_error_label->set_text("Could not read the given file");
m_data_preview_error_label->set_text("Could not read the given file"_string.release_value_but_fixme_should_propagate_errors());
m_data_preview_widget->set_active_widget(m_data_preview_error_label);
return;
}
@ -161,7 +161,7 @@ void CSVImportDialogPage::update_preview()
auto& reader = *m_previously_made_reader;
if (reader.has_error()) {
m_data_preview_table_view->set_model(nullptr);
m_data_preview_error_label->set_text(DeprecatedString::formatted("XSV parse error:\n{}", reader.error_string()));
m_data_preview_error_label->set_text(String::formatted("XSV parse error:\n{}", reader.error_string()).release_value_but_fixme_should_propagate_errors());
m_data_preview_widget->set_active_widget(m_data_preview_error_label);
return;
}

View file

@ -41,7 +41,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, Vector<NonnullR
auto& top_bar = container.add<GUI::Frame>();
top_bar.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 1);
top_bar.set_preferred_height(26);
auto& current_cell_label = top_bar.add<GUI::Label>("");
auto& current_cell_label = top_bar.add<GUI::Label>();
current_cell_label.set_fixed_width(50);
auto& help_button = top_bar.add<GUI::Button>();
@ -361,7 +361,7 @@ void SpreadsheetWidget::setup_tabs(Vector<NonnullRefPtr<Sheet>> new_sheets)
if (selection.size() == 1) {
auto& position = selection.first();
m_current_cell_label->set_text(position.to_cell_identifier(sheet));
m_current_cell_label->set_text(String::from_deprecated_string(position.to_cell_identifier(sheet)).release_value_but_fixme_should_propagate_errors());
auto& cell = sheet.ensure(position);
m_cell_value_editor->on_change = nullptr;
@ -382,7 +382,7 @@ void SpreadsheetWidget::setup_tabs(Vector<NonnullRefPtr<Sheet>> new_sheets)
// There are many cells selected, change all of them.
StringBuilder builder;
builder.appendff("<{}>", selection.size());
m_current_cell_label->set_text(builder.string_view());
m_current_cell_label->set_text(builder.to_string().release_value_but_fixme_should_propagate_errors());
Vector<Cell&> cells;
for (auto& position : selection)
@ -456,7 +456,7 @@ void SpreadsheetWidget::try_generate_tip_for_input_expression(StringView source,
if (text.is_empty()) {
m_inline_documentation_window->hide();
} else {
m_inline_documentation_label->set_text(move(text));
m_inline_documentation_label->set_text(String::from_deprecated_string(text).release_value_but_fixme_should_propagate_errors());
m_inline_documentation_window->show();
}
}
@ -524,7 +524,7 @@ void SpreadsheetWidget::load_file(String const& filename, Core::File& file)
}
m_cell_value_editor->on_change = nullptr;
m_current_cell_label->set_text("");
m_current_cell_label->set_text({});
m_should_change_selected_cells = false;
while (auto* widget = m_tab_widget->active_widget()) {
m_tab_widget->remove_tab(*widget);
@ -549,7 +549,7 @@ void SpreadsheetWidget::import_sheets(String const& filename, Core::File& file)
window()->set_modified(true);
m_cell_value_editor->on_change = nullptr;
m_current_cell_label->set_text("");
m_current_cell_label->set_text({});
m_should_change_selected_cells = false;
while (auto* widget = m_tab_widget->active_widget()) {
m_tab_widget->remove_tab(*widget);

View file

@ -45,7 +45,7 @@ MemoryStatsWidget::MemoryStatsWidget(GraphWidget* graph)
set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 8, 0, 0 }, 3);
auto build_widgets_for_label = [this](DeprecatedString const& description) -> RefPtr<GUI::Label> {
auto build_widgets_for_label = [this](String const& description) -> RefPtr<GUI::Label> {
auto& container = add<GUI::Widget>();
container.set_layout<GUI::HorizontalBoxLayout>();
container.set_fixed_size(275, 12);
@ -57,12 +57,12 @@ MemoryStatsWidget::MemoryStatsWidget(GraphWidget* graph)
return label;
};
m_physical_pages_label = build_widgets_for_label("Physical memory:");
m_physical_pages_committed_label = build_widgets_for_label("Committed memory:");
m_kmalloc_space_label = build_widgets_for_label("Kernel heap:");
m_kmalloc_count_label = build_widgets_for_label("Calls kmalloc:");
m_kfree_count_label = build_widgets_for_label("Calls kfree:");
m_kmalloc_difference_label = build_widgets_for_label("Difference:");
m_physical_pages_label = build_widgets_for_label("Physical memory:"_string.release_value_but_fixme_should_propagate_errors());
m_physical_pages_committed_label = build_widgets_for_label("Committed memory:"_string.release_value_but_fixme_should_propagate_errors());
m_kmalloc_space_label = build_widgets_for_label("Kernel heap:"_string.release_value_but_fixme_should_propagate_errors());
m_kmalloc_count_label = build_widgets_for_label("Calls kmalloc:"_string.release_value_but_fixme_should_propagate_errors());
m_kfree_count_label = build_widgets_for_label("Calls kfree:"_string.release_value_but_fixme_should_propagate_errors());
m_kmalloc_difference_label = build_widgets_for_label("Difference:"_string.release_value_but_fixme_should_propagate_errors());
refresh();
}
@ -125,12 +125,12 @@ void MemoryStatsWidget::refresh()
u64 physical_pages_in_use = physical_allocated;
u64 total_userphysical_and_swappable_pages = physical_allocated + physical_committed + physical_uncommitted;
m_kmalloc_space_label->set_text(DeprecatedString::formatted("{}/{}", human_readable_size(kmalloc_allocated), human_readable_size(kmalloc_bytes_total)));
m_physical_pages_label->set_text(DeprecatedString::formatted("{}/{}", human_readable_size(page_count_to_bytes(physical_pages_in_use)), human_readable_size(page_count_to_bytes(physical_pages_total))));
m_physical_pages_committed_label->set_text(DeprecatedString::formatted("{}", human_readable_size(page_count_to_bytes(physical_committed))));
m_kmalloc_count_label->set_text(DeprecatedString::formatted("{}", kmalloc_call_count));
m_kfree_count_label->set_text(DeprecatedString::formatted("{}", kfree_call_count));
m_kmalloc_difference_label->set_text(DeprecatedString::formatted("{:+}", kmalloc_call_count - kfree_call_count));
m_kmalloc_space_label->set_text(String::formatted("{}/{}", human_readable_size(kmalloc_allocated), human_readable_size(kmalloc_bytes_total)).release_value_but_fixme_should_propagate_errors());
m_physical_pages_label->set_text(String::formatted("{}/{}", human_readable_size(page_count_to_bytes(physical_pages_in_use)), human_readable_size(page_count_to_bytes(physical_pages_total))).release_value_but_fixme_should_propagate_errors());
m_physical_pages_committed_label->set_text(String::formatted("{}", human_readable_size(page_count_to_bytes(physical_committed))).release_value_but_fixme_should_propagate_errors());
m_kmalloc_count_label->set_text(String::formatted("{}", kmalloc_call_count).release_value_but_fixme_should_propagate_errors());
m_kfree_count_label->set_text(String::formatted("{}", kfree_call_count).release_value_but_fixme_should_propagate_errors());
m_kmalloc_difference_label->set_text(String::formatted("{:+}", kmalloc_call_count - kfree_call_count).release_value_but_fixme_should_propagate_errors());
// Because the initialization order of us and the graph is unknown, we might get a couple of updates where the graph widget lookup fails.
// Therefore, we can retry indefinitely. (Should not be too much of a performance hit, as we don't update that often.)

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>("process_name")->set_text(DeprecatedString::formatted("{} (PID {})", process_index.sibling_at_column(ProcessModel::Column::Name).data().to_deprecated_string(), pid));
main_widget->find_descendant_of_type_named<GUI::Label>("process_name")->set_text(String::formatted("{} (PID {})", process_index.sibling_at_column(ProcessModel::Column::Name).data().to_deprecated_string(), pid).release_value_but_fixme_should_propagate_errors());
main_widget->find_descendant_of_type_named<SystemMonitor::ProcessStateWidget>("process_state")->set_pid(pid);
main_widget->find_descendant_of_type_named<SystemMonitor::ProcessFileDescriptorMapWidget>("open_files")->set_pid(pid);

View file

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

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

View file

@ -263,7 +263,7 @@ void VideoPlayerWidget::set_time_label(Time timestamp)
string_builder.append(" / --:--:--"sv);
}
m_timestamp_label->set_text(string_builder.string_view());
m_timestamp_label->set_text(string_builder.to_string().release_value_but_fixme_should_propagate_errors());
}
void VideoPlayerWidget::drop_event(GUI::DropEvent& event)

View file

@ -50,7 +50,7 @@ ErrorOr<void> WelcomeWidget::create_widgets()
m_tip_index++;
if (m_tip_index >= m_tips.size())
m_tip_index = 0;
m_tip_label->set_text(m_tips[m_tip_index].to_deprecated_string());
m_tip_label->set_text(m_tips[m_tip_index]);
};
m_help_button = find_descendant_of_type_named<GUI::Button>("help_button");
@ -82,7 +82,7 @@ ErrorOr<void> WelcomeWidget::create_widgets()
if (auto result = open_and_parse_tips_file(); result.is_error()) {
auto path = TRY(String::formatted("{}/tips.txt", Core::StandardPaths::documents_directory()));
auto error = TRY(String::formatted("Opening \"{}\" failed: {}", path, result.error()));
m_tip_label->set_text(error.to_deprecated_string());
m_tip_label->set_text(error);
warnln(error);
}
@ -114,7 +114,7 @@ void WelcomeWidget::set_random_tip()
return;
m_tip_index = get_random_uniform(m_tips.size());
m_tip_label->set_text(m_tips[m_tip_index].to_deprecated_string());
m_tip_label->set_text(m_tips[m_tip_index]);
}
void WelcomeWidget::paint_event(GUI::PaintEvent& event)