mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:17:35 +00:00
LibGUI+Userland: Port StatusBar::set_override_text() to String
This commit is contained in:
parent
5234a30731
commit
92ff12a0d0
8 changed files with 17 additions and 17 deletions
|
@ -315,12 +315,15 @@ void Action::set_tooltip(DeprecatedString tooltip)
|
|||
});
|
||||
}
|
||||
|
||||
DeprecatedString Action::status_tip() const
|
||||
Optional<String> Action::status_tip() const
|
||||
{
|
||||
if (!m_status_tip.is_empty())
|
||||
return m_status_tip.to_deprecated_string();
|
||||
return m_status_tip;
|
||||
|
||||
return Gfx::parse_ampersand_string(m_text);
|
||||
auto maybe_parsed_action_text = String::from_deprecated_string(Gfx::parse_ampersand_string(m_text));
|
||||
if (maybe_parsed_action_text.is_error())
|
||||
return {};
|
||||
return maybe_parsed_action_text.release_value();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ public:
|
|||
DeprecatedString tooltip() const { return m_tooltip.value_or(m_text); }
|
||||
void set_tooltip(DeprecatedString);
|
||||
|
||||
DeprecatedString status_tip() const;
|
||||
Optional<String> status_tip() const;
|
||||
void set_status_tip(String status_tip) { m_status_tip = move(status_tip); }
|
||||
|
||||
Shortcut const& shortcut() const { return m_shortcut; }
|
||||
|
|
|
@ -116,12 +116,9 @@ void Statusbar::set_text(size_t index, String text)
|
|||
update_segment(index);
|
||||
}
|
||||
|
||||
void Statusbar::set_override_text(DeprecatedString override_text)
|
||||
void Statusbar::set_override_text(Optional<String> override_text)
|
||||
{
|
||||
if (override_text.is_null())
|
||||
m_segments[0]->m_override_text = {};
|
||||
else
|
||||
m_segments[0]->m_override_text = String::from_deprecated_string(override_text).release_value_but_fixme_should_propagate_errors();
|
||||
m_segments[0]->m_override_text = move(override_text);
|
||||
update_segment(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
String text(size_t index = 0) const;
|
||||
void set_text(String);
|
||||
void set_text(size_t index, String);
|
||||
void set_override_text(DeprecatedString);
|
||||
void set_override_text(Optional<String>);
|
||||
|
||||
class Segment final : public Button {
|
||||
C_OBJECT(Segment)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue