mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 13:47:46 +00:00
Userland: Port Model::column_name()
to String
This commit is contained in:
parent
741f07dedf
commit
945f05ed76
70 changed files with 218 additions and 222 deletions
|
@ -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 {};
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {};
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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&);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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&);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue