There a few more examples (including kvantum's blur) at the 2m40 mark in this video:
Elementary (and other file managers) show the capacity bar in the sidebar as well: https://i.stack.imgur.com/4l7YS.png
- This patch is based on the KIO's KFilePlacesView. We're not using the KIO class as there's a significant amount of work needed to support Dolphin's "open in new tab/window" (https://phabricator.kde.org/T9795#178086).
- We're not using the KCapacityBar itself either since we can't easily make space for a 8px tall capacitybar + padding as mentioned in the next point.
- This patch draws overtop the text that's goes below the baseline like gj_.
- It's fairly difficult to add extra space below the text as the places view is a "details" view. That means the text is vertically centered in the widget's "row".
- We can make the PlacesItemWidget 8px taller, adding 4px above and below so there's adequate room for the capacitybar, but that wastes 4px for each mount point. Add padding above/below:
- We add a PlacesItemListWidgetInformant inheriting KStandardItemListWidgetInformant. We overload, PlacesItemListWidgetInformant::calculateItemSizeHints(...) so we can change the height of each PlacesItemWidget.
- We then need to check if the current PlacesItemWidget is a mount point, and share that boolean with the KStandardItemListWidgetInformant. I'm not 100% sure how to do this.
- Ideally we'd use the "compact" view, which displays the text/size/etc in a column beside the icon. However the compact view was not designed for a file to take up the entire width of the viewport. It's also designed to handle vertical overflow with a horizontal scrollbar.
Performance (TODO)
I originally wanted to draw these capacity bars in the main file view (like Windows's "This PC"), but that would probably slow down loading folders with millions of files. So while D10453 was a nice hack, it was dead in the water for merging upstream.
This current patch might affect the startup speed, as the places panel is visible on load. I need to determine if this code is blocking or if it's lazy loaded. We don't want to make the startup slower.
KIO's File Selector only shows the capacity bars on hover?
QT_SCALE_FACTOR=2 build/bin/dolphin
FEATURE: 315405
FIXED-IN: 19.08.0