1
0
mirror of https://github.com/SerenityOS/serenity synced 2024-07-09 04:50:46 +00:00

Userland: Port remaining calls to Widget::set_tooltip_deprecated()

Replaces `set_tooltip_deprecated(string);` with
`set_tooltip(MUST(String::from_deprecated_string(string)));`
purely to get rid of the deprecated function in the following commit.
This commit is contained in:
Karol Kosek 2023-09-10 23:00:25 +02:00 committed by Andreas Kling
parent ed3e729d4e
commit 03a54a519a
8 changed files with 13 additions and 13 deletions

View File

@ -66,7 +66,7 @@ ErrorOr<void> KeymapStatusWidget::refresh_menu()
void KeymapStatusWidget::set_current_keymap(DeprecatedString const& keymap)
{
m_current_keymap = keymap;
set_tooltip_deprecated(keymap);
set_tooltip(MUST(String::from_deprecated_string(keymap)));
update();
}

View File

@ -216,7 +216,7 @@ void BookmarksBarWidget::model_did_update(unsigned)
button.set_fixed_size(font().width(title) + 32, 20);
button.set_relative_rect(rect);
button.set_focus_policy(GUI::FocusPolicy::TabFocus);
button.set_tooltip_deprecated(url);
button.set_tooltip(MUST(String::from_deprecated_string(url)));
button.set_allowed_mouse_buttons_for_pressing(GUI::MouseButton::Primary | GUI::MouseButton::Middle);
button.on_click = [title, url, this](auto) {

View File

@ -80,10 +80,10 @@ void InfinitelyScrollableTableView::mousemove_event(GUI::MouseEvent& event)
if (!is_dragging()) {
auto tooltip = model->data(index, static_cast<GUI::ModelRole>(SheetModel::Role::Tooltip));
if (tooltip.is_string()) {
set_tooltip_deprecated(tooltip.as_string());
set_tooltip(MUST(String::from_deprecated_string(tooltip.as_string())));
show_or_hide_tooltip();
} else {
set_tooltip_deprecated({});
set_tooltip({});
}
}

View File

@ -89,11 +89,11 @@ void FlameGraphView::mousemove_event(GUI::MouseEvent& event)
if (on_hover_change)
on_hover_change();
DeprecatedString label = "";
String label;
if (m_hovered_bar != nullptr && m_hovered_bar->index.is_valid()) {
label = bar_label(*m_hovered_bar);
}
set_tooltip_deprecated(label);
set_tooltip(label);
show_or_hide_tooltip();
update();
@ -175,12 +175,12 @@ void FlameGraphView::paint_event(GUI::PaintEvent& event)
}
}
DeprecatedString FlameGraphView::bar_label(StackBar const& bar) const
String FlameGraphView::bar_label(StackBar const& bar) const
{
auto label_index = bar.index.sibling_at_column(m_text_column);
DeprecatedString label = "All";
String label = "All"_string;
if (label_index.is_valid()) {
label = m_model.data(label_index).to_deprecated_string();
label = MUST(String::from_deprecated_string(m_model.data(label_index).to_deprecated_string()));
}
return label;
}

View File

@ -46,7 +46,7 @@ private:
bool selected;
};
DeprecatedString bar_label(StackBar const&) const;
String bar_label(StackBar const&) const;
void layout_bars();
void layout_children(GUI::ModelIndex& parent, int depth, int left, int right, Vector<GUI::ModelIndex>& selected);

View File

@ -308,7 +308,7 @@ void Action::set_tooltip(DeprecatedString tooltip)
return;
m_tooltip = move(tooltip);
for_each_toolbar_button([&](auto& button) {
button.set_tooltip_deprecated(*m_tooltip);
button.set_tooltip(MUST(String::from_deprecated_string(*m_tooltip)));
});
for_each_menu_item([&](auto& menu_item) {
menu_item.update_from_action({});

View File

@ -191,7 +191,7 @@ ErrorOr<void> QuickLaunchWidget::add_or_adjust_button(DeprecatedString const& bu
button->set_button_style(Gfx::ButtonStyle::Coolbar);
auto icon = entry->icon();
button->set_icon(icon.bitmap_for_size(16));
button->set_tooltip_deprecated(entry->name());
button->set_tooltip(MUST(String::from_deprecated_string(entry->name())));
button->set_name(button_name);
button->on_click = [entry = move(entry), this](auto) {
auto result = entry->launch();

View File

@ -199,7 +199,7 @@ void TaskbarWindow::update_window_button(::Window& window, bool show_as_active)
if (!button)
return;
button->set_text(String::from_deprecated_string(window.title()).release_value_but_fixme_should_propagate_errors());
button->set_tooltip_deprecated(window.title());
button->set_tooltip(String::from_deprecated_string(window.title()).release_value_but_fixme_should_propagate_errors());
button->set_checked(show_as_active);
button->set_visible(is_window_on_current_workspace(window));
}