mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Spreadsheet: Make cell metadata hint return String
This commit is contained in:
parent
4836d33ae4
commit
9c923f20f4
Notes:
sideshowbarker
2024-07-16 20:12:13 +09:00
Author: https://github.com/krkk Commit: https://github.com/SerenityOS/serenity/commit/9c923f20f4 Pull-request: https://github.com/SerenityOS/serenity/pull/21020 Reviewed-by: https://github.com/AtkinsSJ
10 changed files with 15 additions and 15 deletions
|
@ -39,10 +39,10 @@ JS::ThrowCompletionOr<JS::Value> 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 {};
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ public:
|
|||
virtual ~DateCell() override = default;
|
||||
virtual JS::ThrowCompletionOr<DeprecatedString> display(Cell&, CellTypeMetadata const&) const override;
|
||||
virtual JS::ThrowCompletionOr<JS::Value> js_value(Cell&, CellTypeMetadata const&) const override;
|
||||
DeprecatedString metadata_hint(MetadataName) const override;
|
||||
virtual String metadata_hint(MetadataName) const override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -30,12 +30,12 @@ JS::ThrowCompletionOr<JS::Value> 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 {};
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ public:
|
|||
virtual ~IdentityCell() override = default;
|
||||
virtual JS::ThrowCompletionOr<DeprecatedString> display(Cell&, CellTypeMetadata const&) const override;
|
||||
virtual JS::ThrowCompletionOr<JS::Value> js_value(Cell&, CellTypeMetadata const&) const override;
|
||||
DeprecatedString metadata_hint(MetadataName) const override;
|
||||
virtual String metadata_hint(MetadataName) const override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -43,10 +43,10 @@ JS::ThrowCompletionOr<JS::Value> 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 {};
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
virtual ~NumericCell() override = default;
|
||||
virtual JS::ThrowCompletionOr<DeprecatedString> display(Cell&, CellTypeMetadata const&) const override;
|
||||
virtual JS::ThrowCompletionOr<JS::Value> js_value(Cell&, CellTypeMetadata const&) const override;
|
||||
DeprecatedString metadata_hint(MetadataName) const override;
|
||||
virtual String metadata_hint(MetadataName) const override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -32,10 +32,10 @@ JS::ThrowCompletionOr<JS::Value> 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 {};
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ public:
|
|||
virtual ~StringCell() override = default;
|
||||
virtual JS::ThrowCompletionOr<DeprecatedString> display(Cell&, CellTypeMetadata const&) const override;
|
||||
virtual JS::ThrowCompletionOr<JS::Value> js_value(Cell&, CellTypeMetadata const&) const override;
|
||||
DeprecatedString metadata_hint(MetadataName) const override;
|
||||
virtual String metadata_hint(MetadataName) const override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
|
||||
virtual JS::ThrowCompletionOr<DeprecatedString> display(Cell&, CellTypeMetadata const&) const = 0;
|
||||
virtual JS::ThrowCompletionOr<JS::Value> 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; }
|
||||
|
|
|
@ -153,7 +153,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector<Position> const& po
|
|||
|
||||
m_type = CellType::get_by_name(g_types.at(index.row()));
|
||||
if (auto* editor = right_side.find_descendant_of_type_named<GUI::TextEditor>("format_editor"))
|
||||
editor->set_tooltip_deprecated(m_type->metadata_hint(MetadataName::Format));
|
||||
editor->set_tooltip(m_type->metadata_hint(MetadataName::Format));
|
||||
};
|
||||
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue