mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 09:57:36 +00:00
AK+Everywhere: Rename JsonObject::get() to ::get_deprecated()
This is a preparatory step to making `get()` return `ErrorOr`.
This commit is contained in:
parent
efe4329f9f
commit
1dd6b7f5b7
76 changed files with 671 additions and 671 deletions
|
@ -506,8 +506,8 @@ ErrorOr<void> BrowserWindow::load_search_engines(GUI::Menu& settings_menu)
|
|||
if (!json_item.is_object())
|
||||
continue;
|
||||
auto search_engine = json_item.as_object();
|
||||
auto name = search_engine.get("title"sv).to_deprecated_string();
|
||||
auto url_format = search_engine.get("url_format"sv).to_deprecated_string();
|
||||
auto name = search_engine.get_deprecated("title"sv).to_deprecated_string();
|
||||
auto url_format = search_engine.get_deprecated("url_format"sv).to_deprecated_string();
|
||||
|
||||
auto action = GUI::Action::create_checkable(
|
||||
name, [&, url_format](auto&) {
|
||||
|
|
|
@ -52,10 +52,10 @@ void InspectorWidget::set_selection(GUI::ModelIndex const index)
|
|||
|
||||
Selection selection {};
|
||||
if (json->has_u32("pseudo-element"sv)) {
|
||||
selection.dom_node_id = json->get("parent-id"sv).to_i32();
|
||||
selection.pseudo_element = static_cast<Web::CSS::Selector::PseudoElement>(json->get("pseudo-element"sv).to_u32());
|
||||
selection.dom_node_id = json->get_deprecated("parent-id"sv).to_i32();
|
||||
selection.pseudo_element = static_cast<Web::CSS::Selector::PseudoElement>(json->get_deprecated("pseudo-element"sv).to_u32());
|
||||
} else {
|
||||
selection.dom_node_id = json->get("id"sv).to_i32();
|
||||
selection.dom_node_id = json->get_deprecated("id"sv).to_i32();
|
||||
}
|
||||
|
||||
if (selection == m_selection)
|
||||
|
@ -181,21 +181,21 @@ void InspectorWidget::update_node_box_model(StringView node_box_sizing_json)
|
|||
auto json_value = json_or_error.release_value();
|
||||
auto const& json_object = json_value.as_object();
|
||||
|
||||
m_node_box_sizing.margin.top = json_object.get("margin_top"sv).to_float();
|
||||
m_node_box_sizing.margin.right = json_object.get("margin_right"sv).to_float();
|
||||
m_node_box_sizing.margin.bottom = json_object.get("margin_bottom"sv).to_float();
|
||||
m_node_box_sizing.margin.left = json_object.get("margin_left"sv).to_float();
|
||||
m_node_box_sizing.padding.top = json_object.get("padding_top"sv).to_float();
|
||||
m_node_box_sizing.padding.right = json_object.get("padding_right"sv).to_float();
|
||||
m_node_box_sizing.padding.bottom = json_object.get("padding_bottom"sv).to_float();
|
||||
m_node_box_sizing.padding.left = json_object.get("padding_left"sv).to_float();
|
||||
m_node_box_sizing.border.top = json_object.get("border_top"sv).to_float();
|
||||
m_node_box_sizing.border.right = json_object.get("border_right"sv).to_float();
|
||||
m_node_box_sizing.border.bottom = json_object.get("border_bottom"sv).to_float();
|
||||
m_node_box_sizing.border.left = json_object.get("border_left"sv).to_float();
|
||||
m_node_box_sizing.margin.top = json_object.get_deprecated("margin_top"sv).to_float();
|
||||
m_node_box_sizing.margin.right = json_object.get_deprecated("margin_right"sv).to_float();
|
||||
m_node_box_sizing.margin.bottom = json_object.get_deprecated("margin_bottom"sv).to_float();
|
||||
m_node_box_sizing.margin.left = json_object.get_deprecated("margin_left"sv).to_float();
|
||||
m_node_box_sizing.padding.top = json_object.get_deprecated("padding_top"sv).to_float();
|
||||
m_node_box_sizing.padding.right = json_object.get_deprecated("padding_right"sv).to_float();
|
||||
m_node_box_sizing.padding.bottom = json_object.get_deprecated("padding_bottom"sv).to_float();
|
||||
m_node_box_sizing.padding.left = json_object.get_deprecated("padding_left"sv).to_float();
|
||||
m_node_box_sizing.border.top = json_object.get_deprecated("border_top"sv).to_float();
|
||||
m_node_box_sizing.border.right = json_object.get_deprecated("border_right"sv).to_float();
|
||||
m_node_box_sizing.border.bottom = json_object.get_deprecated("border_bottom"sv).to_float();
|
||||
m_node_box_sizing.border.left = json_object.get_deprecated("border_left"sv).to_float();
|
||||
|
||||
m_element_size_view->set_node_content_width(json_object.get("content_width"sv).to_float());
|
||||
m_element_size_view->set_node_content_height(json_object.get("content_height"sv).to_float());
|
||||
m_element_size_view->set_node_content_width(json_object.get_deprecated("content_width"sv).to_float());
|
||||
m_element_size_view->set_node_content_height(json_object.get_deprecated("content_height"sv).to_float());
|
||||
m_element_size_view->set_box_model(m_node_box_sizing);
|
||||
}
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ KeyboardSettingsWidget::KeyboardSettingsWidget()
|
|||
auto json = JsonValue::from_string(proc_keymap->read_all()).release_value_but_fixme_should_propagate_errors();
|
||||
auto const& keymap_object = json.as_object();
|
||||
VERIFY(keymap_object.has("keymap"sv));
|
||||
m_initial_active_keymap = keymap_object.get("keymap"sv).to_deprecated_string();
|
||||
m_initial_active_keymap = keymap_object.get_deprecated("keymap"sv).to_deprecated_string();
|
||||
dbgln("KeyboardSettings thinks the current keymap is: {}", m_initial_active_keymap);
|
||||
|
||||
auto mapper_config(Core::ConfigFile::open("/etc/Keyboard.ini").release_value_but_fixme_should_propagate_errors());
|
||||
|
|
|
@ -78,7 +78,7 @@ NetworkSettingsWidget::NetworkSettingsWidget()
|
|||
size_t index = 0;
|
||||
proc_net_adapters_json.as_array().for_each([&](auto& value) {
|
||||
auto& if_object = value.as_object();
|
||||
auto adapter_name = if_object.get("name"sv).to_deprecated_string();
|
||||
auto adapter_name = if_object.get_deprecated("name"sv).to_deprecated_string();
|
||||
if (adapter_name == "loop")
|
||||
return;
|
||||
|
||||
|
|
|
@ -82,37 +82,37 @@ ErrorOr<NonnullRefPtr<Image>> Image::try_create_from_bitmap(NonnullRefPtr<Gfx::B
|
|||
|
||||
ErrorOr<NonnullRefPtr<Image>> Image::try_create_from_pixel_paint_json(JsonObject const& json)
|
||||
{
|
||||
auto image = TRY(try_create_with_size({ json.get("width"sv).to_i32(), json.get("height"sv).to_i32() }));
|
||||
auto image = TRY(try_create_with_size({ json.get_deprecated("width"sv).to_i32(), json.get_deprecated("height"sv).to_i32() }));
|
||||
|
||||
auto layers_value = json.get("layers"sv);
|
||||
for (auto const& layer_value : layers_value.as_array().values()) {
|
||||
auto layers_value = json.get_deprecated("layers"sv);
|
||||
for (auto& layer_value : layers_value.as_array().values()) {
|
||||
auto const& layer_object = layer_value.as_object();
|
||||
auto name = layer_object.get("name"sv).as_string();
|
||||
auto name = layer_object.get_deprecated("name"sv).as_string();
|
||||
|
||||
auto bitmap_base64_encoded = layer_object.get("bitmap"sv).as_string();
|
||||
auto bitmap_base64_encoded = layer_object.get_deprecated("bitmap"sv).as_string();
|
||||
auto bitmap_data = TRY(decode_base64(bitmap_base64_encoded));
|
||||
auto bitmap = TRY(try_decode_bitmap(bitmap_data));
|
||||
auto layer = TRY(Layer::try_create_with_bitmap(*image, move(bitmap), name));
|
||||
|
||||
if (auto const& mask_object = layer_object.get("mask"sv); !mask_object.is_null()) {
|
||||
if (auto const& mask_object = layer_object.get_deprecated("mask"sv); !mask_object.is_null()) {
|
||||
auto mask_base64_encoded = mask_object.as_string();
|
||||
auto mask_data = TRY(decode_base64(mask_base64_encoded));
|
||||
auto mask = TRY(try_decode_bitmap(mask_data));
|
||||
TRY(layer->try_set_bitmaps(layer->content_bitmap(), mask));
|
||||
}
|
||||
|
||||
auto width = layer_object.get("width"sv).to_i32();
|
||||
auto height = layer_object.get("height"sv).to_i32();
|
||||
auto width = layer_object.get_deprecated("width"sv).to_i32();
|
||||
auto height = layer_object.get_deprecated("height"sv).to_i32();
|
||||
|
||||
if (width != layer->size().width() || height != layer->size().height())
|
||||
return Error::from_string_literal("Decoded layer bitmap has wrong size");
|
||||
|
||||
image->add_layer(*layer);
|
||||
|
||||
layer->set_location({ layer_object.get("locationx"sv).to_i32(), layer_object.get("locationy"sv).to_i32() });
|
||||
layer->set_opacity_percent(layer_object.get("opacity_percent"sv).to_i32());
|
||||
layer->set_visible(layer_object.get("visible"sv).as_bool());
|
||||
layer->set_selected(layer_object.get("selected"sv).as_bool());
|
||||
layer->set_location({ layer_object.get_deprecated("locationx"sv).to_i32(), layer_object.get_deprecated("locationy"sv).to_i32() });
|
||||
layer->set_opacity_percent(layer_object.get_deprecated("opacity_percent"sv).to_i32());
|
||||
layer->set_visible(layer_object.get_deprecated("visible"sv).as_bool());
|
||||
layer->set_selected(layer_object.get_deprecated("selected"sv).as_bool());
|
||||
}
|
||||
|
||||
return image;
|
||||
|
|
|
@ -1237,11 +1237,11 @@ 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("orientation"sv);
|
||||
auto orientation_value = json_object.get_deprecated("orientation"sv);
|
||||
if (!orientation_value.is_string())
|
||||
return;
|
||||
|
||||
auto offset_value = json_object.get("offset"sv);
|
||||
auto offset_value = json_object.get_deprecated("offset"sv);
|
||||
if (!offset_value.is_number())
|
||||
return;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ ErrorOr<void> ProjectLoader::try_load_from_file(NonnullOwnPtr<Core::Stream::File
|
|||
auto image = TRY(Image::try_create_from_pixel_paint_json(json));
|
||||
|
||||
if (json.has("guides"sv))
|
||||
m_json_metadata = json.get("guides"sv).as_array();
|
||||
m_json_metadata = json.get_deprecated("guides"sv).as_array();
|
||||
|
||||
m_image = image;
|
||||
return {};
|
||||
|
|
|
@ -91,12 +91,12 @@ ErrorOr<NonnullOwnPtr<Presentation>> Presentation::load_from_file(StringView fil
|
|||
if (!global_object.has_number("version"sv))
|
||||
return Error::from_string_view("Presentation file is missing a version specification"sv);
|
||||
|
||||
auto const version = global_object.get("version"sv).to_int(-1);
|
||||
auto const version = global_object.get_deprecated("version"sv).to_int(-1);
|
||||
if (version != PRESENTATION_FORMAT_VERSION)
|
||||
return Error::from_string_view("Presentation file has incompatible version"sv);
|
||||
|
||||
auto const& maybe_metadata = global_object.get("metadata"sv);
|
||||
auto const& maybe_slides = global_object.get("slides"sv);
|
||||
auto const& maybe_metadata = global_object.get_deprecated("metadata"sv);
|
||||
auto const& maybe_slides = global_object.get_deprecated("slides"sv);
|
||||
|
||||
if (maybe_metadata.is_null() || !maybe_metadata.is_object() || maybe_slides.is_null() || !maybe_slides.is_array())
|
||||
return Error::from_string_view("Metadata or slides in incorrect format"sv);
|
||||
|
@ -133,8 +133,8 @@ HashMap<DeprecatedString, DeprecatedString> Presentation::parse_metadata(JsonObj
|
|||
|
||||
ErrorOr<Gfx::IntSize> Presentation::parse_presentation_size(JsonObject const& metadata_object)
|
||||
{
|
||||
auto const& maybe_width = metadata_object.get("width"sv);
|
||||
auto const& maybe_aspect = metadata_object.get("aspect"sv);
|
||||
auto const& maybe_width = metadata_object.get_deprecated("width"sv);
|
||||
auto const& maybe_aspect = metadata_object.get_deprecated("aspect"sv);
|
||||
|
||||
if (maybe_width.is_null() || !maybe_width.is_number() || maybe_aspect.is_null() || !maybe_aspect.is_string())
|
||||
return Error::from_string_view("Width or aspect in incorrect format"sv);
|
||||
|
|
|
@ -18,9 +18,9 @@ Slide::Slide(NonnullRefPtrVector<SlideObject> slide_objects, DeprecatedString ti
|
|||
ErrorOr<Slide> Slide::parse_slide(JsonObject const& slide_json)
|
||||
{
|
||||
// FIXME: Use the text with the "title" role for a title, if there is no title given.
|
||||
auto title = slide_json.get("title"sv).as_string_or("Untitled slide");
|
||||
auto title = slide_json.get_deprecated("title"sv).as_string_or("Untitled slide");
|
||||
|
||||
auto const& maybe_slide_objects = slide_json.get("objects"sv);
|
||||
auto const& maybe_slide_objects = slide_json.get_deprecated("objects"sv);
|
||||
if (!maybe_slide_objects.is_array())
|
||||
return Error::from_string_view("Slide objects must be an array"sv);
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ static DeprecatedString to_css_length(float design_value, Presentation const& pr
|
|||
|
||||
ErrorOr<NonnullRefPtr<SlideObject>> SlideObject::parse_slide_object(JsonObject const& slide_object_json)
|
||||
{
|
||||
auto const& maybe_type = slide_object_json.get("type"sv);
|
||||
auto const& maybe_type = slide_object_json.get_deprecated("type"sv);
|
||||
if (!maybe_type.is_string())
|
||||
return Error::from_string_view("Slide object must have a type"sv);
|
||||
|
||||
|
|
|
@ -46,8 +46,8 @@ static ErrorOr<void> fill_mounts(Vector<MountInfo>& output)
|
|||
TRY(json.as_array().try_for_each([&output](JsonValue const& value) -> ErrorOr<void> {
|
||||
auto& filesystem_object = value.as_object();
|
||||
MountInfo mount_info;
|
||||
mount_info.mount_point = filesystem_object.get("mount_point"sv).to_deprecated_string();
|
||||
mount_info.source = filesystem_object.get("source"sv).as_string_or("none"sv);
|
||||
mount_info.mount_point = filesystem_object.get_deprecated("mount_point"sv).to_deprecated_string();
|
||||
mount_info.source = filesystem_object.get_deprecated("source"sv).as_string_or("none"sv);
|
||||
TRY(output.try_append(mount_info));
|
||||
return {};
|
||||
}));
|
||||
|
|
|
@ -85,7 +85,7 @@ HelpWindow::HelpWindow(GUI::Window* parent)
|
|||
VERIFY(url.scheme() == "spreadsheet");
|
||||
if (url.host() == "example") {
|
||||
auto entry = LexicalPath::basename(url.path());
|
||||
auto doc_option = m_docs.get(entry);
|
||||
auto doc_option = m_docs.get_deprecated(entry);
|
||||
if (!doc_option.is_object()) {
|
||||
GUI::MessageBox::show_error(this, DeprecatedString::formatted("No documentation entry found for '{}'", url.path()));
|
||||
return;
|
||||
|
@ -104,7 +104,7 @@ HelpWindow::HelpWindow(GUI::Window* parent)
|
|||
GUI::MessageBox::show_error(this, DeprecatedString::formatted("Example '{}' not found for '{}'", name, url.path()));
|
||||
return;
|
||||
}
|
||||
auto& value = example_data.get(name);
|
||||
auto& value = example_data.get_deprecated(name);
|
||||
|
||||
auto window = GUI::Window::construct(this);
|
||||
window->resize(size());
|
||||
|
@ -141,14 +141,14 @@ HelpWindow::HelpWindow(GUI::Window* parent)
|
|||
DeprecatedString HelpWindow::render(StringView key)
|
||||
{
|
||||
VERIFY(m_docs.has_object(key));
|
||||
auto& doc = m_docs.get(key).as_object();
|
||||
auto& doc = m_docs.get_deprecated(key).as_object();
|
||||
|
||||
auto name = doc.get("name"sv).to_deprecated_string();
|
||||
auto argc = doc.get("argc"sv).to_u32(0);
|
||||
auto name = doc.get_deprecated("name"sv).to_deprecated_string();
|
||||
auto argc = doc.get_deprecated("argc"sv).to_u32(0);
|
||||
VERIFY(doc.has_array("argnames"sv));
|
||||
auto& argnames = doc.get("argnames"sv).as_array();
|
||||
auto& argnames = doc.get_deprecated("argnames"sv).as_array();
|
||||
|
||||
auto docstring = doc.get("doc"sv).to_deprecated_string();
|
||||
auto docstring = doc.get_deprecated("doc"sv).to_deprecated_string();
|
||||
|
||||
StringBuilder markdown_builder;
|
||||
|
||||
|
@ -181,7 +181,7 @@ DeprecatedString HelpWindow::render(StringView key)
|
|||
markdown_builder.append("\n\n"sv);
|
||||
|
||||
if (doc.has("examples"sv)) {
|
||||
auto& examples = doc.get("examples"sv);
|
||||
auto& examples = doc.get_deprecated("examples"sv);
|
||||
VERIFY(examples.is_object());
|
||||
markdown_builder.append("# EXAMPLES\n"sv);
|
||||
examples.as_object().for_each_member([&](auto& text, auto& description_value) {
|
||||
|
|
|
@ -375,9 +375,9 @@ Vector<CellChange> Sheet::copy_cells(Vector<Position> from, Vector<Position> to,
|
|||
RefPtr<Sheet> Sheet::from_json(JsonObject const& object, Workbook& workbook)
|
||||
{
|
||||
auto sheet = adopt_ref(*new Sheet(workbook));
|
||||
auto rows = object.get("rows"sv).to_u32(default_row_count);
|
||||
auto columns = object.get("columns"sv);
|
||||
auto name = object.get("name"sv).as_string_or("Sheet");
|
||||
auto rows = object.get_deprecated("rows"sv).to_u32(default_row_count);
|
||||
auto columns = object.get_deprecated("columns"sv);
|
||||
auto name = object.get_deprecated("name"sv).as_string_or("Sheet");
|
||||
if (object.has("cells"sv) && !object.has_object("cells"sv))
|
||||
return {};
|
||||
|
||||
|
@ -403,51 +403,51 @@ RefPtr<Sheet> Sheet::from_json(JsonObject const& object, Workbook& workbook)
|
|||
auto& parse_function = json.as_object().get_without_side_effects("parse").as_function();
|
||||
|
||||
auto read_format = [](auto& format, auto const& obj) {
|
||||
if (auto value = obj.get("foreground_color"sv); value.is_string())
|
||||
if (auto value = obj.get_deprecated("foreground_color"sv); value.is_string())
|
||||
format.foreground_color = Color::from_string(value.as_string());
|
||||
if (auto value = obj.get("background_color"sv); value.is_string())
|
||||
if (auto value = obj.get_deprecated("background_color"sv); value.is_string())
|
||||
format.background_color = Color::from_string(value.as_string());
|
||||
};
|
||||
|
||||
if (object.has_object("cells"sv)) {
|
||||
object.get("cells"sv).as_object().for_each_member([&](auto& name, JsonValue const& value) {
|
||||
object.get_deprecated("cells"sv).as_object().for_each_member([&](auto& name, JsonValue const& value) {
|
||||
auto position_option = sheet->parse_cell_name(name);
|
||||
if (!position_option.has_value())
|
||||
return IterationDecision::Continue;
|
||||
|
||||
auto position = position_option.value();
|
||||
auto& obj = value.as_object();
|
||||
auto kind = obj.get("kind"sv).as_string_or("LiteralString") == "LiteralString" ? Cell::LiteralString : Cell::Formula;
|
||||
auto kind = obj.get_deprecated("kind"sv).as_string_or("LiteralString") == "LiteralString" ? Cell::LiteralString : Cell::Formula;
|
||||
|
||||
OwnPtr<Cell> cell;
|
||||
switch (kind) {
|
||||
case Cell::LiteralString:
|
||||
cell = make<Cell>(obj.get("value"sv).to_deprecated_string(), position, *sheet);
|
||||
cell = make<Cell>(obj.get_deprecated("value"sv).to_deprecated_string(), position, *sheet);
|
||||
break;
|
||||
case Cell::Formula: {
|
||||
auto& vm = sheet->interpreter().vm();
|
||||
auto value_or_error = JS::call(vm, parse_function, json, JS::PrimitiveString::create(vm, obj.get("value"sv).as_string()));
|
||||
auto value_or_error = JS::call(vm, parse_function, json, JS::PrimitiveString::create(vm, obj.get_deprecated("value"sv).as_string()));
|
||||
if (value_or_error.is_error()) {
|
||||
warnln("Failed to load previous value for cell {}, leaving as undefined", position.to_cell_identifier(sheet));
|
||||
value_or_error = JS::js_undefined();
|
||||
}
|
||||
cell = make<Cell>(obj.get("source"sv).to_deprecated_string(), value_or_error.release_value(), position, *sheet);
|
||||
cell = make<Cell>(obj.get_deprecated("source"sv).to_deprecated_string(), value_or_error.release_value(), position, *sheet);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
auto type_name = obj.has("type"sv) ? obj.get("type"sv).to_deprecated_string() : "Numeric";
|
||||
auto type_name = obj.has("type"sv) ? obj.get_deprecated("type"sv).to_deprecated_string() : "Numeric";
|
||||
cell->set_type(type_name);
|
||||
|
||||
auto type_meta = obj.get("type_metadata"sv);
|
||||
auto type_meta = obj.get_deprecated("type_metadata"sv);
|
||||
if (type_meta.is_object()) {
|
||||
auto& meta_obj = type_meta.as_object();
|
||||
auto meta = cell->type_metadata();
|
||||
if (auto value = meta_obj.get("length"sv); value.is_number())
|
||||
if (auto value = meta_obj.get_deprecated("length"sv); value.is_number())
|
||||
meta.length = value.to_i32();
|
||||
if (auto value = meta_obj.get("format"sv); value.is_string())
|
||||
if (auto value = meta_obj.get_deprecated("format"sv); value.is_string())
|
||||
meta.format = value.as_string();
|
||||
if (auto value = meta_obj.get("alignment"sv); value.is_string()) {
|
||||
if (auto value = meta_obj.get_deprecated("alignment"sv); value.is_string()) {
|
||||
auto alignment = Gfx::text_alignment_from_string(value.as_string());
|
||||
if (alignment.has_value())
|
||||
meta.alignment = alignment.value();
|
||||
|
@ -457,7 +457,7 @@ RefPtr<Sheet> Sheet::from_json(JsonObject const& object, Workbook& workbook)
|
|||
cell->set_type_metadata(move(meta));
|
||||
}
|
||||
|
||||
auto conditional_formats = obj.get("conditional_formats"sv);
|
||||
auto conditional_formats = obj.get_deprecated("conditional_formats"sv);
|
||||
auto cformats = cell->conditional_formats();
|
||||
if (conditional_formats.is_array()) {
|
||||
conditional_formats.as_array().for_each([&](const auto& fmt_val) {
|
||||
|
@ -465,7 +465,7 @@ RefPtr<Sheet> Sheet::from_json(JsonObject const& object, Workbook& workbook)
|
|||
return IterationDecision::Continue;
|
||||
|
||||
auto& fmt_obj = fmt_val.as_object();
|
||||
auto fmt_cond = fmt_obj.get("condition"sv).to_deprecated_string();
|
||||
auto fmt_cond = fmt_obj.get_deprecated("condition"sv).to_deprecated_string();
|
||||
if (fmt_cond.is_empty())
|
||||
return IterationDecision::Continue;
|
||||
|
||||
|
@ -479,7 +479,7 @@ RefPtr<Sheet> Sheet::from_json(JsonObject const& object, Workbook& workbook)
|
|||
cell->set_conditional_formats(move(cformats));
|
||||
}
|
||||
|
||||
auto evaluated_format = obj.get("evaluated_formats"sv);
|
||||
auto evaluated_format = obj.get_deprecated("evaluated_formats"sv);
|
||||
if (evaluated_format.is_object()) {
|
||||
auto& evaluated_format_obj = evaluated_format.as_object();
|
||||
auto& evaluated_fmts = cell->evaluated_formats();
|
||||
|
@ -718,13 +718,13 @@ DeprecatedString Sheet::generate_inline_documentation_for(StringView function, s
|
|||
gather_documentation();
|
||||
|
||||
auto& docs = m_cached_documentation.value();
|
||||
auto entry = docs.get(function);
|
||||
auto entry = docs.get_deprecated(function);
|
||||
if (entry.is_null() || !entry.is_object())
|
||||
return DeprecatedString::formatted("{}(...???{})", function, argument_index);
|
||||
|
||||
auto& entry_object = entry.as_object();
|
||||
size_t argc = entry_object.get("argc"sv).to_int(0);
|
||||
auto argnames_value = entry_object.get("argnames"sv);
|
||||
size_t argc = entry_object.get_deprecated("argc"sv).to_int(0);
|
||||
auto argnames_value = entry_object.get_deprecated("argnames"sv);
|
||||
if (!argnames_value.is_array())
|
||||
return DeprecatedString::formatted("{}(...{}???{})", function, argc, argument_index);
|
||||
auto& argnames = argnames_value.as_array();
|
||||
|
|
|
@ -112,14 +112,14 @@ void MemoryStatsWidget::refresh()
|
|||
auto json_result = JsonValue::from_string(file_contents).release_value_but_fixme_should_propagate_errors();
|
||||
auto const& json = json_result.as_object();
|
||||
|
||||
u32 kmalloc_allocated = json.get("kmalloc_allocated"sv).to_u32();
|
||||
u32 kmalloc_available = json.get("kmalloc_available"sv).to_u32();
|
||||
u64 physical_allocated = json.get("physical_allocated"sv).to_u64();
|
||||
u64 physical_available = json.get("physical_available"sv).to_u64();
|
||||
u64 physical_committed = json.get("physical_committed"sv).to_u64();
|
||||
u64 physical_uncommitted = json.get("physical_uncommitted"sv).to_u64();
|
||||
u32 kmalloc_call_count = json.get("kmalloc_call_count"sv).to_u32();
|
||||
u32 kfree_call_count = json.get("kfree_call_count"sv).to_u32();
|
||||
u32 kmalloc_allocated = json.get_deprecated("kmalloc_allocated"sv).to_u32();
|
||||
u32 kmalloc_available = json.get_deprecated("kmalloc_available"sv).to_u32();
|
||||
u64 physical_allocated = json.get_deprecated("physical_allocated"sv).to_u64();
|
||||
u64 physical_available = json.get_deprecated("physical_available"sv).to_u64();
|
||||
u64 physical_committed = json.get_deprecated("physical_committed"sv).to_u64();
|
||||
u64 physical_uncommitted = json.get_deprecated("physical_uncommitted"sv).to_u64();
|
||||
u32 kmalloc_call_count = json.get_deprecated("kmalloc_call_count"sv).to_u32();
|
||||
u32 kfree_call_count = json.get_deprecated("kfree_call_count"sv).to_u32();
|
||||
|
||||
u64 kmalloc_bytes_total = kmalloc_allocated + kmalloc_available;
|
||||
u64 physical_pages_total = physical_allocated + physical_available;
|
||||
|
|
|
@ -47,25 +47,25 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
|
|||
Vector<GUI::JsonArrayModel::FieldSpec> net_adapters_fields;
|
||||
net_adapters_fields.empend("", Gfx::TextAlignment::CenterLeft,
|
||||
[this](JsonObject const& object) -> GUI::Variant {
|
||||
if (!object.get("link_up"sv).as_bool())
|
||||
if (!object.get_deprecated("link_up"sv).as_bool())
|
||||
return *m_network_link_down_bitmap;
|
||||
else
|
||||
return object.get("ipv4_address"sv).as_string_or(""sv).is_empty() ? *m_network_disconnected_bitmap : *m_network_connected_bitmap;
|
||||
return object.get_deprecated("ipv4_address"sv).as_string_or(""sv).is_empty() ? *m_network_disconnected_bitmap : *m_network_connected_bitmap;
|
||||
});
|
||||
net_adapters_fields.empend("name", "Name", Gfx::TextAlignment::CenterLeft);
|
||||
net_adapters_fields.empend("class_name", "Class", Gfx::TextAlignment::CenterLeft);
|
||||
net_adapters_fields.empend("mac_address", "MAC", Gfx::TextAlignment::CenterLeft);
|
||||
net_adapters_fields.empend("Link status", Gfx::TextAlignment::CenterLeft,
|
||||
[](JsonObject const& object) -> DeprecatedString {
|
||||
if (!object.get("link_up"sv).as_bool())
|
||||
if (!object.get_deprecated("link_up"sv).as_bool())
|
||||
return "Down";
|
||||
|
||||
return DeprecatedString::formatted("{} Mb/s {}-duplex", object.get("link_speed"sv).to_i32(),
|
||||
object.get("link_full_duplex"sv).as_bool() ? "full"sv : "half"sv);
|
||||
return DeprecatedString::formatted("{} Mb/s {}-duplex", object.get_deprecated("link_speed"sv).to_i32(),
|
||||
object.get_deprecated("link_full_duplex"sv).as_bool() ? "full"sv : "half"sv);
|
||||
});
|
||||
net_adapters_fields.empend("IPv4", Gfx::TextAlignment::CenterLeft,
|
||||
[](JsonObject const& object) -> DeprecatedString {
|
||||
return object.get("ipv4_address"sv).as_string_or(""sv);
|
||||
return object.get_deprecated("ipv4_address"sv).as_string_or(""sv);
|
||||
});
|
||||
net_adapters_fields.empend("packets_in", "Pkt In", Gfx::TextAlignment::CenterRight);
|
||||
net_adapters_fields.empend("packets_out", "Pkt Out", Gfx::TextAlignment::CenterRight);
|
||||
|
|
|
@ -27,19 +27,19 @@ ProcessFileDescriptorMapWidget::ProcessFileDescriptorMapWidget()
|
|||
pid_fds_fields.empend("offset", "Offset", Gfx::TextAlignment::CenterRight);
|
||||
pid_fds_fields.empend("absolute_path", "Path", Gfx::TextAlignment::CenterLeft);
|
||||
pid_fds_fields.empend("Access", Gfx::TextAlignment::CenterLeft, [](auto& object) {
|
||||
return object.get("seekable"sv).to_bool() ? "Seekable" : "Sequential";
|
||||
return object.get_deprecated("seekable"sv).to_bool() ? "Seekable" : "Sequential";
|
||||
});
|
||||
pid_fds_fields.empend("Blocking", Gfx::TextAlignment::CenterLeft, [](auto& object) {
|
||||
return object.get("blocking"sv).to_bool() ? "Blocking" : "Nonblocking";
|
||||
return object.get_deprecated("blocking"sv).to_bool() ? "Blocking" : "Nonblocking";
|
||||
});
|
||||
pid_fds_fields.empend("On exec", Gfx::TextAlignment::CenterLeft, [](auto& object) {
|
||||
return object.get("cloexec"sv).to_bool() ? "Close" : "Keep";
|
||||
return object.get_deprecated("cloexec"sv).to_bool() ? "Close" : "Keep";
|
||||
});
|
||||
pid_fds_fields.empend("Can read", Gfx::TextAlignment::CenterLeft, [](auto& object) {
|
||||
return object.get("can_read"sv).to_bool() ? "Yes" : "No";
|
||||
return object.get_deprecated("can_read"sv).to_bool() ? "Yes" : "No";
|
||||
});
|
||||
pid_fds_fields.empend("Can write", Gfx::TextAlignment::CenterLeft, [](auto& object) {
|
||||
return object.get("can_write"sv).to_bool() ? "Yes" : "No";
|
||||
return object.get_deprecated("can_write"sv).to_bool() ? "Yes" : "No";
|
||||
});
|
||||
|
||||
m_model = GUI::JsonArrayModel::create({}, move(pid_fds_fields));
|
||||
|
|
|
@ -57,35 +57,35 @@ ProcessMemoryMapWidget::ProcessMemoryMapWidget()
|
|||
Vector<GUI::JsonArrayModel::FieldSpec> pid_vm_fields;
|
||||
pid_vm_fields.empend(
|
||||
"Address", Gfx::TextAlignment::CenterLeft,
|
||||
[](auto& object) { return DeprecatedString::formatted("{:p}", object.get("address"sv).to_u64()); },
|
||||
[](auto& object) { return object.get("address"sv).to_u64(); });
|
||||
[](auto& object) { return DeprecatedString::formatted("{:p}", object.get_deprecated("address"sv).to_u64()); },
|
||||
[](auto& object) { return object.get_deprecated("address"sv).to_u64(); });
|
||||
pid_vm_fields.empend("size", "Size", Gfx::TextAlignment::CenterRight);
|
||||
pid_vm_fields.empend("amount_resident", "Resident", Gfx::TextAlignment::CenterRight);
|
||||
pid_vm_fields.empend("amount_dirty", "Dirty", Gfx::TextAlignment::CenterRight);
|
||||
pid_vm_fields.empend("Access", Gfx::TextAlignment::CenterLeft, [](auto& object) {
|
||||
StringBuilder builder;
|
||||
if (object.get("readable"sv).to_bool())
|
||||
if (object.get_deprecated("readable"sv).to_bool())
|
||||
builder.append('R');
|
||||
if (object.get("writable"sv).to_bool())
|
||||
if (object.get_deprecated("writable"sv).to_bool())
|
||||
builder.append('W');
|
||||
if (object.get("executable"sv).to_bool())
|
||||
if (object.get_deprecated("executable"sv).to_bool())
|
||||
builder.append('X');
|
||||
if (object.get("shared"sv).to_bool())
|
||||
if (object.get_deprecated("shared"sv).to_bool())
|
||||
builder.append('S');
|
||||
if (object.get("syscall"sv).to_bool())
|
||||
if (object.get_deprecated("syscall"sv).to_bool())
|
||||
builder.append('C');
|
||||
if (object.get("stack"sv).to_bool())
|
||||
if (object.get_deprecated("stack"sv).to_bool())
|
||||
builder.append('T');
|
||||
return builder.to_deprecated_string();
|
||||
});
|
||||
pid_vm_fields.empend("VMObject type", Gfx::TextAlignment::CenterLeft, [](auto& object) {
|
||||
auto type = object.get("vmobject"sv).to_deprecated_string();
|
||||
auto type = object.get_deprecated("vmobject"sv).to_deprecated_string();
|
||||
if (type.ends_with("VMObject"sv))
|
||||
type = type.substring(0, type.length() - 8);
|
||||
return type;
|
||||
});
|
||||
pid_vm_fields.empend("Purgeable", Gfx::TextAlignment::CenterLeft, [](auto& object) {
|
||||
if (object.get("volatile"sv).to_bool())
|
||||
if (object.get_deprecated("volatile"sv).to_bool())
|
||||
return "Volatile";
|
||||
return "Non-volatile";
|
||||
});
|
||||
|
@ -98,7 +98,7 @@ ProcessMemoryMapWidget::ProcessMemoryMapWidget()
|
|||
return GUI::Variant(0);
|
||||
},
|
||||
[](JsonObject const& object) {
|
||||
auto pagemap = object.get("pagemap"sv).as_string_or({});
|
||||
auto pagemap = object.get_deprecated("pagemap"sv).as_string_or({});
|
||||
return pagemap;
|
||||
});
|
||||
pid_vm_fields.empend("cow_pages", "# CoW", Gfx::TextAlignment::CenterRight);
|
||||
|
|
|
@ -39,7 +39,7 @@ ProcessModel::ProcessModel()
|
|||
auto cpuinfo_array = json.value().as_array();
|
||||
cpuinfo_array.for_each([&](auto& value) {
|
||||
auto& cpu_object = value.as_object();
|
||||
auto cpu_id = cpu_object.get("processor"sv).as_u32();
|
||||
auto cpu_id = cpu_object.get_deprecated("processor"sv).as_u32();
|
||||
m_cpus.append(make<CpuInfo>(cpu_id));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -130,18 +130,18 @@ public:
|
|||
[](const JsonObject& object) {
|
||||
StringBuilder size_builder;
|
||||
size_builder.append(' ');
|
||||
size_builder.append(human_readable_size(object.get("total_block_count"sv).to_u64() * object.get("block_size"sv).to_u64()));
|
||||
size_builder.append(human_readable_size(object.get_deprecated("total_block_count"sv).to_u64() * object.get_deprecated("block_size"sv).to_u64()));
|
||||
size_builder.append(' ');
|
||||
return size_builder.to_deprecated_string();
|
||||
},
|
||||
[](const JsonObject& object) {
|
||||
return object.get("total_block_count"sv).to_u64() * object.get("block_size"sv).to_u64();
|
||||
return object.get_deprecated("total_block_count"sv).to_u64() * object.get_deprecated("block_size"sv).to_u64();
|
||||
},
|
||||
[](const JsonObject& object) {
|
||||
auto total_blocks = object.get("total_block_count"sv).to_u64();
|
||||
auto total_blocks = object.get_deprecated("total_block_count"sv).to_u64();
|
||||
if (total_blocks == 0)
|
||||
return 0;
|
||||
auto free_blocks = object.get("free_block_count"sv).to_u64();
|
||||
auto free_blocks = object.get_deprecated("free_block_count"sv).to_u64();
|
||||
auto used_blocks = total_blocks - free_blocks;
|
||||
int percentage = (static_cast<double>(used_blocks) / static_cast<double>(total_blocks) * 100.0);
|
||||
return percentage;
|
||||
|
@ -149,31 +149,31 @@ public:
|
|||
df_fields.empend(
|
||||
"Used", Gfx::TextAlignment::CenterRight,
|
||||
[](const JsonObject& object) {
|
||||
auto total_blocks = object.get("total_block_count"sv).to_u64();
|
||||
auto free_blocks = object.get("free_block_count"sv).to_u64();
|
||||
auto total_blocks = object.get_deprecated("total_block_count"sv).to_u64();
|
||||
auto free_blocks = object.get_deprecated("free_block_count"sv).to_u64();
|
||||
auto used_blocks = total_blocks - free_blocks;
|
||||
return human_readable_size(used_blocks * object.get("block_size"sv).to_u64()); },
|
||||
return human_readable_size(used_blocks * object.get_deprecated("block_size"sv).to_u64()); },
|
||||
[](const JsonObject& object) {
|
||||
auto total_blocks = object.get("total_block_count"sv).to_u64();
|
||||
auto free_blocks = object.get("free_block_count"sv).to_u64();
|
||||
auto total_blocks = object.get_deprecated("total_block_count"sv).to_u64();
|
||||
auto free_blocks = object.get_deprecated("free_block_count"sv).to_u64();
|
||||
auto used_blocks = total_blocks - free_blocks;
|
||||
return used_blocks * object.get("block_size"sv).to_u64();
|
||||
return used_blocks * object.get_deprecated("block_size"sv).to_u64();
|
||||
});
|
||||
df_fields.empend(
|
||||
"Available", Gfx::TextAlignment::CenterRight,
|
||||
[](const JsonObject& object) {
|
||||
return human_readable_size(object.get("free_block_count"sv).to_u64() * object.get("block_size"sv).to_u64());
|
||||
return human_readable_size(object.get_deprecated("free_block_count"sv).to_u64() * object.get_deprecated("block_size"sv).to_u64());
|
||||
},
|
||||
[](const JsonObject& object) {
|
||||
return object.get("free_block_count"sv).to_u64() * object.get("block_size"sv).to_u64();
|
||||
return object.get_deprecated("free_block_count"sv).to_u64() * object.get_deprecated("block_size"sv).to_u64();
|
||||
});
|
||||
df_fields.empend("Access", Gfx::TextAlignment::CenterLeft, [](const JsonObject& object) {
|
||||
bool readonly = object.get("readonly"sv).to_bool();
|
||||
int mount_flags = object.get("mount_flags"sv).to_int();
|
||||
bool readonly = object.get_deprecated("readonly"sv).to_bool();
|
||||
int mount_flags = object.get_deprecated("mount_flags"sv).to_int();
|
||||
return readonly || (mount_flags & MS_RDONLY) ? "Read-only" : "Read/Write";
|
||||
});
|
||||
df_fields.empend("Mount flags", Gfx::TextAlignment::CenterLeft, [](const JsonObject& object) {
|
||||
int mount_flags = object.get("mount_flags"sv).to_int();
|
||||
int mount_flags = object.get_deprecated("mount_flags"sv).to_int();
|
||||
StringBuilder builder;
|
||||
bool first = true;
|
||||
auto check = [&](int flag, StringView name) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue