From 9c923f20f44fafea317c3484ef52924479f34701 Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Sat, 3 Jun 2023 23:43:15 +0200 Subject: [PATCH] Spreadsheet: Make cell metadata hint return String --- Userland/Applications/Spreadsheet/CellType/Date.cpp | 4 ++-- Userland/Applications/Spreadsheet/CellType/Date.h | 2 +- Userland/Applications/Spreadsheet/CellType/Identity.cpp | 6 +++--- Userland/Applications/Spreadsheet/CellType/Identity.h | 2 +- Userland/Applications/Spreadsheet/CellType/Numeric.cpp | 4 ++-- Userland/Applications/Spreadsheet/CellType/Numeric.h | 2 +- Userland/Applications/Spreadsheet/CellType/String.cpp | 4 ++-- Userland/Applications/Spreadsheet/CellType/String.h | 2 +- Userland/Applications/Spreadsheet/CellType/Type.h | 2 +- Userland/Applications/Spreadsheet/CellTypeDialog.cpp | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Userland/Applications/Spreadsheet/CellType/Date.cpp b/Userland/Applications/Spreadsheet/CellType/Date.cpp index 9dfda3cea1..085acaf46d 100644 --- a/Userland/Applications/Spreadsheet/CellType/Date.cpp +++ b/Userland/Applications/Spreadsheet/CellType/Date.cpp @@ -39,10 +39,10 @@ JS::ThrowCompletionOr DateCell::js_value(Cell& cell, CellTypeMetadata return JS::Value(value / 1000); // Turn it to seconds } -DeprecatedString DateCell::metadata_hint(MetadataName metadata) const +String DateCell::metadata_hint(MetadataName metadata) const { if (metadata == MetadataName::Format) - return "Date format string as supported by `strftime'"; + return "Date format string as supported by `strftime'"_string; return {}; } diff --git a/Userland/Applications/Spreadsheet/CellType/Date.h b/Userland/Applications/Spreadsheet/CellType/Date.h index 9a84a790d9..61258e4eb6 100644 --- a/Userland/Applications/Spreadsheet/CellType/Date.h +++ b/Userland/Applications/Spreadsheet/CellType/Date.h @@ -18,7 +18,7 @@ public: virtual ~DateCell() override = default; virtual JS::ThrowCompletionOr display(Cell&, CellTypeMetadata const&) const override; virtual JS::ThrowCompletionOr js_value(Cell&, CellTypeMetadata const&) const override; - DeprecatedString metadata_hint(MetadataName) const override; + virtual String metadata_hint(MetadataName) const override; }; } diff --git a/Userland/Applications/Spreadsheet/CellType/Identity.cpp b/Userland/Applications/Spreadsheet/CellType/Identity.cpp index 3a4ef2009e..203c040120 100644 --- a/Userland/Applications/Spreadsheet/CellType/Identity.cpp +++ b/Userland/Applications/Spreadsheet/CellType/Identity.cpp @@ -30,12 +30,12 @@ JS::ThrowCompletionOr IdentityCell::js_value(Cell& cell, CellTypeMeta return cell.js_data(); } -DeprecatedString IdentityCell::metadata_hint(MetadataName metadata) const +String IdentityCell::metadata_hint(MetadataName metadata) const { if (metadata == MetadataName::Length) - return "Ignored"; + return "Ignored"_string; if (metadata == MetadataName::Format) - return "JavaScript expression, `value' refers to the cell's value"; + return "JavaScript expression, `value' refers to the cell's value"_string; return {}; } diff --git a/Userland/Applications/Spreadsheet/CellType/Identity.h b/Userland/Applications/Spreadsheet/CellType/Identity.h index cbca22ad86..a3c7dbe9a3 100644 --- a/Userland/Applications/Spreadsheet/CellType/Identity.h +++ b/Userland/Applications/Spreadsheet/CellType/Identity.h @@ -17,7 +17,7 @@ public: virtual ~IdentityCell() override = default; virtual JS::ThrowCompletionOr display(Cell&, CellTypeMetadata const&) const override; virtual JS::ThrowCompletionOr js_value(Cell&, CellTypeMetadata const&) const override; - DeprecatedString metadata_hint(MetadataName) const override; + virtual String metadata_hint(MetadataName) const override; }; } diff --git a/Userland/Applications/Spreadsheet/CellType/Numeric.cpp b/Userland/Applications/Spreadsheet/CellType/Numeric.cpp index c9834f68d2..acddedcbb1 100644 --- a/Userland/Applications/Spreadsheet/CellType/Numeric.cpp +++ b/Userland/Applications/Spreadsheet/CellType/Numeric.cpp @@ -43,10 +43,10 @@ JS::ThrowCompletionOr NumericCell::js_value(Cell& cell, CellTypeMetad }); } -DeprecatedString NumericCell::metadata_hint(MetadataName metadata) const +String NumericCell::metadata_hint(MetadataName metadata) const { if (metadata == MetadataName::Format) - return "Format string as accepted by `printf', all numeric formats refer to the same value (the cell's value)"; + return "Format string as accepted by `printf', all numeric formats refer to the same value (the cell's value)"_string; return {}; } diff --git a/Userland/Applications/Spreadsheet/CellType/Numeric.h b/Userland/Applications/Spreadsheet/CellType/Numeric.h index da086c0b2a..4a6672c816 100644 --- a/Userland/Applications/Spreadsheet/CellType/Numeric.h +++ b/Userland/Applications/Spreadsheet/CellType/Numeric.h @@ -28,7 +28,7 @@ public: virtual ~NumericCell() override = default; virtual JS::ThrowCompletionOr display(Cell&, CellTypeMetadata const&) const override; virtual JS::ThrowCompletionOr js_value(Cell&, CellTypeMetadata const&) const override; - DeprecatedString metadata_hint(MetadataName) const override; + virtual String metadata_hint(MetadataName) const override; }; } diff --git a/Userland/Applications/Spreadsheet/CellType/String.cpp b/Userland/Applications/Spreadsheet/CellType/String.cpp index 23520ecad6..379ac5215c 100644 --- a/Userland/Applications/Spreadsheet/CellType/String.cpp +++ b/Userland/Applications/Spreadsheet/CellType/String.cpp @@ -32,10 +32,10 @@ JS::ThrowCompletionOr StringCell::js_value(Cell& cell, CellTypeMetada return JS::PrimitiveString::create(vm, string); } -DeprecatedString StringCell::metadata_hint(MetadataName metadata) const +String StringCell::metadata_hint(MetadataName metadata) const { if (metadata == MetadataName::Format) - return "Ignored"; + return "Ignored"_string; return {}; } diff --git a/Userland/Applications/Spreadsheet/CellType/String.h b/Userland/Applications/Spreadsheet/CellType/String.h index 5989372af4..28b145c447 100644 --- a/Userland/Applications/Spreadsheet/CellType/String.h +++ b/Userland/Applications/Spreadsheet/CellType/String.h @@ -17,7 +17,7 @@ public: virtual ~StringCell() override = default; virtual JS::ThrowCompletionOr display(Cell&, CellTypeMetadata const&) const override; virtual JS::ThrowCompletionOr js_value(Cell&, CellTypeMetadata const&) const override; - DeprecatedString metadata_hint(MetadataName) const override; + virtual String metadata_hint(MetadataName) const override; }; } diff --git a/Userland/Applications/Spreadsheet/CellType/Type.h b/Userland/Applications/Spreadsheet/CellType/Type.h index 117a67129b..5badeae308 100644 --- a/Userland/Applications/Spreadsheet/CellType/Type.h +++ b/Userland/Applications/Spreadsheet/CellType/Type.h @@ -37,7 +37,7 @@ public: virtual JS::ThrowCompletionOr display(Cell&, CellTypeMetadata const&) const = 0; virtual JS::ThrowCompletionOr js_value(Cell&, CellTypeMetadata const&) const = 0; - virtual DeprecatedString metadata_hint(MetadataName) const { return {}; } + virtual String metadata_hint(MetadataName) const { return {}; } virtual ~CellType() = default; DeprecatedString const& name() const { return m_name; } diff --git a/Userland/Applications/Spreadsheet/CellTypeDialog.cpp b/Userland/Applications/Spreadsheet/CellTypeDialog.cpp index 5f225d92c2..3027f00add 100644 --- a/Userland/Applications/Spreadsheet/CellTypeDialog.cpp +++ b/Userland/Applications/Spreadsheet/CellTypeDialog.cpp @@ -153,7 +153,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector const& po m_type = CellType::get_by_name(g_types.at(index.row())); if (auto* editor = right_side.find_descendant_of_type_named("format_editor")) - editor->set_tooltip_deprecated(m_type->metadata_hint(MetadataName::Format)); + editor->set_tooltip(m_type->metadata_hint(MetadataName::Format)); }; {