mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 14:37:45 +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:
parent
e5f09ea170
commit
3f3f45580a
762 changed files with 8315 additions and 8316 deletions
|
@ -65,7 +65,7 @@ void BackgroundSettingsWidget::create_frame()
|
|||
};
|
||||
|
||||
m_context_menu = GUI::Menu::construct();
|
||||
m_show_in_file_manager_action = GUI::Action::create("Show in File Manager", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png").release_value_but_fixme_should_propagate_errors(), [this](GUI::Action const&) {
|
||||
m_show_in_file_manager_action = GUI::Action::create("Show in File Manager", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png"sv).release_value_but_fixme_should_propagate_errors(), [this](GUI::Action const&) {
|
||||
LexicalPath path { m_monitor_widget->wallpaper() };
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol(path.dirname(), path.basename()));
|
||||
});
|
||||
|
@ -88,7 +88,7 @@ void BackgroundSettingsWidget::create_frame()
|
|||
|
||||
auto& button = *find_descendant_of_type_named<GUI::Button>("wallpaper_open_button");
|
||||
button.on_click = [this](auto) {
|
||||
auto path = GUI::FilePicker::get_open_filepath(window(), "Select wallpaper from file system", "/res/wallpapers");
|
||||
auto path = GUI::FilePicker::get_open_filepath(window(), "Select wallpaper from file system", "/res/wallpapers"sv);
|
||||
if (!path.has_value())
|
||||
return;
|
||||
m_wallpaper_view->selection().clear();
|
||||
|
@ -124,7 +124,7 @@ void BackgroundSettingsWidget::load_current_settings()
|
|||
{
|
||||
auto ws_config = Core::ConfigFile::open("/etc/WindowServer.ini").release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
auto selected_wallpaper = Config::read_string("WindowManager", "Background", "Wallpaper", "");
|
||||
auto selected_wallpaper = Config::read_string("WindowManager"sv, "Background"sv, "Wallpaper"sv, ""sv);
|
||||
if (!selected_wallpaper.is_empty()) {
|
||||
auto index = static_cast<GUI::FileSystemModel*>(m_wallpaper_view->model())->index(selected_wallpaper, m_wallpaper_view->model_column());
|
||||
m_wallpaper_view->set_cursor(index, GUI::AbstractView::SelectionUpdate::Set);
|
||||
|
|
|
@ -50,7 +50,7 @@ void DesktopSettingsWidget::apply_settings()
|
|||
if (workspace_rows != desktop.workspace_rows() || workspace_columns != desktop.workspace_columns()) {
|
||||
if (!GUI::ConnectionToWindowServer::the().apply_workspace_settings(workspace_rows, workspace_columns, true)) {
|
||||
GUI::MessageBox::show(window(), String::formatted("Error applying workspace settings"),
|
||||
"Workspace settings", GUI::MessageBox::Type::Error);
|
||||
"Workspace settings"sv, GUI::MessageBox::Type::Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -239,7 +239,7 @@ void MonitorSettingsWidget::apply_settings()
|
|||
seconds_until_revert, seconds_until_revert == 1 ? "second" : "seconds");
|
||||
};
|
||||
|
||||
auto box = GUI::MessageBox::construct(window(), box_text(), "Apply new screen layout",
|
||||
auto box = GUI::MessageBox::construct(window(), box_text(), "Apply new screen layout"sv,
|
||||
GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
|
||||
box->set_icon(window()->icon());
|
||||
|
||||
|
@ -258,20 +258,20 @@ void MonitorSettingsWidget::apply_settings()
|
|||
auto save_result = GUI::ConnectionToWindowServer::the().save_screen_layout();
|
||||
if (!save_result.success()) {
|
||||
GUI::MessageBox::show(window(), String::formatted("Error saving settings: {}", save_result.error_msg()),
|
||||
"Unable to save setting", GUI::MessageBox::Type::Error);
|
||||
"Unable to save setting"sv, GUI::MessageBox::Type::Error);
|
||||
}
|
||||
} else {
|
||||
auto restore_result = GUI::ConnectionToWindowServer::the().set_screen_layout(current_layout, false);
|
||||
if (!restore_result.success()) {
|
||||
GUI::MessageBox::show(window(), String::formatted("Error restoring settings: {}", restore_result.error_msg()),
|
||||
"Unable to restore setting", GUI::MessageBox::Type::Error);
|
||||
"Unable to restore setting"sv, GUI::MessageBox::Type::Error);
|
||||
} else {
|
||||
load_current_settings();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
GUI::MessageBox::show(window(), String::formatted("Error setting screen layout: {}", result.error_msg()),
|
||||
"Unable to apply changes", GUI::MessageBox::Type::Error);
|
||||
"Unable to apply changes"sv, GUI::MessageBox::Type::Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace DisplaySettings {
|
|||
MonitorWidget::MonitorWidget()
|
||||
{
|
||||
m_desktop_resolution = GUI::Desktop::the().rect().size();
|
||||
m_monitor_bitmap = Gfx::Bitmap::try_load_from_file("/res/graphics/monitor.png").release_value_but_fixme_should_propagate_errors();
|
||||
m_monitor_bitmap = Gfx::Bitmap::try_load_from_file("/res/graphics/monitor.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
m_desktop_bitmap = Gfx::Bitmap::try_create(m_monitor_bitmap->format(), { 280, 158 }).release_value_but_fixme_should_propagate_errors();
|
||||
m_monitor_rect = { { 12, 13 }, m_desktop_bitmap->size() };
|
||||
set_fixed_size(304, 201);
|
||||
|
|
|
@ -39,9 +39,9 @@ void ThemePreviewWidget::paint_preview(GUI::PaintEvent&)
|
|||
};
|
||||
center_window_group_within(window_group, frame_inner_rect());
|
||||
|
||||
paint_window("Inactive Window", inactive_window_rect, Gfx::WindowTheme::WindowState::Inactive, inactive_window_icon());
|
||||
paint_window("Active Window", active_window_rect, Gfx::WindowTheme::WindowState::Active, active_window_icon());
|
||||
paint_window("Alert", message_box, Gfx::WindowTheme::WindowState::Highlighted, active_window_icon(), 1);
|
||||
paint_window("Inactive Window"sv, inactive_window_rect, Gfx::WindowTheme::WindowState::Inactive, inactive_window_icon());
|
||||
paint_window("Active Window"sv, active_window_rect, Gfx::WindowTheme::WindowState::Active, active_window_icon());
|
||||
paint_window("Alert"sv, message_box, Gfx::WindowTheme::WindowState::Highlighted, active_window_icon(), 1);
|
||||
|
||||
auto draw_centered_button = [&](auto window_rect, auto text, int button_width, int button_height) {
|
||||
Gfx::IntRect button_rect { 0, 0, button_width, button_height };
|
||||
|
@ -50,7 +50,7 @@ void ThemePreviewWidget::paint_preview(GUI::PaintEvent&)
|
|||
painter.draw_text(button_rect, text, Gfx::TextAlignment::Center, preview_palette().color(foreground_role()), Gfx::TextElision::Right, Gfx::TextWrapping::DontWrap);
|
||||
};
|
||||
|
||||
draw_centered_button(message_box, "Ok", 32, 16);
|
||||
draw_centered_button(message_box, "Ok"sv, 32, 16);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,11 +45,11 @@ ThemesSettingsWidget::ThemesSettingsWidget(bool& background_settings_changed)
|
|||
};
|
||||
m_themes_combo->set_selected_index(current_theme_index, GUI::AllowCallback::No);
|
||||
|
||||
auto mouse_settings_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-mouse.png").release_value_but_fixme_should_propagate_errors();
|
||||
auto mouse_settings_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-mouse.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
m_cursor_themes_button = *find_descendant_of_type_named<GUI::Button>("cursor_themes_button");
|
||||
m_cursor_themes_button->set_icon(mouse_settings_icon);
|
||||
m_cursor_themes_button->on_click = [&](auto) {
|
||||
GUI::Process::spawn_or_show_error(window(), "/bin/MouseSettings", Array { "-t", "cursor-theme" });
|
||||
GUI::Process::spawn_or_show_error(window(), "/bin/MouseSettings"sv, Array { "-t", "cursor-theme" });
|
||||
};
|
||||
|
||||
GUI::Application::the()->on_theme_change = [&]() {
|
||||
|
|
|
@ -31,16 +31,16 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_option(selected_tab, "Tab, one of 'background', 'fonts', 'monitor', 'themes', or 'workspaces'", "open-tab", 't', "tab");
|
||||
args_parser.parse(arguments);
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-display-settings");
|
||||
auto app_icon = GUI::Icon::default_icon("app-display-settings"sv);
|
||||
|
||||
bool background_settings_changed = false;
|
||||
|
||||
auto window = TRY(GUI::SettingsWindow::create("Display Settings"));
|
||||
(void)TRY(window->add_tab<DisplaySettings::BackgroundSettingsWidget>("Background", "background", background_settings_changed));
|
||||
(void)TRY(window->add_tab<DisplaySettings::ThemesSettingsWidget>("Themes", "themes", background_settings_changed));
|
||||
(void)TRY(window->add_tab<DisplaySettings::FontSettingsWidget>("Fonts", "fonts"));
|
||||
(void)TRY(window->add_tab<DisplaySettings::MonitorSettingsWidget>("Monitor", "monitor"));
|
||||
(void)TRY(window->add_tab<DisplaySettings::DesktopSettingsWidget>("Workspaces", "workspaces"));
|
||||
(void)TRY(window->add_tab<DisplaySettings::BackgroundSettingsWidget>("Background"sv, "background"sv, background_settings_changed));
|
||||
(void)TRY(window->add_tab<DisplaySettings::ThemesSettingsWidget>("Themes"sv, "themes"sv, background_settings_changed));
|
||||
(void)TRY(window->add_tab<DisplaySettings::FontSettingsWidget>("Fonts"sv, "fonts"sv));
|
||||
(void)TRY(window->add_tab<DisplaySettings::MonitorSettingsWidget>("Monitor"sv, "monitor"sv));
|
||||
(void)TRY(window->add_tab<DisplaySettings::DesktopSettingsWidget>("Workspaces"sv, "workspaces"sv));
|
||||
window->set_active_tab(selected_tab);
|
||||
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue