1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:37:34 +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

@ -30,7 +30,7 @@ DisassemblyWidget::DisassemblyWidget()
m_top_container->set_layout<GUI::HorizontalBoxLayout>();
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>();
@ -49,9 +49,9 @@ void DisassemblyWidget::update_state(Debug::DebugSession const& debug_session, P
return;
auto containing_function = lib->debug_info->get_containing_function(regs.ip() - lib->base_address);
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
m_function_name_label->set_text("<missing>");
m_function_name_label->set_text("<missing>"_string.release_value_but_fixme_should_propagate_errors());
show_disassembly();
} else {
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()
{
m_disassembly_view->set_model({});
m_function_name_label->set_text("");
m_function_name_label->set_text({});
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 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);

View file

@ -113,18 +113,18 @@ void NewProjectDialog::update_dialog()
m_input_valid = true;
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 {
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;
}
auto maybe_project_path = get_project_full_path();
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 {
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;
}

View file

@ -22,19 +22,19 @@ void GMLPreviewWidget::load_gml(DeprecatedString const& gml)
if (gml.is_empty()) {
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;
}
// 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>> {
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()) {
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(); };
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);
m_unstaged_files = unstaged.add<GitFilesView>(
@ -64,7 +64,7 @@ GitWidget::GitWidget()
commit_button.on_click = [this](int) { commit(); };
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);
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_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;
clock.start();
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();
update_timer->start();