Help: Use new format functions.

This commit is contained in:
asynts 2020-10-05 18:05:35 +02:00 committed by Andreas Kling
parent 30b9dff5aa
commit c776d76b71
Notes: sideshowbarker 2024-07-19 02:01:23 +09:00
5 changed files with 7 additions and 7 deletions

View file

@ -107,7 +107,7 @@ String ManualModel::page_and_section(const GUI::ModelIndex& index) const
return {};
auto* page = static_cast<const ManualPageNode*>(node);
auto* section = static_cast<const ManualSectionNode*>(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

View file

@ -40,5 +40,5 @@ NonnullOwnPtrVector<ManualNode>& 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);
}

View file

@ -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

View file

@ -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))
{
}

View file

@ -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;
}