summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
authorDawid Wolosowicz <d@1823.pl>2021-09-01 20:39:38 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-01 23:00:28 +0200
commit14c30af7d839cd9561cf5273ca6d5aa14595c3c6 (patch)
tree8ec6ed7de7ae3282674076a08b15bdb4baf3615e /Userland/Applications
parent1600d5a446261416e296956d9d42203f83ba43d4 (diff)
downloadserenity-14c30af7d839cd9561cf5273ca6d5aa14595c3c6.zip
SpaceAnalyzer: Enable icons within the breadcrumbbar
The breadcrumbbar in here serves exactly the same purpose as the one in File Manager. Given that, I believe it's worth to keep these two visually consistent.
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/SpaceAnalyzer/main.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/Userland/Applications/SpaceAnalyzer/main.cpp b/Userland/Applications/SpaceAnalyzer/main.cpp
index cef6e9eb17..687f1a2bbd 100644
--- a/Userland/Applications/SpaceAnalyzer/main.cpp
+++ b/Userland/Applications/SpaceAnalyzer/main.cpp
@@ -16,6 +16,7 @@
#include <LibGUI/Application.h>
#include <LibGUI/Breadcrumbbar.h>
#include <LibGUI/Clipboard.h>
+#include <LibGUI/FileIconProvider.h>
#include <LibGUI/Icon.h>
#include <LibGUI/Menu.h>
#include <LibGUI/Menubar.h>
@@ -339,14 +340,21 @@ int main(int argc, char* argv[])
treemapwidget.set_viewpoint(index);
};
treemapwidget.on_path_change = [&]() {
+ StringBuilder builder;
+
breadcrumbbar.clear_segments();
for (size_t k = 0; k < treemapwidget.path_size(); k++) {
if (k == 0) {
- breadcrumbbar.append_segment("/");
- } else {
- const SpaceAnalyzer::TreeMapNode* node = treemapwidget.path_node(k);
- breadcrumbbar.append_segment(node->name());
+ breadcrumbbar.append_segment("/", GUI::FileIconProvider::icon_for_path("/").bitmap_for_size(16), "/", "/");
+ continue;
}
+
+ const SpaceAnalyzer::TreeMapNode* node = treemapwidget.path_node(k);
+
+ builder.append("/");
+ builder.append(node->name());
+
+ 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());
};