Selaa lähdekoodia

Help: Use new format functions.

asynts 4 vuotta sitten
vanhempi
commit
c776d76b71

+ 1 - 1
Applications/Help/ManualModel.cpp

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

+ 1 - 1
Applications/Help/ManualPageNode.cpp

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

+ 1 - 1
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

+ 1 - 1
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))
     {
     }
 

+ 3 - 3
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;
         }