SpaceAnalyzer: Display the current location in the window title :^)

This commit is contained in:
Sam Atkins 2022-12-09 17:23:49 +00:00 committed by Linus Groh
parent d8ceaf7870
commit 64cfe2b163
Notes: sideshowbarker 2024-07-17 07:08:37 +09:00

View File

@ -412,6 +412,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
breadcrumbbar.clear_segments();
for (size_t k = 0; k < treemapwidget.path_size(); k++) {
if (k == 0) {
if (treemapwidget.viewpoint() == 0)
window->set_title("/ - SpaceAnalyzer");
breadcrumbbar.append_segment("/", GUI::FileIconProvider::icon_for_path("/").bitmap_for_size(16), "/", "/");
continue;
}
@ -421,6 +424,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
builder.append('/');
builder.append(node->name());
// Sneakily set the window title here, while the StringBuilder holds the right amount of the path.
if (k == treemapwidget.viewpoint())
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.set_selected_segment(treemapwidget.viewpoint());