Userland: Port Model::column_name() to String

This commit is contained in:
Karol Kosek 2023-05-14 19:02:08 +02:00 committed by Andreas Kling
parent 741f07dedf
commit 945f05ed76
Notes: sideshowbarker 2024-07-17 02:39:10 +09:00
70 changed files with 218 additions and 222 deletions

View file

@ -23,17 +23,17 @@ ClipboardHistoryModel::ClipboardHistoryModel()
{
}
DeprecatedString ClipboardHistoryModel::column_name(int column) const
String ClipboardHistoryModel::column_name(int column) const
{
switch (column) {
case Column::Data:
return "Data";
return "Data"_short_string;
case Column::Type:
return "Type";
return "Type"_short_string;
case Column::Size:
return "Size";
return "Size"_short_string;
case Column::Time:
return "Time";
return "Time"_short_string;
default:
VERIFY_NOT_REACHED();
}

View file

@ -60,7 +60,7 @@ private:
// ^GUI::Model
virtual int row_count(const GUI::ModelIndex&) const override { return m_history_items.size(); }
virtual DeprecatedString column_name(int) const override;
virtual String column_name(int) const override;
virtual int column_count(const GUI::ModelIndex&) const override { return Column::__Count; }
// ^GUI::Clipboard::ClipboardClient

View file

@ -34,21 +34,21 @@ int CookiesModel::row_count(GUI::ModelIndex const& index) const
return 0;
}
DeprecatedString CookiesModel::column_name(int column) const
String CookiesModel::column_name(int column) const
{
switch (column) {
case Column::Domain:
return "Domain";
return "Domain"_short_string;
case Column::Path:
return "Path";
return "Path"_short_string;
case Column::Name:
return "Name";
return "Name"_short_string;
case Column::Value:
return "Value";
return "Value"_short_string;
case Column::ExpiryTime:
return "Expiry time";
return "Expiry time"_string.release_value_but_fixme_should_propagate_errors();
case Column::SameSite:
return "SameSite";
return "SameSite"_string.release_value_but_fixme_should_propagate_errors();
case Column::__Count:
return {};
}

View file

@ -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 DeprecatedString column_name(int column) const override;
virtual String column_name(int column) 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 TriState data_matches(GUI::ModelIndex const& index, GUI::Variant const& term) const override;

View file

@ -34,13 +34,13 @@ int HistoryModel::row_count(GUI::ModelIndex const& index) const
return 0;
}
DeprecatedString HistoryModel::column_name(int column) const
String HistoryModel::column_name(int column) const
{
switch (column) {
case Column::Title:
return "Title";
return "Title"_short_string;
case Column::URL:
return "URL";
return "URL"_short_string;
default:
VERIFY_NOT_REACHED();
}

View file

@ -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 DeprecatedString column_name(int column) const override;
virtual String column_name(int column) 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 TriState data_matches(GUI::ModelIndex const& index, GUI::Variant const& term) const override;

View file

@ -35,13 +35,13 @@ int StorageModel::row_count(GUI::ModelIndex const& index) const
return 0;
}
DeprecatedString StorageModel::column_name(int column) const
String StorageModel::column_name(int column) const
{
switch (column) {
case Column::Key:
return "Key";
return "Key"_short_string;
case Column::Value:
return "Value";
return "Value"_short_string;
case Column::__Count:
return {};
}

View file

@ -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 DeprecatedString column_name(int column) const override;
virtual String column_name(int column) 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 TriState data_matches(GUI::ModelIndex const& index, GUI::Variant const& term) const override;

View file

@ -120,21 +120,21 @@ int AddEventDialog::MeridiemListModel::row_count(const GUI::ModelIndex&) const
return 2;
}
DeprecatedString AddEventDialog::MonthListModel::column_name(int column) const
String AddEventDialog::MonthListModel::column_name(int column) const
{
switch (column) {
case Column::Month:
return "Month";
return "Month"_short_string;
default:
VERIFY_NOT_REACHED();
}
}
DeprecatedString AddEventDialog::MeridiemListModel::column_name(int column) const
String AddEventDialog::MeridiemListModel::column_name(int column) const
{
switch (column) {
case Column::Meridiem:
return "Meridiem";
return "Meridiem"_string.release_value_but_fixme_should_propagate_errors();
default:
VERIFY_NOT_REACHED();
}

View file

@ -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 DeprecatedString column_name(int) const override;
virtual String 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 DeprecatedString column_name(int) const override;
virtual String column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
private:

View file

@ -34,15 +34,15 @@ ErrorOr<void> CertificateStoreModel::load()
return {};
}
DeprecatedString CertificateStoreModel::column_name(int column) const
String CertificateStoreModel::column_name(int column) const
{
switch (column) {
case Column::IssuedTo:
return "Issued To";
return "Issued To"_string.release_value_but_fixme_should_propagate_errors();
case Column::IssuedBy:
return "Issued By";
return "Issued By"_string.release_value_but_fixme_should_propagate_errors();
case Column::Expire:
return "Expiration Date";
return "Expiration Date"_string.release_value_but_fixme_should_propagate_errors();
default:
VERIFY_NOT_REACHED();
}

View file

@ -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 DeprecatedString column_name(int) const override;
virtual String column_name(int) const override;
virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override;
virtual ErrorOr<void> load();
virtual ErrorOr<size_t> add(Vector<Certificate> const&);

View file

@ -40,13 +40,13 @@ public:
return 2;
}
DeprecatedString column_name(int column) const override
String column_name(int column) const override
{
switch (column) {
case Column::Offset:
return "Offset";
return "Offset"_short_string;
case Column::Value:
return "Value";
return "Value"_short_string;
}
VERIFY_NOT_REACHED();
}

View file

@ -63,13 +63,13 @@ public:
return 2;
}
DeprecatedString column_name(int column) const override
String column_name(int column) const override
{
switch (column) {
case Column::Type:
return "Type";
return "Type"_short_string;
case Column::Value:
return m_is_little_endian ? "Value (Little Endian)" : "Value (Big Endian)";
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();
}
VERIFY_NOT_REACHED();
}

View file

@ -17,13 +17,13 @@ int InboxModel::row_count(GUI::ModelIndex const&) const
return m_entries.size();
}
DeprecatedString InboxModel::column_name(int column_index) const
String InboxModel::column_name(int column_index) const
{
switch (column_index) {
case Column::From:
return "From";
return "From"_short_string;
case Subject:
return "Subject";
return "Subject"_short_string;
default:
VERIFY_NOT_REACHED();
}

View file

@ -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 DeprecatedString column_name(int) const override;
virtual String column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
private:

View file

@ -15,13 +15,13 @@
#include <LibGUI/SortingProxyModel.h>
#include <LibGUI/TableView.h>
DeprecatedString MouseCursorModel::column_name(int column_index) const
String MouseCursorModel::column_name(int column_index) const
{
switch (column_index) {
case Column::Bitmap:
return {};
case Column::Name:
return "Name";
return "Name"_short_string;
}
VERIFY_NOT_REACHED();
}

View file

@ -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 DeprecatedString column_name(int column_index) const override;
virtual String column_name(int column_index) const override;
virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override;
virtual void invalidate() override;

View file

@ -64,13 +64,13 @@ public:
return Columns::Page;
}
DeprecatedString column_name(int index) const override
String column_name(int index) const override
{
switch (index) {
case 0:
return "Page";
return "Page"_short_string;
case 1:
return "Message";
return "Message"_short_string;
default:
VERIFY_NOT_REACHED();
}

View file

@ -18,19 +18,19 @@ NonnullRefPtr<PartitionModel> PartitionModel::create()
return adopt_ref(*new PartitionModel);
}
DeprecatedString PartitionModel::column_name(int column) const
String PartitionModel::column_name(int column) const
{
switch (column) {
case Column::Partition:
return "Partition";
return "Partition"_string.release_value_but_fixme_should_propagate_errors();
case Column::StartBlock:
return "Start Block";
return "Start Block"_string.release_value_but_fixme_should_propagate_errors();
case Column::EndBlock:
return "End Block";
return "End Block"_string.release_value_but_fixme_should_propagate_errors();
case Column::TotalBlocks:
return "Total Blocks";
return "Total Blocks"_string.release_value_but_fixme_should_propagate_errors();
case Column::Size:
return "Size";
return "Size"_short_string;
default:
VERIFY_NOT_REACHED();
}

View file

@ -27,7 +27,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 DeprecatedString column_name(int) const override;
virtual String column_name(int) const override;
virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override;
ErrorOr<void> set_device_path(DeprecatedString const&);

View file

@ -73,21 +73,21 @@ 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);
}
DeprecatedString PlaylistModel::column_name(int column) const
String PlaylistModel::column_name(int column) const
{
switch (column) {
case 0:
return "Title";
return "Title"_short_string;
case 1:
return "Duration";
return "Duration"_string.release_value_but_fixme_should_propagate_errors();
case 2:
return "Group";
return "Group"_short_string;
case 3:
return "Album";
return "Album"_short_string;
case 4:
return "Artist";
return "Artist"_short_string;
case 5:
return "Filesize";
return "Filesize"_string.release_value_but_fixme_should_propagate_errors();
}
VERIFY_NOT_REACHED();
}

View file

@ -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;
DeprecatedString column_name(int column) const override;
String column_name(int column) const override;
Vector<M3UEntry>& items() { return m_playlist_items; }
private:

View file

@ -166,10 +166,12 @@ void CSVImportDialogPage::update_preview()
return;
}
auto headers = reader.headers();
Vector<String> headers;
for (auto const& header : reader.headers())
headers.append(String::from_deprecated_string(header).release_value_but_fixme_should_propagate_errors());
m_data_preview_table_view->set_model(
GUI::ItemListModel<Reader::XSV::Row, Reader::XSV, Vector<DeprecatedString>>::create(reader, headers, min(8ul, reader.size())));
GUI::ItemListModel<Reader::XSV::Row, Reader::XSV, Vector<String>>::create(reader, headers, min(8ul, reader.size())));
m_data_preview_widget->set_active_widget(m_data_preview_table_view);
m_data_preview_table_view->update();
}

View file

@ -162,12 +162,12 @@ RefPtr<Core::MimeData> SheetModel::mime_data(const GUI::ModelSelection& selectio
return mime_data;
}
DeprecatedString SheetModel::column_name(int index) const
String SheetModel::column_name(int index) const
{
if (index < 0)
return {};
return m_sheet->column(index);
return String::from_deprecated_string(m_sheet->column(index)).release_value_but_fixme_should_propagate_errors();
}
bool SheetModel::is_editable(const GUI::ModelIndex& index) const

View file

@ -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 DeprecatedString column_name(int) const override;
virtual String column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
virtual RefPtr<Core::MimeData> mime_data(const GUI::ModelSelection&) const override;
virtual bool is_editable(const GUI::ModelIndex&) const override;

View file

@ -71,71 +71,71 @@ int ProcessModel::column_count(GUI::ModelIndex const&) const
return Column::__Count;
}
DeprecatedString ProcessModel::column_name(int column) const
String ProcessModel::column_name(int column) const
{
switch (column) {
case Column::Icon:
return "";
return {};
case Column::PID:
return "PID";
return "PID"_short_string;
case Column::TID:
return "TID";
return "TID"_short_string;
case Column::PPID:
return "PPID";
return "PPID"_short_string;
case Column::PGID:
return "PGID";
return "PGID"_short_string;
case Column::SID:
return "SID";
return "SID"_short_string;
case Column::State:
return "State";
return "State"_short_string;
case Column::User:
return "User";
return "User"_short_string;
case Column::Priority:
return "Pr";
return "Pr"_short_string;
case Column::Virtual:
return "Virtual";
return "Virtual"_short_string;
case Column::Physical:
return "Physical";
return "Physical"_string.release_value_but_fixme_should_propagate_errors();
case Column::DirtyPrivate:
return "Private";
return "Private"_short_string;
case Column::CleanInode:
return "CleanI";
return "CleanI"_short_string;
case Column::PurgeableVolatile:
return "Purg:V";
return "Purg:V"_short_string;
case Column::PurgeableNonvolatile:
return "Purg:N";
return "Purg:N"_short_string;
case Column::CPU:
return "CPU";
return "CPU"_short_string;
case Column::Processor:
return "Processor";
return "Processor"_string.release_value_but_fixme_should_propagate_errors();
case Column::Name:
return "Name";
return "Name"_short_string;
case Column::Syscalls:
return "Syscalls";
return "Syscalls"_string.release_value_but_fixme_should_propagate_errors();
case Column::InodeFaults:
return "F:Inode";
return "F:Inode"_short_string;
case Column::ZeroFaults:
return "F:Zero";
return "F:Zero"_short_string;
case Column::CowFaults:
return "F:CoW";
return "F:CoW"_short_string;
case Column::IPv4SocketReadBytes:
return "IPv4 In";
return "IPv4 In"_short_string;
case Column::IPv4SocketWriteBytes:
return "IPv4 Out";
return "IPv4 Out"_string.release_value_but_fixme_should_propagate_errors();
case Column::UnixSocketReadBytes:
return "Unix In";
return "Unix In"_short_string;
case Column::UnixSocketWriteBytes:
return "Unix Out";
return "Unix Out"_string.release_value_but_fixme_should_propagate_errors();
case Column::FileReadBytes:
return "File In";
return "File In"_short_string;
case Column::FileWriteBytes:
return "File Out";
return "File Out"_string.release_value_but_fixme_should_propagate_errors();
case Column::Pledge:
return "Pledge";
return "Pledge"_short_string;
case Column::Veil:
return "Veil";
return "Veil"_short_string;
case Column::Command:
return "Command";
return "Command"_short_string;
default:
VERIFY_NOT_REACHED();
}

View file

@ -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 DeprecatedString column_name(int column) const override;
virtual String column_name(int column) 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;

View file

@ -30,15 +30,15 @@ public:
int row_count(GUI::ModelIndex const&) const override { return m_symbols.size(); };
bool is_column_sortable(int) const override { return false; }
DeprecatedString column_name(int column) const override
String column_name(int column) const override
{
switch (column) {
case Column::Address:
return "Address";
return "Address"_short_string;
case Column::Object:
return "Object";
return "Object"_short_string;
case Column::Symbol:
return "Symbol";
return "Symbol"_short_string;
default:
VERIFY_NOT_REACHED();
}

View file

@ -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 DeprecatedString column_name(int) const override { return "Item"; }
virtual String column_name(int) const override { return "Item"_short_string; }
virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole = GUI::ModelRole::Display) const override;
virtual TriState data_matches(GUI::ModelIndex const&, GUI::Variant const&) const override;

View file

@ -27,13 +27,13 @@ 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 DeprecatedString column_name(int column_index) const override
virtual String column_name(int column_index) const override
{
switch (column_index) {
case Column::Bitmap:
return {};
case Column::Name:
return "Name";
return "Name"_short_string;
}
VERIFY_NOT_REACHED();
}
@ -112,7 +112,7 @@ 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 DeprecatedString column_name(int column_index) const override
virtual String column_name(int column_index) const override
{
switch (column_index) {
case Column::BigIcon:
@ -120,7 +120,7 @@ public:
case Column::LittleIcon:
return {};
case Column::Name:
return "Name";
return "Name"_short_string;
}
VERIFY_NOT_REACHED();
}

View file

@ -27,10 +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 DeprecatedString column_name(int) const override
{
return "";
}
virtual String column_name(int) const override { return {}; }
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;

View file

@ -73,15 +73,15 @@ int DisassemblyModel::row_count(const GUI::ModelIndex&) const
return m_instructions.size();
}
DeprecatedString DisassemblyModel::column_name(int column) const
String DisassemblyModel::column_name(int column) const
{
switch (column) {
case Column::Address:
return "Address";
return "Address"_short_string;
case Column::InstructionBytes:
return "Insn Bytes";
return "Insn Bytes"_string.release_value_but_fixme_should_propagate_errors();
case Column::Disassembly:
return "Disassembly";
return "Disassembly"_string.release_value_but_fixme_should_propagate_errors();
default:
VERIFY_NOT_REACHED();
return {};

View file

@ -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 DeprecatedString column_name(int) const override;
virtual String column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
private:

View file

@ -86,13 +86,13 @@ int RegistersModel::row_count(const GUI::ModelIndex&) const
return m_registers.size();
}
DeprecatedString RegistersModel::column_name(int column) const
String RegistersModel::column_name(int column) const
{
switch (column) {
case Column::Register:
return "Register";
return "Register"_string.release_value_but_fixme_should_propagate_errors();
case Column::Value:
return "Value";
return "Value"_short_string;
default:
VERIFY_NOT_REACHED();
return {};

View file

@ -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 DeprecatedString column_name(int) const override;
virtual String 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; }

View file

@ -53,15 +53,15 @@ int ProjectTemplatesModel::column_count(const GUI::ModelIndex&) const
return Column::__Count;
}
DeprecatedString ProjectTemplatesModel::column_name(int column) const
String ProjectTemplatesModel::column_name(int column) const
{
switch (column) {
case Column::Icon:
return "Icon";
return "Icon"_short_string;
case Column::Id:
return "ID";
return "ID"_short_string;
case Column::Name:
return "Name";
return "Name"_short_string;
}
VERIFY_NOT_REACHED();
}

View file

@ -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 DeprecatedString column_name(int) const override;
virtual String column_name(int) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
void update();

View file

@ -39,15 +39,15 @@ 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 DeprecatedString column_name(int column) const override
virtual String column_name(int column) const override
{
switch (column) {
case Column::Filename:
return "Filename";
return "Filename"_string.release_value_but_fixme_should_propagate_errors();
case Column::Location:
return "#";
return "#"_short_string;
case Column::MatchedText:
return "Text";
return "Text"_short_string;
default:
VERIFY_NOT_REACHED();
}

View file

@ -19,10 +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 DeprecatedString column_name(int) const override
{
return "";
}
virtual String column_name(int) const override { return {}; }
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;

View file

@ -30,17 +30,17 @@ 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 DeprecatedString column_name(int column) const override
virtual String column_name(int column) const override
{
switch (column) {
case Column::Filename:
return "Filename";
return "Filename"_string.release_value_but_fixme_should_propagate_errors();
case Column::Text:
return "Text";
return "Text"_short_string;
case Column::Line:
return "Line";
return "Line"_short_string;
case Column::Column:
return "Col";
return "Col"_short_string;
default:
VERIFY_NOT_REACHED();
}

View file

@ -131,19 +131,19 @@ int DisassemblyModel::row_count(GUI::ModelIndex const&) const
return m_instructions.size();
}
DeprecatedString DisassemblyModel::column_name(int column) const
String DisassemblyModel::column_name(int column) const
{
switch (column) {
case Column::SampleCount:
return m_profile.show_percentages() ? "% Samples" : "# Samples";
return m_profile.show_percentages() ? "% Samples"_string.release_value_but_fixme_should_propagate_errors() : "# Samples"_string.release_value_but_fixme_should_propagate_errors();
case Column::Address:
return "Address";
return "Address"_short_string;
case Column::InstructionBytes:
return "Insn Bytes";
return "Insn Bytes"_string.release_value_but_fixme_should_propagate_errors();
case Column::Disassembly:
return "Disassembly";
return "Disassembly"_string.release_value_but_fixme_should_propagate_errors();
case Column::SourceLocation:
return "Source Location";
return "Source Location"_string.release_value_but_fixme_should_propagate_errors();
default:
VERIFY_NOT_REACHED();
return {};

View file

@ -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 DeprecatedString column_name(int) const override;
virtual String 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; }

View file

@ -142,15 +142,15 @@ int FileEventModel::column_count(GUI::ModelIndex const&) const
return Column::__Count;
}
DeprecatedString FileEventModel::column_name(int column) const
String FileEventModel::column_name(int column) const
{
switch (column) {
case Column::Path:
return "Path";
return "Path"_short_string;
case Column::Count:
return "Event Count";
return "Event Count"_string.release_value_but_fixme_should_propagate_errors();
case Column::Duration:
return "Duration [ms]";
return "Duration [ms]"_string.release_value_but_fixme_should_propagate_errors();
default:
VERIFY_NOT_REACHED();
return {};

View file

@ -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 DeprecatedString column_name(int) const override;
virtual String 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;

View file

@ -29,15 +29,15 @@ int IndividualSampleModel::column_count(GUI::ModelIndex const&) const
return Column::__Count;
}
DeprecatedString IndividualSampleModel::column_name(int column) const
String IndividualSampleModel::column_name(int column) const
{
switch (column) {
case Column::Address:
return "Address";
return "Address"_short_string;
case Column::ObjectName:
return "Object";
return "Object"_short_string;
case Column::Symbol:
return "Symbol";
return "Symbol"_short_string;
default:
VERIFY_NOT_REACHED();
}

View file

@ -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 DeprecatedString column_name(int) const override;
virtual String column_name(int) const override;
virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override;
private:

View file

@ -74,19 +74,19 @@ int ProfileModel::column_count(GUI::ModelIndex const&) const
return Column::__Count;
}
DeprecatedString ProfileModel::column_name(int column) const
String ProfileModel::column_name(int column) const
{
switch (column) {
case Column::SampleCount:
return m_profile.show_percentages() ? "% Samples" : "# Samples";
return m_profile.show_percentages() ? "% Samples"_string.release_value_but_fixme_should_propagate_errors() : "# Samples"_string.release_value_but_fixme_should_propagate_errors();
case Column::SelfCount:
return m_profile.show_percentages() ? "% Self" : "# Self";
return m_profile.show_percentages() ? "% Self"_short_string : "# Self"_short_string;
case Column::ObjectName:
return "Object";
return "Object"_short_string;
case Column::StackFrame:
return "Stack Frame";
return "Stack Frame"_string.release_value_but_fixme_should_propagate_errors();
case Column::SymbolAddress:
return "Symbol Address";
return "Symbol Address"_string.release_value_but_fixme_should_propagate_errors();
default:
VERIFY_NOT_REACHED();
return {};

View file

@ -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 DeprecatedString column_name(int) const override;
virtual String 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;

View file

@ -28,25 +28,25 @@ int SamplesModel::column_count(GUI::ModelIndex const&) const
return Column::__Count;
}
DeprecatedString SamplesModel::column_name(int column) const
String SamplesModel::column_name(int column) const
{
switch (column) {
case Column::SampleIndex:
return "#";
return "#"_short_string;
case Column::Timestamp:
return "Timestamp";
return "Timestamp"_string.release_value_but_fixme_should_propagate_errors();
case Column::ProcessID:
return "PID";
return "PID"_short_string;
case Column::ThreadID:
return "TID";
return "TID"_short_string;
case Column::ExecutableName:
return "Executable";
return "Executable"_string.release_value_but_fixme_should_propagate_errors();
case Column::LostSamples:
return "Lost Samples";
return "Lost Samples"_string.release_value_but_fixme_should_propagate_errors();
case Column::InnermostStackFrame:
return "Innermost Frame";
return "Innermost Frame"_string.release_value_but_fixme_should_propagate_errors();
case Column::Path:
return "Path";
return "Path"_short_string;
default:
VERIFY_NOT_REACHED();
}

View file

@ -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 DeprecatedString column_name(int) const override;
virtual String 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; }

View file

@ -26,23 +26,23 @@ int SignpostsModel::column_count(GUI::ModelIndex const&) const
return Column::__Count;
}
DeprecatedString SignpostsModel::column_name(int column) const
String SignpostsModel::column_name(int column) const
{
switch (column) {
case Column::SignpostIndex:
return "#";
return "#"_short_string;
case Column::Timestamp:
return "Timestamp";
return "Timestamp"_string.release_value_but_fixme_should_propagate_errors();
case Column::ProcessID:
return "PID";
return "PID"_short_string;
case Column::ThreadID:
return "TID";
return "TID"_short_string;
case Column::ExecutableName:
return "Executable";
return "Executable"_string.release_value_but_fixme_should_propagate_errors();
case Column::SignpostString:
return "String";
return "String"_short_string;
case Column::SignpostArgument:
return "Argument";
return "Argument"_string.release_value_but_fixme_should_propagate_errors();
default:
VERIFY_NOT_REACHED();
}

View file

@ -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 DeprecatedString column_name(int) const override;
virtual String 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; }

View file

@ -122,17 +122,17 @@ int SourceModel::row_count(GUI::ModelIndex const&) const
return m_source_lines.size();
}
DeprecatedString SourceModel::column_name(int column) const
String SourceModel::column_name(int column) const
{
switch (column) {
case Column::SampleCount:
return m_profile.show_percentages() ? "% Samples" : "# Samples";
return m_profile.show_percentages() ? "% Samples"_string.release_value_but_fixme_should_propagate_errors() : "# Samples"_string.release_value_but_fixme_should_propagate_errors();
case Column::SourceCode:
return "Source Code";
return "Source Code"_string.release_value_but_fixme_should_propagate_errors();
case Column::Location:
return "Location";
return "Location"_string.release_value_but_fixme_should_propagate_errors();
case Column::LineNumber:
return "Line";
return "Line"_short_string;
default:
VERIFY_NOT_REACHED();
return {};

View file

@ -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 DeprecatedString column_name(int) const override;
virtual String 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; }

View file

@ -92,7 +92,7 @@ public:
return Column::__Count;
}
virtual DeprecatedString column_name(int) const override { return {}; }
virtual String column_name(int) const override { return {}; }
virtual ModelIndex index(int row, int column = 0, ModelIndex const& = ModelIndex()) const override
{

View file

@ -761,27 +761,27 @@ int FileSystemModel::column_count(ModelIndex const&) const
return Column::__Count;
}
DeprecatedString FileSystemModel::column_name(int column) const
String FileSystemModel::column_name(int column) const
{
switch (column) {
case Column::Icon:
return "";
return {};
case Column::Name:
return "Name";
return "Name"_short_string;
case Column::Size:
return "Size";
return "Size"_short_string;
case Column::User:
return "User";
return "User"_short_string;
case Column::Group:
return "Group";
return "Group"_short_string;
case Column::Permissions:
return "Mode";
return "Mode"_short_string;
case Column::ModificationTime:
return "Modified";
return "Modified"_string.release_value_but_fixme_should_propagate_errors();
case Column::Inode:
return "Inode";
return "Inode"_short_string;
case Column::SymlinkTarget:
return "Symlink target";
return "Symlink target"_string.release_value_but_fixme_should_propagate_errors();
}
VERIFY_NOT_REACHED();
}

View file

@ -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 DeprecatedString column_name(int column) const override;
virtual String column_name(int column) 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;

View file

@ -33,7 +33,7 @@ int FilteringProxyModel::column_count(ModelIndex const& index) const
return m_model->column_count(m_matching_indices[index.row()]);
}
DeprecatedString FilteringProxyModel::column_name(int column) const
String FilteringProxyModel::column_name(int column) const
{
return m_model->column_name(column);
}

View file

@ -29,7 +29,7 @@ public:
virtual int row_count(ModelIndex const& = ModelIndex()) const override;
virtual int column_count(ModelIndex const& = ModelIndex()) const override;
virtual DeprecatedString column_name(int) const override;
virtual String 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;

View file

@ -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);
auto name = model()->column_name(section).to_deprecated_string();
column_data.visibility_action = Action::create_checkable(name, [this, section](auto& action) {
set_section_visible(section, action.is_checked());
});

View file

@ -71,11 +71,11 @@ public:
return 1;
}
virtual DeprecatedString column_name(int index) const override
virtual String column_name(int index) const override
{
if constexpr (IsTwoDimensional)
return m_column_names[index];
return "Data";
return "Data"_short_string;
}
virtual Variant data(ModelIndex const& index, ModelRole role) const override

View file

@ -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 DeprecatedString column_name(int column) const override { return m_fields[column].column_name; }
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 Variant data(ModelIndex const&, ModelRole = ModelRole::Display) const override;
virtual void invalidate() override;
virtual void update();

View file

@ -9,11 +9,11 @@
#pragma once
#include <AK/Badge.h>
#include <AK/DeprecatedString.h>
#include <AK/Function.h>
#include <AK/HashMap.h>
#include <AK/HashTable.h>
#include <AK/RefCounted.h>
#include <AK/String.h>
#include <AK/WeakPtr.h>
#include <LibCore/MimeData.h>
#include <LibGUI/Forward.h>
@ -66,7 +66,7 @@ public:
virtual int row_count(ModelIndex const& = ModelIndex()) const = 0;
virtual int column_count(ModelIndex const& = ModelIndex()) const = 0;
virtual DeprecatedString column_name(int) const { return {}; }
virtual String column_name(int) const { return {}; }
virtual Variant data(ModelIndex const&, ModelRole = ModelRole::Display) const = 0;
virtual TriState data_matches(ModelIndex const&, Variant const&) const { return TriState::Unknown; }
virtual void invalidate();

View file

@ -45,17 +45,17 @@ int RunningProcessesModel::column_count(const GUI::ModelIndex&) const
return Column::__Count;
}
DeprecatedString RunningProcessesModel::column_name(int column_index) const
String RunningProcessesModel::column_name(int column_index) const
{
switch (column_index) {
case Column::Icon:
return {};
case Column::PID:
return "PID";
return "PID"_short_string;
case Column::UID:
return "UID";
return "UID"_short_string;
case Column::Name:
return "Name";
return "Name"_short_string;
}
VERIFY_NOT_REACHED();
}

View file

@ -27,7 +27,7 @@ public:
virtual int row_count(const GUI::ModelIndex&) const override;
virtual int column_count(const GUI::ModelIndex&) const override;
virtual DeprecatedString column_name(int column_index) const override;
virtual String column_name(int column_index) const override;
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
void update();

View file

@ -106,7 +106,7 @@ ModelIndex SortingProxyModel::map_to_proxy(ModelIndex const& source_index) const
return create_index(proxy_row, proxy_column, &mapping);
}
DeprecatedString SortingProxyModel::column_name(int column) const
String SortingProxyModel::column_name(int column) const
{
return source().column_name(column);
}

View file

@ -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 DeprecatedString column_name(int) const override;
virtual String 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;

View file

@ -30,13 +30,13 @@ int StylePropertiesModel::row_count(GUI::ModelIndex const&) const
return m_values.size();
}
DeprecatedString StylePropertiesModel::column_name(int column_index) const
String StylePropertiesModel::column_name(int column_index) const
{
switch (column_index) {
case Column::PropertyName:
return "Name";
return "Name"_short_string;
case Column::PropertyValue:
return "Value";
return "Value"_short_string;
default:
VERIFY_NOT_REACHED();
}

View file

@ -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 DeprecatedString column_name(int) const override;
virtual String 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<GUI::ModelIndex> matches(StringView, unsigned flags, GUI::ModelIndex const&) override;