mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:07:35 +00:00
LibGUI: Port tooltip in Breadcrumbbar to String
This commit is contained in:
parent
dd92d09268
commit
3944c39b3a
4 changed files with 7 additions and 7 deletions
|
@ -154,7 +154,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
if (tree_map_widget.viewpoint() == 0)
|
if (tree_map_widget.viewpoint() == 0)
|
||||||
window->set_title("/ - SpaceAnalyzer");
|
window->set_title("/ - SpaceAnalyzer");
|
||||||
|
|
||||||
breadcrumbbar.append_segment("/", GUI::FileIconProvider::icon_for_path("/"sv).bitmap_for_size(16), "/", "/");
|
breadcrumbbar.append_segment("/", GUI::FileIconProvider::icon_for_path("/"sv).bitmap_for_size(16), "/", "/"_string);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
if (k == tree_map_widget.viewpoint())
|
if (k == tree_map_widget.viewpoint())
|
||||||
window->set_title(DeprecatedString::formatted("{} - SpaceAnalyzer", builder.string_view()));
|
window->set_title(DeprecatedString::formatted("{} - SpaceAnalyzer", builder.string_view()));
|
||||||
|
|
||||||
breadcrumbbar.append_segment(node->name(), GUI::FileIconProvider::icon_for_path(builder.string_view()).bitmap_for_size(16), builder.string_view(), builder.string_view());
|
breadcrumbbar.append_segment(node->name(), GUI::FileIconProvider::icon_for_path(builder.string_view()).bitmap_for_size(16), builder.string_view(), MUST(builder.to_string()));
|
||||||
}
|
}
|
||||||
breadcrumbbar.set_selected_segment(tree_map_widget.viewpoint());
|
breadcrumbbar.set_selected_segment(tree_map_widget.viewpoint());
|
||||||
};
|
};
|
||||||
|
|
|
@ -70,13 +70,13 @@ void Breadcrumbbar::clear_segments()
|
||||||
m_selected_segment = {};
|
m_selected_segment = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Breadcrumbbar::append_segment(DeprecatedString text, Gfx::Bitmap const* icon, DeprecatedString data, DeprecatedString tooltip)
|
void Breadcrumbbar::append_segment(DeprecatedString text, Gfx::Bitmap const* icon, DeprecatedString data, String tooltip)
|
||||||
{
|
{
|
||||||
auto& button = add<BreadcrumbButton>();
|
auto& button = add<BreadcrumbButton>();
|
||||||
button.set_button_style(Gfx::ButtonStyle::Coolbar);
|
button.set_button_style(Gfx::ButtonStyle::Coolbar);
|
||||||
button.set_text(String::from_deprecated_string(text).release_value_but_fixme_should_propagate_errors());
|
button.set_text(String::from_deprecated_string(text).release_value_but_fixme_should_propagate_errors());
|
||||||
button.set_icon(icon);
|
button.set_icon(icon);
|
||||||
button.set_tooltip_deprecated(move(tooltip));
|
button.set_tooltip(move(tooltip));
|
||||||
button.set_focus_policy(FocusPolicy::TabFocus);
|
button.set_focus_policy(FocusPolicy::TabFocus);
|
||||||
button.set_checkable(true);
|
button.set_checkable(true);
|
||||||
button.set_exclusive(true);
|
button.set_exclusive(true);
|
||||||
|
|
|
@ -19,7 +19,7 @@ public:
|
||||||
virtual ~Breadcrumbbar() override = default;
|
virtual ~Breadcrumbbar() override = default;
|
||||||
|
|
||||||
void clear_segments();
|
void clear_segments();
|
||||||
void append_segment(DeprecatedString text, Gfx::Bitmap const* icon = nullptr, DeprecatedString data = {}, DeprecatedString tooltip = {});
|
void append_segment(DeprecatedString text, Gfx::Bitmap const* icon = nullptr, DeprecatedString data = {}, String tooltip = {});
|
||||||
void remove_end_segments(size_t segment_index);
|
void remove_end_segments(size_t segment_index);
|
||||||
void relayout();
|
void relayout();
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@ void PathBreadcrumbbar::set_current_path(DeprecatedString const& new_path)
|
||||||
} else {
|
} else {
|
||||||
m_breadcrumbbar->clear_segments();
|
m_breadcrumbbar->clear_segments();
|
||||||
|
|
||||||
m_breadcrumbbar->append_segment("/", GUI::FileIconProvider::icon_for_path("/"sv).bitmap_for_size(16), "/", "/");
|
m_breadcrumbbar->append_segment("/", GUI::FileIconProvider::icon_for_path("/"sv).bitmap_for_size(16), "/", "/"_string);
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
|
|
||||||
for (auto& part : lexical_path.parts()) {
|
for (auto& part : lexical_path.parts()) {
|
||||||
|
@ -118,7 +118,7 @@ void PathBreadcrumbbar::set_current_path(DeprecatedString const& new_path)
|
||||||
builder.append('/');
|
builder.append('/');
|
||||||
builder.append(part);
|
builder.append(part);
|
||||||
|
|
||||||
m_breadcrumbbar->append_segment(part, GUI::FileIconProvider::icon_for_path(builder.string_view()).bitmap_for_size(16), builder.string_view(), builder.string_view());
|
m_breadcrumbbar->append_segment(part, GUI::FileIconProvider::icon_for_path(builder.string_view()).bitmap_for_size(16), builder.string_view(), MUST(builder.to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_breadcrumbbar->set_selected_segment(m_breadcrumbbar->segment_count() - 1);
|
m_breadcrumbbar->set_selected_segment(m_breadcrumbbar->segment_count() - 1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue