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

PixelPaint: Replace uses of JsonObject::get_deprecated()/get_ptr()

This commit is contained in:
Sam Atkins 2022-12-21 19:34:37 +00:00 committed by Tim Flynn
parent ecbe317413
commit c36de98223
3 changed files with 22 additions and 21 deletions

View file

@ -1237,15 +1237,15 @@ ImageEditor& MainWidget::create_new_editor(NonnullRefPtr<Image> image)
if (!value.is_object())
return;
auto& json_object = value.as_object();
auto orientation_value = json_object.get_deprecated("orientation"sv);
if (!orientation_value.is_string())
auto orientation_value = json_object.get_deprecated_string("orientation"sv);
if (!orientation_value.has_value())
return;
auto offset_value = json_object.get_deprecated("offset"sv);
if (!offset_value.is_number())
auto offset_value = json_object.get("offset"sv);
if (!offset_value.has_value() || !offset_value->is_number())
return;
auto orientation_string = orientation_value.as_string();
auto orientation_string = orientation_value.value();
PixelPaint::Guide::Orientation orientation;
if (orientation_string == "horizontal"sv)
orientation = PixelPaint::Guide::Orientation::Horizontal;
@ -1254,7 +1254,7 @@ ImageEditor& MainWidget::create_new_editor(NonnullRefPtr<Image> image)
else
return;
image_editor.add_guide(PixelPaint::Guide::construct(orientation, offset_value.to_number<float>()));
image_editor.add_guide(PixelPaint::Guide::construct(orientation, offset_value->to_number<float>()));
});
}