mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-06 08:10:02 +00:00
LibGUI: Show human readable size in filemanager
The size is visible only in TableView mode of the filemanager.
This commit is contained in:
parent
8fe7983cc5
commit
49a062f81d
Notes:
sideshowbarker
2024-07-18 21:03:45 +09:00
Author: https://github.com/guerinoni 🔰
Commit: 49a062f81d
Pull-request: https://github.com/SerenityOS/serenity/pull/5948
Issue: https://github.com/SerenityOS/serenity/issues/5938
Reviewed-by: https://github.com/linusg ✅
2 changed files with 4 additions and 5 deletions
|
@ -413,10 +413,8 @@ void DirectoryView::update_statusbar()
|
||||||
size_t selected_byte_count = 0;
|
size_t selected_byte_count = 0;
|
||||||
|
|
||||||
current_view().selection().for_each_index([&](auto& index) {
|
current_view().selection().for_each_index([&](auto& index) {
|
||||||
auto& model = *current_view().model();
|
const auto& node = this->node(index);
|
||||||
auto size_index = model.index(index.row(), GUI::FileSystemModel::Column::Size, model.parent_index(index));
|
selected_byte_count += node.size;
|
||||||
auto file_size = size_index.data().to_i32();
|
|
||||||
selected_byte_count += file_size;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/LexicalPath.h>
|
#include <AK/LexicalPath.h>
|
||||||
|
#include <AK/NumberFormat.h>
|
||||||
#include <AK/QuickSort.h>
|
#include <AK/QuickSort.h>
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <LibCore/DirIterator.h>
|
#include <LibCore/DirIterator.h>
|
||||||
|
@ -439,7 +440,7 @@ Variant FileSystemModel::data(const ModelIndex& index, ModelRole role) const
|
||||||
case Column::Name:
|
case Column::Name:
|
||||||
return node.name;
|
return node.name;
|
||||||
case Column::Size:
|
case Column::Size:
|
||||||
return (int)node.size;
|
return human_readable_size(node.size);
|
||||||
case Column::Owner:
|
case Column::Owner:
|
||||||
return name_for_uid(node.uid);
|
return name_for_uid(node.uid);
|
||||||
case Column::Group:
|
case Column::Group:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue