diff --git a/Applications/SystemMonitor/MemoryStatsWidget.cpp b/Applications/SystemMonitor/MemoryStatsWidget.cpp index 809a8aaecb..4c32d6f828 100644 --- a/Applications/SystemMonitor/MemoryStatsWidget.cpp +++ b/Applications/SystemMonitor/MemoryStatsWidget.cpp @@ -119,12 +119,12 @@ void MemoryStatsWidget::refresh() size_t user_pages_available = user_physical_allocated + user_physical_available; size_t supervisor_pages_available = super_physical_alloc + super_physical_free; - m_kmalloc_space_label->set_text(String::format("%uK/%uK", bytes_to_kb(kmalloc_allocated), bytes_to_kb(kmalloc_sum_available))); - m_user_physical_pages_label->set_text(String::format("%uK/%uK", page_count_to_kb(user_physical_allocated), page_count_to_kb(user_pages_available))); - m_supervisor_physical_pages_label->set_text(String::format("%uK/%uK", page_count_to_kb(super_physical_alloc), page_count_to_kb(supervisor_pages_available))); - m_kmalloc_count_label->set_text(String::format("%u", kmalloc_call_count)); - m_kfree_count_label->set_text(String::format("%u", kfree_call_count)); - m_kmalloc_difference_label->set_text(String::format("+%u", kmalloc_call_count - kfree_call_count)); + m_kmalloc_space_label->set_text(String::formatted("{}K/{}K", bytes_to_kb(kmalloc_allocated), bytes_to_kb(kmalloc_sum_available))); + m_user_physical_pages_label->set_text(String::formatted("{}K/{}K", page_count_to_kb(user_physical_allocated), page_count_to_kb(user_pages_available))); + m_supervisor_physical_pages_label->set_text(String::formatted("{}K/{}K", page_count_to_kb(super_physical_alloc), page_count_to_kb(supervisor_pages_available))); + m_kmalloc_count_label->set_text(String::formatted("{}", kmalloc_call_count)); + m_kfree_count_label->set_text(String::formatted("{}", kfree_call_count)); + m_kmalloc_difference_label->set_text(String::formatted("{:+}", kmalloc_call_count - kfree_call_count)); m_graph.set_max(page_count_to_kb(user_pages_available)); m_graph.add_value(page_count_to_kb(user_physical_allocated)); diff --git a/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp b/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp index da3868dda2..48dfae098d 100644 --- a/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp +++ b/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp @@ -70,5 +70,5 @@ void ProcessFileDescriptorMapWidget::set_pid(pid_t pid) if (m_pid == pid) return; m_pid = pid; - m_model->set_json_path(String::format("/proc/%d/fds", m_pid)); + m_model->set_json_path(String::formatted("/proc/{}/fds", m_pid)); } diff --git a/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp b/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp index 978005422b..ccc4d12f85 100644 --- a/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp +++ b/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp @@ -72,7 +72,7 @@ ProcessMemoryMapWidget::ProcessMemoryMapWidget() Vector pid_vm_fields; pid_vm_fields.empend( "Address", Gfx::TextAlignment::CenterLeft, - [](auto& object) { return String::format("%#x", object.get("address").to_u32()); }, + [](auto& object) { return String::formatted("{:#x}", object.get("address").to_u32()); }, [](auto& object) { return object.get("address").to_u32(); }); pid_vm_fields.empend("size", "Size", Gfx::TextAlignment::CenterRight); pid_vm_fields.empend("amount_resident", "Resident", Gfx::TextAlignment::CenterRight); @@ -133,7 +133,7 @@ void ProcessMemoryMapWidget::set_pid(pid_t pid) if (m_pid == pid) return; m_pid = pid; - m_json_model->set_json_path(String::format("/proc/%d/vm", pid)); + m_json_model->set_json_path(String::formatted("/proc/{}/vm", pid)); } void ProcessMemoryMapWidget::refresh() diff --git a/Applications/SystemMonitor/ProcessModel.cpp b/Applications/SystemMonitor/ProcessModel.cpp index d1c7901f0d..885320b30d 100644 --- a/Applications/SystemMonitor/ProcessModel.cpp +++ b/Applications/SystemMonitor/ProcessModel.cpp @@ -153,7 +153,7 @@ String ProcessModel::column_name(int column) const static String pretty_byte_size(size_t size) { - return String::format("%uK", size / 1024); + return String::formatted("{}K", size / 1024); } GUI::Variant ProcessModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const diff --git a/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp b/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp index 98fd77e72d..9e2d22443c 100644 --- a/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp +++ b/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp @@ -53,5 +53,5 @@ void ProcessUnveiledPathsWidget::set_pid(pid_t pid) if (m_pid == pid) return; m_pid = pid; - m_model->set_json_path(String::format("/proc/%d/unveil", m_pid)); + m_model->set_json_path(String::formatted("/proc/{}/unveil", m_pid)); } diff --git a/Applications/SystemMonitor/ThreadStackWidget.cpp b/Applications/SystemMonitor/ThreadStackWidget.cpp index 3b7e677192..01e37791a0 100644 --- a/Applications/SystemMonitor/ThreadStackWidget.cpp +++ b/Applications/SystemMonitor/ThreadStackWidget.cpp @@ -55,9 +55,9 @@ void ThreadStackWidget::set_ids(pid_t pid, pid_t tid) void ThreadStackWidget::refresh() { - auto file = Core::File::construct(String::format("/proc/%d/stacks/%d", m_pid, m_tid)); + auto file = Core::File::construct(String::formatted("/proc/{}/stacks/{}", m_pid, m_tid)); if (!file->open(Core::IODevice::ReadOnly)) { - m_stack_editor->set_text(String::format("Unable to open %s", file->filename().characters())); + m_stack_editor->set_text(String::formatted("Unable to open {}", file->filename())); return; } diff --git a/Applications/SystemMonitor/main.cpp b/Applications/SystemMonitor/main.cpp index 8428fa8876..ed554646f2 100644 --- a/Applications/SystemMonitor/main.cpp +++ b/Applications/SystemMonitor/main.cpp @@ -97,7 +97,7 @@ private: static bool can_access_pid(pid_t pid) { - auto path = String::format("/proc/%d", pid); + auto path = String::formatted("/proc/{}", pid); return access(path.characters(), X_OK) == 0; } @@ -469,21 +469,21 @@ NonnullRefPtr build_pci_devices_tab() auto bus = object.get("bus").to_u32(); auto slot = object.get("slot").to_u32(); auto function = object.get("function").to_u32(); - return String::format("%04x:%02x:%02x.%d", seg, bus, slot, function); + return String::formatted("{:04x}:{:02x}:{:02x}.{}", seg, bus, slot, function); }); pci_fields.empend( "Class", Gfx::TextAlignment::CenterLeft, [db](const JsonObject& object) { auto class_id = object.get("class").to_u32(); String class_name = db->get_class(class_id); - return class_name == "" ? String::format("%04x", class_id) : class_name; + return class_name == "" ? String::formatted("{:04x}", class_id) : class_name; }); pci_fields.empend( "Vendor", Gfx::TextAlignment::CenterLeft, [db](const JsonObject& object) { auto vendor_id = object.get("vendor_id").to_u32(); String vendor_name = db->get_vendor(vendor_id); - return vendor_name == "" ? String::format("%02x", vendor_id) : vendor_name; + return vendor_name == "" ? String::formatted("{:02x}", vendor_id) : vendor_name; }); pci_fields.empend( "Device", Gfx::TextAlignment::CenterLeft, @@ -491,13 +491,13 @@ NonnullRefPtr build_pci_devices_tab() auto vendor_id = object.get("vendor_id").to_u32(); auto device_id = object.get("device_id").to_u32(); String device_name = db->get_device(vendor_id, device_id); - return device_name == "" ? String::format("%02x", device_id) : device_name; + return device_name == "" ? String::formatted("{:02x}", device_id) : device_name; }); pci_fields.empend( "Revision", Gfx::TextAlignment::CenterRight, [](const JsonObject& object) { auto revision_id = object.get("revision_id").to_u32(); - return String::format("%02x", revision_id); + return String::formatted("{:02x}", revision_id); }); pci_table_view.set_model(GUI::SortingProxyModel::create(GUI::JsonArrayModel::create("/proc/pci", move(pci_fields)))); @@ -545,7 +545,7 @@ NonnullRefPtr build_graphs_tab() cpu_graph.set_text_color(Color::Green); cpu_graph.set_graph_color(Color::from_rgb(0x00bb00)); cpu_graph.text_formatter = [](int value, int) { - return String::format("%d%%", value); + return String::formatted("{}%", value); }; cpu_graphs.append(&cpu_graph); } @@ -563,7 +563,7 @@ NonnullRefPtr build_graphs_tab() memory_graph.set_text_color(Color::Cyan); memory_graph.set_graph_color(Color::from_rgb(0x00bbbb)); memory_graph.text_formatter = [](int value, int max) { - return String::format("%d / %d KiB", value, max); + return String::formatted("{} / {} KiB", value, max); }; self.add(memory_graph);