From c776d76b71695f64b4281ad02144c30a0844e965 Mon Sep 17 00:00:00 2001 From: asynts Date: Mon, 5 Oct 2020 18:05:35 +0200 Subject: [PATCH] Help: Use new format functions. --- Applications/Help/ManualModel.cpp | 2 +- Applications/Help/ManualPageNode.cpp | 2 +- Applications/Help/ManualSectionNode.cpp | 2 +- Applications/Help/ManualSectionNode.h | 2 +- Applications/Help/main.cpp | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Applications/Help/ManualModel.cpp b/Applications/Help/ManualModel.cpp index b8829f5077..4384e596f6 100644 --- a/Applications/Help/ManualModel.cpp +++ b/Applications/Help/ManualModel.cpp @@ -107,7 +107,7 @@ String ManualModel::page_and_section(const GUI::ModelIndex& index) const return {}; auto* page = static_cast(node); auto* section = static_cast(page->parent()); - return String::format("%s(%s)", page->name().characters(), section->section_name().characters()); + return String::formatted("{}({})", page->name(), section->section_name()); } GUI::ModelIndex ManualModel::index(int row, int column, const GUI::ModelIndex& parent_index) const diff --git a/Applications/Help/ManualPageNode.cpp b/Applications/Help/ManualPageNode.cpp index 594a002b1b..4b30c4dca4 100644 --- a/Applications/Help/ManualPageNode.cpp +++ b/Applications/Help/ManualPageNode.cpp @@ -40,5 +40,5 @@ NonnullOwnPtrVector& ManualPageNode::children() const String ManualPageNode::path() const { - return String::format("%s/%s.md", m_section.path().characters(), m_page.characters()); + return String::formatted("{}/{}.md", m_section.path(), m_page); } diff --git a/Applications/Help/ManualSectionNode.cpp b/Applications/Help/ManualSectionNode.cpp index 4f23b8fc0c..ce34eb3286 100644 --- a/Applications/Help/ManualSectionNode.cpp +++ b/Applications/Help/ManualSectionNode.cpp @@ -33,7 +33,7 @@ String ManualSectionNode::path() const { - return String::format("/usr/share/man/man%s", m_section.characters()); + return String::formatted("/usr/share/man/man{}", m_section); } void ManualSectionNode::reify_if_needed() const diff --git a/Applications/Help/ManualSectionNode.h b/Applications/Help/ManualSectionNode.h index b0114201c3..9b70ea9812 100644 --- a/Applications/Help/ManualSectionNode.h +++ b/Applications/Help/ManualSectionNode.h @@ -34,7 +34,7 @@ public: ManualSectionNode(String section, String name) : m_section(section) - , m_full_name(String::format("%s. %s", section.characters(), name.characters())) + , m_full_name(String::formatted("{}. {}", section, name)) { } diff --git a/Applications/Help/main.cpp b/Applications/Help/main.cpp index ea06761b91..9a3290272f 100644 --- a/Applications/Help/main.cpp +++ b/Applications/Help/main.cpp @@ -172,7 +172,7 @@ int main(int argc, char* argv[]) page_view.load_html(html, URL::create_with_file_protocol(path)); String page_and_section = model->page_and_section(tree_view.selection().first()); - window->set_title(String::format("%s - Help", page_and_section.characters())); + window->set_title(String::formatted("{} - Help", page_and_section)); }; tree_view.on_selection_change = [&] { @@ -194,7 +194,7 @@ int main(int argc, char* argv[]) auto open_external = [&](auto& url) { if (!Desktop::Launcher::open(url)) { GUI::MessageBox::show(window, - String::format("The link to '%s' could not be opened.", url.to_string().characters()), + String::formatted("The link to '{}' could not be opened.", url), "Failed to open link", GUI::MessageBox::Type::Error); } @@ -234,7 +234,7 @@ int main(int argc, char* argv[]) } auto tree_view_index = model->index_from_path(path); if (tree_view_index.has_value()) { - dbg() << "Found path _" << path << "_ in model at index " << tree_view_index.value(); + dbgln("Found path _{}_ in model at index {}", path, tree_view_index.value()); tree_view.selection().set(tree_view_index.value()); return; }