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

Everywhere: Convert a handful of String::format() => formatted()

This commit is contained in:
Andreas Kling 2021-01-16 12:00:33 +01:00
parent c90b7881a7
commit c71807a3fc
23 changed files with 24 additions and 24 deletions

View file

@ -160,7 +160,7 @@ void LookupServer::service_client(RefPtr<Core::LocalSocket> socket)
return;
}
for (auto& response : responses) {
auto line = String::format("%s\n", response.characters());
auto line = String::formatted("{}\n", response);
int nsent = socket->write(line);
if (nsent < 0) {
perror("write");

View file

@ -176,7 +176,7 @@ NonnullRefPtr<GUI::Menu> build_system_menu()
Core::DirIterator dt("/res/themes", Core::DirIterator::SkipDots);
while (dt.has_next()) {
auto theme_name = dt.next_path();
auto theme_path = String::format("/res/themes/%s", theme_name.characters());
auto theme_path = String::formatted("/res/themes/{}", theme_name);
g_themes.append({ LexicalPath(theme_name).title(), theme_path });
}
quick_sort(g_themes, [](auto& a, auto& b) { return a.name < b.name; });

View file

@ -276,7 +276,7 @@ Service::Service(const Core::ConfigFile& config, const StringView& name)
ASSERT(config.has_group(name));
set_name(name);
m_executable_path = config.read_entry(name, "Executable", String::format("/bin/%s", this->name().characters()));
m_executable_path = config.read_entry(name, "Executable", String::formatted("/bin/{}", this->name()));
m_extra_arguments = config.read_entry(name, "Arguments", "").split(' ');
m_stdio_file_path = config.read_entry(name, "StdIO");

View file

@ -761,7 +761,7 @@ bool Compositor::draw_geometry_label(Gfx::IntRect& geometry_label_damage_rect)
if (!window_being_moved_or_resized->size_increment().is_null()) {
int width_steps = (window_being_moved_or_resized->width() - window_being_moved_or_resized->base_size().width()) / window_being_moved_or_resized->size_increment().width();
int height_steps = (window_being_moved_or_resized->height() - window_being_moved_or_resized->base_size().height()) / window_being_moved_or_resized->size_increment().height();
geometry_string = String::format("%s (%dx%d)", geometry_string.characters(), width_steps, height_steps);
geometry_string = String::formatted("{} ({}x{})", geometry_string, width_steps, height_steps);
}
auto geometry_label_rect = Gfx::IntRect { 0, 0, wm.font().width(geometry_string) + 16, wm.font().glyph_height() + 10 };
geometry_label_rect.center_within(window_being_moved_or_resized->rect());

View file

@ -77,7 +77,7 @@ int main(int, char**)
auto wm_config = Core::ConfigFile::open("/etc/WindowServer/WindowServer.ini");
auto theme_name = wm_config->read_entry("Theme", "Name", "Default");
auto theme = Gfx::load_system_theme(String::format("/res/themes/%s.ini", theme_name.characters()));
auto theme = Gfx::load_system_theme(String::formatted("/res/themes/{}.ini", theme_name));
ASSERT(theme);
Gfx::set_system_theme(*theme);
auto palette = Gfx::PaletteImpl::create_with_shared_buffer(*theme);