1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:37:46 +00:00

Everywhere: Add sv suffix to strings relying on StringView(char const*)

Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).

No functional changes.
This commit is contained in:
sin-ack 2022-07-11 17:32:29 +00:00 committed by Andreas Kling
parent e5f09ea170
commit 3f3f45580a
762 changed files with 8315 additions and 8316 deletions

View file

@ -153,8 +153,8 @@ void GraphWidget::paint_event(GUI::PaintEvent& event)
text_rect.set_height(font().glyph_height());
auto text = format.text_formatter(current_values[i]);
if (format.text_shadow_color != Color::Transparent)
painter.draw_text(text_rect.translated(1, 1), text.characters(), Gfx::TextAlignment::CenterRight, format.text_shadow_color);
painter.draw_text(text_rect, text.characters(), Gfx::TextAlignment::CenterRight, graph_color);
painter.draw_text(text_rect.translated(1, 1), text, Gfx::TextAlignment::CenterRight, format.text_shadow_color);
painter.draw_text(text_rect, text, Gfx::TextAlignment::CenterRight, graph_color);
y += text_rect.height() + 4;
}
}

View file

@ -114,16 +114,16 @@ void MemoryStatsWidget::refresh()
auto json_result = JsonValue::from_string(file_contents).release_value_but_fixme_should_propagate_errors();
auto const& json = json_result.as_object();
u32 kmalloc_allocated = json.get("kmalloc_allocated").to_u32();
u32 kmalloc_available = json.get("kmalloc_available").to_u32();
u64 user_physical_allocated = json.get("user_physical_allocated").to_u64();
u64 user_physical_available = json.get("user_physical_available").to_u64();
u64 user_physical_committed = json.get("user_physical_committed").to_u64();
u64 user_physical_uncommitted = json.get("user_physical_uncommitted").to_u64();
u64 super_physical_alloc = json.get("super_physical_allocated").to_u64();
u64 super_physical_free = json.get("super_physical_available").to_u64();
u32 kmalloc_call_count = json.get("kmalloc_call_count").to_u32();
u32 kfree_call_count = json.get("kfree_call_count").to_u32();
u32 kmalloc_allocated = json.get("kmalloc_allocated"sv).to_u32();
u32 kmalloc_available = json.get("kmalloc_available"sv).to_u32();
u64 user_physical_allocated = json.get("user_physical_allocated"sv).to_u64();
u64 user_physical_available = json.get("user_physical_available"sv).to_u64();
u64 user_physical_committed = json.get("user_physical_committed"sv).to_u64();
u64 user_physical_uncommitted = json.get("user_physical_uncommitted"sv).to_u64();
u64 super_physical_alloc = json.get("super_physical_allocated"sv).to_u64();
u64 super_physical_free = json.get("super_physical_available"sv).to_u64();
u32 kmalloc_call_count = json.get("kmalloc_call_count"sv).to_u32();
u32 kfree_call_count = json.get("kfree_call_count"sv).to_u32();
u64 kmalloc_bytes_total = kmalloc_allocated + kmalloc_available;
u64 user_physical_pages_total = user_physical_allocated + user_physical_available;

View file

@ -24,8 +24,8 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
layout()->set_margins(4);
set_fill_with_background_color(true);
m_network_connected_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/network-connected.png").release_value_but_fixme_should_propagate_errors();
m_network_disconnected_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/network-disconnected.png").release_value_but_fixme_should_propagate_errors();
m_network_connected_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/network-connected.png"sv).release_value_but_fixme_should_propagate_errors();
m_network_disconnected_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/network-disconnected.png"sv).release_value_but_fixme_should_propagate_errors();
m_network_link_down_bitmap = Gfx::Bitmap::try_create(m_network_connected_bitmap->format(), m_network_connected_bitmap->size()).release_value_but_fixme_should_propagate_errors();
{
@ -35,7 +35,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
});
}
auto& adapters_group_box = add<GUI::GroupBox>("Adapters");
auto& adapters_group_box = add<GUI::GroupBox>("Adapters"sv);
adapters_group_box.set_layout<GUI::VerticalBoxLayout>();
adapters_group_box.layout()->set_margins(6);
adapters_group_box.set_fixed_height(120);
@ -45,25 +45,25 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
Vector<GUI::JsonArrayModel::FieldSpec> net_adapters_fields;
net_adapters_fields.empend("", Gfx::TextAlignment::CenterLeft,
[this](JsonObject const& object) -> GUI::Variant {
if (!object.get("link_up").as_bool())
if (!object.get("link_up"sv).as_bool())
return *m_network_link_down_bitmap;
else
return object.get("ipv4_address").as_string_or("").is_empty() ? *m_network_disconnected_bitmap : *m_network_connected_bitmap;
return object.get("ipv4_address"sv).as_string_or(""sv).is_empty() ? *m_network_disconnected_bitmap : *m_network_connected_bitmap;
});
net_adapters_fields.empend("name", "Name", Gfx::TextAlignment::CenterLeft);
net_adapters_fields.empend("class_name", "Class", Gfx::TextAlignment::CenterLeft);
net_adapters_fields.empend("mac_address", "MAC", Gfx::TextAlignment::CenterLeft);
net_adapters_fields.empend("Link status", Gfx::TextAlignment::CenterLeft,
[](JsonObject const& object) -> String {
if (!object.get("link_up").as_bool())
if (!object.get("link_up"sv).as_bool())
return "Down";
return String::formatted("{} Mb/s {}-duplex", object.get("link_speed").to_i32(),
object.get("link_full_duplex").as_bool() ? "full" : "half");
return String::formatted("{} Mb/s {}-duplex", object.get("link_speed"sv).to_i32(),
object.get("link_full_duplex"sv).as_bool() ? "full"sv : "half"sv);
});
net_adapters_fields.empend("IPv4", Gfx::TextAlignment::CenterLeft,
[](JsonObject const& object) -> String {
return object.get("ipv4_address").as_string_or("");
return object.get("ipv4_address"sv).as_string_or(""sv);
});
net_adapters_fields.empend("packets_in", "Pkt In", Gfx::TextAlignment::CenterRight);
net_adapters_fields.empend("packets_out", "Pkt Out", Gfx::TextAlignment::CenterRight);
@ -72,7 +72,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
m_adapter_model = GUI::JsonArrayModel::create("/proc/net/adapters", move(net_adapters_fields));
m_adapter_table_view->set_model(MUST(GUI::SortingProxyModel::create(*m_adapter_model)));
auto& tcp_sockets_group_box = add<GUI::GroupBox>("TCP Sockets");
auto& tcp_sockets_group_box = add<GUI::GroupBox>("TCP Sockets"sv);
tcp_sockets_group_box.set_layout<GUI::VerticalBoxLayout>();
tcp_sockets_group_box.layout()->set_margins(6);
@ -93,7 +93,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
m_tcp_socket_model = GUI::JsonArrayModel::create("/proc/net/tcp", move(net_tcp_fields));
m_tcp_socket_table_view->set_model(MUST(GUI::SortingProxyModel::create(*m_tcp_socket_model)));
auto& udp_sockets_group_box = add<GUI::GroupBox>("UDP Sockets");
auto& udp_sockets_group_box = add<GUI::GroupBox>("UDP Sockets"sv);
udp_sockets_group_box.set_layout<GUI::VerticalBoxLayout>();
udp_sockets_group_box.layout()->set_margins(6);

View file

@ -27,19 +27,19 @@ ProcessFileDescriptorMapWidget::ProcessFileDescriptorMapWidget()
pid_fds_fields.empend("offset", "Offset", Gfx::TextAlignment::CenterRight);
pid_fds_fields.empend("absolute_path", "Path", Gfx::TextAlignment::CenterLeft);
pid_fds_fields.empend("Access", Gfx::TextAlignment::CenterLeft, [](auto& object) {
return object.get("seekable").to_bool() ? "Seekable" : "Sequential";
return object.get("seekable"sv).to_bool() ? "Seekable" : "Sequential";
});
pid_fds_fields.empend("Blocking", Gfx::TextAlignment::CenterLeft, [](auto& object) {
return object.get("blocking").to_bool() ? "Blocking" : "Nonblocking";
return object.get("blocking"sv).to_bool() ? "Blocking" : "Nonblocking";
});
pid_fds_fields.empend("On exec", Gfx::TextAlignment::CenterLeft, [](auto& object) {
return object.get("cloexec").to_bool() ? "Close" : "Keep";
return object.get("cloexec"sv).to_bool() ? "Close" : "Keep";
});
pid_fds_fields.empend("Can read", Gfx::TextAlignment::CenterLeft, [](auto& object) {
return object.get("can_read").to_bool() ? "Yes" : "No";
return object.get("can_read"sv).to_bool() ? "Yes" : "No";
});
pid_fds_fields.empend("Can write", Gfx::TextAlignment::CenterLeft, [](auto& object) {
return object.get("can_write").to_bool() ? "Yes" : "No";
return object.get("can_write"sv).to_bool() ? "Yes" : "No";
});
m_model = GUI::JsonArrayModel::create({}, move(pid_fds_fields));

View file

@ -57,35 +57,35 @@ ProcessMemoryMapWidget::ProcessMemoryMapWidget()
Vector<GUI::JsonArrayModel::FieldSpec> pid_vm_fields;
pid_vm_fields.empend(
"Address", Gfx::TextAlignment::CenterLeft,
[](auto& object) { return String::formatted("{:p}", object.get("address").to_u64()); },
[](auto& object) { return object.get("address").to_u64(); });
[](auto& object) { return String::formatted("{:p}", object.get("address"sv).to_u64()); },
[](auto& object) { return object.get("address"sv).to_u64(); });
pid_vm_fields.empend("size", "Size", Gfx::TextAlignment::CenterRight);
pid_vm_fields.empend("amount_resident", "Resident", Gfx::TextAlignment::CenterRight);
pid_vm_fields.empend("amount_dirty", "Dirty", Gfx::TextAlignment::CenterRight);
pid_vm_fields.empend("Access", Gfx::TextAlignment::CenterLeft, [](auto& object) {
StringBuilder builder;
if (object.get("readable").to_bool())
if (object.get("readable"sv).to_bool())
builder.append('R');
if (object.get("writable").to_bool())
if (object.get("writable"sv).to_bool())
builder.append('W');
if (object.get("executable").to_bool())
if (object.get("executable"sv).to_bool())
builder.append('X');
if (object.get("shared").to_bool())
if (object.get("shared"sv).to_bool())
builder.append('S');
if (object.get("syscall").to_bool())
if (object.get("syscall"sv).to_bool())
builder.append('C');
if (object.get("stack").to_bool())
if (object.get("stack"sv).to_bool())
builder.append('T');
return builder.to_string();
});
pid_vm_fields.empend("VMObject type", Gfx::TextAlignment::CenterLeft, [](auto& object) {
auto type = object.get("vmobject").to_string();
if (type.ends_with("VMObject"))
auto type = object.get("vmobject"sv).to_string();
if (type.ends_with("VMObject"sv))
type = type.substring(0, type.length() - 8);
return type;
});
pid_vm_fields.empend("Purgeable", Gfx::TextAlignment::CenterLeft, [](auto& object) {
if (object.get("volatile").to_bool())
if (object.get("volatile"sv).to_bool())
return "Volatile";
return "Non-volatile";
});
@ -98,7 +98,7 @@ ProcessMemoryMapWidget::ProcessMemoryMapWidget()
return GUI::Variant(0);
},
[](JsonObject const& object) {
auto pagemap = object.get("pagemap").as_string_or({});
auto pagemap = object.get("pagemap"sv).as_string_or({});
return pagemap;
});
pid_vm_fields.empend("cow_pages", "# CoW", Gfx::TextAlignment::CenterRight);

View file

@ -38,7 +38,7 @@ ProcessModel::ProcessModel()
auto cpuinfo_array = json.value().as_array();
cpuinfo_array.for_each([&](auto& value) {
auto& cpu_object = value.as_object();
auto cpu_id = cpu_object.get("processor").as_u32();
auto cpu_id = cpu_object.get("processor"sv).as_u32();
m_cpus.append(make<CpuInfo>(cpu_id));
});
}
@ -46,7 +46,7 @@ ProcessModel::ProcessModel()
if (m_cpus.is_empty())
m_cpus.append(make<CpuInfo>(0));
m_kernel_process_icon = GUI::Icon::default_icon("gear");
m_kernel_process_icon = GUI::Icon::default_icon("gear"sv);
}
int ProcessModel::row_count(GUI::ModelIndex const& index) const

View file

@ -138,7 +138,7 @@ public:
processors_field.empend("brand", "Brand", Gfx::TextAlignment::CenterLeft);
processors_field.empend("Features", Gfx::TextAlignment::CenterLeft, [](auto& object) {
StringBuilder builder;
auto features = object.get("features").as_array();
auto features = object.get("features"sv).as_array();
for (auto& feature : features.values()) {
builder.append(feature.to_string());
builder.append(' ');
@ -163,38 +163,38 @@ public:
pci_fields.empend(
"Address", Gfx::TextAlignment::CenterLeft,
[](const JsonObject& object) {
auto seg = object.get("seg").to_u32();
auto bus = object.get("bus").to_u32();
auto device = object.get("device").to_u32();
auto function = object.get("function").to_u32();
auto seg = object.get("seg"sv).to_u32();
auto bus = object.get("bus"sv).to_u32();
auto device = object.get("device"sv).to_u32();
auto function = object.get("function"sv).to_u32();
return String::formatted("{:04x}:{:02x}:{:02x}.{}", seg, bus, device, function);
});
pci_fields.empend(
"Class", Gfx::TextAlignment::CenterLeft,
[this](const JsonObject& object) {
auto class_id = object.get("class").to_u32();
String class_name = m_db ? m_db->get_class(class_id) : nullptr;
auto class_id = object.get("class"sv).to_u32();
String class_name = m_db ? m_db->get_class(class_id) : StringView {};
return class_name.is_empty() ? String::formatted("Unknown class: {:04x}", class_id) : class_name;
});
pci_fields.empend(
"Vendor", Gfx::TextAlignment::CenterLeft,
[this](const JsonObject& object) {
auto vendor_id = object.get("vendor_id").to_u32();
String vendor_name = m_db ? m_db->get_vendor(vendor_id) : nullptr;
auto vendor_id = object.get("vendor_id"sv).to_u32();
String vendor_name = m_db ? m_db->get_vendor(vendor_id) : StringView {};
return vendor_name.is_empty() ? String::formatted("Unknown vendor: {:02x}", vendor_id) : vendor_name;
});
pci_fields.empend(
"Device", Gfx::TextAlignment::CenterLeft,
[this](const JsonObject& object) {
auto vendor_id = object.get("vendor_id").to_u32();
auto device_id = object.get("device_id").to_u32();
String device_name = m_db ? m_db->get_device(vendor_id, device_id) : nullptr;
auto vendor_id = object.get("vendor_id"sv).to_u32();
auto device_id = object.get("device_id"sv).to_u32();
String device_name = m_db ? m_db->get_device(vendor_id, device_id) : StringView {};
return device_name.is_empty() ? String::formatted("Unknown device: {:02x}", device_id) : device_name;
});
pci_fields.empend(
"Revision", Gfx::TextAlignment::CenterRight,
[](const JsonObject& object) {
auto revision_id = object.get("revision_id").to_u32();
auto revision_id = object.get("revision_id"sv).to_u32();
return String::formatted("{:02x}", revision_id);
});
@ -227,18 +227,18 @@ public:
[](const JsonObject& object) {
StringBuilder size_builder;
size_builder.append(" ");
size_builder.append(human_readable_size(object.get("total_block_count").to_u64() * object.get("block_size").to_u64()));
size_builder.append(human_readable_size(object.get("total_block_count"sv).to_u64() * object.get("block_size"sv).to_u64()));
size_builder.append(" ");
return size_builder.to_string();
},
[](const JsonObject& object) {
return object.get("total_block_count").to_u64() * object.get("block_size").to_u64();
return object.get("total_block_count"sv).to_u64() * object.get("block_size"sv).to_u64();
},
[](const JsonObject& object) {
auto total_blocks = object.get("total_block_count").to_u64();
auto total_blocks = object.get("total_block_count"sv).to_u64();
if (total_blocks == 0)
return 0;
auto free_blocks = object.get("free_block_count").to_u64();
auto free_blocks = object.get("free_block_count"sv).to_u64();
auto used_blocks = total_blocks - free_blocks;
int percentage = (static_cast<double>(used_blocks) / static_cast<double>(total_blocks) * 100.0);
return percentage;
@ -246,34 +246,34 @@ public:
df_fields.empend(
"Used", Gfx::TextAlignment::CenterRight,
[](const JsonObject& object) {
auto total_blocks = object.get("total_block_count").to_u64();
auto free_blocks = object.get("free_block_count").to_u64();
auto total_blocks = object.get("total_block_count"sv).to_u64();
auto free_blocks = object.get("free_block_count"sv).to_u64();
auto used_blocks = total_blocks - free_blocks;
return human_readable_size(used_blocks * object.get("block_size").to_u64()); },
return human_readable_size(used_blocks * object.get("block_size"sv).to_u64()); },
[](const JsonObject& object) {
auto total_blocks = object.get("total_block_count").to_u64();
auto free_blocks = object.get("free_block_count").to_u64();
auto total_blocks = object.get("total_block_count"sv).to_u64();
auto free_blocks = object.get("free_block_count"sv).to_u64();
auto used_blocks = total_blocks - free_blocks;
return used_blocks * object.get("block_size").to_u64();
return used_blocks * object.get("block_size"sv).to_u64();
});
df_fields.empend(
"Available", Gfx::TextAlignment::CenterRight,
[](const JsonObject& object) {
return human_readable_size(object.get("free_block_count").to_u64() * object.get("block_size").to_u64());
return human_readable_size(object.get("free_block_count"sv).to_u64() * object.get("block_size"sv).to_u64());
},
[](const JsonObject& object) {
return object.get("free_block_count").to_u64() * object.get("block_size").to_u64();
return object.get("free_block_count"sv).to_u64() * object.get("block_size"sv).to_u64();
});
df_fields.empend("Access", Gfx::TextAlignment::CenterLeft, [](const JsonObject& object) {
bool readonly = object.get("readonly").to_bool();
int mount_flags = object.get("mount_flags").to_int();
bool readonly = object.get("readonly"sv).to_bool();
int mount_flags = object.get("mount_flags"sv).to_int();
return readonly || (mount_flags & MS_RDONLY) ? "Read-only" : "Read/Write";
});
df_fields.empend("Mount flags", Gfx::TextAlignment::CenterLeft, [](const JsonObject& object) {
int mount_flags = object.get("mount_flags").to_int();
int mount_flags = object.get("mount_flags"sv).to_int();
StringBuilder builder;
bool first = true;
auto check = [&](int flag, const char* name) {
auto check = [&](int flag, StringView name) {
if (!(mount_flags & flag))
return;
if (!first)
@ -281,13 +281,13 @@ public:
builder.append(name);
first = false;
};
check(MS_NODEV, "nodev");
check(MS_NOEXEC, "noexec");
check(MS_NOSUID, "nosuid");
check(MS_BIND, "bind");
check(MS_RDONLY, "ro");
check(MS_WXALLOWED, "wxallowed");
check(MS_AXALLOWED, "axallowed");
check(MS_NODEV, "nodev"sv);
check(MS_NOEXEC, "noexec"sv);
check(MS_NOSUID, "nosuid"sv);
check(MS_BIND, "bind"sv);
check(MS_RDONLY, "ro"sv);
check(MS_WXALLOWED, "wxallowed"sv);
check(MS_AXALLOWED, "axallowed"sv);
if (builder.string_view().is_empty())
return String("defaults");
return builder.to_string();
@ -365,7 +365,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
parser.parse(arguments);
StringView args_tab_view = args_tab;
auto app_icon = GUI::Icon::default_icon("app-system-monitor");
auto app_icon = GUI::Icon::default_icon("app-system-monitor"sv);
auto window = GUI::Window::construct();
window->set_title("System Monitor");
@ -402,10 +402,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
process_table_view.set_key_column_and_sort_order(ProcessModel::Column::CPU, GUI::SortOrder::Descending);
process_model->update();
i32 frequency = Config::read_i32("SystemMonitor", "Monitor", "Frequency", 3);
i32 frequency = Config::read_i32("SystemMonitor"sv, "Monitor"sv, "Frequency"sv, 3);
if (frequency != 1 && frequency != 3 && frequency != 5) {
frequency = 3;
Config::write_i32("SystemMonitor", "Monitor", "Frequency", frequency);
Config::write_i32("SystemMonitor"sv, "Monitor"sv, "Frequency"sv, frequency);
}
auto& refresh_timer = window->add<Core::Timer>(
@ -439,29 +439,29 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
};
auto kill_action = GUI::Action::create(
"&Kill Process", { Mod_Ctrl, Key_K }, { Key_Delete }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/kill.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) {
"&Kill Process", { Mod_Ctrl, Key_K }, { Key_Delete }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/kill.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) {
pid_t pid = selected_id(ProcessModel::Column::PID);
if (pid == -1)
return;
auto rc = GUI::MessageBox::show(window, String::formatted("Do you really want to kill \"{}\" (PID {})?", selected_name(ProcessModel::Column::Name), pid), "System Monitor", GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
auto rc = GUI::MessageBox::show(window, String::formatted("Do you really want to kill \"{}\" (PID {})?", selected_name(ProcessModel::Column::Name), pid), "System Monitor"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
if (rc == GUI::Dialog::ExecResult::Yes)
kill(pid, SIGKILL);
},
&process_table_view);
auto stop_action = GUI::Action::create(
"&Stop Process", { Mod_Ctrl, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/stop-hand.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) {
"&Stop Process", { Mod_Ctrl, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/stop-hand.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) {
pid_t pid = selected_id(ProcessModel::Column::PID);
if (pid == -1)
return;
auto rc = GUI::MessageBox::show(window, String::formatted("Do you really want to stop \"{}\" (PID {})?", selected_name(ProcessModel::Column::Name), pid), "System Monitor", GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
auto rc = GUI::MessageBox::show(window, String::formatted("Do you really want to stop \"{}\" (PID {})?", selected_name(ProcessModel::Column::Name), pid), "System Monitor"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
if (rc == GUI::Dialog::ExecResult::Yes)
kill(pid, SIGSTOP);
},
&process_table_view);
auto continue_action = GUI::Action::create(
"&Continue Process", { Mod_Ctrl, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/continue.png").release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) {
"&Continue Process", { Mod_Ctrl, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/continue.png"sv).release_value_but_fixme_should_propagate_errors(), [&](const GUI::Action&) {
pid_t pid = selected_id(ProcessModel::Column::PID);
if (pid != -1)
kill(pid, SIGCONT);
@ -470,12 +470,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto profile_action = GUI::Action::create(
"&Profile Process", { Mod_Ctrl, Key_P },
Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) {
Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
pid_t pid = selected_id(ProcessModel::Column::PID);
if (pid == -1)
return;
auto pid_string = String::number(pid);
GUI::Process::spawn_or_show_error(window, "/bin/Profiler", Array { "--pid", pid_string.characters() });
GUI::Process::spawn_or_show_error(window, "/bin/Profiler"sv, Array { "--pid", pid_string.characters() });
},
&process_table_view);
@ -531,7 +531,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto make_frequency_action = [&](int seconds) {
auto action = GUI::Action::create_checkable(String::formatted("&{} Sec", seconds), [&refresh_timer, seconds](auto&) {
Config::write_i32("SystemMonitor", "Monitor", "Frequency", seconds);
Config::write_i32("SystemMonitor"sv, "Monitor"sv, "Frequency"sv, seconds);
refresh_timer.restart(seconds * 1000);
});
action->set_status_tip(String::formatted("Refresh every {} seconds", seconds));
@ -597,7 +597,7 @@ ErrorOr<NonnullRefPtr<GUI::Window>> build_process_window(pid_t pid)
window->resize(480, 360);
window->set_title(String::formatted("PID {} - System Monitor", pid));
auto app_icon = GUI::Icon::default_icon("app-system-monitor");
auto app_icon = GUI::Icon::default_icon("app-system-monitor"sv);
window->set_icon(app_icon.bitmap_for_size(16));
auto main_widget = TRY(window->try_set_main_widget<GUI::Widget>());