diff --git a/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp b/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp index b37a0ca72c..157b8add28 100644 --- a/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp +++ b/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp @@ -23,7 +23,7 @@ ClipboardHistoryModel::ClipboardHistoryModel() { } -String ClipboardHistoryModel::column_name(int column) const +ErrorOr ClipboardHistoryModel::column_name(int column) const { switch (column) { case Column::Data: diff --git a/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.h b/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.h index e7e45ea8fb..246d0e2bdc 100644 --- a/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.h +++ b/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.h @@ -60,7 +60,7 @@ private: // ^GUI::Model virtual int row_count(const GUI::ModelIndex&) const override { return m_history_items.size(); } - virtual String column_name(int) const override; + virtual ErrorOr column_name(int) const override; virtual int column_count(const GUI::ModelIndex&) const override { return Column::__Count; } // ^GUI::Clipboard::ClipboardClient diff --git a/Userland/Applications/Browser/CookiesModel.cpp b/Userland/Applications/Browser/CookiesModel.cpp index 3fbe1f8787..2dfabc6b94 100644 --- a/Userland/Applications/Browser/CookiesModel.cpp +++ b/Userland/Applications/Browser/CookiesModel.cpp @@ -34,7 +34,7 @@ int CookiesModel::row_count(GUI::ModelIndex const& index) const return 0; } -String CookiesModel::column_name(int column) const +ErrorOr CookiesModel::column_name(int column) const { switch (column) { case Column::Domain: @@ -46,14 +46,14 @@ String CookiesModel::column_name(int column) const case Column::Value: return "Value"_short_string; case Column::ExpiryTime: - return "Expiry time"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Expiry time"_string); case Column::SameSite: - return "SameSite"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("SameSite"_string); case Column::__Count: - return {}; + return String {}; } - return {}; + return String {}; } GUI::ModelIndex CookiesModel::index(int row, int column, GUI::ModelIndex const&) const diff --git a/Userland/Applications/Browser/CookiesModel.h b/Userland/Applications/Browser/CookiesModel.h index b34b0e9350..3df6ee03c0 100644 --- a/Userland/Applications/Browser/CookiesModel.h +++ b/Userland/Applications/Browser/CookiesModel.h @@ -30,7 +30,7 @@ public: void clear_items(); virtual int row_count(GUI::ModelIndex const&) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int column) const override; + virtual ErrorOr column_name(int) const override; virtual GUI::ModelIndex index(int row, int column = 0, GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual GUI::Variant data(GUI::ModelIndex const& index, GUI::ModelRole role = GUI::ModelRole::Display) const override; virtual GUI::Model::MatchResult data_matches(GUI::ModelIndex const& index, GUI::Variant const& term) const override; diff --git a/Userland/Applications/Browser/History/HistoryModel.cpp b/Userland/Applications/Browser/History/HistoryModel.cpp index 6fbee523e1..ec85b6cab5 100644 --- a/Userland/Applications/Browser/History/HistoryModel.cpp +++ b/Userland/Applications/Browser/History/HistoryModel.cpp @@ -34,7 +34,7 @@ int HistoryModel::row_count(GUI::ModelIndex const& index) const return 0; } -String HistoryModel::column_name(int column) const +ErrorOr HistoryModel::column_name(int column) const { switch (column) { case Column::Title: @@ -45,7 +45,7 @@ String HistoryModel::column_name(int column) const VERIFY_NOT_REACHED(); } - return {}; + return String {}; } GUI::ModelIndex HistoryModel::index(int row, int column, GUI::ModelIndex const&) const diff --git a/Userland/Applications/Browser/History/HistoryModel.h b/Userland/Applications/Browser/History/HistoryModel.h index 5b89da9ee3..1fc0ebf5dd 100644 --- a/Userland/Applications/Browser/History/HistoryModel.h +++ b/Userland/Applications/Browser/History/HistoryModel.h @@ -25,7 +25,7 @@ public: void clear_items(); virtual int row_count(GUI::ModelIndex const&) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int column) const override; + virtual ErrorOr column_name(int) const override; virtual GUI::ModelIndex index(int row, int column = 0, GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual GUI::Variant data(GUI::ModelIndex const& index, GUI::ModelRole role = GUI::ModelRole::Display) const override; virtual GUI::Model::MatchResult data_matches(GUI::ModelIndex const& index, GUI::Variant const& term) const override; diff --git a/Userland/Applications/Browser/StorageModel.cpp b/Userland/Applications/Browser/StorageModel.cpp index 879bee6baf..07eaeff654 100644 --- a/Userland/Applications/Browser/StorageModel.cpp +++ b/Userland/Applications/Browser/StorageModel.cpp @@ -35,7 +35,7 @@ int StorageModel::row_count(GUI::ModelIndex const& index) const return 0; } -String StorageModel::column_name(int column) const +ErrorOr StorageModel::column_name(int column) const { switch (column) { case Column::Key: @@ -43,10 +43,10 @@ String StorageModel::column_name(int column) const case Column::Value: return "Value"_short_string; case Column::__Count: - return {}; + return String {}; } - return {}; + return String {}; } GUI::ModelIndex StorageModel::index(int row, int column, GUI::ModelIndex const&) const diff --git a/Userland/Applications/Browser/StorageModel.h b/Userland/Applications/Browser/StorageModel.h index 92ed8bcf62..b081bc887d 100644 --- a/Userland/Applications/Browser/StorageModel.h +++ b/Userland/Applications/Browser/StorageModel.h @@ -22,7 +22,7 @@ public: void clear_items(); virtual int row_count(GUI::ModelIndex const&) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int column) const override; + virtual ErrorOr column_name(int) const override; virtual GUI::ModelIndex index(int row, int column = 0, GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual GUI::Variant data(GUI::ModelIndex const& index, GUI::ModelRole role = GUI::ModelRole::Display) const override; virtual GUI::Model::MatchResult data_matches(GUI::ModelIndex const& index, GUI::Variant const& term) const override; diff --git a/Userland/Applications/Calendar/AddEventDialog.cpp b/Userland/Applications/Calendar/AddEventDialog.cpp index 09ff89df3c..80f9e8e2dc 100644 --- a/Userland/Applications/Calendar/AddEventDialog.cpp +++ b/Userland/Applications/Calendar/AddEventDialog.cpp @@ -120,7 +120,7 @@ int AddEventDialog::MeridiemListModel::row_count(const GUI::ModelIndex&) const return 2; } -String AddEventDialog::MonthListModel::column_name(int column) const +ErrorOr AddEventDialog::MonthListModel::column_name(int column) const { switch (column) { case Column::Month: @@ -130,11 +130,11 @@ String AddEventDialog::MonthListModel::column_name(int column) const } } -String AddEventDialog::MeridiemListModel::column_name(int column) const +ErrorOr AddEventDialog::MeridiemListModel::column_name(int column) const { switch (column) { case Column::Meridiem: - return "Meridiem"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Meridiem"_string); default: VERIFY_NOT_REACHED(); } diff --git a/Userland/Applications/Calendar/AddEventDialog.h b/Userland/Applications/Calendar/AddEventDialog.h index 4f0aa162e8..5d7ad20de4 100644 --- a/Userland/Applications/Calendar/AddEventDialog.h +++ b/Userland/Applications/Calendar/AddEventDialog.h @@ -38,7 +38,7 @@ private: virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int) const override; + virtual ErrorOr column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; private: @@ -57,7 +57,7 @@ private: virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int) const override; + virtual ErrorOr column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; private: diff --git a/Userland/Applications/CertificateSettings/CertificateStoreWidget.cpp b/Userland/Applications/CertificateSettings/CertificateStoreWidget.cpp index d2fc3c215e..6d0cf87798 100644 --- a/Userland/Applications/CertificateSettings/CertificateStoreWidget.cpp +++ b/Userland/Applications/CertificateSettings/CertificateStoreWidget.cpp @@ -34,15 +34,15 @@ ErrorOr CertificateStoreModel::load() return {}; } -String CertificateStoreModel::column_name(int column) const +ErrorOr CertificateStoreModel::column_name(int column) const { switch (column) { case Column::IssuedTo: - return "Issued To"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Issued To"_string); case Column::IssuedBy: - return "Issued By"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Issued By"_string); case Column::Expire: - return "Expiration Date"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Expiration Date"_string); default: VERIFY_NOT_REACHED(); } diff --git a/Userland/Applications/CertificateSettings/CertificateStoreWidget.h b/Userland/Applications/CertificateSettings/CertificateStoreWidget.h index 107305fe68..cc9d02b3d8 100644 --- a/Userland/Applications/CertificateSettings/CertificateStoreWidget.h +++ b/Userland/Applications/CertificateSettings/CertificateStoreWidget.h @@ -44,7 +44,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return m_certificates.size(); } virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int) const override; + virtual ErrorOr column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual ErrorOr load(); virtual ErrorOr add(Vector const&); diff --git a/Userland/Applications/HexEditor/SearchResultsModel.h b/Userland/Applications/HexEditor/SearchResultsModel.h index 927459990b..ce4e39c86f 100644 --- a/Userland/Applications/HexEditor/SearchResultsModel.h +++ b/Userland/Applications/HexEditor/SearchResultsModel.h @@ -40,7 +40,7 @@ public: return 2; } - String column_name(int column) const override + ErrorOr column_name(int column) const override { switch (column) { case Column::Offset: diff --git a/Userland/Applications/HexEditor/ValueInspectorModel.h b/Userland/Applications/HexEditor/ValueInspectorModel.h index 79d931ada1..e8caf398d2 100644 --- a/Userland/Applications/HexEditor/ValueInspectorModel.h +++ b/Userland/Applications/HexEditor/ValueInspectorModel.h @@ -63,13 +63,13 @@ public: return 2; } - String column_name(int column) const override + ErrorOr column_name(int column) const override { switch (column) { case Column::Type: return "Type"_short_string; case Column::Value: - return m_is_little_endian ? "Value (Little Endian)"_string.release_value_but_fixme_should_propagate_errors() : "Value (Big Endian)"_string.release_value_but_fixme_should_propagate_errors(); + return m_is_little_endian ? TRY("Value (Little Endian)"_string) : TRY("Value (Big Endian)"_string); } VERIFY_NOT_REACHED(); } diff --git a/Userland/Applications/Mail/InboxModel.cpp b/Userland/Applications/Mail/InboxModel.cpp index 5eee5f0e1f..4519014ffd 100644 --- a/Userland/Applications/Mail/InboxModel.cpp +++ b/Userland/Applications/Mail/InboxModel.cpp @@ -17,7 +17,7 @@ int InboxModel::row_count(GUI::ModelIndex const&) const return m_entries.size(); } -String InboxModel::column_name(int column_index) const +ErrorOr InboxModel::column_name(int column_index) const { switch (column_index) { case Column::From: diff --git a/Userland/Applications/Mail/InboxModel.h b/Userland/Applications/Mail/InboxModel.h index ab63595130..19272c0dd9 100644 --- a/Userland/Applications/Mail/InboxModel.h +++ b/Userland/Applications/Mail/InboxModel.h @@ -32,7 +32,7 @@ public: virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int) const override; + virtual ErrorOr column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; private: diff --git a/Userland/Applications/MouseSettings/ThemeWidget.cpp b/Userland/Applications/MouseSettings/ThemeWidget.cpp index d71566cea7..815332eb4c 100644 --- a/Userland/Applications/MouseSettings/ThemeWidget.cpp +++ b/Userland/Applications/MouseSettings/ThemeWidget.cpp @@ -15,11 +15,11 @@ #include #include -String MouseCursorModel::column_name(int column_index) const +ErrorOr MouseCursorModel::column_name(int column_index) const { switch (column_index) { case Column::Bitmap: - return {}; + return String {}; case Column::Name: return "Name"_short_string; } diff --git a/Userland/Applications/MouseSettings/ThemeWidget.h b/Userland/Applications/MouseSettings/ThemeWidget.h index 07fda847be..2308745c7b 100644 --- a/Userland/Applications/MouseSettings/ThemeWidget.h +++ b/Userland/Applications/MouseSettings/ThemeWidget.h @@ -25,7 +25,7 @@ public: virtual int row_count(const GUI::ModelIndex&) const override { return m_cursors.size(); } virtual int column_count(const GUI::ModelIndex&) const override { return Column::__Count; } - virtual String column_name(int column_index) const override; + virtual ErrorOr column_name(int column_index) const override; virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override; virtual void invalidate() override; diff --git a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp index d419d52033..4bf3777b89 100644 --- a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp +++ b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp @@ -64,7 +64,7 @@ public: return Columns::Page; } - String column_name(int index) const override + ErrorOr column_name(int index) const override { switch (index) { case 0: diff --git a/Userland/Applications/PartitionEditor/PartitionModel.cpp b/Userland/Applications/PartitionEditor/PartitionModel.cpp index 4a059cc690..b69e24efee 100644 --- a/Userland/Applications/PartitionEditor/PartitionModel.cpp +++ b/Userland/Applications/PartitionEditor/PartitionModel.cpp @@ -17,17 +17,17 @@ NonnullRefPtr PartitionModel::create() return adopt_ref(*new PartitionModel); } -String PartitionModel::column_name(int column) const +ErrorOr PartitionModel::column_name(int column) const { switch (column) { case Column::Partition: - return "Partition"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Partition"_string); case Column::StartBlock: - return "Start Block"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Start Block"_string); case Column::EndBlock: - return "End Block"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("End Block"_string); case Column::TotalBlocks: - return "Total Blocks"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Total Blocks"_string); case Column::Size: return "Size"_short_string; default: diff --git a/Userland/Applications/PartitionEditor/PartitionModel.h b/Userland/Applications/PartitionEditor/PartitionModel.h index a66fff5f11..bc3a1febe4 100644 --- a/Userland/Applications/PartitionEditor/PartitionModel.h +++ b/Userland/Applications/PartitionEditor/PartitionModel.h @@ -28,7 +28,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return m_partition_table->partitions_count(); } virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int) const override; + virtual ErrorOr column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; ErrorOr set_device_path(DeprecatedString const&); diff --git a/Userland/Applications/SoundPlayer/PlaylistWidget.cpp b/Userland/Applications/SoundPlayer/PlaylistWidget.cpp index 61bd75e6e1..feaeda5672 100644 --- a/Userland/Applications/SoundPlayer/PlaylistWidget.cpp +++ b/Userland/Applications/SoundPlayer/PlaylistWidget.cpp @@ -73,13 +73,13 @@ DeprecatedString PlaylistModel::format_duration(u32 duration_in_seconds) return DeprecatedString::formatted("{:02}:{:02}:{:02}", duration_in_seconds / 3600, duration_in_seconds / 60, duration_in_seconds % 60); } -String PlaylistModel::column_name(int column) const +ErrorOr PlaylistModel::column_name(int column) const { switch (column) { case 0: return "Title"_short_string; case 1: - return "Duration"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Duration"_string); case 2: return "Group"_short_string; case 3: @@ -87,7 +87,7 @@ String PlaylistModel::column_name(int column) const case 4: return "Artist"_short_string; case 5: - return "Filesize"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Filesize"_string); } VERIFY_NOT_REACHED(); } diff --git a/Userland/Applications/SoundPlayer/PlaylistWidget.h b/Userland/Applications/SoundPlayer/PlaylistWidget.h index fcf67bbcd8..89c4ea0f0a 100644 --- a/Userland/Applications/SoundPlayer/PlaylistWidget.h +++ b/Userland/Applications/SoundPlayer/PlaylistWidget.h @@ -24,7 +24,7 @@ public: int row_count(const GUI::ModelIndex&) const override { return m_playlist_items.size(); } int column_count(const GUI::ModelIndex&) const override { return 6; } GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; - String column_name(int column) const override; + ErrorOr column_name(int column) const override; Vector& items() { return m_playlist_items; } private: diff --git a/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp b/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp index cad08a711e..aaf34daa0d 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp @@ -162,12 +162,12 @@ RefPtr SheetModel::mime_data(const GUI::ModelSelection& selectio return mime_data; } -String SheetModel::column_name(int index) const +ErrorOr SheetModel::column_name(int index) const { if (index < 0) - return {}; + return String {}; - return String::from_deprecated_string(m_sheet->column(index)).release_value_but_fixme_should_propagate_errors(); + return TRY(String::from_deprecated_string(m_sheet->column(index))); } bool SheetModel::is_editable(const GUI::ModelIndex& index) const diff --git a/Userland/Applications/Spreadsheet/SpreadsheetModel.h b/Userland/Applications/Spreadsheet/SpreadsheetModel.h index 15bd933ad7..9a876e23cc 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetModel.h +++ b/Userland/Applications/Spreadsheet/SpreadsheetModel.h @@ -23,7 +23,7 @@ public: virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return m_sheet->row_count(); } virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return m_sheet->column_count(); } - virtual String column_name(int) const override; + virtual ErrorOr column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; virtual RefPtr mime_data(const GUI::ModelSelection&) const override; virtual bool is_editable(const GUI::ModelIndex&) const override; diff --git a/Userland/Applications/SystemMonitor/ProcessModel.cpp b/Userland/Applications/SystemMonitor/ProcessModel.cpp index 37de9b02f2..28e247dd0a 100644 --- a/Userland/Applications/SystemMonitor/ProcessModel.cpp +++ b/Userland/Applications/SystemMonitor/ProcessModel.cpp @@ -71,11 +71,11 @@ int ProcessModel::column_count(GUI::ModelIndex const&) const return Column::__Count; } -String ProcessModel::column_name(int column) const +ErrorOr ProcessModel::column_name(int column) const { switch (column) { case Column::Icon: - return {}; + return String {}; case Column::PID: return "PID"_short_string; case Column::TID: @@ -95,7 +95,7 @@ String ProcessModel::column_name(int column) const case Column::Virtual: return "Virtual"_short_string; case Column::Physical: - return "Physical"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Physical"_string); case Column::DirtyPrivate: return "Private"_short_string; case Column::CleanInode: @@ -107,11 +107,11 @@ String ProcessModel::column_name(int column) const case Column::CPU: return "CPU"_short_string; case Column::Processor: - return "Processor"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Processor"_string); case Column::Name: return "Name"_short_string; case Column::Syscalls: - return "Syscalls"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Syscalls"_string); case Column::InodeFaults: return "F:Inode"_short_string; case Column::ZeroFaults: @@ -121,15 +121,15 @@ String ProcessModel::column_name(int column) const case Column::IPv4SocketReadBytes: return "IPv4 In"_short_string; case Column::IPv4SocketWriteBytes: - return "IPv4 Out"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("IPv4 Out"_string); case Column::UnixSocketReadBytes: return "Unix In"_short_string; case Column::UnixSocketWriteBytes: - return "Unix Out"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Unix Out"_string); case Column::FileReadBytes: return "File In"_short_string; case Column::FileWriteBytes: - return "File Out"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("File Out"_string); case Column::Pledge: return "Pledge"_short_string; case Column::Veil: diff --git a/Userland/Applications/SystemMonitor/ProcessModel.h b/Userland/Applications/SystemMonitor/ProcessModel.h index d26a63b5fd..973008cf69 100644 --- a/Userland/Applications/SystemMonitor/ProcessModel.h +++ b/Userland/Applications/SystemMonitor/ProcessModel.h @@ -63,7 +63,7 @@ public: virtual int tree_column() const override { return Column::Name; } virtual int row_count(GUI::ModelIndex const&) const override; virtual int column_count(GUI::ModelIndex const&) const override; - virtual String column_name(int column) const override; + virtual ErrorOr column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual GUI::ModelIndex index(int row, int column, GUI::ModelIndex const& parent = {}) const override; virtual GUI::ModelIndex parent_index(GUI::ModelIndex const&) const override; diff --git a/Userland/Applications/SystemMonitor/ProcessStateWidget.cpp b/Userland/Applications/SystemMonitor/ProcessStateWidget.cpp index 3ffe236a18..065ab41e6c 100644 --- a/Userland/Applications/SystemMonitor/ProcessStateWidget.cpp +++ b/Userland/Applications/SystemMonitor/ProcessStateWidget.cpp @@ -48,7 +48,7 @@ public: // NOTE: The icon column is nameless in ProcessModel, but we want it to have a name here. return "Icon"; } - return m_target.column_name(index.row()); + return m_target.column_name(index.row()).release_value_but_fixme_should_propagate_errors(); } return m_target_index.sibling_at_column(index.row()).data(); } diff --git a/Userland/Applications/SystemMonitor/ThreadStackWidget.cpp b/Userland/Applications/SystemMonitor/ThreadStackWidget.cpp index a1bc060df8..5be4316650 100644 --- a/Userland/Applications/SystemMonitor/ThreadStackWidget.cpp +++ b/Userland/Applications/SystemMonitor/ThreadStackWidget.cpp @@ -30,7 +30,7 @@ public: int row_count(GUI::ModelIndex const&) const override { return m_symbols.size(); }; bool is_column_sortable(int) const override { return false; } - String column_name(int column) const override + ErrorOr column_name(int column) const override { switch (column) { case Column::Address: diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp index 8fc3d2063a..4ecdb29171 100644 --- a/Userland/Applications/SystemMonitor/main.cpp +++ b/Userland/Applications/SystemMonitor/main.cpp @@ -303,7 +303,7 @@ ErrorOr serenity_main(Main::Arguments arguments) for (auto column = 0; column < ProcessModel::Column::__Count; ++column) { process_table_view.set_column_visible(column, - Config::read_bool("SystemMonitor"sv, "ProcessTableColumns"sv, process_model->column_name(column), + Config::read_bool("SystemMonitor"sv, "ProcessTableColumns"sv, TRY(process_model->column_name(column)), process_model->is_default_column(column))); } @@ -516,7 +516,7 @@ ErrorOr serenity_main(Main::Arguments arguments) // to be loaded the next time the application is opened. auto& process_table_header = process_table_view.column_header(); for (auto column = 0; column < ProcessModel::Column::__Count; ++column) - Config::write_bool("SystemMonitor"sv, "ProcessTableColumns"sv, process_model->column_name(column), process_table_header.is_section_visible(column)); + Config::write_bool("SystemMonitor"sv, "ProcessTableColumns"sv, TRY(process_model->column_name(column)), process_table_header.is_section_visible(column)); return exec; } diff --git a/Userland/Demos/ModelGallery/BasicModel.h b/Userland/Demos/ModelGallery/BasicModel.h index 9e7fd9b581..91aec97914 100644 --- a/Userland/Demos/ModelGallery/BasicModel.h +++ b/Userland/Demos/ModelGallery/BasicModel.h @@ -20,7 +20,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return m_items.size(); } virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return 1; } - virtual String column_name(int) const override { return "Item"_short_string; } + virtual ErrorOr column_name(int) const override { return "Item"_short_string; } virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole = GUI::ModelRole::Display) const override; virtual GUI::Model::MatchResult data_matches(GUI::ModelIndex const&, GUI::Variant const&) const override; diff --git a/Userland/Demos/WidgetGallery/GalleryModels.h b/Userland/Demos/WidgetGallery/GalleryModels.h index 166ae540e0..dafb3969de 100644 --- a/Userland/Demos/WidgetGallery/GalleryModels.h +++ b/Userland/Demos/WidgetGallery/GalleryModels.h @@ -27,11 +27,11 @@ public: virtual int row_count(const GUI::ModelIndex&) const override { return m_cursors.size(); } virtual int column_count(const GUI::ModelIndex&) const override { return Column::__Count; } - virtual String column_name(int column_index) const override + virtual ErrorOr column_name(int column_index) const override { switch (column_index) { case Column::Bitmap: - return {}; + return String {}; case Column::Name: return "Name"_short_string; } @@ -112,13 +112,13 @@ public: virtual int row_count(const GUI::ModelIndex&) const override { return m_icon_sets.size(); } virtual int column_count(const GUI::ModelIndex&) const override { return Column::__Count; } - virtual String column_name(int column_index) const override + virtual ErrorOr column_name(int column_index) const override { switch (column_index) { case Column::BigIcon: - return {}; + return String {}; case Column::LittleIcon: - return {}; + return String {}; case Column::Name: return "Name"_short_string; } diff --git a/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h b/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h index bde27ab71b..56e9b5e30d 100644 --- a/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h +++ b/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h @@ -27,7 +27,7 @@ public: virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return m_frames.size(); } virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return 1; } - virtual String column_name(int) const override { return {}; } + virtual ErrorOr column_name(int) const override { return String {}; } virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; diff --git a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp index 309e1b7b65..a67b4d93d7 100644 --- a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp +++ b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp @@ -73,18 +73,17 @@ int DisassemblyModel::row_count(const GUI::ModelIndex&) const return m_instructions.size(); } -String DisassemblyModel::column_name(int column) const +ErrorOr DisassemblyModel::column_name(int column) const { switch (column) { case Column::Address: return "Address"_short_string; case Column::InstructionBytes: - return "Insn Bytes"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Insn Bytes"_string); case Column::Disassembly: - return "Disassembly"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Disassembly"_string); default: VERIFY_NOT_REACHED(); - return {}; } } diff --git a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h index a4c867b3ba..33ee35777d 100644 --- a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h +++ b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h @@ -45,7 +45,7 @@ public: virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int) const override; + virtual ErrorOr column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; private: diff --git a/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp b/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp index 574fa54a67..d756848890 100644 --- a/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp +++ b/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp @@ -86,16 +86,15 @@ int RegistersModel::row_count(const GUI::ModelIndex&) const return m_registers.size(); } -String RegistersModel::column_name(int column) const +ErrorOr RegistersModel::column_name(int column) const { switch (column) { case Column::Register: - return "Register"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Register"_string); case Column::Value: return "Value"_short_string; default: VERIFY_NOT_REACHED(); - return {}; } } diff --git a/Userland/DevTools/HackStudio/Debugger/RegistersModel.h b/Userland/DevTools/HackStudio/Debugger/RegistersModel.h index c13621ded2..0d4505b2ea 100644 --- a/Userland/DevTools/HackStudio/Debugger/RegistersModel.h +++ b/Userland/DevTools/HackStudio/Debugger/RegistersModel.h @@ -41,7 +41,7 @@ public: virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int) const override; + virtual ErrorOr column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; PtraceRegisters const& raw_registers() const { return m_raw_registers; } diff --git a/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.cpp b/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.cpp index 3e38967d4e..9e69fa0498 100644 --- a/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.cpp +++ b/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.cpp @@ -53,7 +53,7 @@ int ProjectTemplatesModel::column_count(const GUI::ModelIndex&) const return Column::__Count; } -String ProjectTemplatesModel::column_name(int column) const +ErrorOr ProjectTemplatesModel::column_name(int column) const { switch (column) { case Column::Icon: diff --git a/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h b/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h index f52585953d..c897632f6a 100644 --- a/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h +++ b/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h @@ -35,7 +35,7 @@ public: virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; - virtual String column_name(int) const override; + virtual ErrorOr column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; void update(); diff --git a/Userland/DevTools/HackStudio/FindInFilesWidget.cpp b/Userland/DevTools/HackStudio/FindInFilesWidget.cpp index 97769c2783..77af7c784b 100644 --- a/Userland/DevTools/HackStudio/FindInFilesWidget.cpp +++ b/Userland/DevTools/HackStudio/FindInFilesWidget.cpp @@ -39,11 +39,11 @@ public: virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return m_matches.size(); } virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int column) const override + virtual ErrorOr column_name(int column) const override { switch (column) { case Column::Filename: - return "Filename"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Filename"_string); case Column::Location: return "#"_short_string; case Column::MatchedText: diff --git a/Userland/DevTools/HackStudio/Git/GitFilesModel.h b/Userland/DevTools/HackStudio/Git/GitFilesModel.h index 20719d3abd..98921f40d9 100644 --- a/Userland/DevTools/HackStudio/Git/GitFilesModel.h +++ b/Userland/DevTools/HackStudio/Git/GitFilesModel.h @@ -19,7 +19,7 @@ public: virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return m_files.size(); } virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return 1; } - virtual String column_name(int) const override { return {}; } + virtual ErrorOr column_name(int) const override { return String {}; } virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; diff --git a/Userland/DevTools/HackStudio/ToDoEntriesWidget.cpp b/Userland/DevTools/HackStudio/ToDoEntriesWidget.cpp index 466d6e69b2..6a4a381147 100644 --- a/Userland/DevTools/HackStudio/ToDoEntriesWidget.cpp +++ b/Userland/DevTools/HackStudio/ToDoEntriesWidget.cpp @@ -30,11 +30,11 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return m_matches.size(); } virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int column) const override + virtual ErrorOr column_name(int column) const override { switch (column) { case Column::Filename: - return "Filename"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Filename"_string); case Column::Text: return "Text"_short_string; case Column::Line: diff --git a/Userland/DevTools/Profiler/DisassemblyModel.cpp b/Userland/DevTools/Profiler/DisassemblyModel.cpp index d6211e0ba6..de88b3eee8 100644 --- a/Userland/DevTools/Profiler/DisassemblyModel.cpp +++ b/Userland/DevTools/Profiler/DisassemblyModel.cpp @@ -131,22 +131,21 @@ int DisassemblyModel::row_count(GUI::ModelIndex const&) const return m_instructions.size(); } -String DisassemblyModel::column_name(int column) const +ErrorOr DisassemblyModel::column_name(int column) const { switch (column) { case Column::SampleCount: - return m_profile.show_percentages() ? "% Samples"_string.release_value_but_fixme_should_propagate_errors() : "# Samples"_string.release_value_but_fixme_should_propagate_errors(); + return m_profile.show_percentages() ? TRY("% Samples"_string) : TRY("# Samples"_string); case Column::Address: return "Address"_short_string; case Column::InstructionBytes: - return "Insn Bytes"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Insn Bytes"_string); case Column::Disassembly: - return "Disassembly"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Disassembly"_string); case Column::SourceLocation: - return "Source Location"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Source Location"_string); default: VERIFY_NOT_REACHED(); - return {}; } } diff --git a/Userland/DevTools/Profiler/DisassemblyModel.h b/Userland/DevTools/Profiler/DisassemblyModel.h index cd3a6f47e8..1c301faeca 100644 --- a/Userland/DevTools/Profiler/DisassemblyModel.h +++ b/Userland/DevTools/Profiler/DisassemblyModel.h @@ -46,7 +46,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int) const override; + virtual ErrorOr column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual bool is_column_sortable(int) const override { return false; } diff --git a/Userland/DevTools/Profiler/FilesystemEventModel.cpp b/Userland/DevTools/Profiler/FilesystemEventModel.cpp index 4ab7c5ec05..3d6fefb035 100644 --- a/Userland/DevTools/Profiler/FilesystemEventModel.cpp +++ b/Userland/DevTools/Profiler/FilesystemEventModel.cpp @@ -142,18 +142,17 @@ int FileEventModel::column_count(GUI::ModelIndex const&) const return Column::__Count; } -String FileEventModel::column_name(int column) const +ErrorOr FileEventModel::column_name(int column) const { switch (column) { case Column::Path: return "Path"_short_string; case Column::Count: - return "Event Count"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Event Count"_string); case Column::Duration: - return "Duration [ms]"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Duration [ms]"_string); default: VERIFY_NOT_REACHED(); - return {}; } } diff --git a/Userland/DevTools/Profiler/FilesystemEventModel.h b/Userland/DevTools/Profiler/FilesystemEventModel.h index 27a75a4347..784484ecd6 100644 --- a/Userland/DevTools/Profiler/FilesystemEventModel.h +++ b/Userland/DevTools/Profiler/FilesystemEventModel.h @@ -74,7 +74,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; - virtual String column_name(int) const override; + virtual ErrorOr column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual GUI::ModelIndex index(int row, int column, GUI::ModelIndex const& parent = GUI::ModelIndex()) const override; virtual GUI::ModelIndex parent_index(GUI::ModelIndex const&) const override; diff --git a/Userland/DevTools/Profiler/IndividualSampleModel.cpp b/Userland/DevTools/Profiler/IndividualSampleModel.cpp index 9b56984f0a..b25a371d36 100644 --- a/Userland/DevTools/Profiler/IndividualSampleModel.cpp +++ b/Userland/DevTools/Profiler/IndividualSampleModel.cpp @@ -29,7 +29,7 @@ int IndividualSampleModel::column_count(GUI::ModelIndex const&) const return Column::__Count; } -String IndividualSampleModel::column_name(int column) const +ErrorOr IndividualSampleModel::column_name(int column) const { switch (column) { case Column::Address: diff --git a/Userland/DevTools/Profiler/IndividualSampleModel.h b/Userland/DevTools/Profiler/IndividualSampleModel.h index d499f62338..3b1102b06e 100644 --- a/Userland/DevTools/Profiler/IndividualSampleModel.h +++ b/Userland/DevTools/Profiler/IndividualSampleModel.h @@ -31,7 +31,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; - virtual String column_name(int) const override; + virtual ErrorOr column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; private: diff --git a/Userland/DevTools/Profiler/ProfileModel.cpp b/Userland/DevTools/Profiler/ProfileModel.cpp index 9c98a9d6b8..b1198b8ec1 100644 --- a/Userland/DevTools/Profiler/ProfileModel.cpp +++ b/Userland/DevTools/Profiler/ProfileModel.cpp @@ -74,22 +74,21 @@ int ProfileModel::column_count(GUI::ModelIndex const&) const return Column::__Count; } -String ProfileModel::column_name(int column) const +ErrorOr ProfileModel::column_name(int column) const { switch (column) { case Column::SampleCount: - return m_profile.show_percentages() ? "% Samples"_string.release_value_but_fixme_should_propagate_errors() : "# Samples"_string.release_value_but_fixme_should_propagate_errors(); + return m_profile.show_percentages() ? TRY("% Samples"_string) : TRY("# Samples"_string); case Column::SelfCount: return m_profile.show_percentages() ? "% Self"_short_string : "# Self"_short_string; case Column::ObjectName: return "Object"_short_string; case Column::StackFrame: - return "Stack Frame"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Stack Frame"_string); case Column::SymbolAddress: - return "Symbol Address"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Symbol Address"_string); default: VERIFY_NOT_REACHED(); - return {}; } } diff --git a/Userland/DevTools/Profiler/ProfileModel.h b/Userland/DevTools/Profiler/ProfileModel.h index 6b05de1ca9..e94a03e8b8 100644 --- a/Userland/DevTools/Profiler/ProfileModel.h +++ b/Userland/DevTools/Profiler/ProfileModel.h @@ -34,7 +34,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; - virtual String column_name(int) const override; + virtual ErrorOr column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual GUI::ModelIndex index(int row, int column, GUI::ModelIndex const& parent = GUI::ModelIndex()) const override; virtual GUI::ModelIndex parent_index(GUI::ModelIndex const&) const override; diff --git a/Userland/DevTools/Profiler/SamplesModel.cpp b/Userland/DevTools/Profiler/SamplesModel.cpp index 5a44a38f2d..5e33a20555 100644 --- a/Userland/DevTools/Profiler/SamplesModel.cpp +++ b/Userland/DevTools/Profiler/SamplesModel.cpp @@ -28,23 +28,23 @@ int SamplesModel::column_count(GUI::ModelIndex const&) const return Column::__Count; } -String SamplesModel::column_name(int column) const +ErrorOr SamplesModel::column_name(int column) const { switch (column) { case Column::SampleIndex: return "#"_short_string; case Column::Timestamp: - return "Timestamp"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Timestamp"_string); case Column::ProcessID: return "PID"_short_string; case Column::ThreadID: return "TID"_short_string; case Column::ExecutableName: - return "Executable"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Executable"_string); case Column::LostSamples: - return "Lost Samples"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Lost Samples"_string); case Column::InnermostStackFrame: - return "Innermost Frame"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Innermost Frame"_string); case Column::Path: return "Path"_short_string; default: diff --git a/Userland/DevTools/Profiler/SamplesModel.h b/Userland/DevTools/Profiler/SamplesModel.h index 144307b5bf..fe91f7d8cf 100644 --- a/Userland/DevTools/Profiler/SamplesModel.h +++ b/Userland/DevTools/Profiler/SamplesModel.h @@ -36,7 +36,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; - virtual String column_name(int) const override; + virtual ErrorOr column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual bool is_column_sortable(int) const override { return false; } diff --git a/Userland/DevTools/Profiler/SignpostsModel.cpp b/Userland/DevTools/Profiler/SignpostsModel.cpp index 2f54720b9c..896227d8a0 100644 --- a/Userland/DevTools/Profiler/SignpostsModel.cpp +++ b/Userland/DevTools/Profiler/SignpostsModel.cpp @@ -26,23 +26,23 @@ int SignpostsModel::column_count(GUI::ModelIndex const&) const return Column::__Count; } -String SignpostsModel::column_name(int column) const +ErrorOr SignpostsModel::column_name(int column) const { switch (column) { case Column::SignpostIndex: return "#"_short_string; case Column::Timestamp: - return "Timestamp"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Timestamp"_string); case Column::ProcessID: return "PID"_short_string; case Column::ThreadID: return "TID"_short_string; case Column::ExecutableName: - return "Executable"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Executable"_string); case Column::SignpostString: return "String"_short_string; case Column::SignpostArgument: - return "Argument"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Argument"_string); default: VERIFY_NOT_REACHED(); } diff --git a/Userland/DevTools/Profiler/SignpostsModel.h b/Userland/DevTools/Profiler/SignpostsModel.h index f227f3a952..8f7b5871e9 100644 --- a/Userland/DevTools/Profiler/SignpostsModel.h +++ b/Userland/DevTools/Profiler/SignpostsModel.h @@ -35,7 +35,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; - virtual String column_name(int) const override; + virtual ErrorOr column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual bool is_column_sortable(int) const override { return false; } diff --git a/Userland/DevTools/Profiler/SourceModel.cpp b/Userland/DevTools/Profiler/SourceModel.cpp index 90797d1eb7..9cda3c952c 100644 --- a/Userland/DevTools/Profiler/SourceModel.cpp +++ b/Userland/DevTools/Profiler/SourceModel.cpp @@ -122,20 +122,19 @@ int SourceModel::row_count(GUI::ModelIndex const&) const return m_source_lines.size(); } -String SourceModel::column_name(int column) const +ErrorOr SourceModel::column_name(int column) const { switch (column) { case Column::SampleCount: - return m_profile.show_percentages() ? "% Samples"_string.release_value_but_fixme_should_propagate_errors() : "# Samples"_string.release_value_but_fixme_should_propagate_errors(); + return m_profile.show_percentages() ? TRY("% Samples"_string) : TRY("# Samples"_string); case Column::SourceCode: - return "Source Code"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Source Code"_string); case Column::Location: - return "Location"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Location"_string); case Column::LineNumber: return "Line"_short_string; default: VERIFY_NOT_REACHED(); - return {}; } } diff --git a/Userland/DevTools/Profiler/SourceModel.h b/Userland/DevTools/Profiler/SourceModel.h index 0dded94fc3..af85480a4a 100644 --- a/Userland/DevTools/Profiler/SourceModel.h +++ b/Userland/DevTools/Profiler/SourceModel.h @@ -38,7 +38,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int) const override; + virtual ErrorOr column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual bool is_column_sortable(int) const override { return false; } diff --git a/Userland/Libraries/LibGUI/AbstractTableView.cpp b/Userland/Libraries/LibGUI/AbstractTableView.cpp index 2c73e23492..8e00f6a32d 100644 --- a/Userland/Libraries/LibGUI/AbstractTableView.cpp +++ b/Userland/Libraries/LibGUI/AbstractTableView.cpp @@ -58,7 +58,7 @@ void AbstractTableView::auto_resize_column(int column) auto& model = *this->model(); int row_count = model.row_count(); - int header_width = m_column_header->font().width(model.column_name(column)); + int header_width = m_column_header->font().width(model.column_name(column).release_value_but_fixme_should_propagate_errors()); if (column == m_key_column && model.is_column_sortable(column)) header_width += HeaderView::sorting_arrow_width + HeaderView::sorting_arrow_offset; @@ -97,7 +97,7 @@ void AbstractTableView::update_column_sizes() for (int column = 0; column < column_count; ++column) { if (!column_header().is_section_visible(column)) continue; - int header_width = m_column_header->font().width(model.column_name(column)); + int header_width = m_column_header->font().width(model.column_name(column).release_value_but_fixme_should_propagate_errors()); if (column == m_key_column && model.is_column_sortable(column)) header_width += HeaderView::sorting_arrow_width + HeaderView::sorting_arrow_offset; int column_width = header_width; diff --git a/Userland/Libraries/LibGUI/CommandPalette.cpp b/Userland/Libraries/LibGUI/CommandPalette.cpp index 2159835161..f1902f1552 100644 --- a/Userland/Libraries/LibGUI/CommandPalette.cpp +++ b/Userland/Libraries/LibGUI/CommandPalette.cpp @@ -92,7 +92,7 @@ public: return Column::__Count; } - virtual String column_name(int) const override { return {}; } + virtual ErrorOr column_name(int) const override { return String {}; } virtual ModelIndex index(int row, int column = 0, ModelIndex const& = ModelIndex()) const override { diff --git a/Userland/Libraries/LibGUI/FileSystemModel.cpp b/Userland/Libraries/LibGUI/FileSystemModel.cpp index 425c9c7ad6..4875e7cb4e 100644 --- a/Userland/Libraries/LibGUI/FileSystemModel.cpp +++ b/Userland/Libraries/LibGUI/FileSystemModel.cpp @@ -761,11 +761,11 @@ int FileSystemModel::column_count(ModelIndex const&) const return Column::__Count; } -String FileSystemModel::column_name(int column) const +ErrorOr FileSystemModel::column_name(int column) const { switch (column) { case Column::Icon: - return {}; + return String {}; case Column::Name: return "Name"_short_string; case Column::Size: @@ -777,11 +777,11 @@ String FileSystemModel::column_name(int column) const case Column::Permissions: return "Mode"_short_string; case Column::ModificationTime: - return "Modified"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Modified"_string); case Column::Inode: return "Inode"_short_string; case Column::SymlinkTarget: - return "Symlink target"_string.release_value_but_fixme_should_propagate_errors(); + return TRY("Symlink target"_string); } VERIFY_NOT_REACHED(); } diff --git a/Userland/Libraries/LibGUI/FileSystemModel.h b/Userland/Libraries/LibGUI/FileSystemModel.h index fa2250a3cd..fa9535ac51 100644 --- a/Userland/Libraries/LibGUI/FileSystemModel.h +++ b/Userland/Libraries/LibGUI/FileSystemModel.h @@ -127,7 +127,7 @@ public: virtual int tree_column() const override { return Column::Name; } virtual int row_count(ModelIndex const& = ModelIndex()) const override; virtual int column_count(ModelIndex const& = ModelIndex()) const override; - virtual String column_name(int column) const override; + virtual ErrorOr column_name(int) const override; 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; diff --git a/Userland/Libraries/LibGUI/FilteringProxyModel.cpp b/Userland/Libraries/LibGUI/FilteringProxyModel.cpp index e8097c5a3c..65f515df7e 100644 --- a/Userland/Libraries/LibGUI/FilteringProxyModel.cpp +++ b/Userland/Libraries/LibGUI/FilteringProxyModel.cpp @@ -34,7 +34,7 @@ int FilteringProxyModel::column_count(ModelIndex const& index) const return m_model->column_count(m_matching_indices[index.row()].index); } -String FilteringProxyModel::column_name(int column) const +ErrorOr FilteringProxyModel::column_name(int column) const { return m_model->column_name(column); } diff --git a/Userland/Libraries/LibGUI/FilteringProxyModel.h b/Userland/Libraries/LibGUI/FilteringProxyModel.h index 8c01b1aacd..4506aa6cd5 100644 --- a/Userland/Libraries/LibGUI/FilteringProxyModel.h +++ b/Userland/Libraries/LibGUI/FilteringProxyModel.h @@ -35,7 +35,7 @@ public: virtual int row_count(ModelIndex const& = ModelIndex()) const override; virtual int column_count(ModelIndex const& = ModelIndex()) const override; - virtual String column_name(int) const override; + virtual ErrorOr column_name(int) const override; virtual Variant data(ModelIndex const&, ModelRole = ModelRole::Display) const override; virtual void invalidate() override; virtual ModelIndex index(int row, int column = 0, ModelIndex const& parent = ModelIndex()) const override; diff --git a/Userland/Libraries/LibGUI/HeaderView.cpp b/Userland/Libraries/LibGUI/HeaderView.cpp index 834cb76da3..c6ff384136 100644 --- a/Userland/Libraries/LibGUI/HeaderView.cpp +++ b/Userland/Libraries/LibGUI/HeaderView.cpp @@ -265,7 +265,7 @@ void HeaderView::paint_horizontal(Painter& painter) bool hovered = section == m_hovered_section && model()->is_column_sortable(section); Gfx::StylePainter::paint_button(painter, cell_rect, palette(), Gfx::ButtonStyle::Normal, pressed, hovered); - auto text = model()->column_name(section); + auto text = model()->column_name(section).release_value_but_fixme_should_propagate_errors(); auto text_rect = cell_rect.shrunken(m_table_view.horizontal_padding() * 2, 0); if (pressed) text_rect.translate_by(1, 1); @@ -358,7 +358,7 @@ Menu& HeaderView::ensure_context_menu() int section_count = this->section_count(); for (int section = 0; section < section_count; ++section) { auto& column_data = this->section_data(section); - auto name = model()->column_name(section).to_deprecated_string(); + auto name = model()->column_name(section).release_value_but_fixme_should_propagate_errors().to_deprecated_string(); column_data.visibility_action = Action::create_checkable(name, [this, section](auto& action) { set_section_visible(section, action.is_checked()); }); diff --git a/Userland/Libraries/LibGUI/ItemListModel.h b/Userland/Libraries/LibGUI/ItemListModel.h index db6b24c968..ef49320e74 100644 --- a/Userland/Libraries/LibGUI/ItemListModel.h +++ b/Userland/Libraries/LibGUI/ItemListModel.h @@ -71,7 +71,7 @@ public: return 1; } - virtual String column_name(int index) const override + virtual ErrorOr column_name(int index) const override { if constexpr (IsTwoDimensional) return m_column_names[index]; diff --git a/Userland/Libraries/LibGUI/JsonArrayModel.h b/Userland/Libraries/LibGUI/JsonArrayModel.h index 1913da23b1..922a6e2c95 100644 --- a/Userland/Libraries/LibGUI/JsonArrayModel.h +++ b/Userland/Libraries/LibGUI/JsonArrayModel.h @@ -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 m_fields[column].column_name; } + virtual ErrorOr 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(); diff --git a/Userland/Libraries/LibGUI/Model.h b/Userland/Libraries/LibGUI/Model.h index fcf86035bc..a2f038e74c 100644 --- a/Userland/Libraries/LibGUI/Model.h +++ b/Userland/Libraries/LibGUI/Model.h @@ -71,7 +71,7 @@ public: virtual int row_count(ModelIndex const& = ModelIndex()) const = 0; virtual int column_count(ModelIndex const& = ModelIndex()) const = 0; - virtual String column_name(int) const { return {}; } + virtual ErrorOr column_name(int) const { return String {}; } virtual Variant data(ModelIndex const&, ModelRole = ModelRole::Display) const = 0; virtual MatchResult data_matches(ModelIndex const&, Variant const&) const { return {}; } virtual void invalidate(); diff --git a/Userland/Libraries/LibGUI/RunningProcessesModel.cpp b/Userland/Libraries/LibGUI/RunningProcessesModel.cpp index 8df445bea9..6c3f15227f 100644 --- a/Userland/Libraries/LibGUI/RunningProcessesModel.cpp +++ b/Userland/Libraries/LibGUI/RunningProcessesModel.cpp @@ -45,11 +45,11 @@ int RunningProcessesModel::column_count(const GUI::ModelIndex&) const return Column::__Count; } -String RunningProcessesModel::column_name(int column_index) const +ErrorOr RunningProcessesModel::column_name(int column_index) const { switch (column_index) { case Column::Icon: - return {}; + return String {}; case Column::PID: return "PID"_short_string; case Column::UID: diff --git a/Userland/Libraries/LibGUI/RunningProcessesModel.h b/Userland/Libraries/LibGUI/RunningProcessesModel.h index 5f0ed6d08a..7a0343c403 100644 --- a/Userland/Libraries/LibGUI/RunningProcessesModel.h +++ b/Userland/Libraries/LibGUI/RunningProcessesModel.h @@ -27,7 +27,7 @@ public: virtual int row_count(const GUI::ModelIndex&) const override; virtual int column_count(const GUI::ModelIndex&) const override; - virtual String column_name(int column_index) const override; + virtual ErrorOr column_name(int column_index) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; void update(); diff --git a/Userland/Libraries/LibGUI/SortingProxyModel.cpp b/Userland/Libraries/LibGUI/SortingProxyModel.cpp index 37c8509eff..6357a16552 100644 --- a/Userland/Libraries/LibGUI/SortingProxyModel.cpp +++ b/Userland/Libraries/LibGUI/SortingProxyModel.cpp @@ -106,7 +106,7 @@ ModelIndex SortingProxyModel::map_to_proxy(ModelIndex const& source_index) const return create_index(proxy_row, proxy_column, &mapping); } -String SortingProxyModel::column_name(int column) const +ErrorOr SortingProxyModel::column_name(int column) const { return source().column_name(column); } diff --git a/Userland/Libraries/LibGUI/SortingProxyModel.h b/Userland/Libraries/LibGUI/SortingProxyModel.h index 84627704f0..84a3a35b9f 100644 --- a/Userland/Libraries/LibGUI/SortingProxyModel.h +++ b/Userland/Libraries/LibGUI/SortingProxyModel.h @@ -24,7 +24,7 @@ public: virtual int tree_column() const override { return m_source->tree_column(); } virtual int row_count(ModelIndex const& = ModelIndex()) const override; virtual int column_count(ModelIndex const& = ModelIndex()) const override; - virtual String column_name(int) const override; + virtual ErrorOr column_name(int) const override; virtual Variant data(ModelIndex const&, ModelRole = ModelRole::Display) const override; virtual void invalidate() override; virtual StringView drag_data_type() const override; diff --git a/Userland/Libraries/LibGUI/TreeView.cpp b/Userland/Libraries/LibGUI/TreeView.cpp index 7407cd29b9..3e2b2746d6 100644 --- a/Userland/Libraries/LibGUI/TreeView.cpp +++ b/Userland/Libraries/LibGUI/TreeView.cpp @@ -673,7 +673,7 @@ void TreeView::auto_resize_column(int column) auto& model = *this->model(); - int header_width = column_header().font().width(model.column_name(column)); + int header_width = column_header().font().width(model.column_name(column).release_value_but_fixme_should_propagate_errors()); if (column == m_key_column && model.is_column_sortable(column)) header_width += HeaderView::sorting_arrow_width + HeaderView::sorting_arrow_offset; int column_width = header_width; @@ -718,7 +718,7 @@ void TreeView::update_column_sizes() continue; if (!column_header().is_section_visible(column)) continue; - int header_width = column_header().font().width(model.column_name(column)); + int header_width = column_header().font().width(model.column_name(column).release_value_but_fixme_should_propagate_errors()); if (column == m_key_column && model.is_column_sortable(column)) header_width += HeaderView::sorting_arrow_width + HeaderView::sorting_arrow_offset; int column_width = header_width; @@ -739,7 +739,7 @@ void TreeView::update_column_sizes() set_column_width(column, max(this->column_width(column), column_width)); } - int tree_column_header_width = column_header().font().width(model.column_name(tree_column)); + int tree_column_header_width = column_header().font().width(model.column_name(tree_column).release_value_but_fixme_should_propagate_errors()); if (tree_column == m_key_column && model.is_column_sortable(tree_column)) tree_column_header_width += HeaderView::sorting_arrow_width + HeaderView::sorting_arrow_offset; int tree_column_width = tree_column_header_width; diff --git a/Userland/Libraries/LibWebView/StylePropertiesModel.cpp b/Userland/Libraries/LibWebView/StylePropertiesModel.cpp index 4d903463fd..b3367ee087 100644 --- a/Userland/Libraries/LibWebView/StylePropertiesModel.cpp +++ b/Userland/Libraries/LibWebView/StylePropertiesModel.cpp @@ -30,7 +30,7 @@ int StylePropertiesModel::row_count(GUI::ModelIndex const&) const return m_values.size(); } -String StylePropertiesModel::column_name(int column_index) const +ErrorOr StylePropertiesModel::column_name(int column_index) const { switch (column_index) { case Column::PropertyName: diff --git a/Userland/Libraries/LibWebView/StylePropertiesModel.h b/Userland/Libraries/LibWebView/StylePropertiesModel.h index c92070b35d..87a2d78912 100644 --- a/Userland/Libraries/LibWebView/StylePropertiesModel.h +++ b/Userland/Libraries/LibWebView/StylePropertiesModel.h @@ -31,7 +31,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int) const override; + virtual ErrorOr column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual bool is_searchable() const override { return true; } virtual Vector matches(StringView, unsigned flags, GUI::ModelIndex const&) override;