Browse Source

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.
Karol Kosek 1 year ago
parent
commit
03a54a519a

+ 1 - 1
Userland/Applets/Keymap/KeymapStatusWidget.cpp

@@ -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();
 }
 

+ 1 - 1
Userland/Applications/Browser/BookmarksBarWidget.cpp

@@ -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) {

+ 2 - 2
Userland/Applications/Spreadsheet/SpreadsheetView.cpp

@@ -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({});
             }
         }
 

+ 5 - 5
Userland/DevTools/Profiler/FlameGraphView.cpp

@@ -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;
 }

+ 1 - 1
Userland/DevTools/Profiler/FlameGraphView.h

@@ -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);
 

+ 1 - 1
Userland/Libraries/LibGUI/Action.cpp

@@ -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({});

+ 1 - 1
Userland/Services/Taskbar/QuickLaunchWidget.cpp

@@ -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();

+ 1 - 1
Userland/Services/Taskbar/TaskbarWindow.cpp

@@ -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));
 }