1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:17:35 +00:00

LibGUI+Userland: Port StatusBar::text() and set_text functions to String

This commit is contained in:
Karol Kosek 2023-06-04 10:24:38 +02:00 committed by Sam Atkins
parent 2064f544c6
commit 2029750519
27 changed files with 88 additions and 88 deletions

View file

@ -350,7 +350,7 @@ WebView::OutOfProcessWebView& MainWidget::ensure_web_view()
m_page_view = web_view_container.add<WebView::OutOfProcessWebView>();
m_page_view->on_link_hover = [this](auto& url) {
if (url.is_valid())
m_statusbar->set_text(url.to_deprecated_string());
m_statusbar->set_text(String::from_deprecated_string(url.to_deprecated_string()).release_value_but_fixme_should_propagate_errors());
else
update_statusbar();
};
@ -600,12 +600,12 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
auto syntax_menu = TRY(view_menu->try_add_submenu("&Syntax"_short_string));
m_plain_text_highlight = GUI::Action::create_checkable("&Plain Text", [&](auto&) {
m_statusbar->set_text(1, "Plain Text");
m_statusbar->set_text(1, "Plain Text"_string.release_value_but_fixme_should_propagate_errors());
m_editor->set_syntax_highlighter({});
m_editor->update();
});
m_plain_text_highlight->set_checked(true);
m_statusbar->set_text(1, "Plain Text");
m_statusbar->set_text(1, TRY("Plain Text"_string));
syntax_actions.add_action(*m_plain_text_highlight);
TRY(syntax_menu->try_add_action(*m_plain_text_highlight));
@ -940,13 +940,13 @@ void MainWidget::update_statusbar()
auto word_count = m_editor->number_of_words();
builder.appendff("{:'d} {} ({:'d} {})", text.length(), text.length() == 1 ? "character" : "characters", word_count, word_count != 1 ? "words" : "word");
}
m_statusbar->set_text(0, builder.to_deprecated_string());
m_statusbar->set_text(0, builder.to_string().release_value_but_fixme_should_propagate_errors());
if (m_editor && m_editor->syntax_highlighter()) {
auto language = m_editor->syntax_highlighter()->language();
m_statusbar->set_text(1, Syntax::language_to_string(language));
m_statusbar->set_text(1, String::from_utf8(Syntax::language_to_string(language)).release_value_but_fixme_should_propagate_errors());
}
m_statusbar->set_text(2, DeprecatedString::formatted("Ln {:'d} Col {:'d}", m_editor->cursor().line() + 1, m_editor->cursor().column()));
m_statusbar->set_text(2, String::formatted("Ln {:'d} Col {:'d}", m_editor->cursor().line() + 1, m_editor->cursor().column()).release_value_but_fixme_should_propagate_errors());
}
void MainWidget::find_text(GUI::TextEditor::SearchDirection direction, ShowMessageIfNoResults show_message)