From b7558a5ce43c62efb357863f709d942daf9aa218 Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Sun, 14 May 2023 19:38:08 +0200 Subject: [PATCH] LibGUI+Userland: Store column names in JsonArrayModel as String --- .../Browser/BookmarksBarWidget.cpp | 4 +- .../BrowserSettings/BrowserSettingsWidget.cpp | 4 +- .../SystemMonitor/NetworkStatisticsWidget.cpp | 50 +++++++++---------- .../ProcessFileDescriptorMapWidget.cpp | 18 +++---- .../SystemMonitor/ProcessMemoryMapWidget.cpp | 20 ++++---- .../ProcessUnveiledPathsWidget.cpp | 4 +- Userland/Applications/SystemMonitor/main.cpp | 26 +++++----- Userland/DevTools/SQLStudio/MainWidget.cpp | 2 +- Userland/Libraries/LibGUI/JsonArrayModel.h | 8 +-- 9 files changed, 68 insertions(+), 68 deletions(-) diff --git a/Userland/Applications/Browser/BookmarksBarWidget.cpp b/Userland/Applications/Browser/BookmarksBarWidget.cpp index ebe83a57303..ec30449564b 100644 --- a/Userland/Applications/Browser/BookmarksBarWidget.cpp +++ b/Userland/Applications/Browser/BookmarksBarWidget.cpp @@ -165,8 +165,8 @@ BookmarksBarWidget::BookmarksBarWidget(DeprecatedString const& bookmarks_file, b this)); Vector fields; - fields.empend("title", "Title", Gfx::TextAlignment::CenterLeft); - fields.empend("url", "Url", Gfx::TextAlignment::CenterRight); + fields.empend("title", "Title"_short_string, Gfx::TextAlignment::CenterLeft); + fields.empend("url", "Url"_short_string, Gfx::TextAlignment::CenterRight); set_model(GUI::JsonArrayModel::create(bookmarks_file, move(fields))); model()->invalidate(); } diff --git a/Userland/Applications/BrowserSettings/BrowserSettingsWidget.cpp b/Userland/Applications/BrowserSettings/BrowserSettingsWidget.cpp index c058a079848..73a43167ddd 100644 --- a/Userland/Applications/BrowserSettings/BrowserSettingsWidget.cpp +++ b/Userland/Applications/BrowserSettings/BrowserSettingsWidget.cpp @@ -103,8 +103,8 @@ ErrorOr BrowserSettingsWidget::setup() }; Vector search_engine_fields; - search_engine_fields.empend("title", "Title", Gfx::TextAlignment::CenterLeft); - search_engine_fields.empend("url_format", "Url format", Gfx::TextAlignment::CenterLeft); + search_engine_fields.empend("title", "Title"_short_string, Gfx::TextAlignment::CenterLeft); + search_engine_fields.empend("url_format", TRY("Url format"_string), Gfx::TextAlignment::CenterLeft); auto search_engines_model = GUI::JsonArrayModel::create(DeprecatedString::formatted("{}/SearchEngines.json", Core::StandardPaths::config_directory()), move(search_engine_fields)); search_engines_model->invalidate(); Vector custom_search_engine; diff --git a/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp b/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp index 218c261c358..be4f56355a0 100644 --- a/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp +++ b/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp @@ -43,17 +43,17 @@ NetworkStatisticsWidget::NetworkStatisticsWidget() m_adapter_table_view = adapters_group_box.add(); Vector net_adapters_fields; - net_adapters_fields.empend("", Gfx::TextAlignment::CenterLeft, + net_adapters_fields.empend(String(), Gfx::TextAlignment::CenterLeft, [this](JsonObject const& object) -> GUI::Variant { if (!object.get_bool("link_up"sv).value_or(false)) return *m_network_link_down_bitmap; else return object.get_deprecated_string("ipv4_address"sv).value_or("").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, + net_adapters_fields.empend("name", "Name"_short_string, Gfx::TextAlignment::CenterLeft); + net_adapters_fields.empend("class_name", "Class"_short_string, Gfx::TextAlignment::CenterLeft); + net_adapters_fields.empend("mac_address", "MAC"_short_string, Gfx::TextAlignment::CenterLeft); + net_adapters_fields.empend("Link status"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterLeft, [](JsonObject const& object) -> DeprecatedString { if (!object.get_bool("link_up"sv).value_or(false)) return "Down"; @@ -61,14 +61,14 @@ NetworkStatisticsWidget::NetworkStatisticsWidget() return DeprecatedString::formatted("{} Mb/s {}-duplex", object.get_i32("link_speed"sv).value_or(0), object.get_bool("link_full_duplex"sv).value_or(false) ? "full"sv : "half"sv); }); - net_adapters_fields.empend("IPv4", Gfx::TextAlignment::CenterLeft, + net_adapters_fields.empend("IPv4"_short_string, Gfx::TextAlignment::CenterLeft, [](JsonObject const& object) -> DeprecatedString { return object.get_deprecated_string("ipv4_address"sv).value_or(""sv); }); - net_adapters_fields.empend("packets_in", "Pkt In", Gfx::TextAlignment::CenterRight); - net_adapters_fields.empend("packets_out", "Pkt Out", Gfx::TextAlignment::CenterRight); - net_adapters_fields.empend("bytes_in", "Bytes In", Gfx::TextAlignment::CenterRight); - net_adapters_fields.empend("bytes_out", "Bytes Out", Gfx::TextAlignment::CenterRight); + net_adapters_fields.empend("packets_in", "Pkt In"_short_string, Gfx::TextAlignment::CenterRight); + net_adapters_fields.empend("packets_out", "Pkt Out"_short_string, Gfx::TextAlignment::CenterRight); + net_adapters_fields.empend("bytes_in", "Bytes In"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterRight); + net_adapters_fields.empend("bytes_out", "Bytes Out"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterRight); m_adapter_model = GUI::JsonArrayModel::create("/sys/kernel/net/adapters", move(net_adapters_fields)); m_adapter_table_view->set_model(MUST(GUI::SortingProxyModel::create(*m_adapter_model))); m_adapter_context_menu = MUST(GUI::Menu::try_create()); @@ -97,17 +97,17 @@ NetworkStatisticsWidget::NetworkStatisticsWidget() m_tcp_socket_table_view = tcp_sockets_group_box.add(); Vector net_tcp_fields; - net_tcp_fields.empend("peer_address", "Peer", Gfx::TextAlignment::CenterLeft); - net_tcp_fields.empend("peer_port", "Port", Gfx::TextAlignment::CenterRight); - net_tcp_fields.empend("local_address", "Local", Gfx::TextAlignment::CenterLeft); - net_tcp_fields.empend("local_port", "Port", Gfx::TextAlignment::CenterRight); - net_tcp_fields.empend("state", "State", Gfx::TextAlignment::CenterLeft); - net_tcp_fields.empend("ack_number", "Ack#", Gfx::TextAlignment::CenterRight); - net_tcp_fields.empend("sequence_number", "Seq#", Gfx::TextAlignment::CenterRight); - net_tcp_fields.empend("packets_in", "Pkt In", Gfx::TextAlignment::CenterRight); - net_tcp_fields.empend("packets_out", "Pkt Out", Gfx::TextAlignment::CenterRight); - net_tcp_fields.empend("bytes_in", "Bytes In", Gfx::TextAlignment::CenterRight); - net_tcp_fields.empend("bytes_out", "Bytes Out", Gfx::TextAlignment::CenterRight); + net_tcp_fields.empend("peer_address", "Peer"_short_string, Gfx::TextAlignment::CenterLeft); + net_tcp_fields.empend("peer_port", "Port"_short_string, Gfx::TextAlignment::CenterRight); + net_tcp_fields.empend("local_address", "Local"_short_string, Gfx::TextAlignment::CenterLeft); + net_tcp_fields.empend("local_port", "Port"_short_string, Gfx::TextAlignment::CenterRight); + net_tcp_fields.empend("state", "State"_short_string, Gfx::TextAlignment::CenterLeft); + net_tcp_fields.empend("ack_number", "Ack#"_short_string, Gfx::TextAlignment::CenterRight); + net_tcp_fields.empend("sequence_number", "Seq#"_short_string, Gfx::TextAlignment::CenterRight); + net_tcp_fields.empend("packets_in", "Pkt In"_short_string, Gfx::TextAlignment::CenterRight); + net_tcp_fields.empend("packets_out", "Pkt Out"_short_string, Gfx::TextAlignment::CenterRight); + net_tcp_fields.empend("bytes_in", "Bytes In"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterRight); + net_tcp_fields.empend("bytes_out", "Bytes Out"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterRight); m_tcp_socket_model = GUI::JsonArrayModel::create("/sys/kernel/net/tcp", move(net_tcp_fields)); m_tcp_socket_table_view->set_model(MUST(GUI::SortingProxyModel::create(*m_tcp_socket_model))); @@ -117,10 +117,10 @@ NetworkStatisticsWidget::NetworkStatisticsWidget() m_udp_socket_table_view = udp_sockets_group_box.add(); Vector net_udp_fields; - net_udp_fields.empend("peer_address", "Peer", Gfx::TextAlignment::CenterLeft); - net_udp_fields.empend("peer_port", "Port", Gfx::TextAlignment::CenterRight); - net_udp_fields.empend("local_address", "Local", Gfx::TextAlignment::CenterLeft); - net_udp_fields.empend("local_port", "Port", Gfx::TextAlignment::CenterRight); + net_udp_fields.empend("peer_address", "Peer"_short_string, Gfx::TextAlignment::CenterLeft); + net_udp_fields.empend("peer_port", "Port"_short_string, Gfx::TextAlignment::CenterRight); + net_udp_fields.empend("local_address", "Local"_short_string, Gfx::TextAlignment::CenterLeft); + net_udp_fields.empend("local_port", "Port"_short_string, Gfx::TextAlignment::CenterRight); m_udp_socket_model = GUI::JsonArrayModel::create("/sys/kernel/net/udp", move(net_udp_fields)); m_udp_socket_table_view->set_model(MUST(GUI::SortingProxyModel::create(*m_udp_socket_model))); diff --git a/Userland/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp b/Userland/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp index c1a5db07c5e..83941126a2c 100644 --- a/Userland/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp +++ b/Userland/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp @@ -21,23 +21,23 @@ ProcessFileDescriptorMapWidget::ProcessFileDescriptorMapWidget() m_table_view = add(); Vector pid_fds_fields; - pid_fds_fields.empend("fd", "FD", Gfx::TextAlignment::CenterRight); - pid_fds_fields.empend("class", "Class", Gfx::TextAlignment::CenterLeft); - 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) { + pid_fds_fields.empend("fd", "FD"_short_string, Gfx::TextAlignment::CenterRight); + pid_fds_fields.empend("class", "Class"_short_string, Gfx::TextAlignment::CenterLeft); + pid_fds_fields.empend("offset", "Offset"_short_string, Gfx::TextAlignment::CenterRight); + pid_fds_fields.empend("absolute_path", "Path"_short_string, Gfx::TextAlignment::CenterLeft); + pid_fds_fields.empend("Access"_short_string, Gfx::TextAlignment::CenterLeft, [](auto& object) { return object.get_bool("seekable"sv).value_or(false) ? "Seekable" : "Sequential"; }); - pid_fds_fields.empend("Blocking", Gfx::TextAlignment::CenterLeft, [](auto& object) { + pid_fds_fields.empend("Blocking"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterLeft, [](auto& object) { return object.get_bool("blocking"sv).value_or(false) ? "Blocking" : "Nonblocking"; }); - pid_fds_fields.empend("On exec", Gfx::TextAlignment::CenterLeft, [](auto& object) { + pid_fds_fields.empend("On exec"_short_string, Gfx::TextAlignment::CenterLeft, [](auto& object) { return object.get_bool("cloexec"sv).value_or(false) ? "Close" : "Keep"; }); - pid_fds_fields.empend("Can read", Gfx::TextAlignment::CenterLeft, [](auto& object) { + pid_fds_fields.empend("Can read"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterLeft, [](auto& object) { return object.get_bool("can_read"sv).value_or(false) ? "Yes" : "No"; }); - pid_fds_fields.empend("Can write", Gfx::TextAlignment::CenterLeft, [](auto& object) { + pid_fds_fields.empend("Can write"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterLeft, [](auto& object) { return object.get_bool("can_write"sv).value_or(false) ? "Yes" : "No"; }); diff --git a/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp b/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp index 2feabf542c8..a669a0a2f12 100644 --- a/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp +++ b/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp @@ -55,13 +55,13 @@ ProcessMemoryMapWidget::ProcessMemoryMapWidget() m_table_view = add(); Vector pid_vm_fields; pid_vm_fields.empend( - "Address", Gfx::TextAlignment::CenterLeft, + "Address"_short_string, Gfx::TextAlignment::CenterLeft, [](auto& object) { return DeprecatedString::formatted("{:p}", object.get_u64("address"sv).value_or(0)); }, [](auto& object) { return object.get_u64("address"sv).value_or(0); }); - 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) { + pid_vm_fields.empend("size", "Size"_short_string, Gfx::TextAlignment::CenterRight); + pid_vm_fields.empend("amount_resident", "Resident"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterRight); + pid_vm_fields.empend("amount_dirty", "Dirty"_short_string, Gfx::TextAlignment::CenterRight); + pid_vm_fields.empend("Access"_short_string, Gfx::TextAlignment::CenterLeft, [](auto& object) { StringBuilder builder; if (object.get_bool("readable"sv).value_or(false)) builder.append('R'); @@ -77,19 +77,19 @@ ProcessMemoryMapWidget::ProcessMemoryMapWidget() builder.append('T'); return builder.to_deprecated_string(); }); - pid_vm_fields.empend("VMObject type", Gfx::TextAlignment::CenterLeft, [](auto& object) { + pid_vm_fields.empend("VMObject type"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterLeft, [](auto& object) { auto type = object.get_deprecated_string("vmobject"sv).value_or({}); 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) { + pid_vm_fields.empend("Purgeable"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterLeft, [](auto& object) { if (object.get_bool("volatile"sv).value_or(false)) return "Volatile"; return "Non-volatile"; }); pid_vm_fields.empend( - "Page map", Gfx::TextAlignment::CenterLeft, + "Page map"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterLeft, [](auto&) { return GUI::Variant(); }, @@ -100,8 +100,8 @@ ProcessMemoryMapWidget::ProcessMemoryMapWidget() auto pagemap = object.get_deprecated_string("pagemap"sv).value_or({}); return pagemap; }); - pid_vm_fields.empend("cow_pages", "# CoW", Gfx::TextAlignment::CenterRight); - pid_vm_fields.empend("name", "Name", Gfx::TextAlignment::CenterLeft); + pid_vm_fields.empend("cow_pages", "# CoW"_short_string, Gfx::TextAlignment::CenterRight); + pid_vm_fields.empend("name", "Name"_short_string, Gfx::TextAlignment::CenterLeft); m_json_model = GUI::JsonArrayModel::create({}, move(pid_vm_fields)); m_table_view->set_model(MUST(GUI::SortingProxyModel::create(*m_json_model))); diff --git a/Userland/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp b/Userland/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp index e064543976c..e6bf6a41e16 100644 --- a/Userland/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp +++ b/Userland/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp @@ -22,8 +22,8 @@ ProcessUnveiledPathsWidget::ProcessUnveiledPathsWidget() m_table_view = add(); Vector pid_unveil_fields; - pid_unveil_fields.empend("path", "Path", Gfx::TextAlignment::CenterLeft); - pid_unveil_fields.empend("permissions", "Permissions", Gfx::TextAlignment::CenterLeft); + pid_unveil_fields.empend("path", "Path"_short_string, Gfx::TextAlignment::CenterLeft); + pid_unveil_fields.empend("permissions", "Permissions"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterLeft); m_model = GUI::JsonArrayModel::create({}, move(pid_unveil_fields)); m_table_view->set_model(MUST(GUI::SortingProxyModel::create(*m_model))); diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp index b3fa16a137b..9875fbd9bd3 100644 --- a/Userland/Applications/SystemMonitor/main.cpp +++ b/Userland/Applications/SystemMonitor/main.cpp @@ -123,11 +123,11 @@ public: auto& fs_table_view = *self.find_child_of_type_named("storage_table"); Vector df_fields; - df_fields.empend("mount_point", "Mount point", Gfx::TextAlignment::CenterLeft); - df_fields.empend("class_name", "Class", Gfx::TextAlignment::CenterLeft); - df_fields.empend("source", "Source", Gfx::TextAlignment::CenterLeft); + df_fields.empend("mount_point", "Mount point"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterLeft); + df_fields.empend("class_name", "Class"_short_string, Gfx::TextAlignment::CenterLeft); + df_fields.empend("source", "Source"_short_string, Gfx::TextAlignment::CenterLeft); df_fields.empend( - "Size", Gfx::TextAlignment::CenterRight, + "Size"_short_string, Gfx::TextAlignment::CenterRight, [](JsonObject const& object) { StringBuilder size_builder; size_builder.append(' '); @@ -148,7 +148,7 @@ public: return percentage; }); df_fields.empend( - "Used", Gfx::TextAlignment::CenterRight, + "Used"_short_string, Gfx::TextAlignment::CenterRight, [](JsonObject const& object) { auto total_blocks = object.get_u64("total_block_count"sv).value_or(0); auto free_blocks = object.get_u64("free_block_count"sv).value_or(0); @@ -161,19 +161,19 @@ public: return used_blocks * object.get_u64("block_size"sv).value_or(0); }); df_fields.empend( - "Available", Gfx::TextAlignment::CenterRight, + "Available"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterRight, [](JsonObject const& object) { return human_readable_size(object.get_u64("free_block_count"sv).value_or(0) * object.get_u64("block_size"sv).value_or(0)); }, [](JsonObject const& object) { return object.get_u64("free_block_count"sv).value_or(0) * object.get_u64("block_size"sv).value_or(0); }); - df_fields.empend("Access", Gfx::TextAlignment::CenterLeft, [](JsonObject const& object) { + df_fields.empend("Access"_short_string, Gfx::TextAlignment::CenterLeft, [](JsonObject const& object) { bool readonly = object.get_bool("readonly"sv).value_or(false); int mount_flags = object.get_i32("mount_flags"sv).value_or(0); return readonly || (mount_flags & MS_RDONLY) ? "Read-only" : "Read/Write"; }); - df_fields.empend("Mount flags", Gfx::TextAlignment::CenterLeft, [](JsonObject const& object) { + df_fields.empend("Mount flags"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterLeft, [](JsonObject const& object) { int mount_flags = object.get_i32("mount_flags"sv).value_or(0); StringBuilder builder; bool first = true; @@ -197,11 +197,11 @@ public: return DeprecatedString("defaults"); return builder.to_deprecated_string(); }); - df_fields.empend("free_block_count", "Free blocks", Gfx::TextAlignment::CenterRight); - df_fields.empend("total_block_count", "Total blocks", Gfx::TextAlignment::CenterRight); - df_fields.empend("free_inode_count", "Free inodes", Gfx::TextAlignment::CenterRight); - df_fields.empend("total_inode_count", "Total inodes", Gfx::TextAlignment::CenterRight); - df_fields.empend("block_size", "Block size", Gfx::TextAlignment::CenterRight); + df_fields.empend("free_block_count", "Free blocks"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterRight); + df_fields.empend("total_block_count", "Total blocks"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterRight); + df_fields.empend("free_inode_count", "Free inodes"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterRight); + df_fields.empend("total_inode_count", "Total inodes"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterRight); + df_fields.empend("block_size", "Block size"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterRight); fs_table_view.set_model(MUST(GUI::SortingProxyModel::create(GUI::JsonArrayModel::create("/sys/kernel/df", move(df_fields))))); diff --git a/Userland/DevTools/SQLStudio/MainWidget.cpp b/Userland/DevTools/SQLStudio/MainWidget.cpp index d93d051bb27..a82f66bd213 100644 --- a/Userland/DevTools/SQLStudio/MainWidget.cpp +++ b/Userland/DevTools/SQLStudio/MainWidget.cpp @@ -286,7 +286,7 @@ ErrorOr MainWidget::setup() Vector query_result_fields; for (auto& column_name : m_result_column_names) - query_result_fields.empend(column_name, column_name, Gfx::TextAlignment::CenterLeft); + query_result_fields.empend(column_name, String::from_deprecated_string(column_name).release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterLeft); auto query_results_model = GUI::JsonArrayModel::create("{}", move(query_result_fields)); m_query_results_table_view->set_model(MUST(GUI::SortingProxyModel::create(*query_results_model))); diff --git a/Userland/Libraries/LibGUI/JsonArrayModel.h b/Userland/Libraries/LibGUI/JsonArrayModel.h index c34a802c005..1913da23b1c 100644 --- a/Userland/Libraries/LibGUI/JsonArrayModel.h +++ b/Userland/Libraries/LibGUI/JsonArrayModel.h @@ -16,7 +16,7 @@ namespace GUI { class JsonArrayModel final : public Model { public: struct FieldSpec { - FieldSpec(DeprecatedString const& a_column_name, Gfx::TextAlignment a_text_alignment, Function&& a_massage_for_display, Function&& a_massage_for_sort = {}, Function&& a_massage_for_custom = {}) + FieldSpec(String const& a_column_name, Gfx::TextAlignment a_text_alignment, Function&& a_massage_for_display, Function&& a_massage_for_sort = {}, Function&& a_massage_for_custom = {}) : column_name(a_column_name) , text_alignment(a_text_alignment) , massage_for_display(move(a_massage_for_display)) @@ -25,7 +25,7 @@ public: { } - FieldSpec(DeprecatedString const& a_json_field_name, DeprecatedString const& a_column_name, Gfx::TextAlignment a_text_alignment) + FieldSpec(DeprecatedString const& a_json_field_name, String const& a_column_name, Gfx::TextAlignment a_text_alignment) : json_field_name(a_json_field_name) , column_name(a_column_name) , text_alignment(a_text_alignment) @@ -33,7 +33,7 @@ public: } DeprecatedString json_field_name; - DeprecatedString column_name; + String column_name; Gfx::TextAlignment text_alignment; Function massage_for_display; Function massage_for_sort; @@ -49,7 +49,7 @@ public: virtual int row_count(ModelIndex const& = ModelIndex()) const override { return m_array.size(); } virtual int column_count(ModelIndex const& = ModelIndex()) const override { return m_fields.size(); } - virtual String column_name(int column) const override { return String::from_deprecated_string(m_fields[column].column_name).release_value_but_fixme_should_propagate_errors(); } + virtual String column_name(int column) const override { return m_fields[column].column_name; } virtual Variant data(ModelIndex const&, ModelRole = ModelRole::Display) const override; virtual void invalidate() override; virtual void update();