1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:17:44 +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

@ -36,7 +36,7 @@ AboutDialog::AboutDialog(StringView name, Gfx::Bitmap const* icon, Window* paren
widget.layout()->set_spacing(0);
auto& banner_image = widget.add<GUI::ImageWidget>();
banner_image.load_from_file("/res/graphics/brand-banner.png");
banner_image.load_from_file("/res/graphics/brand-banner.png"sv);
auto& content_container = widget.add<Widget>();
content_container.set_layout<HorizontalBoxLayout>();
@ -69,9 +69,9 @@ AboutDialog::AboutDialog(StringView name, Gfx::Bitmap const* icon, Window* paren
make_label(m_name, true);
// If we are displaying a dialog for an application, insert 'SerenityOS' below the application name
if (m_name != "SerenityOS")
make_label("SerenityOS");
make_label("SerenityOS"sv);
make_label(m_version_string);
make_label("Copyright \xC2\xA9 the SerenityOS developers, 2018-2022");
make_label("Copyright \xC2\xA9 the SerenityOS developers, 2018-2022"sv);
right_container.layout()->add_spacer();

View file

@ -60,7 +60,7 @@ void AbstractTableView::auto_resize_column(int column)
int header_width = m_column_header->font().width(model.column_name(column));
if (column == m_key_column && model.is_column_sortable(column))
header_width += font().width(" \xE2\xAC\x86");
header_width += font().width(" \xE2\xAC\x86"sv);
int column_width = header_width;
bool is_empty = true;
@ -99,7 +99,7 @@ void AbstractTableView::update_column_sizes()
continue;
int header_width = m_column_header->font().width(model.column_name(column));
if (column == m_key_column && model.is_column_sortable(column))
header_width += font().width(" \xE2\xAC\x86"); // UPWARDS BLACK ARROW
header_width += font().width(" \xE2\xAC\x86"sv); // UPWARDS BLACK ARROW
int column_width = header_width;
for (int row = 0; row < row_count; ++row) {
auto cell_data = model.index(row, column).data();

View file

@ -21,12 +21,12 @@ namespace GUI {
AbstractThemePreview::AbstractThemePreview(Gfx::Palette const& preview_palette)
: m_preview_palette(preview_palette)
{
m_active_window_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png").release_value_but_fixme_should_propagate_errors();
m_inactive_window_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png").release_value_but_fixme_should_propagate_errors();
m_active_window_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png"sv).release_value_but_fixme_should_propagate_errors();
m_inactive_window_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png"sv).release_value_but_fixme_should_propagate_errors();
m_default_close_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window-close.png").release_value_but_fixme_should_propagate_errors();
m_default_maximize_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/upward-triangle.png").release_value_but_fixme_should_propagate_errors();
m_default_minimize_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/downward-triangle.png").release_value_but_fixme_should_propagate_errors();
m_default_close_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window-close.png"sv).release_value_but_fixme_should_propagate_errors();
m_default_maximize_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/upward-triangle.png"sv).release_value_but_fixme_should_propagate_errors();
m_default_minimize_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/downward-triangle.png"sv).release_value_but_fixme_should_propagate_errors();
VERIFY(m_active_window_icon);
VERIFY(m_inactive_window_icon);

View file

@ -28,7 +28,7 @@ public:
{
m_label->set_text(Gfx::parse_ampersand_string(tooltip));
int tooltip_width = m_label->effective_min_size().width().as_int() + 10;
int line_count = m_label->text().count("\n");
int line_count = m_label->text().count("\n"sv);
int glyph_height = m_label->font().glyph_height();
int tooltip_height = glyph_height * (1 + line_count) + ((glyph_height + 1) / 2) * line_count + 8;

View file

@ -52,13 +52,13 @@ public:
if (index.column() == Column::Icon) {
if (suggestion.language == CodeComprehension::Language::Cpp) {
if (!s_cpp_identifier_icon) {
s_cpp_identifier_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/completion/cpp-identifier.png").release_value_but_fixme_should_propagate_errors();
s_cpp_identifier_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/completion/cpp-identifier.png"sv).release_value_but_fixme_should_propagate_errors();
}
return *s_cpp_identifier_icon;
}
if (suggestion.language == CodeComprehension::Language::Unspecified) {
if (!s_unspecified_identifier_icon) {
s_unspecified_identifier_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/completion/unspecified-identifier.png").release_value_but_fixme_should_propagate_errors();
s_unspecified_identifier_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/completion/unspecified-identifier.png"sv).release_value_but_fixme_should_propagate_errors();
}
return *s_unspecified_identifier_icon;
}

View file

@ -186,7 +186,7 @@ ColorPicker::ColorPicker(Color color, Window* parent_window, String title)
: Dialog(parent_window)
, m_color(color)
{
set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/color-chooser.png").release_value_but_fixme_should_propagate_errors());
set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/color-chooser.png"sv).release_value_but_fixme_should_propagate_errors());
set_title(title);
set_resizable(false);
resize(458, 326);

View file

@ -23,7 +23,7 @@ static constexpr Gfx::CharacterBitmap s_arrow_bitmap {
" ### "
" ## "
" # "
" ",
" "sv,
9, 9
};

View file

@ -98,7 +98,7 @@ ComboBox::ComboBox()
m_open_button = add<Button>();
m_open_button->set_button_style(Gfx::ButtonStyle::ThickCap);
m_open_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/downward-triangle.png").release_value_but_fixme_should_propagate_errors());
m_open_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/downward-triangle.png"sv).release_value_but_fixme_should_propagate_errors());
m_open_button->set_focus_policy(GUI::FocusPolicy::NoFocus);
m_open_button->on_click = [this](auto) {
if (m_list_window->is_visible())

View file

@ -193,7 +193,7 @@ CommandPalette::CommandPalette(GUI::Window& parent_window, ScreenPosition screen
m_table_view->set_column_headers_visible(false);
m_filter_model = MUST(GUI::FilteringProxyModel::create(*m_model));
m_filter_model->set_filter_term("");
m_filter_model->set_filter_term(""sv);
m_table_view->set_column_painting_delegate(0, make<ActionIconDelegate>());
m_table_view->set_model(*m_filter_model);

View file

@ -27,71 +27,71 @@ NonnullRefPtr<Action> make_about_action(String const& app_name, Icon const& app_
NonnullRefPtr<Action> make_open_action(Function<void(Action&)> callback, Core::Object* parent)
{
auto action = Action::create("&Open...", { Mod_Ctrl, Key_O }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
auto action = Action::create("&Open...", { Mod_Ctrl, Key_O }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Open an existing file");
return action;
}
NonnullRefPtr<Action> make_save_action(Function<void(Action&)> callback, Core::Object* parent)
{
auto action = Action::create("&Save", { Mod_Ctrl, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/save.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
auto action = Action::create("&Save", { Mod_Ctrl, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/save.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Save the current file");
return action;
}
NonnullRefPtr<Action> make_save_as_action(Function<void(Action&)> callback, Core::Object* parent)
{
auto action = Action::create("Save &As...", { Mod_Ctrl | Mod_Shift, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/save-as.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
auto action = Action::create("Save &As...", { Mod_Ctrl | Mod_Shift, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/save-as.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Save the current file with a new name");
return action;
}
NonnullRefPtr<Action> make_move_to_front_action(Function<void(Action&)> callback, Core::Object* parent)
{
auto action = Action::create("Move to &Front", { Mod_Ctrl | Mod_Shift, Key_Up }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/move-to-front.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
auto action = Action::create("Move to &Front", { Mod_Ctrl | Mod_Shift, Key_Up }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/move-to-front.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Move to the top of the stack");
return action;
}
NonnullRefPtr<Action> make_move_to_back_action(Function<void(Action&)> callback, Core::Object* parent)
{
auto action = Action::create("Move to &Back", { Mod_Ctrl | Mod_Shift, Key_Down }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/move-to-back.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
auto action = Action::create("Move to &Back", { Mod_Ctrl | Mod_Shift, Key_Down }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/move-to-back.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Move to the bottom of the stack");
return action;
}
NonnullRefPtr<Action> make_undo_action(Function<void(Action&)> callback, Core::Object* parent)
{
return Action::create("&Undo", { Mod_Ctrl, Key_Z }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/undo.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
return Action::create("&Undo", { Mod_Ctrl, Key_Z }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/undo.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_redo_action(Function<void(Action&)> callback, Core::Object* parent)
{
return Action::create("&Redo", { Mod_Ctrl | Mod_Shift, Key_Z }, { Mod_Ctrl, Key_Y }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/redo.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
return Action::create("&Redo", { Mod_Ctrl | Mod_Shift, Key_Z }, { Mod_Ctrl, Key_Y }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/redo.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_delete_action(Function<void(Action&)> callback, Core::Object* parent)
{
return Action::create("&Delete", { Mod_None, Key_Delete }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
return Action::create("&Delete", { Mod_None, Key_Delete }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/delete.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_cut_action(Function<void(Action&)> callback, Core::Object* parent)
{
auto action = Action::create("Cu&t", { Mod_Ctrl, Key_X }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-cut.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
auto action = Action::create("Cu&t", { Mod_Ctrl, Key_X }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-cut.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Cut to clipboard");
return action;
}
NonnullRefPtr<Action> make_copy_action(Function<void(Action&)> callback, Core::Object* parent)
{
auto action = Action::create("&Copy", { Mod_Ctrl, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
auto action = Action::create("&Copy", { Mod_Ctrl, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Copy to clipboard");
return action;
}
NonnullRefPtr<Action> make_paste_action(Function<void(Action&)> callback, Core::Object* parent)
{
auto action = Action::create("&Paste", { Mod_Ctrl, Key_V }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/paste.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
auto action = Action::create("&Paste", { Mod_Ctrl, Key_V }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/paste.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Paste from clipboard");
return action;
}
@ -100,7 +100,7 @@ NonnullRefPtr<Action> make_fullscreen_action(Function<void(Action&)> callback, C
{
auto action = Action::create("&Fullscreen", { Mod_None, Key_F11 }, move(callback), parent);
action->set_status_tip("Enter fullscreen mode");
action->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/fullscreen.png").release_value_but_fixme_should_propagate_errors());
action->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/fullscreen.png"sv).release_value_but_fixme_should_propagate_errors());
return action;
}
@ -113,80 +113,80 @@ NonnullRefPtr<Action> make_quit_action(Function<void(Action&)> callback)
NonnullRefPtr<Action> make_help_action(Function<void(Action&)> callback, Core::Object* parent)
{
auto action = Action::create("&Manual", { Mod_None, Key_F1 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-help.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
auto action = Action::create("&Manual", { Mod_None, Key_F1 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-help.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Show help contents");
return action;
}
NonnullRefPtr<Action> make_go_back_action(Function<void(Action&)> callback, Core::Object* parent)
{
auto action = Action::create("Go &Back", { Mod_Alt, Key_Left }, { MouseButton::Backward }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
auto action = Action::create("Go &Back", { Mod_Alt, Key_Left }, { MouseButton::Backward }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Move one step backward in history");
return action;
}
NonnullRefPtr<Action> make_go_forward_action(Function<void(Action&)> callback, Core::Object* parent)
{
auto action = Action::create("Go &Forward", { Mod_Alt, Key_Right }, { MouseButton::Forward }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
auto action = Action::create("Go &Forward", { Mod_Alt, Key_Right }, { MouseButton::Forward }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Move one step forward in history");
return action;
}
NonnullRefPtr<Action> make_go_home_action(Function<void(Action&)> callback, Core::Object* parent)
{
return Action::create("Go &Home", { Mod_Alt, Key_Home }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-home.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
return Action::create("Go &Home", { Mod_Alt, Key_Home }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-home.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_close_tab_action(Function<void(Action&)> callback, Core::Object* parent)
{
auto action = Action::create("&Close Tab", { Mod_Ctrl, Key_W }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/close-tab.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
auto action = Action::create("&Close Tab", { Mod_Ctrl, Key_W }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/close-tab.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Close current tab");
return action;
}
NonnullRefPtr<Action> make_reload_action(Function<void(Action&)> callback, Core::Object* parent)
{
return Action::create("&Reload", { Mod_Ctrl, Key_R }, Key_F5, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reload.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
return Action::create("&Reload", { Mod_Ctrl, Key_R }, Key_F5, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/reload.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_select_all_action(Function<void(Action&)> callback, Core::Object* parent)
{
return Action::create("Select &All", { Mod_Ctrl, Key_A }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/select-all.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
return Action::create("Select &All", { Mod_Ctrl, Key_A }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/select-all.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_rename_action(Function<void(Action&)> callback, Core::Object* parent)
{
return Action::create("Re&name", Key_F2, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/rename.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
return Action::create("Re&name", Key_F2, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/rename.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_properties_action(Function<void(Action&)> callback, Core::Object* parent)
{
return Action::create("P&roperties", { Mod_Alt, Key_Return }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/properties.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
return Action::create("P&roperties", { Mod_Alt, Key_Return }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/properties.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_zoom_in_action(Function<void(Action&)> callback, Core::Object* parent)
{
return GUI::Action::create("Zoom &In", { Mod_Ctrl, Key_Equal }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/zoom-in.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
return GUI::Action::create("Zoom &In", { Mod_Ctrl, Key_Equal }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/zoom-in.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_reset_zoom_action(Function<void(Action&)> callback, Core::Object* parent)
{
return GUI::Action::create("&Reset Zoom", { Mod_Ctrl, Key_0 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/zoom-reset.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
return GUI::Action::create("&Reset Zoom", { Mod_Ctrl, Key_0 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/zoom-reset.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_zoom_out_action(Function<void(Action&)> callback, Core::Object* parent)
{
return GUI::Action::create("Zoom &Out", { Mod_Ctrl, Key_Minus }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/zoom-out.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
return GUI::Action::create("Zoom &Out", { Mod_Ctrl, Key_Minus }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/zoom-out.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_rotate_clockwise_action(Function<void(Action&)> callback, Core::Object* parent)
{
return GUI::Action::create("Rotate Clock&wise", { Mod_Ctrl | Mod_Shift, Key_GreaterThan }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-rotate-cw.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
return GUI::Action::create("Rotate Clock&wise", { Mod_Ctrl | Mod_Shift, Key_GreaterThan }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-rotate-cw.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
NonnullRefPtr<Action> make_rotate_counterclockwise_action(Function<void(Action&)> callback, Core::Object* parent)
{
return GUI::Action::create("Rotate &Counterclockwise", { Mod_Ctrl | Mod_Shift, Key_LessThan }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-rotate-ccw.png").release_value_but_fixme_should_propagate_errors(), move(callback), parent);
return GUI::Action::create("Rotate &Counterclockwise", { Mod_Ctrl | Mod_Shift, Key_LessThan }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-rotate-ccw.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
}
}

View file

@ -61,8 +61,8 @@ void CommonLocationsProvider::load_from_json(String const& json_path)
if (!entry_value.is_object())
continue;
auto entry = entry_value.as_object();
auto name = entry.get("name").to_string();
auto path = entry.get("path").to_string();
auto name = entry.get("name"sv).to_string();
auto path = entry.get("path"sv).to_string();
s_common_locations.append({ name, path });
}

View file

@ -53,7 +53,7 @@ void Desktop::set_wallpaper_mode(StringView mode)
String Desktop::wallpaper_path() const
{
return Config::read_string("WindowManager", "Background", "Wallpaper");
return Config::read_string("WindowManager"sv, "Background"sv, "Wallpaper"sv);
}
RefPtr<Gfx::Bitmap> Desktop::wallpaper_bitmap() const
@ -72,7 +72,7 @@ bool Desktop::set_wallpaper(RefPtr<Gfx::Bitmap> wallpaper_bitmap, Optional<Strin
if (ret_val && path.has_value()) {
dbgln("Saving wallpaper path '{}' to ConfigServer", *path);
Config::write_string("WindowManager", "Background", "Wallpaper", *path);
Config::write_string("WindowManager"sv, "Background"sv, "Wallpaper"sv, *path);
}
return ret_val;

View file

@ -28,7 +28,7 @@ static Vector<u32> supported_emoji_code_points()
if (lexical_path.extension() != "png")
continue;
auto basename = lexical_path.basename();
if (!basename.starts_with("U+"))
if (!basename.starts_with("U+"sv))
continue;
// FIXME: Handle multi code point emojis.
if (basename.contains('_'))

View file

@ -559,17 +559,17 @@ inline StringView mouse_button_to_string(MouseButton key)
{
switch (key) {
case MouseButton::None:
return "None";
return "None"sv;
case MouseButton::Primary:
return "Primary";
return "Primary"sv;
case MouseButton::Secondary:
return "Secondary";
return "Secondary"sv;
case MouseButton::Middle:
return "Middle";
return "Middle"sv;
case MouseButton::Backward:
return "Backward";
return "Backward"sv;
case MouseButton::Forward:
return "Forward";
return "Forward"sv;
default:
VERIFY_NOT_REACHED();
}

View file

@ -48,7 +48,7 @@ static void initialize_executable_icon_if_needed()
if (initialized)
return;
initialized = true;
s_executable_icon = Icon::default_icon("filetype-executable");
s_executable_icon = Icon::default_icon("filetype-executable"sv);
}
static void initialize_filetype_image_icon_if_needed()
@ -57,7 +57,7 @@ static void initialize_filetype_image_icon_if_needed()
if (initialized)
return;
initialized = true;
s_filetype_image_icon = Icon::default_icon("filetype-image");
s_filetype_image_icon = Icon::default_icon("filetype-image"sv);
}
static void initialize_if_needed()
@ -68,19 +68,19 @@ static void initialize_if_needed()
auto config = Core::ConfigFile::open("/etc/FileIconProvider.ini").release_value_but_fixme_should_propagate_errors();
s_symlink_emblem = Gfx::Bitmap::try_load_from_file("/res/icons/symlink-emblem.png").release_value_but_fixme_should_propagate_errors();
s_symlink_emblem_small = Gfx::Bitmap::try_load_from_file("/res/icons/symlink-emblem-small.png").release_value_but_fixme_should_propagate_errors();
s_symlink_emblem = Gfx::Bitmap::try_load_from_file("/res/icons/symlink-emblem.png"sv).release_value_but_fixme_should_propagate_errors();
s_symlink_emblem_small = Gfx::Bitmap::try_load_from_file("/res/icons/symlink-emblem-small.png"sv).release_value_but_fixme_should_propagate_errors();
s_hard_disk_icon = Icon::default_icon("hard-disk");
s_directory_icon = Icon::default_icon("filetype-folder");
s_directory_open_icon = Icon::default_icon("filetype-folder-open");
s_inaccessible_directory_icon = Icon::default_icon("filetype-folder-inaccessible");
s_home_directory_icon = Icon::default_icon("home-directory");
s_home_directory_open_icon = Icon::default_icon("home-directory-open");
s_desktop_directory_icon = Icon::default_icon("desktop");
s_file_icon = Icon::default_icon("filetype-unknown");
s_symlink_icon = Icon::default_icon("filetype-symlink");
s_socket_icon = Icon::default_icon("filetype-socket");
s_hard_disk_icon = Icon::default_icon("hard-disk"sv);
s_directory_icon = Icon::default_icon("filetype-folder"sv);
s_directory_open_icon = Icon::default_icon("filetype-folder-open"sv);
s_inaccessible_directory_icon = Icon::default_icon("filetype-folder-inaccessible"sv);
s_home_directory_icon = Icon::default_icon("home-directory"sv);
s_home_directory_open_icon = Icon::default_icon("home-directory-open"sv);
s_desktop_directory_icon = Icon::default_icon("desktop"sv);
s_file_icon = Icon::default_icon("filetype-unknown"sv);
s_symlink_icon = Icon::default_icon("filetype-symlink"sv);
s_socket_icon = Icon::default_icon("filetype-socket"sv);
initialize_filetype_image_icon_if_needed();
initialize_executable_icon_if_needed();
@ -176,13 +176,13 @@ Icon FileIconProvider::icon_for_executable(String const& path)
// If any of the required sections are missing then use the defaults
Icon icon;
struct IconSection {
char const* section_name;
StringView section_name;
int image_size;
};
static constexpr Array<IconSection, 2> icon_sections = {
IconSection { .section_name = "serenity_icon_s", .image_size = 16 },
IconSection { .section_name = "serenity_icon_m", .image_size = 32 }
IconSection { .section_name = "serenity_icon_s"sv, .image_size = 16 },
IconSection { .section_name = "serenity_icon_m"sv, .image_size = 32 }
};
bool had_error = false;

View file

@ -34,7 +34,7 @@ namespace GUI {
Optional<String> FilePicker::get_open_filepath(Window* parent_window, String const& window_title, StringView path, bool folder, ScreenPosition screen_position)
{
auto picker = FilePicker::construct(parent_window, folder ? Mode::OpenFolder : Mode::Open, "", path, screen_position);
auto picker = FilePicker::construct(parent_window, folder ? Mode::OpenFolder : Mode::Open, ""sv, path, screen_position);
if (!window_title.is_null())
picker->set_title(window_title);
@ -75,11 +75,11 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St
case Mode::OpenMultiple:
case Mode::OpenFolder:
set_title("Open");
set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png").release_value_but_fixme_should_propagate_errors());
set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors());
break;
case Mode::Save:
set_title("Save as");
set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/save-as.png").release_value_but_fixme_should_propagate_errors());
set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/save-as.png"sv).release_value_but_fixme_should_propagate_errors());
break;
}
resize(560, 320);
@ -115,7 +115,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St
};
auto open_parent_directory_action = Action::create(
"Open parent directory", { Mod_Alt, Key_Up }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open-parent-directory.png").release_value_but_fixme_should_propagate_errors(), [this](Action const&) {
"Open parent directory", { Mod_Alt, Key_Up }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open-parent-directory.png"sv).release_value_but_fixme_should_propagate_errors(), [this](Action const&) {
set_path(String::formatted("{}/..", m_model->root_path()));
},
this);
@ -129,13 +129,13 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St
toolbar.add_separator();
auto mkdir_action = Action::create(
"New directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png").release_value_but_fixme_should_propagate_errors(), [this](Action const&) {
"New directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png"sv).release_value_but_fixme_should_propagate_errors(), [this](Action const&) {
String value;
if (InputBox::show(this, value, "Enter name:", "New directory") == InputBox::ExecResult::OK && !value.is_empty()) {
if (InputBox::show(this, value, "Enter name:"sv, "New directory"sv) == InputBox::ExecResult::OK && !value.is_empty()) {
auto new_dir_path = LexicalPath::canonicalized_path(String::formatted("{}/{}", m_model->root_path(), value));
int rc = mkdir(new_dir_path.characters(), 0777);
if (rc < 0) {
MessageBox::show(this, String::formatted("mkdir(\"{}\") failed: {}", new_dir_path, strerror(errno)), "Error", MessageBox::Type::Error);
MessageBox::show(this, String::formatted("mkdir(\"{}\") failed: {}", new_dir_path, strerror(errno)), "Error"sv, MessageBox::Type::Error);
} else {
m_model->invalidate();
}
@ -272,12 +272,12 @@ void FilePicker::on_file_return()
bool file_exists = Core::File::exists(path);
if (!file_exists && (m_mode == Mode::Open || m_mode == Mode::OpenFolder)) {
MessageBox::show(this, String::formatted("No such file or directory: {}", m_filename_textbox->text()), "File not found", MessageBox::Type::Error, MessageBox::InputType::OK);
MessageBox::show(this, String::formatted("No such file or directory: {}", m_filename_textbox->text()), "File not found"sv, MessageBox::Type::Error, MessageBox::InputType::OK);
return;
}
if (file_exists && m_mode == Mode::Save) {
auto result = MessageBox::show(this, "File already exists. Overwrite?", "Existing File", MessageBox::Type::Warning, MessageBox::InputType::OKCancel);
auto result = MessageBox::show(this, "File already exists. Overwrite?"sv, "Existing File"sv, MessageBox::Type::Warning, MessageBox::InputType::OKCancel);
if (result == MessageBox::ExecResult::Cancel)
return;
}
@ -289,7 +289,7 @@ void FilePicker::on_file_return()
void FilePicker::set_path(String const& path)
{
if (access(path.characters(), R_OK | X_OK) == -1) {
GUI::MessageBox::show(this, String::formatted("Could not open '{}':\n{}", path, strerror(errno)), "Error", GUI::MessageBox::Type::Error);
GUI::MessageBox::show(this, String::formatted("Could not open '{}':\n{}", path, strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error);
auto& common_locations_tray = *find_descendant_of_type_named<GUI::Tray>("common_locations_tray");
for (auto& location_button : m_common_location_buttons)
common_locations_tray.set_item_checked(location_button.tray_item_index, m_model->root_path() == location_button.path);

View file

@ -43,7 +43,7 @@ private:
// ^GUI::ModelClient
virtual void model_did_update(unsigned) override;
FilePicker(Window* parent_window, Mode type = Mode::Open, StringView filename = "Untitled", StringView path = Core::StandardPaths::home_directory(), ScreenPosition screen_position = Dialog::ScreenPosition::CenterWithinParent);
FilePicker(Window* parent_window, Mode type = Mode::Open, StringView filename = "Untitled"sv, StringView path = Core::StandardPaths::home_directory(), ScreenPosition screen_position = Dialog::ScreenPosition::CenterWithinParent);
static String ok_button_name(Mode mode)
{

View file

@ -128,7 +128,7 @@ public:
virtual Variant data(ModelIndex const&, ModelRole = ModelRole::Display) const override;
virtual ModelIndex parent_index(ModelIndex const&) const override;
virtual ModelIndex index(int row, int column = 0, ModelIndex const& parent = ModelIndex()) const override;
virtual StringView drag_data_type() const override { return "text/uri-list"; }
virtual StringView drag_data_type() const override { return "text/uri-list"sv; }
virtual bool accepts_drag(ModelIndex const&, Vector<String> const& mime_types) const override;
virtual bool is_column_sortable(int column_index) const override { return column_index != Column::Icon; }
virtual bool is_editable(ModelIndex const&) const override;

View file

@ -24,7 +24,7 @@ FontPicker::FontPicker(Window* parent_window, Gfx::Font const* current_font, boo
{
set_title("Font picker");
resize(430, 280);
set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png").release_value_but_fixme_should_propagate_errors());
set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-font-editor.png"sv).release_value_but_fixme_should_propagate_errors());
auto& widget = set_main_widget<GUI::Widget>();
if (!widget.load_from_gml(font_picker_dialog_gml))

View file

@ -52,7 +52,7 @@ public:
static void indent(StringBuilder& builder, size_t indentation)
{
for (size_t i = 0; i < indentation; ++i)
builder.append(" ");
builder.append(" "sv);
}
};
@ -136,7 +136,7 @@ public:
auto first = true;
as_array().for_each([&](auto& value) {
if (!first)
builder.append(", ");
builder.append(", "sv);
first = false;
value.serialize(builder);
});
@ -248,7 +248,7 @@ public:
indent(builder, indentation);
builder.append('@');
builder.append(m_name);
builder.append(" {");
builder.append(" {"sv);
if (!m_properties.is_empty() || !m_sub_objects.is_empty()) {
builder.append('\n');

View file

@ -107,8 +107,8 @@ void AutocompleteProvider::provide_completions(Function<void(Vector<CodeComprehe
state = previous_states.take_last();
}
auto& widget_class = *Core::ObjectClassRegistration::find("GUI::Widget");
auto& layout_class = *Core::ObjectClassRegistration::find("GUI::Layout");
auto& widget_class = *Core::ObjectClassRegistration::find("GUI::Widget"sv);
auto& layout_class = *Core::ObjectClassRegistration::find("GUI::Layout"sv);
// FIXME: Can this be done without a StringBuilder?
auto make_fuzzy = [](StringView str) {

View file

@ -269,9 +269,9 @@ void HeaderView::paint_horizontal(Painter& painter)
StringBuilder builder;
builder.append(model()->column_name(section));
if (m_table_view.sort_order() == SortOrder::Ascending)
builder.append(" \xE2\xAC\x86"); // UPWARDS BLACK ARROW
builder.append(" \xE2\xAC\x86"sv); // UPWARDS BLACK ARROW
else if (m_table_view.sort_order() == SortOrder::Descending)
builder.append(" \xE2\xAC\x87"); // DOWNWARDS BLACK ARROW
builder.append(" \xE2\xAC\x87"sv); // DOWNWARDS BLACK ARROW
text = builder.to_string();
} else {
text = model()->column_name(section);

View file

@ -21,12 +21,12 @@ extern Core::ObjectClassRegistration registration_Layout;
}
}
#define REGISTER_LAYOUT(namespace_, class_name) \
namespace Core { \
namespace Registration { \
Core::ObjectClassRegistration registration_##class_name( \
#namespace_ "::" #class_name, []() { return static_ptr_cast<Core::Object>(namespace_::class_name::construct()); }, &registration_Layout); \
} \
#define REGISTER_LAYOUT(namespace_, class_name) \
namespace Core { \
namespace Registration { \
Core::ObjectClassRegistration registration_##class_name( \
#namespace_ "::" #class_name##sv, []() { return static_ptr_cast<Core::Object>(namespace_::class_name::construct()); }, &registration_Layout); \
} \
}
namespace GUI {

View file

@ -29,7 +29,7 @@ LinkLabel::LinkLabel(String text)
void LinkLabel::setup_actions()
{
m_open_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(), [&](const GUI::Action&) {
m_open_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(), [&](const GUI::Action&) {
if (on_click)
on_click();
});

View file

@ -26,18 +26,18 @@ Dialog::ExecResult MessageBox::show(Window* parent_window, StringView text, Stri
Dialog::ExecResult MessageBox::show_error(Window* parent_window, StringView text)
{
return show(parent_window, text, "Error", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK);
return show(parent_window, text, "Error"sv, GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK);
}
Dialog::ExecResult MessageBox::ask_about_unsaved_changes(Window* parent_window, StringView path, Optional<Time> last_unmodified_timestamp)
{
StringBuilder builder;
builder.append("Save changes to ");
builder.append("Save changes to "sv);
if (path.is_empty())
builder.append("untitled document");
builder.append("untitled document"sv);
else
builder.appendff("\"{}\"", LexicalPath::basename(path));
builder.append(" before closing?");
builder.append(" before closing?"sv);
if (!path.is_empty() && last_unmodified_timestamp.has_value()) {
auto age = (Time::now_monotonic() - *last_unmodified_timestamp).to_seconds();
@ -45,7 +45,7 @@ Dialog::ExecResult MessageBox::ask_about_unsaved_changes(Window* parent_window,
builder.appendff("\nLast saved {} ago.", readable_time);
}
auto box = MessageBox::construct(parent_window, builder.string_view(), "Unsaved changes", Type::Warning, InputType::YesNoCancel);
auto box = MessageBox::construct(parent_window, builder.string_view(), "Unsaved changes"sv, Type::Warning, InputType::YesNoCancel);
if (parent_window)
box->set_icon(parent_window->icon());
@ -76,13 +76,13 @@ RefPtr<Gfx::Bitmap> MessageBox::icon() const
{
switch (m_type) {
case Type::Information:
return Gfx::Bitmap::try_load_from_file("/res/icons/32x32/msgbox-information.png").release_value_but_fixme_should_propagate_errors();
return Gfx::Bitmap::try_load_from_file("/res/icons/32x32/msgbox-information.png"sv).release_value_but_fixme_should_propagate_errors();
case Type::Warning:
return Gfx::Bitmap::try_load_from_file("/res/icons/32x32/msgbox-warning.png").release_value_but_fixme_should_propagate_errors();
return Gfx::Bitmap::try_load_from_file("/res/icons/32x32/msgbox-warning.png"sv).release_value_but_fixme_should_propagate_errors();
case Type::Error:
return Gfx::Bitmap::try_load_from_file("/res/icons/32x32/msgbox-error.png").release_value_but_fixme_should_propagate_errors();
return Gfx::Bitmap::try_load_from_file("/res/icons/32x32/msgbox-error.png"sv).release_value_but_fixme_should_propagate_errors();
case Type::Question:
return Gfx::Bitmap::try_load_from_file("/res/icons/32x32/msgbox-question.png").release_value_but_fixme_should_propagate_errors();
return Gfx::Bitmap::try_load_from_file("/res/icons/32x32/msgbox-question.png"sv).release_value_but_fixme_should_propagate_errors();
default:
return nullptr;
}

View file

@ -108,7 +108,7 @@ RefPtr<Core::MimeData> Model::mime_data(ModelSelection const& selection) const
selection.for_each_index([&](auto& index) {
auto text_data = index.data();
if (!first)
text_builder.append(", ");
text_builder.append(", "sv);
text_builder.append(text_data.to_string());
if (!first)

View file

@ -69,8 +69,8 @@ struct Formatter<GUI::ModelIndex> : Formatter<FormatString> {
ErrorOr<void> format(FormatBuilder& builder, GUI::ModelIndex const& value)
{
if (value.internal_data())
return Formatter<FormatString>::format(builder, "ModelIndex({},{},{})", value.row(), value.column(), value.internal_data());
return Formatter<FormatString>::format(builder, "ModelIndex({},{})", value.row(), value.column());
return Formatter<FormatString>::format(builder, "ModelIndex({},{},{})"sv, value.row(), value.column(), value.internal_data());
return Formatter<FormatString>::format(builder, "ModelIndex({},{})"sv, value.row(), value.column());
}
};

View file

@ -101,19 +101,19 @@ void MultiView::set_column_visible(int column_index, bool visible)
void MultiView::build_actions()
{
m_view_as_icons_action = Action::create_checkable(
"Icon view", { Mod_Ctrl, KeyCode::Key_1 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/icon-view.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) {
"Icon view", { Mod_Ctrl, KeyCode::Key_1 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/icon-view.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
set_view_mode(ViewMode::Icon);
},
this);
m_view_as_table_action = Action::create_checkable(
"Table view", { Mod_Ctrl, KeyCode::Key_2 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/table-view.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) {
"Table view", { Mod_Ctrl, KeyCode::Key_2 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/table-view.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
set_view_mode(ViewMode::Table);
},
this);
m_view_as_columns_action = Action::create_checkable(
"Columns view", { Mod_Ctrl, KeyCode::Key_3 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/columns-view.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) {
"Columns view", { Mod_Ctrl, KeyCode::Key_3 }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/columns-view.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
set_view_mode(ViewMode::Columns);
},
this);

View file

@ -28,7 +28,7 @@ PasswordInputDialog::PasswordInputDialog(Window* parent_window, String title, St
auto& key_icon_label = *widget.find_descendant_of_type_named<GUI::Label>("key_icon_label");
key_icon_label.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/key.png").release_value_but_fixme_should_propagate_errors());
key_icon_label.set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/key.png"sv).release_value_but_fixme_should_propagate_errors());
auto& server_label = *widget.find_descendant_of_type_named<GUI::Label>("server_label");
server_label.set_text(move(server));

View file

@ -76,7 +76,7 @@ template<>
struct Formatter<GUI::PersistentModelIndex> : Formatter<FormatString> {
ErrorOr<void> format(FormatBuilder& builder, GUI::PersistentModelIndex const& value)
{
return Formatter<FormatString>::format(builder, "PersistentModelIndex({},{},{})", value.row(), value.column(), value.internal_data());
return Formatter<FormatString>::format(builder, "PersistentModelIndex({},{},{})"sv, value.row(), value.column(), value.internal_data());
}
};

View file

@ -56,7 +56,7 @@ ProcessChooser::ProcessChooser(StringView window_title, StringView button_label,
select_button.set_fixed_width(80);
select_button.on_click = [this](auto) {
if (m_table_view->selection().is_empty()) {
GUI::MessageBox::show(this, "No process selected!", m_window_title, GUI::MessageBox::Type::Error);
GUI::MessageBox::show(this, "No process selected!"sv, m_window_title, GUI::MessageBox::Type::Error);
return;
}
auto index = m_table_view->selection().first();

View file

@ -22,7 +22,7 @@ public:
pid_t pid() const { return m_pid; }
private:
ProcessChooser(StringView window_title = "Process Chooser", StringView button_label = "Select", Gfx::Bitmap const* window_icon = nullptr, GUI::Window* parent_window = nullptr);
ProcessChooser(StringView window_title = "Process Chooser"sv, StringView button_label = "Select"sv, Gfx::Bitmap const* window_icon = nullptr, GUI::Window* parent_window = nullptr);
void set_pid_from_index_and_close(ModelIndex const&);

View file

@ -30,7 +30,7 @@ static constexpr Gfx::CharacterBitmap s_resize_corner_shadows_bitmap {
" "
" ## ## ## ## ## "
" # # # # # "
" ",
" "sv,
16, 16
};
@ -50,7 +50,7 @@ static constexpr Gfx::CharacterBitmap s_resize_corner_highlights_bitmap {
" "
" "
" # # # # # "
" ",
" "sv,
16, 16
};

View file

@ -75,7 +75,7 @@ ErrorOr<NonnullRefPtr<SettingsWindow>> SettingsWindow::create(String title, Show
if (!window->is_modified())
return Window::CloseRequestDecision::Close;
auto result = MessageBox::show(window, "Apply these settings before closing?", "Unsaved changes", MessageBox::Type::Warning, MessageBox::InputType::YesNoCancel);
auto result = MessageBox::show(window, "Apply these settings before closing?"sv, "Unsaved changes"sv, MessageBox::Type::Warning, MessageBox::InputType::YesNoCancel);
switch (result) {
case MessageBox::ExecResult::Yes:
window->apply_settings();

View file

@ -18,7 +18,7 @@ SpinBox::SpinBox()
set_min_size({ 40, 22 });
set_preferred_size({ SpecialDimension::OpportunisticGrow, 22 });
m_editor = add<TextBox>();
m_editor->set_text("0");
m_editor->set_text("0"sv);
m_editor->on_change = [this, weak_this = make_weak_ptr()] {
if (!weak_this)
return;
@ -42,13 +42,13 @@ SpinBox::SpinBox()
m_increment_button = add<Button>();
m_increment_button->set_button_style(Gfx::ButtonStyle::ThickCap);
m_increment_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/upward-triangle.png").release_value_but_fixme_should_propagate_errors());
m_increment_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/upward-triangle.png"sv).release_value_but_fixme_should_propagate_errors());
m_increment_button->set_focus_policy(GUI::FocusPolicy::NoFocus);
m_increment_button->on_click = [this](auto) { set_value(m_value + 1); };
m_increment_button->set_auto_repeat_interval(150);
m_decrement_button = add<Button>();
m_decrement_button->set_button_style(Gfx::ButtonStyle::ThickCap);
m_decrement_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/downward-triangle.png").release_value_but_fixme_should_propagate_errors());
m_decrement_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/downward-triangle.png"sv).release_value_but_fixme_should_propagate_errors());
m_decrement_button->set_focus_policy(GUI::FocusPolicy::NoFocus);
m_decrement_button->on_click = [this](auto) { set_value(m_value - 1); };
m_decrement_button->set_auto_repeat_interval(150);

View file

@ -89,12 +89,12 @@ void TextEditor::create_actions()
m_cut_action->set_enabled(false);
m_copy_action->set_enabled(false);
m_paste_action = CommonActions::make_paste_action([&](auto&) { paste(); }, this);
m_paste_action->set_enabled(is_editable() && Clipboard::the().fetch_mime_type().starts_with("text/"));
m_paste_action->set_enabled(is_editable() && Clipboard::the().fetch_mime_type().starts_with("text/"sv));
if (is_multi_line()) {
m_go_to_line_action = Action::create(
"Go to line...", { Mod_Ctrl, Key_L }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) {
"Go to line...", { Mod_Ctrl, Key_L }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) {
String value;
if (InputBox::show(window(), value, "Line:", "Go to line") == InputBox::ExecResult::OK) {
if (InputBox::show(window(), value, "Line:"sv, "Go to line"sv) == InputBox::ExecResult::OK) {
auto line_target = value.to_uint();
if (line_target.has_value()) {
set_cursor_and_focus_line(line_target.value() - 1, 0);
@ -1560,7 +1560,7 @@ void TextEditor::paste()
return;
auto [data, mime_type, _] = GUI::Clipboard::the().fetch_data_and_type();
if (!mime_type.starts_with("text/"))
if (!mime_type.starts_with("text/"sv))
return;
if (data.is_empty())
@ -1953,8 +1953,8 @@ void TextEditor::document_did_update_undo_stack()
m_undo_action->set_enabled(can_undo() && !text_is_secret());
m_redo_action->set_enabled(can_redo() && !text_is_secret());
m_undo_action->set_text(make_action_text("&Undo", document().undo_stack().undo_action_text()));
m_redo_action->set_text(make_action_text("&Redo", document().undo_stack().redo_action_text()));
m_undo_action->set_text(make_action_text("&Undo"sv, document().undo_stack().undo_action_text()));
m_redo_action->set_text(make_action_text("&Redo"sv, document().undo_stack().redo_action_text()));
// FIXME: This is currently firing more often than it should.
// Ideally we'd only send this out when the undo stack modified state actually changes.
@ -1982,7 +1982,7 @@ void TextEditor::cursor_did_change()
void TextEditor::clipboard_content_did_change(String const& mime_type)
{
m_paste_action->set_enabled(is_editable() && mime_type.starts_with("text/"));
m_paste_action->set_enabled(is_editable() && mime_type.starts_with("text/"sv));
}
void TextEditor::set_document(TextDocument& document)

View file

@ -45,8 +45,8 @@ struct AK::Formatter<GUI::TextPosition> : AK::Formatter<FormatString> {
ErrorOr<void> format(FormatBuilder& builder, GUI::TextPosition const& value)
{
if (value.is_valid())
return Formatter<FormatString>::format(builder, "({},{})", value.line(), value.column());
return Formatter<FormatString>::format(builder, "({},{})"sv, value.line(), value.column());
return Formatter<FormatString>::format(builder, "GUI::TextPosition(Invalid)");
return builder.put_string("GUI::TextPosition(Invalid)"sv);
}
};

View file

@ -72,7 +72,7 @@ struct AK::Formatter<GUI::TextRange> : AK::Formatter<FormatString> {
ErrorOr<void> format(FormatBuilder& builder, GUI::TextRange const& value)
{
if (value.is_valid())
return Formatter<FormatString>::format(builder, "{}-{}", value.start(), value.end());
return Formatter<FormatString>::format(builder, "GUI::TextRange(Invalid)");
return Formatter<FormatString>::format(builder, "{}-{}"sv, value.start(), value.end());
return builder.put_string("GUI::TextRange(Invalid)"sv);
}
};

View file

@ -42,8 +42,8 @@ TreeView::TreeView()
set_background_role(ColorRole::Base);
set_foreground_role(ColorRole::BaseText);
set_column_headers_visible(false);
m_expand_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/serenity/treeview-expand.png").release_value_but_fixme_should_propagate_errors();
m_collapse_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/serenity/treeview-collapse.png").release_value_but_fixme_should_propagate_errors();
m_expand_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/serenity/treeview-expand.png"sv).release_value_but_fixme_should_propagate_errors();
m_collapse_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/serenity/treeview-collapse.png"sv).release_value_but_fixme_should_propagate_errors();
}
ModelIndex TreeView::index_at_event_position(Gfx::IntPoint const& a_position, bool& is_toggle) const
@ -644,7 +644,7 @@ void TreeView::auto_resize_column(int column)
int header_width = column_header().font().width(model.column_name(column));
if (column == m_key_column && model.is_column_sortable(column))
header_width += font().width(" \xE2\xAC\x86");
header_width += font().width(" \xE2\xAC\x86"sv);
int column_width = header_width;
bool is_empty = true;
@ -689,7 +689,7 @@ void TreeView::update_column_sizes()
continue;
int header_width = column_header().font().width(model.column_name(column));
if (column == m_key_column && model.is_column_sortable(column))
header_width += font().width(" \xE2\xAC\x86");
header_width += font().width(" \xE2\xAC\x86"sv);
int column_width = header_width;
traverse_in_paint_order([&](ModelIndex const& index, Gfx::IntRect const&, Gfx::IntRect const&, int) {
auto cell_data = model.index(index.row(), column, index.parent()).data();
@ -710,7 +710,7 @@ void TreeView::update_column_sizes()
int tree_column_header_width = column_header().font().width(model.column_name(tree_column));
if (tree_column == m_key_column && model.is_column_sortable(tree_column))
tree_column_header_width += font().width(" \xE2\xAC\x86");
tree_column_header_width += font().width(" \xE2\xAC\x86"sv);
int tree_column_width = tree_column_header_width;
traverse_in_paint_order([&](ModelIndex const& index, Gfx::IntRect const&, Gfx::IntRect const&, int indent_level) {
auto cell_data = model.index(index.row(), tree_column, index.parent()).data();

View file

@ -298,17 +298,17 @@ inline auto clamp<GUI::UIDimension>(GUI::UIDimension const& input, GUI::UIDimens
[this] { \
auto size = this->getter(); \
JsonObject size_object; \
size_object.set("width", size.width().as_json_value()); \
size_object.set("height", size.height().as_json_value()); \
size_object.set("width"sv, size.width().as_json_value()); \
size_object.set("height"sv, size.height().as_json_value()); \
return size_object; \
}, \
[this](auto& value) { \
if (!value.is_object()) \
return false; \
auto result_width = GUI::UIDimension::construct_from_json_value( \
value.as_object().get("width")); \
value.as_object().get("width"sv)); \
auto result_height = GUI::UIDimension::construct_from_json_value( \
value.as_object().get("height")); \
value.as_object().get("height"sv)); \
if (result_width.has_value() && result_height.has_value()) { \
GUI::UISize size(result_width.value(), result_height.value()); \
setter(size); \

View file

@ -1150,7 +1150,7 @@ bool Widget::load_from_gml_ast(NonnullRefPtr<GUI::GML::Node> ast, RefPtr<Core::O
return false;
}
auto& layout_class = *Core::ObjectClassRegistration::find("GUI::Layout");
auto& layout_class = *Core::ObjectClassRegistration::find("GUI::Layout"sv);
if (auto* registration = Core::ObjectClassRegistration::find(class_name)) {
auto layout = registration->construct();
if (!layout || !registration->is_derived_from(layout_class)) {
@ -1168,7 +1168,7 @@ bool Widget::load_from_gml_ast(NonnullRefPtr<GUI::GML::Node> ast, RefPtr<Core::O
});
}
auto& widget_class = *Core::ObjectClassRegistration::find("GUI::Widget");
auto& widget_class = *Core::ObjectClassRegistration::find("GUI::Widget"sv);
bool is_tab_widget = is<TabWidget>(*this);
object->for_each_child_object_interruptible([&](auto child_data) {
auto class_name = child_data->name();

View file

@ -32,12 +32,12 @@ extern Core::ObjectClassRegistration registration_Widget;
}
}
#define REGISTER_WIDGET(namespace_, class_name) \
namespace Core { \
namespace Registration { \
Core::ObjectClassRegistration registration_##class_name( \
#namespace_ "::" #class_name, []() { return static_ptr_cast<Core::Object>(namespace_::class_name::construct()); }, &registration_Widget); \
} \
#define REGISTER_WIDGET(namespace_, class_name) \
namespace Core { \
namespace Registration { \
Core::ObjectClassRegistration registration_##class_name( \
#namespace_ "::" #class_name##sv, []() { return static_ptr_cast<Core::Object>(namespace_::class_name::construct()); }, &registration_Widget); \
} \
}
namespace GUI {

View file

@ -21,7 +21,7 @@ CoverWizardPage::CoverWizardPage()
set_layout<HorizontalBoxLayout>();
m_banner_image_widget = add<ImageWidget>();
m_banner_image_widget->set_fixed_size(160, 315);
m_banner_image_widget->load_from_file("/res/graphics/wizard-banner-simple.png");
m_banner_image_widget->load_from_file("/res/graphics/wizard-banner-simple.png"sv);
m_content_widget = add<Widget>();
m_content_widget->set_layout<VerticalBoxLayout>();