mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 15:27:35 +00:00
AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
This commit is contained in:
parent
f74251606d
commit
6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions
|
@ -15,12 +15,12 @@ class CreateNewImageDialog final : public GUI::Dialog {
|
|||
|
||||
public:
|
||||
Gfx::IntSize const& image_size() const { return m_image_size; }
|
||||
String const& image_name() const { return m_image_name; }
|
||||
DeprecatedString const& image_name() const { return m_image_name; }
|
||||
|
||||
private:
|
||||
CreateNewImageDialog(GUI::Window* parent_window);
|
||||
|
||||
String m_image_name;
|
||||
DeprecatedString m_image_name;
|
||||
Gfx::IntSize m_image_size;
|
||||
|
||||
RefPtr<GUI::TextBox> m_name_textbox;
|
||||
|
|
|
@ -15,13 +15,13 @@ class CreateNewLayerDialog final : public GUI::Dialog {
|
|||
|
||||
public:
|
||||
Gfx::IntSize const& layer_size() const { return m_layer_size; }
|
||||
String const& layer_name() const { return m_layer_name; }
|
||||
DeprecatedString const& layer_name() const { return m_layer_name; }
|
||||
|
||||
private:
|
||||
CreateNewLayerDialog(Gfx::IntSize const& suggested_size, GUI::Window* parent_window);
|
||||
|
||||
Gfx::IntSize m_layer_size;
|
||||
String m_layer_name;
|
||||
DeprecatedString m_layer_name;
|
||||
|
||||
RefPtr<GUI::TextBox> m_name_textbox;
|
||||
};
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace PixelPaint {
|
||||
|
||||
EditGuideDialog::EditGuideDialog(GUI::Window* parent_window, String const& offset, Guide::Orientation orientation)
|
||||
EditGuideDialog::EditGuideDialog(GUI::Window* parent_window, DeprecatedString const& offset, Guide::Orientation orientation)
|
||||
: Dialog(parent_window)
|
||||
, m_offset(offset)
|
||||
, m_orientation(orientation)
|
||||
|
|
|
@ -16,15 +16,15 @@ class EditGuideDialog final : public GUI::Dialog {
|
|||
C_OBJECT(EditGuideDialog);
|
||||
|
||||
public:
|
||||
String const offset() const { return m_offset; }
|
||||
DeprecatedString const offset() const { return m_offset; }
|
||||
Guide::Orientation orientation() const { return m_orientation; }
|
||||
|
||||
Optional<float> offset_as_pixel(ImageEditor const&);
|
||||
|
||||
private:
|
||||
EditGuideDialog(GUI::Window* parent_window, String const& offset = {}, Guide::Orientation orientation = Guide::Orientation::Unset);
|
||||
EditGuideDialog(GUI::Window* parent_window, DeprecatedString const& offset = {}, Guide::Orientation orientation = Guide::Orientation::Unset);
|
||||
|
||||
String m_offset;
|
||||
DeprecatedString m_offset;
|
||||
Guide::Orientation m_orientation;
|
||||
RefPtr<GUI::TextBox> m_offset_text_box;
|
||||
bool m_is_horizontal_checked { false };
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace PixelPaint {
|
|||
|
||||
class FilterNode final : public GUI::TreeViewModel::Node {
|
||||
public:
|
||||
FilterNode(String text, Optional<GUI::Icon> icon, Node* parent_node, NonnullRefPtr<Filter> filter)
|
||||
FilterNode(DeprecatedString text, Optional<GUI::Icon> icon, Node* parent_node, NonnullRefPtr<Filter> filter)
|
||||
: Node(move(text), move(icon), parent_node)
|
||||
, m_filter(move(filter))
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <Applications/PixelPaint/IconBag.h>
|
||||
|
||||
namespace PixelPaint {
|
||||
|
|
|
@ -474,7 +474,7 @@ void Image::did_change_rect(Gfx::IntRect const& a_modified_rect)
|
|||
client->image_did_change_rect(modified_rect);
|
||||
}
|
||||
|
||||
ImageUndoCommand::ImageUndoCommand(Image& image, String action_text)
|
||||
ImageUndoCommand::ImageUndoCommand(Image& image, DeprecatedString action_text)
|
||||
: m_snapshot(image.take_snapshot().release_value_but_fixme_should_propagate_errors())
|
||||
, m_image(image)
|
||||
, m_action_text(move(action_text))
|
||||
|
|
|
@ -123,16 +123,16 @@ private:
|
|||
|
||||
class ImageUndoCommand : public GUI::Command {
|
||||
public:
|
||||
ImageUndoCommand(Image&, String action_text);
|
||||
ImageUndoCommand(Image&, DeprecatedString action_text);
|
||||
|
||||
virtual void undo() override;
|
||||
virtual void redo() override;
|
||||
virtual String action_text() const override { return m_action_text; }
|
||||
virtual DeprecatedString action_text() const override { return m_action_text; }
|
||||
|
||||
private:
|
||||
RefPtr<Image> m_snapshot;
|
||||
Image& m_image;
|
||||
String m_action_text;
|
||||
DeprecatedString m_action_text;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ ImageEditor::ImageEditor(NonnullRefPtr<Image> image)
|
|||
, m_gui_event_loop(Core::EventLoop::current())
|
||||
{
|
||||
set_focus_policy(GUI::FocusPolicy::StrongFocus);
|
||||
m_undo_stack.push(make<ImageUndoCommand>(*m_image, String()));
|
||||
m_undo_stack.push(make<ImageUndoCommand>(*m_image, DeprecatedString()));
|
||||
m_image->add_client(*this);
|
||||
m_image->selection().add_client(*this);
|
||||
set_original_rect(m_image->rect());
|
||||
|
@ -61,7 +61,7 @@ ImageEditor::~ImageEditor()
|
|||
m_image->remove_client(*this);
|
||||
}
|
||||
|
||||
void ImageEditor::did_complete_action(String action_text)
|
||||
void ImageEditor::did_complete_action(DeprecatedString action_text)
|
||||
{
|
||||
if (on_modified_change)
|
||||
on_modified_change(true);
|
||||
|
@ -105,14 +105,14 @@ bool ImageEditor::redo()
|
|||
return true;
|
||||
}
|
||||
|
||||
void ImageEditor::set_title(String title)
|
||||
void ImageEditor::set_title(DeprecatedString title)
|
||||
{
|
||||
m_title = move(title);
|
||||
if (on_title_change)
|
||||
on_title_change(m_title);
|
||||
}
|
||||
|
||||
void ImageEditor::set_path(String path)
|
||||
void ImageEditor::set_path(DeprecatedString path)
|
||||
{
|
||||
m_path = move(path);
|
||||
set_title(LexicalPath::title(m_path));
|
||||
|
@ -201,7 +201,7 @@ void ImageEditor::paint_event(GUI::PaintEvent& event)
|
|||
|
||||
int const editor_x = content_to_frame_position({ x, 0 }).x();
|
||||
painter.draw_line({ editor_x, 0 }, { editor_x, m_ruler_thickness }, ruler_fg_color);
|
||||
painter.draw_text({ { editor_x + 2, 0 }, { m_ruler_thickness, m_ruler_thickness - 2 } }, String::formatted("{}", x), painter.font(), Gfx::TextAlignment::CenterLeft, ruler_text_color);
|
||||
painter.draw_text({ { editor_x + 2, 0 }, { m_ruler_thickness, m_ruler_thickness - 2 } }, DeprecatedString::formatted("{}", x), painter.font(), Gfx::TextAlignment::CenterLeft, ruler_text_color);
|
||||
}
|
||||
|
||||
// Vertical ruler
|
||||
|
@ -218,7 +218,7 @@ void ImageEditor::paint_event(GUI::PaintEvent& event)
|
|||
|
||||
int const editor_y = content_to_frame_position({ 0, y }).y();
|
||||
painter.draw_line({ 0, editor_y }, { m_ruler_thickness, editor_y }, ruler_fg_color);
|
||||
painter.draw_text({ { 0, editor_y - m_ruler_thickness }, { m_ruler_thickness, m_ruler_thickness } }, String::formatted("{}", y), painter.font(), Gfx::TextAlignment::BottomRight, ruler_text_color);
|
||||
painter.draw_text({ { 0, editor_y - m_ruler_thickness }, { m_ruler_thickness, m_ruler_thickness } }, DeprecatedString::formatted("{}", y), painter.font(), Gfx::TextAlignment::BottomRight, ruler_text_color);
|
||||
}
|
||||
|
||||
// Mouse position indicator
|
||||
|
@ -684,7 +684,7 @@ void ImageEditor::save_project()
|
|||
return;
|
||||
auto result = save_project_to_file(*response.value());
|
||||
if (result.is_error()) {
|
||||
GUI::MessageBox::show_error(window(), String::formatted("Could not save {}: {}", path(), result.error()));
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Could not save {}: {}", path(), result.error()));
|
||||
return;
|
||||
}
|
||||
undo_stack().set_current_unmodified();
|
||||
|
@ -700,7 +700,7 @@ void ImageEditor::save_project_as()
|
|||
auto file = response.value();
|
||||
auto result = save_project_to_file(*file);
|
||||
if (result.is_error()) {
|
||||
GUI::MessageBox::show_error(window(), String::formatted("Could not save {}: {}", file->filename(), result.error()));
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Could not save {}: {}", file->filename(), result.error()));
|
||||
return;
|
||||
}
|
||||
set_path(file->filename());
|
||||
|
@ -710,7 +710,7 @@ void ImageEditor::save_project_as()
|
|||
on_modified_change(false);
|
||||
}
|
||||
|
||||
Result<void, String> ImageEditor::save_project_to_file(Core::File& file) const
|
||||
Result<void, DeprecatedString> ImageEditor::save_project_to_file(Core::File& file) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
auto json = MUST(JsonObjectSerializer<>::try_create(builder));
|
||||
|
@ -729,7 +729,7 @@ Result<void, String> ImageEditor::save_project_to_file(Core::File& file) const
|
|||
MUST(json.finish());
|
||||
|
||||
if (!file.write(builder.string_view()))
|
||||
return String { file.error_string() };
|
||||
return DeprecatedString { file.error_string() };
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -43,17 +43,17 @@ public:
|
|||
void set_active_tool(Tool*);
|
||||
void update_tool_cursor();
|
||||
|
||||
void did_complete_action(String action_text);
|
||||
void did_complete_action(DeprecatedString action_text);
|
||||
bool undo();
|
||||
bool redo();
|
||||
|
||||
auto& undo_stack() { return m_undo_stack; }
|
||||
|
||||
String const& path() const { return m_path; }
|
||||
void set_path(String);
|
||||
DeprecatedString const& path() const { return m_path; }
|
||||
void set_path(DeprecatedString);
|
||||
|
||||
String const& title() const { return m_title; }
|
||||
void set_title(String);
|
||||
DeprecatedString const& title() const { return m_title; }
|
||||
void set_title(DeprecatedString);
|
||||
|
||||
void add_guide(NonnullRefPtr<Guide> guide) { m_guides.append(guide); }
|
||||
void remove_guide(Guide const& guide)
|
||||
|
@ -82,7 +82,7 @@ public:
|
|||
|
||||
Function<void(Layer*)> on_active_layer_change;
|
||||
|
||||
Function<void(String const&)> on_title_change;
|
||||
Function<void(DeprecatedString const&)> on_title_change;
|
||||
|
||||
Function<void(Gfx::IntPoint const&)> on_image_mouse_position_change;
|
||||
|
||||
|
@ -144,7 +144,7 @@ private:
|
|||
GUI::MouseEvent event_adjusted_for_layer(GUI::MouseEvent const&, Layer const&) const;
|
||||
GUI::MouseEvent event_with_pan_and_scale_applied(GUI::MouseEvent const&) const;
|
||||
|
||||
Result<void, String> save_project_to_file(Core::File&) const;
|
||||
Result<void, DeprecatedString> save_project_to_file(Core::File&) const;
|
||||
|
||||
int calculate_ruler_step_size() const;
|
||||
Gfx::IntRect mouse_indicator_rect_x() const;
|
||||
|
@ -156,8 +156,8 @@ private:
|
|||
RefPtr<Layer> m_active_layer;
|
||||
GUI::UndoStack m_undo_stack;
|
||||
|
||||
String m_path;
|
||||
String m_title;
|
||||
DeprecatedString m_path;
|
||||
DeprecatedString m_title;
|
||||
|
||||
NonnullRefPtrVector<Guide> m_guides;
|
||||
bool m_show_guides { true };
|
||||
|
|
|
@ -20,7 +20,7 @@ void FilterApplicationCommand::execute()
|
|||
m_filter->m_editor->gui_event_loop().deferred_invoke([strong_this = NonnullRefPtr(*this)]() {
|
||||
// HACK: we can't tell strong_this to not be const
|
||||
(*const_cast<NonnullRefPtr<Layer>*>(&strong_this->m_target_layer))->did_modify_bitmap(strong_this->m_target_layer->rect());
|
||||
strong_this->m_filter->m_editor->did_complete_action(String::formatted("Filter {}", strong_this->m_filter->filter_name()));
|
||||
strong_this->m_filter->m_editor->did_complete_action(DeprecatedString::formatted("Filter {}", strong_this->m_filter->filter_name()));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
namespace PixelPaint {
|
||||
|
||||
ErrorOr<NonnullRefPtr<Layer>> Layer::try_create_with_size(Image& image, Gfx::IntSize const& size, String name)
|
||||
ErrorOr<NonnullRefPtr<Layer>> Layer::try_create_with_size(Image& image, Gfx::IntSize const& size, DeprecatedString name)
|
||||
{
|
||||
VERIFY(!size.is_empty());
|
||||
|
||||
|
@ -27,7 +27,7 @@ ErrorOr<NonnullRefPtr<Layer>> Layer::try_create_with_size(Image& image, Gfx::Int
|
|||
return adopt_nonnull_ref_or_enomem(new (nothrow) Layer(image, move(bitmap), move(name)));
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<Layer>> Layer::try_create_with_bitmap(Image& image, NonnullRefPtr<Gfx::Bitmap> bitmap, String name)
|
||||
ErrorOr<NonnullRefPtr<Layer>> Layer::try_create_with_bitmap(Image& image, NonnullRefPtr<Gfx::Bitmap> bitmap, DeprecatedString name)
|
||||
{
|
||||
VERIFY(!bitmap->size().is_empty());
|
||||
|
||||
|
@ -56,7 +56,7 @@ ErrorOr<NonnullRefPtr<Layer>> Layer::try_create_snapshot(Image& image, Layer con
|
|||
return snapshot;
|
||||
}
|
||||
|
||||
Layer::Layer(Image& image, NonnullRefPtr<Gfx::Bitmap> bitmap, String name)
|
||||
Layer::Layer(Image& image, NonnullRefPtr<Gfx::Bitmap> bitmap, DeprecatedString name)
|
||||
: m_image(image)
|
||||
, m_name(move(name))
|
||||
, m_content_bitmap(move(bitmap))
|
||||
|
@ -101,7 +101,7 @@ void Layer::set_opacity_percent(int opacity_percent)
|
|||
m_image.layer_did_modify_properties({}, *this);
|
||||
}
|
||||
|
||||
void Layer::set_name(String name)
|
||||
void Layer::set_name(DeprecatedString name)
|
||||
{
|
||||
if (m_name == name)
|
||||
return;
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Noncopyable.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Weakable.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Painter.h>
|
||||
|
@ -29,8 +29,8 @@ class Layer
|
|||
AK_MAKE_NONMOVABLE(Layer);
|
||||
|
||||
public:
|
||||
static ErrorOr<NonnullRefPtr<Layer>> try_create_with_size(Image&, Gfx::IntSize const&, String name);
|
||||
static ErrorOr<NonnullRefPtr<Layer>> try_create_with_bitmap(Image&, NonnullRefPtr<Gfx::Bitmap>, String name);
|
||||
static ErrorOr<NonnullRefPtr<Layer>> try_create_with_size(Image&, Gfx::IntSize const&, DeprecatedString name);
|
||||
static ErrorOr<NonnullRefPtr<Layer>> try_create_with_bitmap(Image&, NonnullRefPtr<Gfx::Bitmap>, DeprecatedString name);
|
||||
static ErrorOr<NonnullRefPtr<Layer>> try_create_snapshot(Image&, Layer const&);
|
||||
|
||||
~Layer() = default;
|
||||
|
@ -53,8 +53,8 @@ public:
|
|||
Gfx::IntRect relative_rect() const { return { location(), size() }; }
|
||||
Gfx::IntRect rect() const { return { {}, size() }; }
|
||||
|
||||
String const& name() const { return m_name; }
|
||||
void set_name(String);
|
||||
DeprecatedString const& name() const { return m_name; }
|
||||
void set_name(DeprecatedString);
|
||||
|
||||
void flip(Gfx::Orientation orientation);
|
||||
void rotate(Gfx::RotationDirection direction);
|
||||
|
@ -97,11 +97,11 @@ public:
|
|||
Gfx::Bitmap& currently_edited_bitmap();
|
||||
|
||||
private:
|
||||
Layer(Image&, NonnullRefPtr<Gfx::Bitmap>, String name);
|
||||
Layer(Image&, NonnullRefPtr<Gfx::Bitmap>, DeprecatedString name);
|
||||
|
||||
Image& m_image;
|
||||
|
||||
String m_name;
|
||||
DeprecatedString m_name;
|
||||
Gfx::IntPoint m_location;
|
||||
NonnullRefPtr<Gfx::Bitmap> m_content_bitmap;
|
||||
RefPtr<Gfx::Bitmap> m_scratch_edited_bitmap { nullptr };
|
||||
|
|
|
@ -42,7 +42,7 @@ LevelsDialog::LevelsDialog(GUI::Window* parent_window, ImageEditor* editor)
|
|||
VERIFY(cancel_button);
|
||||
VERIFY(m_editor->active_layer());
|
||||
|
||||
context_label->set_text(String::formatted("Working on layer: {}", m_editor->active_layer()->name()));
|
||||
context_label->set_text(DeprecatedString::formatted("Working on layer: {}", m_editor->active_layer()->name()));
|
||||
m_gamma_slider->set_value(100);
|
||||
|
||||
m_brightness_slider->on_change = [this](auto) {
|
||||
|
|
|
@ -142,7 +142,7 @@ void MainWidget::image_editor_did_update_undo_stack()
|
|||
}
|
||||
|
||||
// Note: Update these together! v
|
||||
static Vector<String> const s_suggested_zoom_levels { "25%", "50%", "100%", "200%", "300%", "400%", "800%", "1600%", "Fit to width", "Fit to height", "Fit entire image" };
|
||||
static Vector<DeprecatedString> const s_suggested_zoom_levels { "25%", "50%", "100%", "200%", "300%", "400%", "800%", "1600%", "Fit to width", "Fit to height", "Fit entire image" };
|
||||
static constexpr int s_zoom_level_fit_width = 8;
|
||||
static constexpr int s_zoom_level_fit_height = 9;
|
||||
static constexpr int s_zoom_level_fit_image = 10;
|
||||
|
@ -216,7 +216,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
|
|||
auto preserve_alpha_channel = GUI::MessageBox::show(&window, "Do you wish to preserve transparency?"sv, "Preserve transparency?"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
|
||||
auto result = editor->image().export_bmp_to_file(response.value(), preserve_alpha_channel == GUI::MessageBox::ExecResult::Yes);
|
||||
if (result.is_error())
|
||||
GUI::MessageBox::show_error(&window, String::formatted("Export to BMP failed: {}", result.error()));
|
||||
GUI::MessageBox::show_error(&window, DeprecatedString::formatted("Export to BMP failed: {}", result.error()));
|
||||
}));
|
||||
|
||||
m_export_submenu->add_action(
|
||||
|
@ -231,7 +231,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
|
|||
auto preserve_alpha_channel = GUI::MessageBox::show(&window, "Do you wish to preserve transparency?"sv, "Preserve transparency?"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo);
|
||||
auto result = editor->image().export_png_to_file(response.value(), preserve_alpha_channel == GUI::MessageBox::ExecResult::Yes);
|
||||
if (result.is_error())
|
||||
GUI::MessageBox::show_error(&window, String::formatted("Export to PNG failed: {}", result.error()));
|
||||
GUI::MessageBox::show_error(&window, DeprecatedString::formatted("Export to PNG failed: {}", result.error()));
|
||||
}));
|
||||
|
||||
m_export_submenu->add_action(
|
||||
|
@ -244,7 +244,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
|
|||
return;
|
||||
auto result = editor->image().export_qoi_to_file(response.value());
|
||||
if (result.is_error())
|
||||
GUI::MessageBox::show_error(&window, String::formatted("Export to QOI failed: {}", result.error()));
|
||||
GUI::MessageBox::show_error(&window, DeprecatedString::formatted("Export to QOI failed: {}", result.error()));
|
||||
}));
|
||||
|
||||
m_export_submenu->set_icon(g_icon_bag.file_export);
|
||||
|
@ -400,7 +400,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
|
|||
|
||||
auto result = PixelPaint::PaletteWidget::load_palette_file(*response.value());
|
||||
if (result.is_error()) {
|
||||
GUI::MessageBox::show_error(&window, String::formatted("Loading color palette failed: {}", result.error()));
|
||||
GUI::MessageBox::show_error(&window, DeprecatedString::formatted("Loading color palette failed: {}", result.error()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -414,7 +414,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
|
|||
|
||||
auto result = PixelPaint::PaletteWidget::save_palette_file(m_palette_widget->colors(), *response.value());
|
||||
if (result.is_error())
|
||||
GUI::MessageBox::show_error(&window, String::formatted("Writing color palette failed: {}", result.error()));
|
||||
GUI::MessageBox::show_error(&window, DeprecatedString::formatted("Writing color palette failed: {}", result.error()));
|
||||
}));
|
||||
|
||||
m_view_menu = window.add_menu("&View");
|
||||
|
@ -629,7 +629,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
|
|||
if (dialog->exec() == GUI::Dialog::ExecResult::OK) {
|
||||
auto layer_or_error = PixelPaint::Layer::try_create_with_size(editor->image(), dialog->layer_size(), dialog->layer_name());
|
||||
if (layer_or_error.is_error()) {
|
||||
GUI::MessageBox::show_error(&window, String::formatted("Unable to create layer with size {}", dialog->size()));
|
||||
GUI::MessageBox::show_error(&window, DeprecatedString::formatted("Unable to create layer with size {}", dialog->size()));
|
||||
return;
|
||||
}
|
||||
editor->image().add_layer(layer_or_error.release_value());
|
||||
|
@ -930,8 +930,8 @@ void MainWidget::initialize_menubar(GUI::Window& window)
|
|||
|
||||
m_zoom_combobox = toolbar.add<GUI::ComboBox>();
|
||||
m_zoom_combobox->set_max_width(75);
|
||||
m_zoom_combobox->set_model(*GUI::ItemListModel<String>::create(s_suggested_zoom_levels));
|
||||
m_zoom_combobox->on_change = [this](String const& value, GUI::ModelIndex const& index) {
|
||||
m_zoom_combobox->set_model(*GUI::ItemListModel<DeprecatedString>::create(s_suggested_zoom_levels));
|
||||
m_zoom_combobox->on_change = [this](DeprecatedString const& value, GUI::ModelIndex const& index) {
|
||||
auto* editor = current_image_editor();
|
||||
VERIFY(editor);
|
||||
|
||||
|
@ -995,7 +995,7 @@ void MainWidget::open_image(Core::File& file)
|
|||
auto try_load = m_loader.try_load_from_file(file);
|
||||
|
||||
if (try_load.is_error()) {
|
||||
GUI::MessageBox::show_error(window(), String::formatted("Unable to open file: {}, {}", file.filename(), try_load.error()));
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Unable to open file: {}, {}", file.filename(), try_load.error()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1105,7 +1105,7 @@ ImageEditor& MainWidget::create_new_editor(NonnullRefPtr<Image> image)
|
|||
};
|
||||
|
||||
image_editor.on_scale_change = Core::debounce([this](float scale) {
|
||||
m_zoom_combobox->set_text(String::formatted("{}%", roundf(scale * 100)));
|
||||
m_zoom_combobox->set_text(DeprecatedString::formatted("{}%", roundf(scale * 100)));
|
||||
current_image_editor()->update_tool_cursor();
|
||||
},
|
||||
100);
|
||||
|
|
|
@ -134,7 +134,7 @@ PaletteWidget::PaletteWidget()
|
|||
|
||||
auto result = load_palette_path("/res/color-palettes/default.palette");
|
||||
if (result.is_error()) {
|
||||
GUI::MessageBox::show_error(window(), String::formatted("Loading default palette failed: {}", result.error()));
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Loading default palette failed: {}", result.error()));
|
||||
display_color_list(fallback_colors());
|
||||
|
||||
return;
|
||||
|
@ -225,7 +225,7 @@ Vector<Color> PaletteWidget::colors()
|
|||
return colors;
|
||||
}
|
||||
|
||||
Result<Vector<Color>, String> PaletteWidget::load_palette_file(Core::File& file)
|
||||
Result<Vector<Color>, DeprecatedString> PaletteWidget::load_palette_file(Core::File& file)
|
||||
{
|
||||
Vector<Color> palette;
|
||||
|
||||
|
@ -245,22 +245,22 @@ Result<Vector<Color>, String> PaletteWidget::load_palette_file(Core::File& file)
|
|||
file.close();
|
||||
|
||||
if (palette.is_empty())
|
||||
return String { "The palette file did not contain any usable colors"sv };
|
||||
return DeprecatedString { "The palette file did not contain any usable colors"sv };
|
||||
|
||||
return palette;
|
||||
}
|
||||
|
||||
Result<Vector<Color>, String> PaletteWidget::load_palette_path(String const& file_path)
|
||||
Result<Vector<Color>, DeprecatedString> PaletteWidget::load_palette_path(DeprecatedString const& file_path)
|
||||
{
|
||||
auto file_or_error = Core::File::open(file_path, Core::OpenMode::ReadOnly);
|
||||
if (file_or_error.is_error())
|
||||
return String { strerror(file_or_error.error().code()) };
|
||||
return DeprecatedString { strerror(file_or_error.error().code()) };
|
||||
|
||||
auto& file = *file_or_error.value();
|
||||
return load_palette_file(file);
|
||||
}
|
||||
|
||||
Result<void, String> PaletteWidget::save_palette_file(Vector<Color> palette, Core::File& file)
|
||||
Result<void, DeprecatedString> PaletteWidget::save_palette_file(Vector<Color> palette, Core::File& file)
|
||||
{
|
||||
for (auto& color : palette) {
|
||||
file.write(color.to_string_without_alpha());
|
||||
|
|
|
@ -31,9 +31,9 @@ public:
|
|||
|
||||
Vector<Color> colors();
|
||||
|
||||
static Result<Vector<Color>, String> load_palette_file(Core::File&);
|
||||
static Result<Vector<Color>, String> load_palette_path(String const&);
|
||||
static Result<void, String> save_palette_file(Vector<Color>, Core::File&);
|
||||
static Result<Vector<Color>, DeprecatedString> load_palette_file(Core::File&);
|
||||
static Result<Vector<Color>, DeprecatedString> load_palette_path(DeprecatedString const&);
|
||||
static Result<void, DeprecatedString> save_palette_file(Vector<Color>, Core::File&);
|
||||
static Vector<Color> fallback_colors();
|
||||
|
||||
void set_image_editor(ImageEditor*);
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
#include "ProjectLoader.h"
|
||||
#include "Image.h"
|
||||
#include "Layer.h"
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/Result.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibImageDecoderClient/Client.h>
|
||||
|
|
|
@ -53,7 +53,7 @@ ToolboxWidget::ToolboxWidget()
|
|||
void ToolboxWidget::setup_tools()
|
||||
{
|
||||
auto add_tool = [&](StringView icon_name, GUI::Shortcut const& shortcut, NonnullOwnPtr<Tool> tool, bool is_default_tool = false) {
|
||||
auto action = GUI::Action::create_checkable(tool->tool_name(), shortcut, Gfx::Bitmap::try_load_from_file(String::formatted("/res/icons/pixelpaint/{}.png", icon_name)).release_value_but_fixme_should_propagate_errors(),
|
||||
auto action = GUI::Action::create_checkable(tool->tool_name(), shortcut, Gfx::Bitmap::try_load_from_file(DeprecatedString::formatted("/res/icons/pixelpaint/{}.png", icon_name)).release_value_but_fixme_should_propagate_errors(),
|
||||
[this, tool = tool.ptr()](auto& action) {
|
||||
if (action.is_checked()) {
|
||||
on_tool_selection(tool);
|
||||
|
|
|
@ -74,7 +74,7 @@ void GuideTool::on_mousedown(Layer*, MouseEvent& event)
|
|||
|
||||
if (m_selected_guide) {
|
||||
m_guide_origin = m_selected_guide->offset();
|
||||
GUI::Application::the()->show_tooltip_immediately(String::formatted("{}", m_guide_origin), GUI::Application::the()->tooltip_source_widget());
|
||||
GUI::Application::the()->show_tooltip_immediately(DeprecatedString::formatted("{}", m_guide_origin), GUI::Application::the()->tooltip_source_widget());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ void GuideTool::on_mousemove(Layer*, MouseEvent& event)
|
|||
|
||||
m_selected_guide->set_offset(new_offset);
|
||||
|
||||
GUI::Application::the()->show_tooltip_immediately(String::formatted("{}", new_offset), GUI::Application::the()->tooltip_source_widget());
|
||||
GUI::Application::the()->show_tooltip_immediately(DeprecatedString::formatted("{}", new_offset), GUI::Application::the()->tooltip_source_widget());
|
||||
|
||||
editor()->layers_did_change();
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ void GuideTool::on_context_menu(Layer*, GUI::ContextMenuEvent& event)
|
|||
return;
|
||||
auto dialog = EditGuideDialog::construct(
|
||||
editor()->window(),
|
||||
String::formatted("{}", m_context_menu_guide->offset()),
|
||||
DeprecatedString::formatted("{}", m_context_menu_guide->offset()),
|
||||
m_context_menu_guide->orientation());
|
||||
if (dialog->exec() != GUI::Dialog::ExecResult::OK)
|
||||
return;
|
||||
|
|
|
@ -205,7 +205,7 @@ GUI::Widget* RectangleSelectTool::get_properties_widget()
|
|||
|
||||
auto& mode_combo = mode_container.add<GUI::ComboBox>();
|
||||
mode_combo.set_only_allow_values_from_model(true);
|
||||
mode_combo.set_model(*GUI::ItemListModel<String>::create(m_merge_mode_names));
|
||||
mode_combo.set_model(*GUI::ItemListModel<DeprecatedString>::create(m_merge_mode_names));
|
||||
mode_combo.set_selected_index((int)m_merge_mode);
|
||||
mode_combo.on_change = [this](auto&&, GUI::ModelIndex const& index) {
|
||||
VERIFY(index.row() >= 0);
|
||||
|
|
|
@ -40,7 +40,7 @@ private:
|
|||
};
|
||||
|
||||
RefPtr<GUI::Widget> m_properties_widget;
|
||||
Vector<String> m_merge_mode_names {};
|
||||
Vector<DeprecatedString> m_merge_mode_names {};
|
||||
Selection::MergeMode m_merge_mode { Selection::MergeMode::Set };
|
||||
float m_edge_feathering { 0.0f };
|
||||
bool m_selecting { false };
|
||||
|
|
|
@ -120,7 +120,7 @@ GUI::Widget* WandSelectTool::get_properties_widget()
|
|||
|
||||
auto& mode_combo = mode_container.add<GUI::ComboBox>();
|
||||
mode_combo.set_only_allow_values_from_model(true);
|
||||
mode_combo.set_model(*GUI::ItemListModel<String>::create(m_merge_mode_names));
|
||||
mode_combo.set_model(*GUI::ItemListModel<DeprecatedString>::create(m_merge_mode_names));
|
||||
mode_combo.set_selected_index((int)m_merge_mode);
|
||||
mode_combo.on_change = [this](auto&&, GUI::ModelIndex const& index) {
|
||||
VERIFY(index.row() >= 0);
|
||||
|
|
|
@ -31,7 +31,7 @@ private:
|
|||
|
||||
int m_threshold { 0 };
|
||||
RefPtr<GUI::Widget> m_properties_widget;
|
||||
Vector<String> m_merge_mode_names {};
|
||||
Vector<DeprecatedString> m_merge_mode_names {};
|
||||
Selection::MergeMode m_merge_mode { Selection::MergeMode::Set };
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue